jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
changeset 20797 bb3ea44a7875
parent 5506 202f599c92aa
child 21299 b4e7e588552d
child 21278 ef8a3a2a72f2
equal deleted inserted replaced
20796:ba811c58b250 20797:bb3ea44a7875
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   338     default_modtime = modtime;  // catch a reasonable default
   338     default_modtime = modtime;  // catch a reasonable default
   339   time_t t = modtime;
   339   time_t t = modtime;
   340   struct tm sbuf;
   340   struct tm sbuf;
   341   (void)memset((void*)&sbuf,0, sizeof(sbuf));
   341   (void)memset((void*)&sbuf,0, sizeof(sbuf));
   342   struct tm* s = gmtime_r(&t, &sbuf);
   342   struct tm* s = gmtime_r(&t, &sbuf);
       
   343   if (s == NULL) {
       
   344     fprintf(u->errstrm, "Error: gmtime failure, invalid input archive\n");
       
   345     exit(2);
       
   346   }
   343   modtime_cache = modtime;
   347   modtime_cache = modtime;
   344   dostime_cache = dostime(s->tm_year + 1900, s->tm_mon + 1, s->tm_mday,
   348   dostime_cache = dostime(s->tm_year + 1900, s->tm_mon + 1, s->tm_mday,
   345                           s->tm_hour, s->tm_min, s->tm_sec);
   349                           s->tm_hour, s->tm_min, s->tm_sec);
   346   //printf("modtime %d => %d\n", modtime_cache, dostime_cache);
   350   //printf("modtime %d => %d\n", modtime_cache, dostime_cache);
   347   return dostime_cache;
   351   return dostime_cache;
   382     }
   386     }
   383     return false;
   387     return false;
   384   }
   388   }
   385 
   389 
   386   deflated.empty();
   390   deflated.empty();
   387   zs.next_out  = (uchar*) deflated.grow(len + (len/2));
   391   zs.next_out  = (uchar*) deflated.grow(add_size(len, (len/2)));
   388   zs.avail_out = (int)deflated.size();
   392   zs.avail_out = (int)deflated.size();
   389 
   393 
   390   zs.next_in = (uchar*)head.ptr;
   394   zs.next_in = (uchar*)head.ptr;
   391   zs.avail_in = (int)head.len;
   395   zs.avail_in = (int)head.len;
   392 
   396