]> granicus.if.org Git - php/commitdiff
- MF53
authorPierre Joye <pajoye@php.net>
Sun, 19 Jul 2009 15:21:13 +0000 (15:21 +0000)
committerPierre Joye <pajoye@php.net>
Sun, 19 Jul 2009 15:21:13 +0000 (15:21 +0000)
ext/zip/lib/zip.h
ext/zip/lib/zip_add.c
ext/zip/lib/zip_close.c
ext/zip/lib/zip_filerange_crc.c
ext/zip/lib/zip_get_archive_flag.c
ext/zip/lib/zip_open.c
ext/zip/lib/zip_set_archive_flag.c

index e63ee7c7a70a0af438f1e8f0952f4730cd147159..14a57bc5829bc3a0730f7209c1becd11726581fc 100644 (file)
@@ -20,7 +20,7 @@
   3. The names of the authors may not be used to endorse or promote
      products derived from this software without specific prior
      written permission.
+
   THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
   OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
 #ifdef PHP_WIN32
 #      include "zip_win32.h"
-# ifdef PHP_ZIP_EXPORTS
+#      ifdef PHP_ZIP_EXPORTS
 #              define ZIP_EXTERN(rt) __declspec(dllexport)rt _stdcall
-# else
+#      else
 #              define ZIP_EXTERN(rt) rt
-# endif
+#      endif
 #elif defined(__GNUC__) && __GNUC__ >= 4
 #      define ZIP_EXTERN(rt) __attribute__ ((visibility("default"))) rt
 #else
@@ -217,7 +217,7 @@ ZIP_EXTERN(struct zip_source *)zip_source_filep(struct zip *, FILE *,
                                               off_t, off_t);
 ZIP_EXTERN(void) zip_source_free(struct zip_source *);
 ZIP_EXTERN(struct zip_source *)zip_source_function(struct zip *,
-                                      zip_source_callback, void *);
+                                                 zip_source_callback, void *);
 ZIP_EXTERN(struct zip_source *)zip_source_zip(struct zip *, struct zip *,
                                             int, int, off_t, off_t);
 ZIP_EXTERN(int) zip_stat(struct zip *, const char *, int, struct zip_stat *);
index 3afb1768f71d7ea759f4c0fa99188108ec9dd6c3..85d5997911b9420557dbb28cda3362ce99e7a1b7 100644 (file)
@@ -17,7 +17,7 @@
   3. The names of the authors may not be used to endorse or promote
      products derived from this software without specific prior
      written permission.
+
   THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
   OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
index 289ca7afb34959d50dba66fa01aa67476aac84e5..7f93cc94e16b426d85de481e4c1bf09825e30e08 100644 (file)
@@ -229,11 +229,10 @@ zip_close(struct zip *za)
 
            zs = NULL;
            if (!ZIP_ENTRY_DATA_CHANGED(za->entry+i)) {
-               if ((zs=zip_source_zip(za, za, i, ZIP_FL_RECOMPRESS, 0, -1))
-                   == NULL) {
-               error = 1;
-               break;
-           }
+                       if ((zs=zip_source_zip(za, za, i, ZIP_FL_RECOMPRESS, 0, -1)) == NULL) {
+                               error = 1;
+                               break;
+               }
            }
 
            if (add_data(za, zs ? zs : za->entry[i].source, &de, out) < 0) {
@@ -286,19 +285,19 @@ zip_close(struct zip *za)
        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");
-       }
+               if (reopen_on_error) {
+               /* ignore errors, since we're already in an error case */
+               za->zp = fopen(za->zn, "rb");
+               }
                return -1;
        }
     mask = umask(0);
@@ -638,7 +637,7 @@ _zip_create_temp_output(struct zip *za, FILE **outp)
     FILE *tfp;
        int len = strlen(za->zn) + 8;
 
-    if ((temp=(char *)malloc(strlen(za->zn)+8)) == NULL) {
+    if ((temp=(char *)malloc(len)) == NULL) {
        _zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
        return NULL;
     }
index 4d1ad566929f8d5d0c0d15833340f3584d039289..c6890987b16df928362d6dedc7c75ff1714fbcc9 100644 (file)
@@ -1,6 +1,6 @@
 /*
   zip_filerange_crc.c -- compute CRC32 for a range of a file
-  Copyright (C) 2008 Dieter Baron and Thomas Klausner
+  Copyright (C) 2008-2009 Dieter Baron and Thomas Klausner
 
   This file is part of libzip, a library to manipulate ZIP archives.
   The authors can be contacted at <libzip@nih.at>
index 2d46aa39ffbb4d4323e85129a9dcedb4ad5bb50c..a595c51f59942d8bb944bc996d804bf4ac4a0eb6 100644 (file)
@@ -1,6 +1,6 @@
 /*
   zip_get_archive_flag.c -- get archive global flag
-  Copyright (C) 2008 Dieter Baron and Thomas Klausner
+  Copyright (C) 2008-2009 Dieter Baron and Thomas Klausner
 
   This file is part of libzip, a library to manipulate ZIP archives.
   The authors can be contacted at <libzip@nih.at>
index 4b219556c8538ec3e1c501dc34c409764f601d99..e3840197dd408cf1fcbbe3ccc9764a31170f48cd 100644 (file)
@@ -69,15 +69,16 @@ zip_open(const char *fn, int flags, int *zep)
     if (flags & ZIP_OVERWRITE) {
        return _zip_allocate_new(fn, zep);
     }
-    
+
     switch (_zip_file_exists(fn, flags, zep)) {
     case -1:
                        if (!(flags & ZIP_OVERWRITE)) {
-       return NULL;
+                               return NULL;
                        }
-                       
+
     case 0:
        return _zip_allocate_new(fn, zep);
+
     default:
        break;
     }
index a6fdd8d2d07ff3035799476bbe3704de246a9745..20316e4614aa9a5a3ebf28ecac4e4b6f9cfc64e0 100644 (file)
@@ -1,6 +1,6 @@
 /*
   zip_get_archive_flag.c -- set archive global flag
-  Copyright (C) 2008 Dieter Baron and Thomas Klausner
+  Copyright (C) 2008-2009 Dieter Baron and Thomas Klausner
 
   This file is part of libzip, a library to manipulate ZIP archives.
   The authors can be contacted at <libzip@nih.at>