1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 17:22:15 +01:00
This commit is contained in:
Pierre Joye
2009-07-19 15:21:13 +00:00
parent e03540f80e
commit 19059ef91e
7 changed files with 26 additions and 26 deletions

View 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
@@ -39,11 +39,11 @@
#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 *);

View 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

View 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;
}

View 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>

View 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>

View 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;
}

View 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>