]> granicus.if.org Git - php/commitdiff
rechecked the merged libzip, took also the indents from the original to
authorAnatoliy Belsky <ab@php.net>
Tue, 5 Jun 2012 20:11:07 +0000 (22:11 +0200)
committerAnatoliy Belsky <ab@php.net>
Thu, 7 Jun 2012 19:01:31 +0000 (21:01 +0200)
avoid confusion next time

ext/zip/lib/zip_close.c
ext/zip/lib/zip_delete.c
ext/zip/lib/zip_dirent.c
ext/zip/lib/zip_fopen_index.c
ext/zip/lib/zip_fread.c
ext/zip/lib/zip_open.c

index b0e3c75c1c90d0650fcd5f53b8735174c08ffedd..362f92d749cc91e0510210c5b91b213ac863d613 100644 (file)
@@ -316,22 +316,22 @@ zip_close(struct zip *za)
        free(temp);
        return -1;
     }
-
-       if (za->zp) {
-               fclose(za->zp);
-               za->zp = NULL;
-               reopen_on_error = 1;
+    
+    if (za->zp) {
+       fclose(za->zp);
+       za->zp = NULL;
+       reopen_on_error = 1;
     }
     if (_zip_rename(temp, za->zn) != 0) {
-               _zip_error_set(&za->error, ZIP_ER_RENAME, errno);
-               remove(temp);
-               free(temp);
-               if (reopen_on_error) {
-               /* ignore errors, since we're already in an error case */
-               za->zp = fopen(za->zn, "rb");
-               }
-               return -1;
+       _zip_error_set(&za->error, ZIP_ER_RENAME, errno);
+       remove(temp);
+       free(temp);
+       if (reopen_on_error) {
+           /* ignore errors, since we're already in an error case */
+           za->zp = fopen(za->zn, "rb");
        }
+       return -1;
+    }
 #ifndef PHP_WIN32
     mask = umask(0);
     umask(mask);
index da3e65b28a3723199c8cd469dff020abd3ccb948..131d444124c4b56cda3625adc4aaf63c63d83935 100644 (file)
@@ -40,7 +40,7 @@
 ZIP_EXTERN(int)
 zip_delete(struct zip *za, zip_uint64_t idx)
 {
-    if (idx < 0 || idx >= za->nentry) {
+    if (idx >= za->nentry) {
        _zip_error_set(&za->error, ZIP_ER_INVAL, 0);
        return -1;
     }
index 6cb9ee3ee51350bcb8617a9567c1563eaa00e51e..b5b9d273be4ba025b7b3bef0b7959ce95de2da0f 100644 (file)
@@ -472,7 +472,7 @@ _zip_dirent_write(struct zip_dirent *zde, FILE *fp, int localp,
 static time_t
 _zip_d2u_time(int dtime, int ddate)
 {
-    struct tm tm = {0};
+    struct tm tm;
 
     memset(&tm, 0, sizeof(tm));
     
index 5c777ee0ffaf8cdef6847a14812ba8617391c5d8..b60fd33e8f53e75b2450a93d8161e930e26358c6 100644 (file)
@@ -39,7 +39,6 @@
 
 #include "zipint.h"
 
-
 \f
 
 ZIP_EXTERN(struct zip_file *)
index 4c828a843346f9b89a3126a1149baa7a5c5bb377..a6c0851b0aaac5a614b3504dd89d178f23c10f4e 100644 (file)
@@ -60,15 +60,6 @@ zip_fread(struct zip_file *zf, void *outbuf, zip_uint64_t toread)
        _zip_error_set_from_source(&zf->error, zf->src);
        return -1;
     }
-    
-       /* XXX the following left from the previous PHP port, let's see how to use it now */
-    /*zf->zstr->next_out = (Bytef *)outbuf;
-    zf->zstr->avail_out = toread;
-    out_before = zf->zstr->total_out;*/
-    
-    /* endless loop until something has been accomplished */
-    /*for (;;) {
-       ret = inflate(zf->zstr, Z_SYNC_FLUSH);*/
 
     return n;
 }
index 11c6fe05a68a9cb152d0c25180aa2ccc554e55a0..5aba34f67aadb3699782f2e67a5e5cf26a904d4d 100644 (file)
@@ -357,17 +357,17 @@ _zip_check_torrentzip(struct zip *za)
     if (za->cdir->comment_len != TORRENT_SIG_LEN+8
        || strncmp(za->cdir->comment, TORRENT_SIG, TORRENT_SIG_LEN) != 0)
        return;
-    
+
     memcpy(buf, za->cdir->comment+TORRENT_SIG_LEN, 8);
     buf[8] = '\0';
     errno = 0;
     crc_should = strtoul(buf, &end, 16);
     if ((crc_should == UINT_MAX && errno != 0) || (end && *end))
        return;
-    
+
     if (_zip_filerange_crc(za->zp, za->cdir->offset, za->cdir->size,
                           &crc_got, NULL) < 0)
-           return;
+       return;
 
     if (crc_got == crc_should)
        za->flags |= ZIP_AFL_TORRENT;