diff options
Diffstat (limited to 'ext/zip/lib')
90 files changed, 740 insertions, 740 deletions
diff --git a/ext/zip/lib/mkstemp.c b/ext/zip/lib/mkstemp.c index 843d5e3613..3d03ee9acc 100644 --- a/ext/zip/lib/mkstemp.c +++ b/ext/zip/lib/mkstemp.c @@ -48,7 +48,7 @@ #define O_BINARY 0 #endif - + int _zip_mkstemp(char *path) @@ -62,7 +62,7 @@ _zip_mkstemp(char *path) return ret; } #else - int fd; + int fd; char *start, *trv; struct stat sbuf; pid_t pid; @@ -80,7 +80,7 @@ _zip_mkstemp(char *path) if (*trv == 'X') xcnt++; else - xcnt = 0; + xcnt = 0; /* Use at least one from xtra. Use 2 if more than 6 X's. */ if (*(trv - 1) == 'X') diff --git a/ext/zip/lib/php_zip_config.w32.h b/ext/zip/lib/php_zip_config.w32.h index 1fec26317b..b3192cbdd4 100644 --- a/ext/zip/lib/php_zip_config.w32.h +++ b/ext/zip/lib/php_zip_config.w32.h @@ -1,60 +1,60 @@ -#ifndef HAD_CONFIG_H
-#define HAD_CONFIG_H
-#define HAVE__CLOSE
-#define HAVE__DUP
-#define HAVE__FDOPEN
-#define HAVE__FILENO
-#define HAVE__OPEN
-#define HAVE__SNPRINTF
-/* #undef HAVE__STRCMPI */
-#define HAVE__STRDUP
-#define HAVE__STRICMP
-/* #undef HAVE_FSEEKO */
-/* #undef HAVE_FTELLO */
-/* #undef HAVE_MKSTEMP */
-#define HAVE_MOVEFILEEXA
-/* #undef HAVE_SNPRINTF */
-/* #undef HAVE_STRCASECMP */
-/* #undef HAVE_STRINGS_H */
-/* #undef HAVE_STRUCT_TM_TM_ZONE */
-/* #undef HAVE_UNISTD_H */
-#define PACKAGE "libzip"
-#define VERSION "0.10.b"
-
-/* #undef HAVE_SSIZE_T */
-
-#ifndef HAVE_SSIZE_T
-
-#ifndef SIZE_T_LIBZIP
-#define SIZE_T_LIBZIP 4
-#endif
-#ifndef INT_LIBZIP
-#define INT_LIBZIP 4
-#endif
-#ifndef LONG_LIBZIP
-#define LONG_LIBZIP 4
-#endif
-#ifndef LONG_LONG_LIBZIP
-#define LONG_LONG_LIBZIP 8
-#endif
-#ifndef SIZEOF_OFF_T
-#define SIZEOF_OFF_T 4
-#endif
-
-# if SIZE_T_LIBZIP == INT_LIBZIP
-# ifndef ssize_t
-typedef int ssize_t;
-# endif
-# elif SIZE_T_LIBZIP == LONG_LIBZIP
-typedef long ssize_t;
-# elif SIZE_T_LIBZIP == LONG_LONG_LIBZIP
-typedef long long ssize_t;
-# else
-#error no suitable type for ssize_t found
-# endif
-#endif
-
-# undef strcasecmp
-# define strcasecmp _strcmpi
-
-#endif /* HAD_CONFIG_H */
+#ifndef HAD_CONFIG_H +#define HAD_CONFIG_H +#define HAVE__CLOSE +#define HAVE__DUP +#define HAVE__FDOPEN +#define HAVE__FILENO +#define HAVE__OPEN +#define HAVE__SNPRINTF +/* #undef HAVE__STRCMPI */ +#define HAVE__STRDUP +#define HAVE__STRICMP +/* #undef HAVE_FSEEKO */ +/* #undef HAVE_FTELLO */ +/* #undef HAVE_MKSTEMP */ +#define HAVE_MOVEFILEEXA +/* #undef HAVE_SNPRINTF */ +/* #undef HAVE_STRCASECMP */ +/* #undef HAVE_STRINGS_H */ +/* #undef HAVE_STRUCT_TM_TM_ZONE */ +/* #undef HAVE_UNISTD_H */ +#define PACKAGE "libzip" +#define VERSION "0.10.b" + +/* #undef HAVE_SSIZE_T */ + +#ifndef HAVE_SSIZE_T + +#ifndef SIZE_T_LIBZIP +#define SIZE_T_LIBZIP 4 +#endif +#ifndef INT_LIBZIP +#define INT_LIBZIP 4 +#endif +#ifndef LONG_LIBZIP +#define LONG_LIBZIP 4 +#endif +#ifndef LONG_LONG_LIBZIP +#define LONG_LONG_LIBZIP 8 +#endif +#ifndef SIZEOF_OFF_T +#define SIZEOF_OFF_T 4 +#endif + +# if SIZE_T_LIBZIP == INT_LIBZIP +# ifndef ssize_t +typedef int ssize_t; +# endif +# elif SIZE_T_LIBZIP == LONG_LIBZIP +typedef long ssize_t; +# elif SIZE_T_LIBZIP == LONG_LONG_LIBZIP +typedef long long ssize_t; +# else +#error no suitable type for ssize_t found +# endif +#endif + +# undef strcasecmp +# define strcasecmp _strcmpi + +#endif /* HAD_CONFIG_H */ diff --git a/ext/zip/lib/zip.h b/ext/zip/lib/zip.h index 2665291abc..2eef0548ad 100644 --- a/ext/zip/lib/zip.h +++ b/ext/zip/lib/zip.h @@ -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 @@ -34,10 +34,10 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "main/php.h" - + #ifdef PHP_WIN32 #ifdef PHP_ZIP_EXPORTS # define ZIP_EXTERN __declspec(dllexport) _stdcall @@ -49,7 +49,7 @@ #else # define ZIP_EXTERN #endif - + #ifdef __cplusplus @@ -132,7 +132,7 @@ extern "C" { #define ZIP_ER_REMOVE 22 /* S Can't remove file */ #define ZIP_ER_DELETED 23 /* N Entry has been deleted */ #define ZIP_ER_ENCRNOTSUPP 24 /* N Encryption method not supported */ -#define ZIP_ER_RDONLY 25 /* N Read-only archive */ +#define ZIP_ER_RDONLY 25 /* N Read-only archive */ #define ZIP_ER_NOPASSWD 26 /* N No password provided */ #define ZIP_ER_WRONGPASSWD 27 /* N Wrong password provided */ @@ -206,7 +206,7 @@ extern "C" { #define ZIP_OPSYS_DEFAULT ZIP_OPSYS_UNIX - + enum zip_source_cmd { ZIP_SOURCE_OPEN, /* prepare for reading */ @@ -246,12 +246,12 @@ struct zip; struct zip_file; struct zip_source; -typedef zip_uint32_t zip_flags_t; +typedef zip_uint32_t zip_flags_t; typedef zip_int64_t (*zip_source_callback)(void *, void *, zip_uint64_t, enum zip_source_cmd); - + #ifndef ZIP_DISABLE_DEPRECATED ZIP_EXTERN zip_int64_t zip_add(struct zip *, const char *, struct zip_source *); /* use zip_file_add */ diff --git a/ext/zip/lib/zip_add.c b/ext/zip/lib/zip_add.c index 5b907824b3..6de3cd2cf2 100644 --- a/ext/zip/lib/zip_add.c +++ b/ext/zip/lib/zip_add.c @@ -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 @@ -31,12 +31,12 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - + /* NOTE: Return type is signed so we can return -1 on error. diff --git a/ext/zip/lib/zip_add_dir.c b/ext/zip/lib/zip_add_dir.c index af3f05e2c9..32315da9a1 100644 --- a/ext/zip/lib/zip_add_dir.c +++ b/ext/zip/lib/zip_add_dir.c @@ -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 @@ -31,12 +31,12 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - + /* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ diff --git a/ext/zip/lib/zip_add_entry.c b/ext/zip/lib/zip_add_entry.c index 5cbc9574ad..583efc4561 100644 --- a/ext/zip/lib/zip_add_entry.c +++ b/ext/zip/lib/zip_add_entry.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + /* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c index 2239f5618e..38f5e07142 100644 --- a/ext/zip/lib/zip_close.c +++ b/ext/zip/lib/zip_close.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" @@ -52,7 +52,7 @@ #include <fcntl.h> #endif - + /* max deflate size increase: size + ceil(size/16k)*5+6 */ #define MAX_DEFLATE_SIZE_32 4293656963u @@ -64,7 +64,7 @@ static int write_cdir(struct zip *, const struct zip_filelist *, zip_uint64_t, F static char *_zip_create_temp_output(struct zip *, FILE **); static int _zip_torrentzip_cmp(const void *, const void *); - + ZIP_EXTERN int zip_close(struct zip *za) @@ -98,7 +98,7 @@ zip_close(struct zip *za) } zip_discard(za); return 0; - } + } if (!changed) { zip_discard(za); @@ -109,7 +109,7 @@ zip_close(struct zip *za) _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); return -1; } - + if ((filelist=(struct zip_filelist *)malloc(sizeof(filelist[0])*(size_t)survivors)) == NULL) return -1; @@ -134,7 +134,7 @@ zip_close(struct zip *za) _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); return -1; } - + filelist[j].idx = i; filelist[j].name = zip_get_name(za, i, 0); j++; @@ -150,8 +150,8 @@ zip_close(struct zip *za) free(filelist); return -1; } - - + + if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) qsort(filelist, (size_t)survivors, sizeof(filelist[0]), _zip_torrentzip_cmp); @@ -257,7 +257,7 @@ zip_close(struct zip *za) free(temp); return -1; } - + if (za->zp) { fclose(za->zp); za->zp = NULL; @@ -281,11 +281,11 @@ zip_close(struct zip *za) zip_discard(za); free(temp); - + return 0; } - + static int add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, FILE *ft) @@ -296,7 +296,7 @@ add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, FILE *ft int ret; int is_zip64; zip_flags_t flags; - + if (zip_source_stat(src, &st) < 0) { _zip_error_set_from_source(&za->error, src); return -1; @@ -325,7 +325,7 @@ add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, FILE *ft flags |= ZIP_FL_FORCE_ZIP64; else { de->uncomp_size = st.size; - + if ((st.valid & ZIP_STAT_COMP_SIZE) == 0) { if (( ((de->comp_method == ZIP_CM_DEFLATE || ZIP_CM_IS_DEFAULT(de->comp_method)) && st.size > MAX_DEFLATE_SIZE_32) || (de->comp_method != ZIP_CM_STORE && de->comp_method != ZIP_CM_DEFLATE && !ZIP_CM_IS_DEFAULT(de->comp_method)))) @@ -347,7 +347,7 @@ add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, FILE *ft if (st.comp_method == ZIP_CM_STORE || (ZIP_CM_IS_DEFAULT(de->comp_method) && st.comp_method != de->comp_method)) { struct zip_source *s_store, *s_crc; zip_compression_implementation comp_impl; - + if (st.comp_method != ZIP_CM_STORE) { if ((comp_impl=_zip_get_compression_implementation(st.comp_method)) == NULL) { _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); @@ -390,12 +390,12 @@ add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, FILE *ft s2 = src; offdata = ftello(ft); - + ret = copy_source(za, s2, ft); - + if (zip_source_stat(s2, &st) < 0) ret = -1; - + while (s2 != src) { if ((s2=zip_source_pop(s2)) == NULL) { /* TODO: set erorr */ @@ -433,14 +433,14 @@ add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, FILE *ft if ((ret=_zip_dirent_write(de, ft, flags, &za->error)) < 0) return -1; - + if (is_zip64 != ret) { /* Zip64 mismatch between preliminary file header written before data and final file header written afterwards */ _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); return -1; } - + if (fseeko(ft, offend, SEEK_SET) < 0) { _zip_error_set(&za->error, ZIP_ER_SEEK, errno); return -1; @@ -449,7 +449,7 @@ add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, FILE *ft return 0; } - + static int copy_data(FILE *fs, zip_uint64_t len, FILE *ft, struct zip_error *error) @@ -477,14 +477,14 @@ copy_data(FILE *fs, zip_uint64_t len, FILE *ft, struct zip_error *error) _zip_error_set(error, ZIP_ER_WRITE, errno); return -1; } - + len -= n; } return 0; } - + static int copy_source(struct zip *za, struct zip_source *src, FILE *ft) @@ -506,19 +506,19 @@ copy_source(struct zip *za, struct zip_source *src, FILE *ft) break; } } - + if (n < 0) { if (ret == 0) _zip_error_set_from_source(&za->error, src); ret = -1; - } + } zip_source_close(src); - + return ret; } - + static int write_cdir(struct zip *za, const struct zip_filelist *filelist, zip_uint64_t survivors, FILE *out) @@ -527,12 +527,12 @@ write_cdir(struct zip *za, const struct zip_filelist *filelist, zip_uint64_t sur zip_int64_t size; uLong crc; char buf[TORRENT_CRC_LEN+1]; - + cd_start = ftello(out); if ((size=_zip_cdir_write(za, filelist, survivors, out)) < 0) return -1; - + end = ftello(out); if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0) == 0) @@ -559,7 +559,7 @@ write_cdir(struct zip *za, const struct zip_filelist *filelist, zip_uint64_t sur return 0; } - + int _zip_changed(const struct zip *za, zip_uint64_t *survivorsp) @@ -586,7 +586,7 @@ _zip_changed(const struct zip *za, zip_uint64_t *survivorsp) return changed; } - + static char * _zip_create_temp_output(struct zip *za, FILE **outp) @@ -594,7 +594,7 @@ _zip_create_temp_output(struct zip *za, FILE **outp) char *temp; int tfd; FILE *tfp; - + if (za->tempdir) { if ((temp=(char *)malloc(strlen(za->tempdir)+13)) == NULL) { _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); @@ -615,7 +615,7 @@ _zip_create_temp_output(struct zip *za, FILE **outp) free(temp); return NULL; } - + if ((tfp=fdopen(tfd, "r+b")) == NULL) { _zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno); close(tfd); @@ -636,7 +636,7 @@ _zip_create_temp_output(struct zip *za, FILE **outp) return temp; } - + static int _zip_torrentzip_cmp(const void *a, const void *b) diff --git a/ext/zip/lib/zip_delete.c b/ext/zip/lib/zip_delete.c index cb769367cc..799a81249b 100644 --- a/ext/zip/lib/zip_delete.c +++ b/ext/zip/lib/zip_delete.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN int zip_delete(struct zip *za, zip_uint64_t idx) @@ -60,4 +60,4 @@ zip_delete(struct zip *za, zip_uint64_t idx) return 0; } - + diff --git a/ext/zip/lib/zip_dir_add.c b/ext/zip/lib/zip_dir_add.c index bd34bae141..15b2c1af47 100644 --- a/ext/zip/lib/zip_dir_add.c +++ b/ext/zip/lib/zip_dir_add.c @@ -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 @@ -31,14 +31,14 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include <string.h> #include "zipint.h" - + /* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ @@ -77,7 +77,7 @@ zip_dir_add(struct zip *za, const char *name, zip_flags_t flags) free(s); return -1; } - + idx = _zip_file_replace(za, ZIP_UINT64_MAX, s ? s : name, source, flags); free(s); diff --git a/ext/zip/lib/zip_dirent.c b/ext/zip/lib/zip_dirent.c index b98d707f6d..974e493ffd 100644 --- a/ext/zip/lib/zip_dirent.c +++ b/ext/zip/lib/zip_dirent.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdio.h> #include <stdlib.h> @@ -47,7 +47,7 @@ static struct zip_string *_zip_read_string(const unsigned char **, FILE *, zip_u static struct zip_string *_zip_dirent_process_ef_utf_8(const struct zip_dirent *, zip_uint16_t, struct zip_string *); static struct zip_extra_field *_zip_ef_utf8(zip_uint16_t, struct zip_string *, struct zip_error *); - + void _zip_cdir_free(struct zip_cdir *cd) @@ -64,7 +64,7 @@ _zip_cdir_free(struct zip_cdir *cd) free(cd); } - + int _zip_cdir_grow(struct zip_cdir *cd, zip_uint64_t nentry, struct zip_error *error) @@ -85,7 +85,7 @@ _zip_cdir_grow(struct zip_cdir *cd, zip_uint64_t nentry, struct zip_error *error _zip_error_set(error, ZIP_ER_MEMORY, 0); return -1; } - + for (i=cd->nentry_alloc; i<nentry; i++) _zip_entry_init(entry+i); @@ -95,14 +95,14 @@ _zip_cdir_grow(struct zip_cdir *cd, zip_uint64_t nentry, struct zip_error *error return 0; } - + struct zip_cdir * _zip_cdir_new(zip_uint64_t nentry, struct zip_error *error) { struct zip_cdir *cd; zip_uint64_t i; - + if ((cd=(struct zip_cdir *)malloc(sizeof(*cd))) == NULL) { _zip_error_set(error, ZIP_ER_MEMORY, 0); return NULL; @@ -126,7 +126,7 @@ _zip_cdir_new(zip_uint64_t nentry, struct zip_error *error) return cd; } - + zip_int64_t _zip_cdir_write(struct zip *za, const struct zip_filelist *filelist, zip_uint64_t survivors, FILE *fp) @@ -180,7 +180,7 @@ _zip_cdir_write(struct zip *za, const struct zip_filelist *filelist, zip_uint64_ _zip_write4(0, fp); _zip_write8(offset+size, fp); _zip_write4(1, fp); - + } /* clearerr(fp); */ @@ -205,7 +205,7 @@ _zip_cdir_write(struct zip *za, const struct zip_filelist *filelist, zip_uint64_ return (zip_int64_t)size; } - + struct zip_dirent * _zip_dirent_clone(const struct zip_dirent *sde) @@ -219,14 +219,14 @@ _zip_dirent_clone(const struct zip_dirent *sde) memcpy(tde, sde, sizeof(*sde)); else _zip_dirent_init(tde); - + tde->changed = 0; tde->cloned = 1; return tde; } - + void _zip_dirent_finalize(struct zip_dirent *zde) @@ -239,7 +239,7 @@ _zip_dirent_finalize(struct zip_dirent *zde) _zip_string_free(zde->comment); } - + void _zip_dirent_free(struct zip_dirent *zde) @@ -251,7 +251,7 @@ _zip_dirent_free(struct zip_dirent *zde) free(zde); } - + void _zip_dirent_init(struct zip_dirent *de) @@ -277,7 +277,7 @@ _zip_dirent_init(struct zip_dirent *de) de->offset = 0; } - + int _zip_dirent_needs_zip64(const struct zip_dirent *de, zip_flags_t flags) @@ -289,7 +289,7 @@ _zip_dirent_needs_zip64(const struct zip_dirent *de, zip_flags_t flags) return 0; } - + struct zip_dirent * _zip_dirent_new(void) @@ -303,14 +303,14 @@ _zip_dirent_new(void) return de; } - + /* _zip_dirent_read(zde, fp, bufp, left, localp, error): Fills the zip directory entry zde. If bufp is non-NULL, data is taken from there and bufp is advanced by the amount of data used; otherwise data is read from fp as needed. - + if leftp is non-NULL, no more bytes than specified by it are used, and *leftp is reduced by the number of bytes used. @@ -374,19 +374,19 @@ _zip_dirent_read(struct zip_dirent *zde, FILE *fp, zde->version_needed = _zip_read2(&cur); zde->bitflags = _zip_read2(&cur); zde->comp_method = _zip_read2(&cur); - + /* convert to time_t */ dostime = _zip_read2(&cur); dosdate = _zip_read2(&cur); zde->last_mod = _zip_d2u_time(dostime, dosdate); - + zde->crc = _zip_read4(&cur); zde->comp_size = _zip_read4(&cur); zde->uncomp_size = _zip_read4(&cur); - + filename_len = _zip_read2(&cur); ef_len = _zip_read2(&cur); - + if (local) { comment_len = 0; zde->disk_number = 0; @@ -475,7 +475,7 @@ _zip_dirent_read(struct zip_dirent *zde, FILE *fp, _zip_error_set(error, ZIP_ER_INCONS, 0); return -1; } - + if (zde->uncomp_size == ZIP_UINT32_MAX) zde->uncomp_size = _zip_read8(&ef); else if (local) @@ -489,14 +489,14 @@ _zip_dirent_read(struct zip_dirent *zde, FILE *fp, zde->disk_number = _zip_read4(&ef); } } - + if (!local) { if (zde->offset > ZIP_OFF_MAX) { _zip_error_set(error, ZIP_ER_SEEK, EFBIG); return -1; } } - + zde->extra_fields = _zip_ef_remove_internal(zde->extra_fields); if (bufp) @@ -507,7 +507,7 @@ _zip_dirent_read(struct zip_dirent *zde, FILE *fp, return 0; } - + static struct zip_string * _zip_dirent_process_ef_utf_8(const struct zip_dirent *de, zip_uint16_t id, struct zip_string *str) @@ -531,11 +531,11 @@ _zip_dirent_process_ef_utf_8(const struct zip_dirent *de, zip_uint16_t id, struc str = ef_str; } } - + return str; } - + zip_int32_t _zip_dirent_size(FILE *f, zip_uint16_t flags, struct zip_error *error) @@ -566,7 +566,7 @@ _zip_dirent_size(FILE *f, zip_uint16_t flags, struct zip_error *error) return size; } - + /* _zip_dirent_torrent_normalize(de); Set values suitable for torrentzip. @@ -603,7 +603,7 @@ _zip_dirent_torrent_normalize(struct zip_dirent *de) last_mod = mktime(&torrenttime); } - + de->version_madeby = 0; de->version_needed = 20; /* 2.0 */ de->bitflags = 2; /* maximum compression */ @@ -620,7 +620,7 @@ _zip_dirent_torrent_normalize(struct zip_dirent *de) de->comment = NULL; } - + /* _zip_dirent_write(zde, fp, flags, error): Writes zip directory entry zde to file fp. @@ -702,7 +702,7 @@ _zip_dirent_write(struct zip_dirent *de, FILE *fp, zip_flags_t flags, struct zip is_really_zip64 = _zip_dirent_needs_zip64(de, flags); else is_really_zip64 = is_zip64; - + if ((flags & ZIP_FL_LOCAL) == 0) _zip_write2(is_really_zip64 ? 45 : de->version_madeby, fp); _zip_write2(is_really_zip64 ? 45 : de->version_needed, fp); @@ -725,7 +725,7 @@ _zip_dirent_write(struct zip_dirent *de, FILE *fp, zip_flags_t flags, struct zip _zip_write2(_zip_string_length(de->filename), fp); _zip_write2(_zip_ef_size(de->extra_fields, flags) + _zip_ef_size(ef, ZIP_EF_BOTH), fp); - + if ((flags & ZIP_FL_LOCAL) == 0) { _zip_write2(_zip_string_length(de->comment), fp); _zip_write2((zip_uint16_t)de->disk_number, fp); @@ -760,7 +760,7 @@ _zip_dirent_write(struct zip_dirent *de, FILE *fp, zip_flags_t flags, struct zip return is_zip64; } - + static time_t _zip_d2u_time(zip_uint16_t dtime, zip_uint16_t ddate) @@ -768,10 +768,10 @@ _zip_d2u_time(zip_uint16_t dtime, zip_uint16_t ddate) struct tm tm; memset(&tm, 0, sizeof(tm)); - + /* let mktime decide if DST is in effect */ tm.tm_isdst = -1; - + tm.tm_year = ((ddate>>9)&127) + 1980 - 1900; tm.tm_mon = ((ddate>>5)&15) - 1; tm.tm_mday = ddate&31; @@ -783,7 +783,7 @@ _zip_d2u_time(zip_uint16_t dtime, zip_uint16_t ddate) return mktime(&tm); } - + static struct zip_extra_field * _zip_ef_utf8(zip_uint16_t id, struct zip_string *str, struct zip_error *error) @@ -798,7 +798,7 @@ _zip_ef_utf8(zip_uint16_t id, struct zip_string *str, struct zip_error *error) if (len+5 > ZIP_UINT16_MAX) { /* TODO: error */ } - + if ((data=(zip_uint8_t *)malloc(len+5)) == NULL) { _zip_error_set(error, ZIP_ER_MEMORY, 0); return NULL; @@ -815,7 +815,7 @@ _zip_ef_utf8(zip_uint16_t id, struct zip_string *str, struct zip_error *error) return ef; } - + struct zip_dirent * _zip_get_dirent(struct zip *za, zip_uint64_t idx, zip_flags_t flags, struct zip_error *error) @@ -843,7 +843,7 @@ _zip_get_dirent(struct zip *za, zip_uint64_t idx, zip_flags_t flags, struct zip_ return za->entry[idx].changes; } - + zip_uint16_t _zip_read2(const zip_uint8_t **a) @@ -856,7 +856,7 @@ _zip_read2(const zip_uint8_t **a) return ret; } - + zip_uint32_t _zip_read4(const zip_uint8_t **a) @@ -869,7 +869,7 @@ _zip_read4(const zip_uint8_t **a) return ret; } - + zip_uint64_t _zip_read8(const zip_uint8_t **a) @@ -884,7 +884,7 @@ _zip_read8(const zip_uint8_t **a) return x+(y<<32); } - + zip_uint8_t * _zip_read_data(const zip_uint8_t **buf, FILE *fp, size_t len, int nulp, struct zip_error *error) @@ -927,7 +927,7 @@ _zip_read_data(const zip_uint8_t **buf, FILE *fp, size_t len, int nulp, struct z return r; } - + static struct zip_string * _zip_read_string(const zip_uint8_t **buf, FILE *fp, zip_uint16_t len, int nulp, struct zip_error *error) @@ -943,7 +943,7 @@ _zip_read_string(const zip_uint8_t **buf, FILE *fp, zip_uint16_t len, int nulp, return s; } - + void _zip_poke4(zip_uint32_t i, zip_uint8_t **p) @@ -954,7 +954,7 @@ _zip_poke4(zip_uint32_t i, zip_uint8_t **p) *((*p)++) = (i>>24)&0xff; } - + void _zip_poke8(zip_uint64_t i, zip_uint8_t **p) @@ -969,7 +969,7 @@ _zip_poke8(zip_uint64_t i, zip_uint8_t **p) *((*p)++) = (i>>56)&0xff; } - + void _zip_write2(zip_uint16_t i, FILE *fp) @@ -980,7 +980,7 @@ _zip_write2(zip_uint16_t i, FILE *fp) return; } - + void _zip_write4(zip_uint32_t i, FILE *fp) @@ -989,11 +989,11 @@ _zip_write4(zip_uint32_t i, FILE *fp) putc((i>>8)&0xff, fp); putc((i>>16)&0xff, fp); putc((i>>24)&0xff, fp); - + return; } - + void _zip_write8(zip_uint64_t i, FILE *fp) @@ -1006,11 +1006,11 @@ _zip_write8(zip_uint64_t i, FILE *fp) putc((i>>40)&0xff, fp); putc((i>>48)&0xff, fp); putc((i>>56)&0xff, fp); - + return; } - + void _zip_u2d_time(time_t time, zip_uint16_t *dtime, zip_uint16_t *ddate) diff --git a/ext/zip/lib/zip_discard.c b/ext/zip/lib/zip_discard.c index 040b029411..5b36df8b0b 100644 --- a/ext/zip/lib/zip_discard.c +++ b/ext/zip/lib/zip_discard.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + /* zip_discard: frees the space allocated to a zipfile struct, and closes the @@ -76,7 +76,7 @@ zip_discard(struct zip *za) _zip_error_fini(&za->error); free(za->file); - + free(za); return; diff --git a/ext/zip/lib/zip_entry.c b/ext/zip/lib/zip_entry.c index 58663e8d0c..2f41b2a470 100644 --- a/ext/zip/lib/zip_entry.c +++ b/ext/zip/lib/zip_entry.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" @@ -43,7 +43,7 @@ _zip_entry_finalize(struct zip_entry *e) _zip_dirent_free(e->changes); } - + void _zip_entry_init(struct zip_entry *e) diff --git a/ext/zip/lib/zip_err_str.c b/ext/zip/lib/zip_err_str.c index 8fb60036e0..deac7004ba 100644 --- a/ext/zip/lib/zip_err_str.c +++ b/ext/zip/lib/zip_err_str.c @@ -5,7 +5,7 @@ #include "zipint.h" - + const char * const _zip_err_str[] = { "No error", @@ -33,7 +33,7 @@ const char * const _zip_err_str[] = { "Can't remove file", "Entry has been deleted", "Encryption method not supported", - "Read-only archive", + "Read-only archive", "No password provided", "Wrong password provided", }; @@ -70,7 +70,7 @@ const int _zip_err_type[] = { S, N, N, - N, + N, N, N, }; diff --git a/ext/zip/lib/zip_error.c b/ext/zip/lib/zip_error.c index 7efb4f5275..2d65d48bfc 100644 --- a/ext/zip/lib/zip_error.c +++ b/ext/zip/lib/zip_error.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + void _zip_error_clear(struct zip_error *err) @@ -49,7 +49,7 @@ _zip_error_clear(struct zip_error *err) err->sys_err = 0; } - + void _zip_error_copy(struct zip_error *dst, const struct zip_error *src) @@ -58,7 +58,7 @@ _zip_error_copy(struct zip_error *dst, const struct zip_error *src) dst->sys_err = src->sys_err; } - + void _zip_error_fini(struct zip_error *err) @@ -67,7 +67,7 @@ _zip_error_fini(struct zip_error *err) err->str = NULL; } - + void _zip_error_get(const struct zip_error *err, int *zep, int *sep) @@ -82,7 +82,7 @@ _zip_error_get(const struct zip_error *err, int *zep, int *sep) } } - + void _zip_error_init(struct zip_error *err) @@ -92,7 +92,7 @@ _zip_error_init(struct zip_error *err) err->str = NULL; } - + void _zip_error_set(struct zip_error *err, int ze, int se) @@ -103,13 +103,13 @@ _zip_error_set(struct zip_error *err, int ze, int se) } } - + void _zip_error_set_from_source(struct zip_error *err, struct zip_source *src) { int ze, se; - + zip_source_error(src, &ze, &se); _zip_error_set(err, ze, se); } diff --git a/ext/zip/lib/zip_error_clear.c b/ext/zip/lib/zip_error_clear.c index b4ff103912..d7b32f9631 100644 --- a/ext/zip/lib/zip_error_clear.c +++ b/ext/zip/lib/zip_error_clear.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN void zip_error_clear(struct zip *za) diff --git a/ext/zip/lib/zip_error_get.c b/ext/zip/lib/zip_error_get.c index 6d1c958c17..930610df32 100644 --- a/ext/zip/lib/zip_error_get.c +++ b/ext/zip/lib/zip_error_get.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN void zip_error_get(struct zip *za, int *zep, int *sep) diff --git a/ext/zip/lib/zip_error_get_sys_type.c b/ext/zip/lib/zip_error_get_sys_type.c index 6c6f380740..22087199b6 100644 --- a/ext/zip/lib/zip_error_get_sys_type.c +++ b/ext/zip/lib/zip_error_get_sys_type.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN int zip_error_get_sys_type(int ze) diff --git a/ext/zip/lib/zip_error_strerror.c b/ext/zip/lib/zip_error_strerror.c index 3d0951cfb1..74e49258dd 100644 --- a/ext/zip/lib/zip_error_strerror.c +++ b/ext/zip/lib/zip_error_strerror.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <errno.h> #include <stdio.h> @@ -40,7 +40,7 @@ #include "zipint.h" - + const char * _zip_error_strerror(struct zip_error *err) @@ -57,7 +57,7 @@ _zip_error_strerror(struct zip_error *err) } else { zs = _zip_err_str[err->zip_err]; - + switch (_zip_err_type[err->zip_err]) { case ZIP_ET_SYS: ss = strerror(err->sys_err); @@ -78,7 +78,7 @@ _zip_error_strerror(struct zip_error *err) if ((s=(char *)malloc(strlen(ss) + (zs ? strlen(zs)+2 : 0) + 1)) == NULL) return _zip_err_str[ZIP_ER_MEMORY]; - + sprintf(s, "%s%s%s", (zs ? zs : ""), (zs ? ": " : ""), diff --git a/ext/zip/lib/zip_error_to_str.c b/ext/zip/lib/zip_error_to_str.c index 11a0cd2bb0..c61e2d0c9e 100644 --- a/ext/zip/lib/zip_error_to_str.c +++ b/ext/zip/lib/zip_error_to_str.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <errno.h> #include <stdio.h> @@ -40,7 +40,7 @@ #include "zipint.h" - + ZIP_EXTERN int zip_error_to_str(char *buf, zip_uint64_t len, int ze, int se) @@ -51,16 +51,16 @@ zip_error_to_str(char *buf, zip_uint64_t len, int ze, int se) return snprintf(buf, len, "Unknown error %d", ze); zs = _zip_err_str[ze]; - + switch (_zip_err_type[ze]) { case ZIP_ET_SYS: ss = strerror(se); break; - + case ZIP_ET_ZLIB: ss = zError(se); break; - + default: ss = NULL; } diff --git a/ext/zip/lib/zip_extra_field.c b/ext/zip/lib/zip_extra_field.c index 670a4c833f..76ec3ae12b 100644 --- a/ext/zip/lib/zip_extra_field.c +++ b/ext/zip/lib/zip_extra_field.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" @@ -39,22 +39,22 @@ #include <stdlib.h> #include <string.h> - + struct zip_extra_field * _zip_ef_clone(const struct zip_extra_field *ef, struct zip_error *error) { struct zip_extra_field *head, *prev, *def; - + head = prev = NULL; - + while (ef) { if ((def=_zip_ef_new(ef->id, ef->size, ef->data, ef->flags)) == NULL) { _zip_error_set(error, ZIP_ER_MEMORY, 0); _zip_ef_free(head); return NULL; } - + if (head == NULL) head = def; if (prev) @@ -63,7 +63,7 @@ _zip_ef_clone(const struct zip_extra_field *ef, struct zip_error *error) ef = ef->next; } - + return head; } @@ -93,7 +93,7 @@ _zip_ef_delete_by_id(struct zip_extra_field *ef, zip_uint16_t id, zip_uint16_t i continue; } } - + i++; if (i > id_idx) break; @@ -105,7 +105,7 @@ _zip_ef_delete_by_id(struct zip_extra_field *ef, zip_uint16_t id, zip_uint16_t i } - + void _zip_ef_free(struct zip_extra_field *ef) @@ -120,13 +120,13 @@ _zip_ef_free(struct zip_extra_field *ef) } } - + const zip_uint8_t * _zip_ef_get_by_id(const struct zip_extra_field *ef, zip_uint16_t *lenp, zip_uint16_t id, zip_uint16_t id_idx, zip_flags_t flags, struct zip_error *error) { static const zip_uint8_t empty[1] = { '\0' }; - + int i; i = 0; @@ -150,7 +150,7 @@ _zip_ef_get_by_id(const struct zip_extra_field *ef, zip_uint16_t *lenp, zip_uint return NULL; } - + struct zip_extra_field * _zip_ef_merge(struct zip_extra_field *to, struct zip_extra_field *from) @@ -186,7 +186,7 @@ _zip_ef_merge(struct zip_extra_field *to, struct zip_extra_field *from) return to; } - + struct zip_extra_field * _zip_ef_new(zip_uint16_t id, zip_uint16_t size, const zip_uint8_t *data, zip_flags_t flags) @@ -212,7 +212,7 @@ _zip_ef_new(zip_uint16_t id, zip_uint16_t size, const zip_uint8_t *data, zip_fla return ef; } - + struct zip_extra_field * _zip_ef_parse(const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags, struct zip_error *error) @@ -255,17 +255,17 @@ _zip_ef_parse(const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags, stru return ef_head; } - + struct zip_extra_field * _zip_ef_remove_internal(struct zip_extra_field *ef) { struct zip_extra_field *ef_head; struct zip_extra_field *prev, *next; - + ef_head = ef; prev = NULL; - + while (ef) { if (ZIP_EF_IS_INTERNAL(ef->id)) { next = ef->next; @@ -282,7 +282,7 @@ _zip_ef_remove_internal(struct zip_extra_field *ef) ef = ef->next; } } - + return ef_head; } @@ -301,7 +301,7 @@ _zip_ef_size(const struct zip_extra_field *ef, zip_flags_t flags) return size; } - + void _zip_ef_write(const struct zip_extra_field *ef, zip_flags_t flags, FILE *f) @@ -316,7 +316,7 @@ _zip_ef_write(const struct zip_extra_field *ef, zip_flags_t flags, FILE *f) } } - + int _zip_read_local_ef(struct zip *za, zip_uint64_t idx) @@ -370,13 +370,13 @@ _zip_read_local_ef(struct zip *za, zip_uint64_t idx) return -1; } free(ef_raw); - + ef = _zip_ef_remove_internal(ef); e->orig->extra_fields = _zip_ef_merge(e->orig->extra_fields, ef); } e->orig->local_extra_fields_read = 1; - + if (e->changes && e->changes->local_extra_fields_read == 0) { e->changes->extra_fields = e->orig->extra_fields; e->changes->local_extra_fields_read = 1; diff --git a/ext/zip/lib/zip_extra_field_api.c b/ext/zip/lib/zip_extra_field_api.c index 1412c310a2..0f1c397420 100644 --- a/ext/zip/lib/zip_extra_field_api.c +++ b/ext/zip/lib/zip_extra_field_api.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN int zip_file_extra_field_delete(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_idx, zip_flags_t flags) @@ -51,10 +51,10 @@ zip_file_extra_field_delete(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - + if (_zip_get_dirent(za, idx, 0, NULL) == NULL) return -1; - + if (ZIP_IS_RDONLY(za)) { _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); return -1; @@ -62,14 +62,14 @@ zip_file_extra_field_delete(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id if (_zip_file_extra_field_prepare_for_change(za, idx) < 0) return -1; - + de = za->entry[idx].changes; - + de->extra_fields = _zip_ef_delete_by_id(de->extra_fields, ZIP_EXTRA_FIELD_ALL, ef_idx, flags); return 0; } - + ZIP_EXTERN int zip_file_extra_field_delete_by_id(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_uint16_t ef_idx, zip_flags_t flags) @@ -85,7 +85,7 @@ zip_file_extra_field_delete_by_id(struct zip *za, zip_uint64_t idx, zip_uint16_t _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - + if (_zip_get_dirent(za, idx, 0, NULL) == NULL) return -1; @@ -93,17 +93,17 @@ zip_file_extra_field_delete_by_id(struct zip *za, zip_uint64_t idx, zip_uint16_t _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); return -1; } - + if (_zip_file_extra_field_prepare_for_change(za, idx) < 0) return -1; - + de = za->entry[idx].changes; de->extra_fields = _zip_ef_delete_by_id(de->extra_fields, ef_id, ef_idx, flags); return 0; } - + ZIP_EXTERN const zip_uint8_t * zip_file_extra_field_get(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_idx, zip_uint16_t *idp, zip_uint16_t *lenp, zip_flags_t flags) @@ -150,7 +150,7 @@ zip_file_extra_field_get(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_idx, } - + ZIP_EXTERN const zip_uint8_t * zip_file_extra_field_get_by_id(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_uint16_t ef_idx, zip_uint16_t *lenp, zip_flags_t flags) @@ -172,7 +172,7 @@ zip_file_extra_field_get_by_id(struct zip *za, zip_uint64_t idx, zip_uint16_t ef return _zip_ef_get_by_id(de->extra_fields, lenp, ef_id, ef_idx, flags, &za->error); } - + ZIP_EXTERN zip_int16_t zip_file_extra_fields_count(struct zip *za, zip_uint64_t idx, zip_flags_t flags) @@ -201,7 +201,7 @@ zip_file_extra_fields_count(struct zip *za, zip_uint64_t idx, zip_flags_t flags) return (zip_int16_t)n; } - + ZIP_EXTERN zip_int16_t zip_file_extra_fields_count_by_id(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_flags_t flags) @@ -230,7 +230,7 @@ zip_file_extra_fields_count_by_id(struct zip *za, zip_uint64_t idx, zip_uint16_t return (zip_int16_t)n; } - + ZIP_EXTERN int zip_file_extra_field_set(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_uint16_t ef_idx, const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags) @@ -247,12 +247,12 @@ zip_file_extra_field_set(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id, z if (_zip_get_dirent(za, idx, 0, NULL) == NULL) return -1; - + if (ZIP_IS_RDONLY(za)) { _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); return -1; } - + if (ZIP_EF_IS_INTERNAL(ef_id)) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; @@ -260,7 +260,7 @@ zip_file_extra_field_set(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id, z if (_zip_file_extra_field_prepare_for_change(za, idx) < 0) return -1; - + de = za->entry[idx].changes; ef = de->extra_fields; @@ -302,7 +302,7 @@ zip_file_extra_field_set(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id, z _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - + if ((ef_new=_zip_ef_new(ef_id, len, data, flags)) == NULL) { _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return -1; @@ -322,7 +322,7 @@ zip_file_extra_field_set(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id, z ef->flags &= ~(flags & ZIP_EF_BOTH); ef_new->next = ef->next; ef->next = ef_new; - } + } } else if (ef_prev) { ef_new->next = ef_prev->next; @@ -330,7 +330,7 @@ zip_file_extra_field_set(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id, z } else de->extra_fields = ef_new; - + return 0; } @@ -340,14 +340,14 @@ int _zip_file_extra_field_prepare_for_change(struct zip *za, zip_uint64_t idx) { struct zip_entry *e; - + if (idx >= za->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - + e = za->entry+idx; - + if (e->changes && (e->changes->changed & ZIP_DIRENT_EXTRA_FIELD)) return 0; @@ -355,20 +355,20 @@ _zip_file_extra_field_prepare_for_change(struct zip *za, zip_uint64_t idx) if (_zip_read_local_ef(za, idx) < 0) return -1; } - + if (e->changes == NULL) { if ((e->changes=_zip_dirent_clone(e->orig)) == NULL) { _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return -1; } } - + if (e->orig && e->orig->extra_fields) { if ((e->changes->extra_fields=_zip_ef_clone(e->orig->extra_fields, &za->error)) == NULL) return -1; } e->changes->changed |= ZIP_DIRENT_EXTRA_FIELD; - + return 0; } diff --git a/ext/zip/lib/zip_fclose.c b/ext/zip/lib/zip_fclose.c index c05ec3dd0f..f24f109cb2 100644 --- a/ext/zip/lib/zip_fclose.c +++ b/ext/zip/lib/zip_fclose.c @@ -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 @@ -31,20 +31,20 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + ZIP_EXTERN int zip_fclose(struct zip_file *zf) { int ret; unsigned int i; - + if (zf->src) zip_source_free(zf->src); diff --git a/ext/zip/lib/zip_fdopen.c b/ext/zip/lib/zip_fdopen.c index bda9aabac4..edeaa56488 100644 --- a/ext/zip/lib/zip_fdopen.c +++ b/ext/zip/lib/zip_fdopen.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN struct zip * zip_fdopen(int fd_orig, int _flags, int *zep) @@ -50,7 +50,7 @@ zip_fdopen(int fd_orig, int _flags, int *zep) return NULL; } flags = (unsigned int)_flags; - + if (flags & ZIP_TRUNCATE) { *zep = ZIP_ER_INVAL; return NULL; diff --git a/ext/zip/lib/zip_file_add.c b/ext/zip/lib/zip_file_add.c index 995cb91c1a..a30fd0b0f3 100644 --- a/ext/zip/lib/zip_file_add.c +++ b/ext/zip/lib/zip_file_add.c @@ -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 @@ -31,10 +31,10 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + /* NOTE: Return type is signed so we can return -1 on error. @@ -50,6 +50,6 @@ zip_file_add(struct zip *za, const char *name, struct zip_source *source, zip_fl _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - + return _zip_file_replace(za, ZIP_UINT64_MAX, name, source, flags); } diff --git a/ext/zip/lib/zip_file_error_clear.c b/ext/zip/lib/zip_file_error_clear.c index ce8b6cbd94..c433fbcb84 100644 --- a/ext/zip/lib/zip_file_error_clear.c +++ b/ext/zip/lib/zip_file_error_clear.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN void zip_file_error_clear(struct zip_file *zf) diff --git a/ext/zip/lib/zip_file_error_get.c b/ext/zip/lib/zip_file_error_get.c index f20e011fc7..65b08e3b13 100644 --- a/ext/zip/lib/zip_file_error_get.c +++ b/ext/zip/lib/zip_file_error_get.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN void zip_file_error_get(struct zip_file *zf, int *zep, int *sep) diff --git a/ext/zip/lib/zip_file_get_comment.c b/ext/zip/lib/zip_file_get_comment.c index 766731ea26..9a7a7b5cb5 100644 --- a/ext/zip/lib/zip_file_get_comment.c +++ b/ext/zip/lib/zip_file_get_comment.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + /* lenp is 32 bit because converted comment can be longer than ZIP_UINT16_MAX */ ZIP_EXTERN const char * diff --git a/ext/zip/lib/zip_file_get_external_attributes.c b/ext/zip/lib/zip_file_get_external_attributes.c index f1ad66a63a..21cf41343d 100644 --- a/ext/zip/lib/zip_file_get_external_attributes.c +++ b/ext/zip/lib/zip_file_get_external_attributes.c @@ -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 diff --git a/ext/zip/lib/zip_file_get_offset.c b/ext/zip/lib/zip_file_get_offset.c index e8c199fb5b..40b1f703c7 100644 --- a/ext/zip/lib/zip_file_get_offset.c +++ b/ext/zip/lib/zip_file_get_offset.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdio.h> #include <stdlib.h> @@ -42,7 +42,7 @@ #include "zipint.h" - + /* _zip_file_get_offset(za, ze): Returns the offset of the file data for entry ze. @@ -71,6 +71,6 @@ _zip_file_get_offset(const struct zip *za, zip_uint64_t idx, struct zip_error *e _zip_error_set(error, ZIP_ER_SEEK, EFBIG); return 0; } - + return offset + (zip_uint32_t)size; } diff --git a/ext/zip/lib/zip_file_rename.c b/ext/zip/lib/zip_file_rename.c index 383a52adae..dd4f253457 100644 --- a/ext/zip/lib/zip_file_rename.c +++ b/ext/zip/lib/zip_file_rename.c @@ -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 @@ -31,20 +31,20 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <string.h> #include "zipint.h" - + ZIP_EXTERN int zip_file_rename(struct zip *za, zip_uint64_t idx, const char *name, zip_flags_t flags) { const char *old_name; int old_is_dir, new_is_dir; - + if (idx >= za->nentry || (name != NULL && strlen(name) > ZIP_UINT16_MAX)) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; @@ -57,7 +57,7 @@ zip_file_rename(struct zip *za, zip_uint64_t idx, const char *name, zip_flags_t if ((old_name=zip_get_name(za, idx, 0)) == NULL) return -1; - + new_is_dir = (name != NULL && name[strlen(name)-1] == '/'); old_is_dir = (old_name[strlen(old_name)-1] == '/'); diff --git a/ext/zip/lib/zip_file_replace.c b/ext/zip/lib/zip_file_replace.c index 7e7e942168..622ef3c992 100644 --- a/ext/zip/lib/zip_file_replace.c +++ b/ext/zip/lib/zip_file_replace.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN int zip_file_replace(struct zip *za, zip_uint64_t idx, struct zip_source *source, zip_flags_t flags) @@ -52,7 +52,7 @@ zip_file_replace(struct zip *za, zip_uint64_t idx, struct zip_source *source, zi } - + /* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ @@ -60,7 +60,7 @@ zip_int64_t _zip_file_replace(struct zip *za, zip_uint64_t idx, const char *name, struct zip_source *source, zip_flags_t flags) { zip_uint64_t za_nentry_prev; - + if (ZIP_IS_RDONLY(za)) { _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); return -1; @@ -69,7 +69,7 @@ _zip_file_replace(struct zip *za, zip_uint64_t idx, const char *name, struct zip za_nentry_prev = za->nentry; if (idx == ZIP_UINT64_MAX) { zip_int64_t i = -1; - + if (flags & ZIP_FL_OVERWRITE) i = _zip_name_locate(za, name, flags, NULL); @@ -80,7 +80,7 @@ _zip_file_replace(struct zip *za, zip_uint64_t idx, const char *name, struct zip } idx = (zip_uint64_t)i; } - + if (name && _zip_set_name(za, idx, name, flags) != 0) { if (za->nentry != za_nentry_prev) { _zip_entry_finalize(za->entry+idx); @@ -104,7 +104,7 @@ _zip_file_replace(struct zip *za, zip_uint64_t idx, const char *name, struct zip za->entry[idx].changes->comp_method = ZIP_CM_REPLACED_DEFAULT; za->entry[idx].changes->changed |= ZIP_DIRENT_COMP_METHOD; } - + za->entry[idx].source = source; return (zip_int64_t)idx; diff --git a/ext/zip/lib/zip_file_set_comment.c b/ext/zip/lib/zip_file_set_comment.c index 722f3d43cc..541d3475a8 100644 --- a/ext/zip/lib/zip_file_set_comment.c +++ b/ext/zip/lib/zip_file_set_comment.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + ZIP_EXTERN int zip_file_set_comment(struct zip *za, zip_uint64_t idx, @@ -81,7 +81,7 @@ zip_file_set_comment(struct zip *za, zip_uint64_t idx, changed = !_zip_string_equal(e->orig->comment, cstr); else changed = (cstr != NULL); - + if (changed) { if (e->changes == NULL) { if ((e->changes=_zip_dirent_clone(e->orig)) == NULL) { diff --git a/ext/zip/lib/zip_file_set_external_attributes.c b/ext/zip/lib/zip_file_set_external_attributes.c index 0820d6f5c8..3f2817807f 100644 --- a/ext/zip/lib/zip_file_set_external_attributes.c +++ b/ext/zip/lib/zip_file_set_external_attributes.c @@ -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 diff --git a/ext/zip/lib/zip_file_strerror.c b/ext/zip/lib/zip_file_strerror.c index 9ba70f14ff..f06f698c64 100644 --- a/ext/zip/lib/zip_file_strerror.c +++ b/ext/zip/lib/zip_file_strerror.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN const char * zip_file_strerror(struct zip_file *zf) diff --git a/ext/zip/lib/zip_filerange_crc.c b/ext/zip/lib/zip_filerange_crc.c index c7bd1e8a4a..68b2ce1521 100644 --- a/ext/zip/lib/zip_filerange_crc.c +++ b/ext/zip/lib/zip_filerange_crc.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdio.h> #include <errno.h> @@ -39,7 +39,7 @@ #include "zipint.h" - + int _zip_filerange_crc(FILE *fp, off_t start, off_t len, uLong *crcp, @@ -54,7 +54,7 @@ _zip_filerange_crc(FILE *fp, off_t start, off_t len, uLong *crcp, _zip_error_set(errp, ZIP_ER_SEEK, errno); return -1; } - + while (len > 0) { n = len > BUFSIZE ? BUFSIZE : (size_t)len; if ((n=fread(buf, 1, n, fp)) == 0) { diff --git a/ext/zip/lib/zip_fopen.c b/ext/zip/lib/zip_fopen.c index 331f79ea36..4bee7e500b 100644 --- a/ext/zip/lib/zip_fopen.c +++ b/ext/zip/lib/zip_fopen.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN struct zip_file * zip_fopen(struct zip *za, const char *fname, zip_flags_t flags) diff --git a/ext/zip/lib/zip_fopen_encrypted.c b/ext/zip/lib/zip_fopen_encrypted.c index 34230f00d7..18e198d4a9 100644 --- a/ext/zip/lib/zip_fopen_encrypted.c +++ b/ext/zip/lib/zip_fopen_encrypted.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN struct zip_file * zip_fopen_encrypted(struct zip *za, const char *fname, zip_flags_t flags, const char *password) diff --git a/ext/zip/lib/zip_fopen_index.c b/ext/zip/lib/zip_fopen_index.c index 6136ab4267..0337f1fac8 100644 --- a/ext/zip/lib/zip_fopen_index.c +++ b/ext/zip/lib/zip_fopen_index.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <errno.h> #include <stdio.h> @@ -39,7 +39,7 @@ #include "zipint.h" - + ZIP_EXTERN struct zip_file * zip_fopen_index(struct zip *za, zip_uint64_t index, zip_flags_t flags) diff --git a/ext/zip/lib/zip_fopen_index_encrypted.c b/ext/zip/lib/zip_fopen_index_encrypted.c index ea93050c93..e63eb5c04f 100644 --- a/ext/zip/lib/zip_fopen_index_encrypted.c +++ b/ext/zip/lib/zip_fopen_index_encrypted.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <errno.h> #include <stdio.h> @@ -41,7 +41,7 @@ static struct zip_file *_zip_file_new(struct zip *za); - + ZIP_EXTERN struct zip_file * zip_fopen_index_encrypted(struct zip *za, zip_uint64_t index, zip_flags_t flags, @@ -69,7 +69,7 @@ zip_fopen_index_encrypted(struct zip *za, zip_uint64_t index, zip_flags_t flags, return zf; } - + static struct zip_file * _zip_file_new(struct zip *za) @@ -80,7 +80,7 @@ _zip_file_new(struct zip *za) _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return NULL; } - + if (za->nfile+1 >= za->nfile_alloc) { unsigned int n; n = za->nfile_alloc + 10; diff --git a/ext/zip/lib/zip_fread.c b/ext/zip/lib/zip_fread.c index 8235c6dfac..67717e30d8 100644 --- a/ext/zip/lib/zip_fread.c +++ b/ext/zip/lib/zip_fread.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN zip_int64_t zip_fread(struct zip_file *zf, void *outbuf, zip_uint64_t toread) diff --git a/ext/zip/lib/zip_get_archive_comment.c b/ext/zip/lib/zip_get_archive_comment.c index 202f761f4e..5d6b578b26 100644 --- a/ext/zip/lib/zip_get_archive_comment.c +++ b/ext/zip/lib/zip_get_archive_comment.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <string.h> #include "zipint.h" - + ZIP_EXTERN const char * zip_get_archive_comment(struct zip *za, int *lenp, zip_flags_t flags) diff --git a/ext/zip/lib/zip_get_archive_flag.c b/ext/zip/lib/zip_get_archive_flag.c index 7be5a3f2be..46a2f56694 100644 --- a/ext/zip/lib/zip_get_archive_flag.c +++ b/ext/zip/lib/zip_get_archive_flag.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN int zip_get_archive_flag(struct zip *za, zip_flags_t flag, zip_flags_t flags) diff --git a/ext/zip/lib/zip_get_compression_implementation.c b/ext/zip/lib/zip_get_compression_implementation.c index aa4a1605c0..a2e76e555d 100644 --- a/ext/zip/lib/zip_get_compression_implementation.c +++ b/ext/zip/lib/zip_get_compression_implementation.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + zip_compression_implementation _zip_get_compression_implementation(zip_int32_t cm) diff --git a/ext/zip/lib/zip_get_encryption_implementation.c b/ext/zip/lib/zip_get_encryption_implementation.c index 7dcb99210d..1cd12deff6 100644 --- a/ext/zip/lib/zip_get_encryption_implementation.c +++ b/ext/zip/lib/zip_get_encryption_implementation.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + zip_encryption_implementation _zip_get_encryption_implementation(zip_uint16_t em) diff --git a/ext/zip/lib/zip_get_file_comment.c b/ext/zip/lib/zip_get_file_comment.c index 3be459d4da..347b1386a6 100644 --- a/ext/zip/lib/zip_get_file_comment.c +++ b/ext/zip/lib/zip_get_file_comment.c @@ -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 @@ -31,12 +31,12 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - + ZIP_EXTERN const char * zip_get_file_comment(struct zip *za, zip_uint64_t idx, int *lenp, int flags) diff --git a/ext/zip/lib/zip_get_name.c b/ext/zip/lib/zip_get_name.c index f67c7caf43..f000db1815 100644 --- a/ext/zip/lib/zip_get_name.c +++ b/ext/zip/lib/zip_get_name.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <string.h> #include "zipint.h" - + ZIP_EXTERN const char * zip_get_name(struct zip *za, zip_uint64_t idx, zip_flags_t flags) @@ -45,7 +45,7 @@ zip_get_name(struct zip *za, zip_uint64_t idx, zip_flags_t flags) return _zip_get_name(za, idx, flags, &za->error); } - + const char * _zip_get_name(struct zip *za, zip_uint64_t idx, zip_flags_t flags, struct zip_error *error) diff --git a/ext/zip/lib/zip_get_num_entries.c b/ext/zip/lib/zip_get_num_entries.c index 26484baff2..e57921b9fd 100644 --- a/ext/zip/lib/zip_get_num_entries.c +++ b/ext/zip/lib/zip_get_num_entries.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN zip_int64_t zip_get_num_entries(struct zip *za, zip_flags_t flags) diff --git a/ext/zip/lib/zip_get_num_files.c b/ext/zip/lib/zip_get_num_files.c index d75941d5e1..cc96ee4333 100644 --- a/ext/zip/lib/zip_get_num_files.c +++ b/ext/zip/lib/zip_get_num_files.c @@ -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 @@ -31,12 +31,12 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - + ZIP_EXTERN int zip_get_num_files(struct zip *za) diff --git a/ext/zip/lib/zip_memdup.c b/ext/zip/lib/zip_memdup.c index 06af2dabd3..4faa8982cb 100644 --- a/ext/zip/lib/zip_memdup.c +++ b/ext/zip/lib/zip_memdup.c @@ -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 @@ -36,7 +36,7 @@ #include "zipint.h" - + void * _zip_memdup(const void *mem, size_t len, struct zip_error *error) diff --git a/ext/zip/lib/zip_name_locate.c b/ext/zip/lib/zip_name_locate.c index 3cac110543..e527a5cda5 100644 --- a/ext/zip/lib/zip_name_locate.c +++ b/ext/zip/lib/zip_name_locate.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <string.h> #ifdef HAVE_STRINGS_H @@ -40,7 +40,7 @@ #include "zipint.h" - + ZIP_EXTERN zip_int64_t zip_name_locate(struct zip *za, const char *fname, zip_flags_t flags) @@ -48,7 +48,7 @@ zip_name_locate(struct zip *za, const char *fname, zip_flags_t flags) return _zip_name_locate(za, fname, flags, &za->error); } - + zip_int64_t _zip_name_locate(struct zip *za, const char *fname, zip_flags_t flags, struct zip_error *error) @@ -73,7 +73,7 @@ _zip_name_locate(struct zip *za, const char *fname, zip_flags_t flags, struct zi /* newly added (partially filled) entry or error */ if (fn == NULL) continue; - + if (flags & ZIP_FL_NODIR) { p = strrchr(fn, '/'); if (p) diff --git a/ext/zip/lib/zip_new.c b/ext/zip/lib/zip_new.c index f77634a389..e91282b567 100644 --- a/ext/zip/lib/zip_new.c +++ b/ext/zip/lib/zip_new.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + /* _zip_new: creates a new zipfile struct, and sets the contents to zero; returns @@ -67,6 +67,6 @@ _zip_new(struct zip_error *error) za->nfile = za->nfile_alloc = 0; za->file = NULL; za->tempdir = NULL; - + return za; } diff --git a/ext/zip/lib/zip_open.c b/ext/zip/lib/zip_open.c index d91fe469db..1acaefa30e 100644 --- a/ext/zip/lib/zip_open.c +++ b/ext/zip/lib/zip_open.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <sys/stat.h> #include <errno.h> @@ -58,21 +58,21 @@ static struct zip_cdir *_zip_read_eocd(const unsigned char *, const unsigned cha static struct zip_cdir *_zip_read_eocd64(FILE *, const unsigned char *, const unsigned char *, off_t, size_t, unsigned int, struct zip_error *); - + ZIP_EXTERN struct zip * zip_open(const char *fn, int _flags, int *zep) { FILE *fp; unsigned int flags; - + if (_flags < 0) { if (zep) *zep = ZIP_ER_INVAL; return NULL; } flags = (unsigned int)_flags; - + switch (_zip_file_exists(fn, flags, zep)) { case -1: return NULL; @@ -81,7 +81,7 @@ zip_open(const char *fn, int _flags, int *zep) default: if (flags & ZIP_TRUNCATE) { FILE *f; - + if ((f = fopen(fn, "rb")) == NULL) { set_error(zep, NULL, ZIP_ER_OPEN); return NULL; @@ -105,7 +105,7 @@ ZIP_EXTERN int zip_archive_set_tempdir(struct zip *za, const char *tempdir) { char *new_tempdir; - + if (tempdir) { if ((new_tempdir = strdup(tempdir)) == NULL) { _zip_error_set(&za->error, ZIP_ER_MEMORY, errno); @@ -114,13 +114,13 @@ zip_archive_set_tempdir(struct zip *za, const char *tempdir) } else new_tempdir = NULL; - + free(za->tempdir); za->tempdir = new_tempdir; - + return 0; } - + struct zip * _zip_open(const char *fn, FILE *fp, unsigned int flags, int *zep) @@ -160,7 +160,7 @@ _zip_open(const char *fn, FILE *fp, unsigned int flags, int *zep) za->nentry = cdir->nentry; za->nentry_alloc = cdir->nentry_alloc; za->comment_orig = cdir->comment; - + za->zp = fp; _zip_check_torrentzip(za, cdir); @@ -172,7 +172,7 @@ _zip_open(const char *fn, FILE *fp, unsigned int flags, int *zep) return za; } - + static void set_error(int *zep, const struct zip_error *err, int ze) @@ -189,12 +189,12 @@ set_error(int *zep, const struct zip_error *err, int ze) *zep = ze; } - + /* _zip_readcdir: tries to find a valid end-of-central-directory at the beginning of buf, and then the corresponding central directory entries. - Returns a struct zip_cdir which contains the central directory + Returns a struct zip_cdir which contains the central directory entries, or NULL if unsuccessful. */ static struct zip_cdir * @@ -294,11 +294,11 @@ _zip_readcdir(FILE *fp, off_t buf_offset, unsigned char *buf, const unsigned cha _zip_cdir_free(cd); return NULL; } - + return cd; } - + /* _zip_checkcons: Checks the consistency of the central directory by comparing central @@ -327,7 +327,7 @@ _zip_checkcons(FILE *fp, struct zip_cdir *cd, struct zip_error *error) _zip_error_set(error, ZIP_ER_NOZIP, 0); return -1; } - + j = cd->entry[i].orig->offset + cd->entry[i].orig->comp_size + _zip_string_length(cd->entry[i].orig->filename) + LENTRYSIZE; if (j > max) @@ -336,32 +336,32 @@ _zip_checkcons(FILE *fp, struct zip_cdir *cd, struct zip_error *error) _zip_error_set(error, ZIP_ER_NOZIP, 0); return -1; } - + if (fseeko(fp, (off_t)cd->entry[i].orig->offset, SEEK_SET) != 0) { _zip_error_set(error, ZIP_ER_SEEK, errno); return -1; } - + if (_zip_dirent_read(&temp, fp, NULL, NULL, 1, error) == -1) return -1; - + if (_zip_headercomp(cd->entry[i].orig, &temp) != 0) { _zip_error_set(error, ZIP_ER_INCONS, 0); _zip_dirent_finalize(&temp); return -1; } - + cd->entry[i].orig->extra_fields = _zip_ef_merge(cd->entry[i].orig->extra_fields, temp.extra_fields); cd->entry[i].orig->local_extra_fields_read = 1; temp.extra_fields = NULL; - + _zip_dirent_finalize(&temp); } return (max-min) < ZIP_INT64_MAX ? (zip_int64_t)(max-min) : ZIP_INT64_MAX; } - + /* _zip_check_torrentzip: check whether ZA has a valid TORRENTZIP comment, i.e. is torrentzipped */ @@ -395,7 +395,7 @@ _zip_check_torrentzip(struct zip *za, const struct zip_cdir *cdir) } - + /* _zip_headercomp: compares a central directory entry and a local file header @@ -428,7 +428,7 @@ _zip_headercomp(const struct zip_dirent *central, const struct zip_dirent *local return 0; } - + static struct zip * _zip_allocate_new(const char *fn, unsigned int flags, int *zep) @@ -455,7 +455,7 @@ _zip_allocate_new(const char *fn, unsigned int flags, int *zep) return za; } - + static int _zip_file_exists(const char *fn, unsigned int flags, int *zep) @@ -466,7 +466,7 @@ _zip_file_exists(const char *fn, unsigned int flags, int *zep) set_error(zep, NULL, ZIP_ER_INVAL); return -1; } - + if (stat(fn, &st) != 0) { if (flags & ZIP_CREATE) return 0; @@ -485,7 +485,7 @@ _zip_file_exists(const char *fn, unsigned int flags, int *zep) return 1; } - + static struct zip_cdir * _zip_find_central_dir(FILE *fp, unsigned int flags, int *zep, off_t len) @@ -502,7 +502,7 @@ _zip_find_central_dir(FILE *fp, unsigned int flags, int *zep, off_t len) set_error(zep, NULL, ZIP_ER_NOZIP); return NULL; } - + i = fseeko(fp, -(len < CDBUFSIZE ? len : CDBUFSIZE), SEEK_END); if (i == -1 && errno != EFBIG) { /* seek before start of file on my machine */ @@ -510,7 +510,7 @@ _zip_find_central_dir(FILE *fp, unsigned int flags, int *zep, off_t len) return NULL; } buf_offset = ftello(fp); - + /* 64k is too much for stack */ if ((buf=(unsigned char *)malloc(CDBUFSIZE)) == NULL) { set_error(zep, NULL, ZIP_ER_MEMORY); @@ -525,7 +525,7 @@ _zip_find_central_dir(FILE *fp, unsigned int flags, int *zep, off_t len) free(buf); return NULL; } - + best = -1; cdir = NULL; match = buf+ (buflen < CDBUFSIZE ? 0 : EOCD64LOCLEN); @@ -563,7 +563,7 @@ _zip_find_central_dir(FILE *fp, unsigned int flags, int *zep, off_t len) } free(buf); - + if (best < 0) { set_error(zep, &zerr, 0); _zip_cdir_free(cdir); @@ -573,13 +573,13 @@ _zip_find_central_dir(FILE *fp, unsigned int flags, int *zep, off_t len) return cdir; } - + static unsigned char * _zip_memmem(const unsigned char *big, size_t biglen, const unsigned char *little, size_t littlelen) { const unsigned char *p; - + if ((biglen < littlelen) || (littlelen == 0)) return NULL; p = big-1; @@ -592,7 +592,7 @@ _zip_memmem(const unsigned char *big, size_t biglen, const unsigned char *little return NULL; } - + static struct zip_cdir * _zip_read_eocd(const unsigned char *eocd, const unsigned char *buf, off_t buf_offset, size_t buflen, @@ -626,7 +626,7 @@ _zip_read_eocd(const unsigned char *eocd, const unsigned char *buf, off_t buf_of _zip_error_set(error, ZIP_ER_SEEK, EFBIG); return NULL; } - + if (offset+size > (zip_uint64_t)(buf_offset + (eocd-buf))) { /* cdir spans past EOCD record */ _zip_error_set(error, ZIP_ER_INCONS, 0); @@ -643,11 +643,11 @@ _zip_read_eocd(const unsigned char *eocd, const unsigned char *buf, off_t buf_of cd->size = (off_t)size; cd->offset = (off_t)offset; - + return cd; } - + static struct zip_cdir * _zip_read_eocd64(FILE *f, const zip_uint8_t *eocd64loc, const zip_uint8_t *buf, @@ -662,7 +662,7 @@ _zip_read_eocd64(FILE *f, const zip_uint8_t *eocd64loc, const zip_uint8_t *buf, cdp = eocd64loc+8; eocd_offset = _zip_read8(&cdp); - + if (eocd_offset > ZIP_OFF_MAX || eocd_offset + EOCD64LEN > ZIP_OFF_MAX) { _zip_error_set(error, ZIP_ER_SEEK, EFBIG); return NULL; @@ -700,7 +700,7 @@ _zip_read_eocd64(FILE *f, const zip_uint8_t *eocd64loc, const zip_uint8_t *buf, return NULL; } cdp += 4; - + size = _zip_read8(&cdp); if ((flags & ZIP_CHECKCONS) && size+eocd_offset+12 != (zip_uint64_t)(buf_offset+(eocd64loc-buf))) { @@ -710,7 +710,7 @@ _zip_read_eocd64(FILE *f, const zip_uint8_t *eocd64loc, const zip_uint8_t *buf, cdp += 4; /* skip version made by/needed */ cdp += 8; /* skip num disks */ - + nentry = _zip_read8(&cdp); i = _zip_read8(&cdp); @@ -734,7 +734,7 @@ _zip_read_eocd64(FILE *f, const zip_uint8_t *eocd64loc, const zip_uint8_t *buf, if ((cd=_zip_cdir_new(nentry, error)) == NULL) return NULL; - + cd->size = (off_t)size; cd->offset = (off_t)offset; diff --git a/ext/zip/lib/zip_rename.c b/ext/zip/lib/zip_rename.c index 8841caeca9..b1b0be7115 100644 --- a/ext/zip/lib/zip_rename.c +++ b/ext/zip/lib/zip_rename.c @@ -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 @@ -31,14 +31,14 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <string.h> #define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - + ZIP_EXTERN int zip_rename(struct zip *za, zip_uint64_t idx, const char *name) diff --git a/ext/zip/lib/zip_replace.c b/ext/zip/lib/zip_replace.c index de717afec7..ad643f4948 100644 --- a/ext/zip/lib/zip_replace.c +++ b/ext/zip/lib/zip_replace.c @@ -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 @@ -31,12 +31,12 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - + ZIP_EXTERN int zip_replace(struct zip *za, zip_uint64_t idx, struct zip_source *source) diff --git a/ext/zip/lib/zip_set_archive_comment.c b/ext/zip/lib/zip_set_archive_comment.c index afede38f65..0e68f9fb68 100644 --- a/ext/zip/lib/zip_set_archive_comment.c +++ b/ext/zip/lib/zip_set_archive_comment.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + ZIP_EXTERN int zip_set_archive_comment(struct zip *za, const char *comment, zip_uint16_t len) @@ -79,6 +79,6 @@ zip_set_archive_comment(struct zip *za, const char *comment, zip_uint16_t len) za->comment_changes = cstr; za->comment_changed = 1; } - + return 0; } diff --git a/ext/zip/lib/zip_set_archive_flag.c b/ext/zip/lib/zip_set_archive_flag.c index 68f99b8568..7e1463b000 100644 --- a/ext/zip/lib/zip_set_archive_flag.c +++ b/ext/zip/lib/zip_set_archive_flag.c @@ -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 @@ -31,17 +31,17 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN int zip_set_archive_flag(struct zip *za, zip_flags_t flag, int value) { unsigned int new_flags; - + if (value) new_flags = za->ch_flags | flag; else diff --git a/ext/zip/lib/zip_set_default_password.c b/ext/zip/lib/zip_set_default_password.c index b9aa80acff..d16a1b9112 100644 --- a/ext/zip/lib/zip_set_default_password.c +++ b/ext/zip/lib/zip_set_default_password.c @@ -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 @@ -31,14 +31,14 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include <string.h> #include "zipint.h" - + ZIP_EXTERN int zip_set_default_password(struct zip *za, const char *passwd) @@ -48,7 +48,7 @@ zip_set_default_password(struct zip *za, const char *passwd) if (za->default_password) free(za->default_password); - + if (passwd) { if ((za->default_password=strdup(passwd)) == NULL) { _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); diff --git a/ext/zip/lib/zip_set_file_comment.c b/ext/zip/lib/zip_set_file_comment.c index 7acd0eb36d..93ea924f18 100644 --- a/ext/zip/lib/zip_set_file_comment.c +++ b/ext/zip/lib/zip_set_file_comment.c @@ -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 @@ -31,14 +31,14 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - + ZIP_EXTERN int zip_set_file_comment(struct zip *za, zip_uint64_t idx, const char *comment, int len) diff --git a/ext/zip/lib/zip_set_file_compression.c b/ext/zip/lib/zip_set_file_compression.c index 647f69a68f..a4abca8aff 100644 --- a/ext/zip/lib/zip_set_file_compression.c +++ b/ext/zip/lib/zip_set_file_compression.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN int zip_set_file_compression(struct zip *za, zip_uint64_t idx, @@ -60,11 +60,11 @@ zip_set_file_compression(struct zip *za, zip_uint64_t idx, } e = za->entry+idx; - + old_method = (e->orig == NULL ? ZIP_CM_DEFAULT : e->orig->comp_method); - + /* TODO: revisit this when flags are supported, since they may require a recompression */ - + if (method == old_method) { if (e->changes) { e->changes->changed &= ~ZIP_DIRENT_COMP_METHOD; @@ -85,6 +85,6 @@ zip_set_file_compression(struct zip *za, zip_uint64_t idx, e->changes->comp_method = method; e->changes->changed |= ZIP_DIRENT_COMP_METHOD; } - + return 0; } diff --git a/ext/zip/lib/zip_set_name.c b/ext/zip/lib/zip_set_name.c index 4793c54534..191e9ff449 100644 --- a/ext/zip/lib/zip_set_name.c +++ b/ext/zip/lib/zip_set_name.c @@ -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 @@ -31,14 +31,14 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include <string.h> #include "zipint.h" - + int _zip_set_name(struct zip *za, zip_uint64_t idx, const char *name, zip_flags_t flags) @@ -93,7 +93,7 @@ _zip_set_name(struct zip *za, zip_uint64_t idx, const char *name, zip_flags_t fl changed = !_zip_string_equal(e->orig->filename, str); else changed = 1; - + if (changed) { if (e->changes == NULL) { if ((e->changes=_zip_dirent_clone(e->orig)) == NULL) { diff --git a/ext/zip/lib/zip_source_buffer.c b/ext/zip/lib/zip_source_buffer.c index 8a13e7602d..c81590ddcc 100644 --- a/ext/zip/lib/zip_source_buffer.c +++ b/ext/zip/lib/zip_source_buffer.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include <string.h> @@ -46,7 +46,7 @@ struct read_data { static zip_int64_t read_data(void *, void *, zip_uint64_t, enum zip_source_cmd); - + ZIP_EXTERN struct zip_source * zip_source_buffer(struct zip *za, const void *data, zip_uint64_t len, int freep) @@ -71,7 +71,7 @@ zip_source_buffer(struct zip *za, const void *data, zip_uint64_t len, int freep) f->end = ((const char *)data)+len; f->freep = freep; f->mtime = time(NULL); - + if ((zs=zip_source_function(za, read_data, f)) == NULL) { free(f); return NULL; @@ -80,7 +80,7 @@ zip_source_buffer(struct zip *za, const void *data, zip_uint64_t len, int freep) return zs; } - + static zip_int64_t read_data(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) @@ -96,7 +96,7 @@ read_data(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) case ZIP_SOURCE_OPEN: z->buf = z->data; return 0; - + case ZIP_SOURCE_READ: n = (zip_uint64_t)(z->end - z->buf); if (n > len) @@ -108,14 +108,14 @@ read_data(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) } return (zip_int64_t)n; - + case ZIP_SOURCE_CLOSE: return 0; case ZIP_SOURCE_STAT: { struct zip_stat *st; - + if (len < sizeof(*st)) return -1; @@ -129,7 +129,7 @@ read_data(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) st->encryption_method = ZIP_EM_NONE; st->valid = ZIP_STAT_MTIME|ZIP_STAT_SIZE|ZIP_STAT_COMP_SIZE |ZIP_STAT_COMP_METHOD|ZIP_STAT_ENCRYPTION_METHOD; - + return sizeof(*st); } diff --git a/ext/zip/lib/zip_source_close.c b/ext/zip/lib/zip_source_close.c index 7b89d5fc15..a8e91daf5c 100644 --- a/ext/zip/lib/zip_source_close.c +++ b/ext/zip/lib/zip_source_close.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + void zip_source_close(struct zip_source *src) @@ -49,6 +49,6 @@ zip_source_close(struct zip_source *src) (void)src->cb.l(src->src, src->ud, NULL, 0, ZIP_SOURCE_CLOSE); zip_source_close(src->src); } - + src->is_open = 0; } diff --git a/ext/zip/lib/zip_source_crc.c b/ext/zip/lib/zip_source_crc.c index 7d6df6a385..739be28021 100644 --- a/ext/zip/lib/zip_source_crc.c +++ b/ext/zip/lib/zip_source_crc.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include <string.h> @@ -49,7 +49,7 @@ struct crc_context { static zip_int64_t crc_read(struct zip_source *, void *, void * , zip_uint64_t, enum zip_source_cmd); - + struct zip_source * zip_source_crc(struct zip *za, struct zip_source *src, int validate) @@ -71,11 +71,11 @@ zip_source_crc(struct zip *za, struct zip_source *src, int validate) ctx->e[0] = ctx->e[1] = 0; ctx->size = 0; ctx->crc = 0; - + return zip_source_layered(za, src, crc_read, ctx); } - + static zip_int64_t crc_read(struct zip_source *src, void *_ctx, void *data, @@ -112,13 +112,13 @@ crc_read(struct zip_source *src, void *_ctx, void *data, if ((st.valid & ZIP_STAT_CRC) && st.crc != ctx->crc) { ctx->e[0] = ZIP_ER_CRC; ctx->e[1] = 0; - + return -1; } if ((st.valid & ZIP_STAT_SIZE) && st.size != ctx->size) { ctx->e[0] = ZIP_ER_INCONS; ctx->e[1] = 0; - + return -1; } } @@ -150,7 +150,7 @@ crc_read(struct zip_source *src, void *_ctx, void *data, } } return 0; - + case ZIP_SOURCE_ERROR: memcpy(data, ctx->e, sizeof(ctx->e)); return 0; @@ -162,5 +162,5 @@ crc_read(struct zip_source *src, void *_ctx, void *data, default: return -1; } - + } diff --git a/ext/zip/lib/zip_source_deflate.c b/ext/zip/lib/zip_source_deflate.c index 57444d9677..dbb2f2791b 100644 --- a/ext/zip/lib/zip_source_deflate.c +++ b/ext/zip/lib/zip_source_deflate.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include <string.h> @@ -58,7 +58,7 @@ static zip_int64_t deflate_decompress(struct zip_source *, void *, void *, zip_uint64_t, enum zip_source_cmd); static void deflate_free(struct deflate *); - + struct zip_source * zip_source_deflate(struct zip *za, struct zip_source *src, @@ -97,7 +97,7 @@ zip_source_deflate(struct zip *za, struct zip_source *src, return s2; } - + static zip_int64_t compress_read(struct zip_source *src, struct deflate *ctx, @@ -108,10 +108,10 @@ compress_read(struct zip_source *src, struct deflate *ctx, if (ctx->e[0] != 0) return -1; - + if (len == 0) return 0; - + ctx->zstr.next_out = (Bytef *)data; ctx->zstr.avail_out = (uInt)len; /* TODO: check for overflow */ @@ -171,7 +171,7 @@ compress_read(struct zip_source *src, struct deflate *ctx, return (ctx->e[0] == 0) ? 0 : -1; } - + static zip_int64_t decompress_read(struct zip_source *src, struct deflate *ctx, @@ -182,10 +182,10 @@ decompress_read(struct zip_source *src, struct deflate *ctx, if (ctx->e[0] != 0) return -1; - + if (len == 0) return 0; - + ctx->zstr.next_out = (Bytef *)data; ctx->zstr.avail_out = (uInt)len; /* TODO: check for overflow */ @@ -196,7 +196,7 @@ decompress_read(struct zip_source *src, struct deflate *ctx, switch (ret) { case Z_OK: break; - + case Z_STREAM_END: ctx->eof = 1; end = 1; @@ -240,7 +240,7 @@ decompress_read(struct zip_source *src, struct deflate *ctx, return (ctx->e[0] == 0) ? 0 : -1; } - + static zip_int64_t deflate_compress(struct zip_source *src, void *ud, void *data, @@ -311,7 +311,7 @@ deflate_compress(struct zip_source *src, void *ud, void *data, } } - + static zip_int64_t deflate_decompress(struct zip_source *src, void *ud, void *data, @@ -379,10 +379,10 @@ deflate_decompress(struct zip_source *src, void *ud, void *data, ctx->e[1] = 0; return -1; } - + } - + static void deflate_free(struct deflate *ctx) diff --git a/ext/zip/lib/zip_source_error.c b/ext/zip/lib/zip_source_error.c index f6f802c85b..0e7ce26099 100644 --- a/ext/zip/lib/zip_source_error.c +++ b/ext/zip/lib/zip_source_error.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + void zip_source_error(struct zip_source *src, int *ze, int *se) diff --git a/ext/zip/lib/zip_source_file.c b/ext/zip/lib/zip_source_file.c index 79c8ee5aca..1f7f7b2366 100644 --- a/ext/zip/lib/zip_source_file.c +++ b/ext/zip/lib/zip_source_file.c @@ -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 @@ -31,14 +31,14 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <errno.h> #include <stdio.h> #include "zipint.h" - + ZIP_EXTERN struct zip_source * zip_source_file(struct zip *za, const char *fname, zip_uint64_t start, diff --git a/ext/zip/lib/zip_source_filep.c b/ext/zip/lib/zip_source_filep.c index fcebe73bc6..9b1af4da05 100644 --- a/ext/zip/lib/zip_source_filep.c +++ b/ext/zip/lib/zip_source_filep.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <sys/stat.h> #include <errno.h> @@ -56,7 +56,7 @@ struct read_file { static zip_int64_t read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd); - + ZIP_EXTERN struct zip_source * zip_source_filep(struct zip *za, FILE *file, zip_uint64_t start, @@ -73,7 +73,7 @@ zip_source_filep(struct zip *za, FILE *file, zip_uint64_t start, return _zip_source_file_or_p(za, NULL, file, start, len, 1, NULL); } - + struct zip_source * _zip_source_file_or_p(struct zip *za, const char *fname, FILE *file, @@ -118,7 +118,7 @@ _zip_source_file_or_p(struct zip *za, const char *fname, FILE *file, return zs; } - + static zip_int64_t read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) @@ -150,13 +150,13 @@ read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) } z->remain = z->len; return 0; - + case ZIP_SOURCE_READ: if (z->remain != -1) n = len > (zip_uint64_t)z->remain ? (zip_uint64_t)z->remain : len; else n = len; - + if (n > SIZE_MAX) n = SIZE_MAX; @@ -181,7 +181,7 @@ read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) z->remain -= i; return (zip_int64_t)i; - + case ZIP_SOURCE_CLOSE: if (z->fname) { fclose(z->f); @@ -200,7 +200,7 @@ read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) struct zip_stat *st; struct stat fst; int err; - + if (z->f) err = fstat(fileno(z->f), &fst); else @@ -213,7 +213,7 @@ read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) } st = (struct zip_stat *)data; - + zip_stat_init(st); st->mtime = fst.st_mtime; st->valid |= ZIP_STAT_MTIME; diff --git a/ext/zip/lib/zip_source_free.c b/ext/zip/lib/zip_source_free.c index b1e7840496..ae24ce9299 100644 --- a/ext/zip/lib/zip_source_free.c +++ b/ext/zip/lib/zip_source_free.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + ZIP_EXTERN void zip_source_free(struct zip_source *src) diff --git a/ext/zip/lib/zip_source_function.c b/ext/zip/lib/zip_source_function.c index cb92e339b4..4e9d71e674 100644 --- a/ext/zip/lib/zip_source_function.c +++ b/ext/zip/lib/zip_source_function.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + ZIP_EXTERN struct zip_source * zip_source_function(struct zip *za, zip_source_callback zcb, void *ud) @@ -52,11 +52,11 @@ zip_source_function(struct zip *za, zip_source_callback zcb, void *ud) zs->cb.f = zcb; zs->ud = ud; - + return zs; } - + struct zip_source * _zip_source_new(struct zip *za) diff --git a/ext/zip/lib/zip_source_layered.c b/ext/zip/lib/zip_source_layered.c index ad2870333c..c53d4fa3da 100644 --- a/ext/zip/lib/zip_source_layered.c +++ b/ext/zip/lib/zip_source_layered.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + struct zip_source * zip_source_layered(struct zip *za, struct zip_source *src, @@ -54,6 +54,6 @@ zip_source_layered(struct zip *za, struct zip_source *src, zs->src = src; zs->cb.l = cb; zs->ud = ud; - + return zs; } diff --git a/ext/zip/lib/zip_source_open.c b/ext/zip/lib/zip_source_open.c index 7ea82e3362..65a8d7fbf7 100644 --- a/ext/zip/lib/zip_source_open.c +++ b/ext/zip/lib/zip_source_open.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + int zip_source_open(struct zip_source *src) @@ -58,10 +58,10 @@ zip_source_open(struct zip_source *src) } ret = src->cb.l(src->src, src->ud, NULL, 0, ZIP_SOURCE_OPEN); - + if (ret < 0) { zip_source_close(src->src); - + if (ret == ZIP_SOURCE_ERR_LOWER) src->error_source = ZIP_LES_LOWER; else @@ -71,6 +71,6 @@ zip_source_open(struct zip_source *src) } src->is_open = 1; - + return 0; } diff --git a/ext/zip/lib/zip_source_pkware.c b/ext/zip/lib/zip_source_pkware.c index f6cbf1d2d5..905dbc1d26 100644 --- a/ext/zip/lib/zip_source_pkware.c +++ b/ext/zip/lib/zip_source_pkware.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include <string.h> @@ -49,7 +49,7 @@ struct trad_pkware { #define KEY1 591751049 #define KEY2 878082192 - + static void decrypt(struct trad_pkware *, zip_uint8_t *, const zip_uint8_t *, zip_uint64_t, int); @@ -58,7 +58,7 @@ static zip_int64_t pkware_decrypt(struct zip_source *, void *, void *, zip_uint64_t, enum zip_source_cmd); static void pkware_free(struct trad_pkware *); - + struct zip_source * zip_source_pkware(struct zip *za, struct zip_source *src, @@ -96,7 +96,7 @@ zip_source_pkware(struct zip *za, struct zip_source *src, return s2; } - + static void decrypt(struct trad_pkware *ctx, zip_uint8_t *out, const zip_uint8_t *in, @@ -128,7 +128,7 @@ decrypt(struct trad_pkware *ctx, zip_uint8_t *out, const zip_uint8_t *in, } } - + static int decrypt_header(struct zip_source *src, struct trad_pkware *ctx) @@ -142,7 +142,7 @@ decrypt_header(struct zip_source *src, struct trad_pkware *ctx) zip_source_error(src, ctx->e, ctx->e+1); return -1; } - + if (n != HEADERLEN) { ctx->e[0] = ZIP_ER_EOF; ctx->e[1] = 0; @@ -168,7 +168,7 @@ decrypt_header(struct zip_source *src, struct trad_pkware *ctx) return 0; } - + static zip_int64_t pkware_decrypt(struct zip_source *src, void *ud, void *data, @@ -225,7 +225,7 @@ pkware_decrypt(struct zip_source *src, void *ud, void *data, } } - + static void pkware_free(struct trad_pkware *ctx) diff --git a/ext/zip/lib/zip_source_pop.c b/ext/zip/lib/zip_source_pop.c index cd9cb529b5..166ded8323 100644 --- a/ext/zip/lib/zip_source_pop.c +++ b/ext/zip/lib/zip_source_pop.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + struct zip_source * zip_source_pop(struct zip_source *src) @@ -55,7 +55,7 @@ zip_source_pop(struct zip_source *src) if (src->is_open) (void)src->cb.l(src, src->ud, NULL, 0, ZIP_SOURCE_CLOSE); (void)src->cb.l(src, src->ud, NULL, 0, ZIP_SOURCE_FREE); - + free(src); } diff --git a/ext/zip/lib/zip_source_read.c b/ext/zip/lib/zip_source_read.c index 81b90ba42d..927280e913 100644 --- a/ext/zip/lib/zip_source_read.c +++ b/ext/zip/lib/zip_source_read.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + zip_int64_t zip_source_read(struct zip_source *src, void *data, zip_uint64_t len) @@ -59,6 +59,6 @@ zip_source_read(struct zip_source *src, void *data, zip_uint64_t len) src->error_source = ZIP_LES_UPPER; return -1; } - + return ret; } diff --git a/ext/zip/lib/zip_source_stat.c b/ext/zip/lib/zip_source_stat.c index 85ae6a2fd6..732db4f55f 100644 --- a/ext/zip/lib/zip_source_stat.c +++ b/ext/zip/lib/zip_source_stat.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + int zip_source_stat(struct zip_source *src, struct zip_stat *st) @@ -67,6 +67,6 @@ zip_source_stat(struct zip_source *src, struct zip_stat *st) src->error_source = ZIP_LES_UPPER; return -1; } - + return 0; } diff --git a/ext/zip/lib/zip_source_window.c b/ext/zip/lib/zip_source_window.c index 24d8648c8c..210b584806 100644 --- a/ext/zip/lib/zip_source_window.c +++ b/ext/zip/lib/zip_source_window.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include <string.h> @@ -48,7 +48,7 @@ struct window { static zip_int64_t window_read(struct zip_source *, void *, void *, zip_uint64_t, enum zip_source_cmd); - + struct zip_source * zip_source_window(struct zip *za, struct zip_source *src, zip_uint64_t start, zip_uint64_t len) @@ -72,7 +72,7 @@ zip_source_window(struct zip *za, struct zip_source *src, zip_uint64_t start, zi return zip_source_layered(za, src, window_read, ctx); } - + static zip_int64_t window_read(struct zip_source *src, void *_ctx, void *data, @@ -102,7 +102,7 @@ window_read(struct zip_source *src, void *_ctx, void *data, case ZIP_SOURCE_READ: if (len > ctx->left) len = ctx->left; - + if (len == 0) return 0; @@ -134,7 +134,7 @@ window_read(struct zip_source *src, void *_ctx, void *data, st->valid &= ~(ZIP_STAT_CRC|ZIP_STAT_COMP_SIZE); } return 0; - + case ZIP_SOURCE_ERROR: memcpy(data, ctx->e, sizeof(ctx->e)); return 0; @@ -146,5 +146,5 @@ window_read(struct zip_source *src, void *_ctx, void *data, default: return -1; } - + } diff --git a/ext/zip/lib/zip_source_zip.c b/ext/zip/lib/zip_source_zip.c index e4fc2229f7..0c3559e342 100644 --- a/ext/zip/lib/zip_source_zip.c +++ b/ext/zip/lib/zip_source_zip.c @@ -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 @@ -31,14 +31,14 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include <string.h> #include "zipint.h" - + ZIP_EXTERN struct zip_source * zip_source_zip(struct zip *za, struct zip *srcza, zip_uint64_t srcidx, @@ -48,10 +48,10 @@ zip_source_zip(struct zip *za, struct zip *srcza, zip_uint64_t srcidx, _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } - + if (len == -1) len = 0; - + if (start == 0 && len == 0) flags |= ZIP_FL_COMPRESSED; else diff --git a/ext/zip/lib/zip_source_zip_new.c b/ext/zip/lib/zip_source_zip_new.c index 353489a653..4b62721ca3 100644 --- a/ext/zip/lib/zip_source_zip_new.c +++ b/ext/zip/lib/zip_source_zip_new.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + struct zip_source * _zip_source_zip_new(struct zip *za, struct zip *srcza, zip_uint64_t srcidx, zip_flags_t flags, @@ -130,7 +130,7 @@ _zip_source_zip_new(struct zip *za, struct zip *srcza, zip_uint64_t srcidx, zip_ if ((src=_zip_source_file_or_p(za, NULL, srcza->zp, offset, (zip_int64_t)st.comp_size, 0, &st)) == NULL) return NULL; } - + if (enc_impl) { if ((s2=enc_impl(za, src, st.encryption_method, 0, password)) == NULL) { zip_source_free(src); diff --git a/ext/zip/lib/zip_stat.c b/ext/zip/lib/zip_stat.c index 8254627d92..f6ba171d8d 100644 --- a/ext/zip/lib/zip_stat.c +++ b/ext/zip/lib/zip_stat.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN int zip_stat(struct zip *za, const char *fname, zip_flags_t flags, struct zip_stat *st) diff --git a/ext/zip/lib/zip_stat_index.c b/ext/zip/lib/zip_stat_index.c index 2505c80138..c5712b6d0b 100644 --- a/ext/zip/lib/zip_stat_index.c +++ b/ext/zip/lib/zip_stat_index.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN int zip_stat_index(struct zip *za, zip_uint64_t index, zip_flags_t flags, @@ -49,7 +49,7 @@ zip_stat_index(struct zip *za, zip_uint64_t index, zip_flags_t flags, if ((name=zip_get_name(za, index, flags)) == NULL) return -1; - + if ((flags & ZIP_FL_UNCHANGED) == 0 && ZIP_ENTRY_DATA_CHANGED(za->entry+index)) { @@ -83,6 +83,6 @@ zip_stat_index(struct zip *za, zip_uint64_t index, zip_flags_t flags, st->index = index; st->name = name; st->valid |= ZIP_STAT_INDEX|ZIP_STAT_NAME; - + return 0; } diff --git a/ext/zip/lib/zip_stat_init.c b/ext/zip/lib/zip_stat_init.c index d17613bf5e..21841668d7 100644 --- a/ext/zip/lib/zip_stat_init.c +++ b/ext/zip/lib/zip_stat_init.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN void zip_stat_init(struct zip_stat *st) diff --git a/ext/zip/lib/zip_strerror.c b/ext/zip/lib/zip_strerror.c index 9ebee144f9..37774b23ec 100644 --- a/ext/zip/lib/zip_strerror.c +++ b/ext/zip/lib/zip_strerror.c @@ -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 @@ -31,11 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" - + ZIP_EXTERN const char * zip_strerror(struct zip *za) diff --git a/ext/zip/lib/zip_string.c b/ext/zip/lib/zip_string.c index 4e8709b5f7..e3905da01b 100644 --- a/ext/zip/lib/zip_string.c +++ b/ext/zip/lib/zip_string.c @@ -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 @@ -31,29 +31,29 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include <string.h> #include "zipint.h" - + zip_uint32_t _zip_string_crc32(const struct zip_string *s) { zip_uint32_t crc; - + crc = (zip_uint32_t)crc32(0L, Z_NULL, 0); - if (s != NULL) + if (s != NULL) crc = (zip_uint32_t)crc32(crc, s->raw, s->length); return crc; } - + int _zip_string_equal(const struct zip_string *a, const struct zip_string *b) @@ -69,7 +69,7 @@ _zip_string_equal(const struct zip_string *a, const struct zip_string *b) return (memcmp(a->raw, b->raw, a->length) == 0); } - + void _zip_string_free(struct zip_string *s) @@ -82,7 +82,7 @@ _zip_string_free(struct zip_string *s) free(s); } - + const zip_uint8_t * _zip_string_get(struct zip_string *string, zip_uint32_t *lenp, zip_flags_t flags, struct zip_error *error) @@ -113,13 +113,13 @@ _zip_string_get(struct zip_string *string, zip_uint32_t *lenp, zip_flags_t flags return string->converted; } } - + if (lenp) *lenp = string->length; return string->raw; } - + zip_uint16_t _zip_string_length(const struct zip_string *s) @@ -130,14 +130,14 @@ _zip_string_length(const struct zip_string *s) return s->length; } - + struct zip_string * _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, struct zip_error *error) { struct zip_string *s; enum zip_encoding_type expected_encoding; - + if (length == 0) return NULL; @@ -155,7 +155,7 @@ _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, _zip_error_set(error, ZIP_ER_INVAL, 0); return NULL; } - + if ((s=(struct zip_string *)malloc(sizeof(*s))) == NULL) { _zip_error_set(error, ZIP_ER_MEMORY, 0); return NULL; @@ -180,17 +180,17 @@ _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, return NULL; } } - + return s; } - + void _zip_string_write(const struct zip_string *s, FILE *f) { if (s == NULL) return; - + fwrite(s->raw, s->length, 1, f); } diff --git a/ext/zip/lib/zip_unchange.c b/ext/zip/lib/zip_unchange.c index 5f0e753b78..9730bd2ce3 100644 --- a/ext/zip/lib/zip_unchange.c +++ b/ext/zip/lib/zip_unchange.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + ZIP_EXTERN int zip_unchange(struct zip *za, zip_uint64_t idx) @@ -45,13 +45,13 @@ zip_unchange(struct zip *za, zip_uint64_t idx) return _zip_unchange(za, idx, 0); } - + int _zip_unchange(struct zip *za, zip_uint64_t idx, int allow_duplicates) { zip_int64_t i; - + if (idx >= za->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; diff --git a/ext/zip/lib/zip_unchange_all.c b/ext/zip/lib/zip_unchange_all.c index bbc2825eb6..7fbb92467a 100644 --- a/ext/zip/lib/zip_unchange_all.c +++ b/ext/zip/lib/zip_unchange_all.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + ZIP_EXTERN int zip_unchange_all(struct zip *za) diff --git a/ext/zip/lib/zip_unchange_archive.c b/ext/zip/lib/zip_unchange_archive.c index e24ee21727..4320702191 100644 --- a/ext/zip/lib/zip_unchange_archive.c +++ b/ext/zip/lib/zip_unchange_archive.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include "zipint.h" - + ZIP_EXTERN int zip_unchange_archive(struct zip *za) @@ -47,7 +47,7 @@ zip_unchange_archive(struct zip *za) za->comment_changes = NULL; za->comment_changed = 0; } - + za->ch_flags = za->flags; return 0; diff --git a/ext/zip/lib/zip_unchange_data.c b/ext/zip/lib/zip_unchange_data.c index fa25feb038..b924f2cb23 100644 --- a/ext/zip/lib/zip_unchange_data.c +++ b/ext/zip/lib/zip_unchange_data.c @@ -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 @@ -31,7 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" diff --git a/ext/zip/lib/zip_utf-8.c b/ext/zip/lib/zip_utf-8.c index c36fad13f5..ad2c5627a5 100644 --- a/ext/zip/lib/zip_utf-8.c +++ b/ext/zip/lib/zip_utf-8.c @@ -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 @@ -31,13 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" #include <stdlib.h> - + static const zip_uint16_t _cp437_to_unicode[256] = { /* 0x00 - 0x0F */ @@ -114,7 +114,7 @@ static const zip_uint16_t _cp437_to_unicode[256] = { #define UTF_8_CONTINUE_MASK 0xc0 #define UTF_8_CONTINUE_MATCH 0x80 - + enum zip_encoding_type _zip_guess_encoding(struct zip_string *str, enum zip_encoding_type expected_encoding) @@ -173,11 +173,11 @@ done: if (expected_encoding != enc && enc != ZIP_ENCODING_ASCII) return ZIP_ENCODING_ERROR; } - + return enc; } - + static zip_uint32_t _zip_unicode_to_utf8_len(zip_uint32_t codepoint) @@ -191,7 +191,7 @@ _zip_unicode_to_utf8_len(zip_uint32_t codepoint) return 4; } - + static zip_uint32_t _zip_unicode_to_utf8(zip_uint32_t codepoint, zip_uint8_t *buf) @@ -218,7 +218,7 @@ _zip_unicode_to_utf8(zip_uint32_t codepoint, zip_uint8_t *buf) return 4; } - + zip_uint8_t * _zip_cp437_to_utf8(const zip_uint8_t * const _cp437buf, zip_uint32_t len, diff --git a/ext/zip/lib/zipconf.h b/ext/zip/lib/zipconf.h index 955d85b4ef..1f8f075f50 100644 --- a/ext/zip/lib/zipconf.h +++ b/ext/zip/lib/zipconf.h @@ -1,129 +1,129 @@ -#ifndef _HAD_ZIPCONF_H
-#define _HAD_ZIPCONF_H
-
-/*
- zipconf.h -- platform specific include file
-
- This file was generated automatically by CMake
- based on ../cmake-zipconf.h.in.
- */
-#define LIBZIP_VERSION "0.11.2"
-/* #undef HAVE_INTTYPES_H_LIBZIP */
-
-#if defined(_WIN32)
-# if _MSC_VER > 1500
-# define HAVE_STDINT_H_LIBZIP
-# else
-# include "win32/php_stdint.h"
-# endif
-#else
-# include <inttypes.h>
-#endif
-#define HAVE_SYS_TYPES_H_LIBZIP
-#define HAVE___INT8_LIBZIP
-#define HAVE_INT8_T_LIBZIP
-#define HAVE_UINT8_T_LIBZIP
-#define HAVE___INT16_LIBZIP
-#define HAVE_INT16_T_LIBZIP
-#define HAVE_UINT16_T_LIBZIP
-#define HAVE___INT32_LIBZIP
-#define HAVE_INT32_T_LIBZIP
-#define HAVE_UINT32_T_LIBZIP
-#define HAVE___INT64_LIBZIP
-#define HAVE_INT64_T_LIBZIP
-#define HAVE_UINT64_T_LIBZIP
-#define SHORT_LIBZIP 2
-#define INT_LIBZIP 4
-#define LONG_LIBZIP 4
-#define LONG_LONG_LIBZIP 8
-
-#if defined(HAVE_STDINT_H_LIBZIP)
-#include <stdint.h>
-#elif defined(HAVE_INTTYPES_H_LIBZIP)
-#include <inttypes.h>
-#elif defined(HAVE_SYS_TYPES_H_LIBZIP)
-#include <sys/types.h>
-#endif
-
-#if defined(HAVE_INT8_T_LIBZIP)
-typedef int8_t zip_int8_t;
-#elif defined(HAVE___INT8_LIBZIP)
-typedef __int8 zip_int8_t;
-#else
-typedef signed char zip_int8_t;
-#endif
-#if defined(HAVE_UINT8_T_LIBZIP)
-typedef uint8_t zip_uint8_t;
-#elif defined(HAVE___INT8_LIBZIP)
-typedef unsigned __int8 zip_uint8_t;
-#else
-typedef unsigned char zip_uint8_t;
-#endif
-#if defined(HAVE_INT16_T_LIBZIP)
-typedef int16_t zip_int16_t;
-#elif defined(HAVE___INT16_LIBZIP)
-typedef __int16 zip_int16_t;
-#elif defined(SHORT_LIBZIP) && SHORT_LIBZIP == 2
-typedef signed short zip_int16_t;
-#endif
-#if defined(HAVE_UINT16_T_LIBZIP)
-typedef uint16_t zip_uint16_t;
-#elif defined(HAVE___INT16_LIBZIP)
-typedef unsigned __int16 zip_uint16_t;
-#elif defined(SHORT_LIBZIP) && SHORT_LIBZIP == 2
-typedef unsigned short zip_uint16_t;
-#endif
-#if defined(HAVE_INT32_T_LIBZIP)
-typedef int32_t zip_int32_t;
-#elif defined(HAVE___INT32_LIBZIP)
-typedef __int32 zip_int32_t;
-#elif defined(INT_LIBZIP) && INT_LIBZIP == 4
-typedef signed int zip_int32_t;
-#elif defined(LONG_LIBZIP) && LONG_LIBZIP == 4
-typedef signed long zip_int32_t;
-#endif
-#if defined(HAVE_UINT32_T_LIBZIP)
-typedef uint32_t zip_uint32_t;
-#elif defined(HAVE___INT32_LIBZIP)
-typedef unsigned __int32 zip_uint32_t;
-#elif defined(INT_LIBZIP) && INT_LIBZIP == 4
-typedef unsigned int zip_uint32_t;
-#elif defined(LONG_LIBZIP) && LONG_LIBZIP == 4
-typedef unsigned long zip_uint32_t;
-#endif
-#if defined(HAVE_INT64_T_LIBZIP)
-typedef int64_t zip_int64_t;
-#elif defined(HAVE___INT64_LIBZIP)
-typedef __int64 zip_int64_t;
-#elif defined(LONG_LIBZIP) && LONG_LIBZIP == 8
-typedef signed long zip_int64_t;
-#elif defined(LONG_LONG_LIBZIP) && LONG_LONG_LIBZIP == 8
-typedef signed long long zip_int64_t;
-#endif
-#if defined(HAVE_UINT64_T_LIBZIP)
-typedef uint64_t zip_uint64_t;
-#elif defined(HAVE___INT64_LIBZIP)
-typedef unsigned __int64 zip_uint64_t;
-#elif defined(LONG_LIBZIP) && LONG_LONG_LIBZIP == 8
-typedef unsigned long zip_uint64_t;
-#elif defined(LONG_LONG_LIBZIP) && LONG_LONG_LIBZIP == 8
-typedef unsigned long long zip_uint64_t;
-#endif
-
-#define ZIP_INT8_MIN -0x80
-#define ZIP_INT8_MAX 0x7f
-#define ZIP_UINT8_MAX 0xff
-
-#define ZIP_INT16_MIN -0x8000
-#define ZIP_INT16_MAX 0x7fff
-#define ZIP_UINT16_MAX 0xffff
-
-#define ZIP_INT32_MIN -0x80000000L
-#define ZIP_INT32_MAX 0x7fffffffL
-#define ZIP_UINT32_MAX 0xffffffffLU
-
-#define ZIP_INT64_MIN -0x8000000000000000LL
-#define ZIP_INT64_MAX 0x7fffffffffffffffLL
-#define ZIP_UINT64_MAX 0xffffffffffffffffULL
-
-#endif /* zipconf.h */
+#ifndef _HAD_ZIPCONF_H +#define _HAD_ZIPCONF_H + +/* + zipconf.h -- platform specific include file + + This file was generated automatically by CMake + based on ../cmake-zipconf.h.in. + */ +#define LIBZIP_VERSION "0.11.2" +/* #undef HAVE_INTTYPES_H_LIBZIP */ + +#if defined(_WIN32) +# if _MSC_VER > 1500 +# define HAVE_STDINT_H_LIBZIP +# else +# include "win32/php_stdint.h" +# endif +#else +# include <inttypes.h> +#endif +#define HAVE_SYS_TYPES_H_LIBZIP +#define HAVE___INT8_LIBZIP +#define HAVE_INT8_T_LIBZIP +#define HAVE_UINT8_T_LIBZIP +#define HAVE___INT16_LIBZIP +#define HAVE_INT16_T_LIBZIP +#define HAVE_UINT16_T_LIBZIP +#define HAVE___INT32_LIBZIP +#define HAVE_INT32_T_LIBZIP +#define HAVE_UINT32_T_LIBZIP +#define HAVE___INT64_LIBZIP +#define HAVE_INT64_T_LIBZIP +#define HAVE_UINT64_T_LIBZIP +#define SHORT_LIBZIP 2 +#define INT_LIBZIP 4 +#define LONG_LIBZIP 4 +#define LONG_LONG_LIBZIP 8 + +#if defined(HAVE_STDINT_H_LIBZIP) +#include <stdint.h> +#elif defined(HAVE_INTTYPES_H_LIBZIP) +#include <inttypes.h> +#elif defined(HAVE_SYS_TYPES_H_LIBZIP) +#include <sys/types.h> +#endif + +#if defined(HAVE_INT8_T_LIBZIP) +typedef int8_t zip_int8_t; +#elif defined(HAVE___INT8_LIBZIP) +typedef __int8 zip_int8_t; +#else +typedef signed char zip_int8_t; +#endif +#if defined(HAVE_UINT8_T_LIBZIP) +typedef uint8_t zip_uint8_t; +#elif defined(HAVE___INT8_LIBZIP) +typedef unsigned __int8 zip_uint8_t; +#else +typedef unsigned char zip_uint8_t; +#endif +#if defined(HAVE_INT16_T_LIBZIP) +typedef int16_t zip_int16_t; +#elif defined(HAVE___INT16_LIBZIP) +typedef __int16 zip_int16_t; +#elif defined(SHORT_LIBZIP) && SHORT_LIBZIP == 2 +typedef signed short zip_int16_t; +#endif +#if defined(HAVE_UINT16_T_LIBZIP) +typedef uint16_t zip_uint16_t; +#elif defined(HAVE___INT16_LIBZIP) +typedef unsigned __int16 zip_uint16_t; +#elif defined(SHORT_LIBZIP) && SHORT_LIBZIP == 2 +typedef unsigned short zip_uint16_t; +#endif +#if defined(HAVE_INT32_T_LIBZIP) +typedef int32_t zip_int32_t; +#elif defined(HAVE___INT32_LIBZIP) +typedef __int32 zip_int32_t; +#elif defined(INT_LIBZIP) && INT_LIBZIP == 4 +typedef signed int zip_int32_t; +#elif defined(LONG_LIBZIP) && LONG_LIBZIP == 4 +typedef signed long zip_int32_t; +#endif +#if defined(HAVE_UINT32_T_LIBZIP) +typedef uint32_t zip_uint32_t; +#elif defined(HAVE___INT32_LIBZIP) +typedef unsigned __int32 zip_uint32_t; +#elif defined(INT_LIBZIP) && INT_LIBZIP == 4 +typedef unsigned int zip_uint32_t; +#elif defined(LONG_LIBZIP) && LONG_LIBZIP == 4 +typedef unsigned long zip_uint32_t; +#endif +#if defined(HAVE_INT64_T_LIBZIP) +typedef int64_t zip_int64_t; +#elif defined(HAVE___INT64_LIBZIP) +typedef __int64 zip_int64_t; +#elif defined(LONG_LIBZIP) && LONG_LIBZIP == 8 +typedef signed long zip_int64_t; +#elif defined(LONG_LONG_LIBZIP) && LONG_LONG_LIBZIP == 8 +typedef signed long long zip_int64_t; +#endif +#if defined(HAVE_UINT64_T_LIBZIP) +typedef uint64_t zip_uint64_t; +#elif defined(HAVE___INT64_LIBZIP) +typedef unsigned __int64 zip_uint64_t; +#elif defined(LONG_LIBZIP) && LONG_LONG_LIBZIP == 8 +typedef unsigned long zip_uint64_t; +#elif defined(LONG_LONG_LIBZIP) && LONG_LONG_LIBZIP == 8 +typedef unsigned long long zip_uint64_t; +#endif + +#define ZIP_INT8_MIN -0x80 +#define ZIP_INT8_MAX 0x7f +#define ZIP_UINT8_MAX 0xff + +#define ZIP_INT16_MIN -0x8000 +#define ZIP_INT16_MAX 0x7fff +#define ZIP_UINT16_MAX 0xffff + +#define ZIP_INT32_MIN -0x80000000L +#define ZIP_INT32_MAX 0x7fffffffL +#define ZIP_UINT32_MAX 0xffffffffLU + +#define ZIP_INT64_MIN -0x8000000000000000LL +#define ZIP_INT64_MAX 0x7fffffffffffffffLL +#define ZIP_UINT64_MAX 0xffffffffffffffffULL + +#endif /* zipconf.h */ diff --git a/ext/zip/lib/zipint.h b/ext/zip/lib/zipint.h index 2b6ed2772f..5a07271aac 100644 --- a/ext/zip/lib/zipint.h +++ b/ext/zip/lib/zipint.h @@ -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 @@ -181,7 +181,7 @@ zip_compression_implementation _zip_get_compression_implementation(zip_int32_t); zip_encryption_implementation _zip_get_encryption_implementation(zip_uint16_t); - + /* This API is not final yet, but we need it internally, so it's private for now. */ @@ -224,7 +224,7 @@ struct zip_source *zip_source_window(struct zip *, struct zip_source *, struct zip_source *zip_source_pop(struct zip_source *); - + /* error source for layered sources */ @@ -290,7 +290,7 @@ struct zip { unsigned int nfile; /* number of opened files within archive */ unsigned int nfile_alloc; /* number of files allocated */ struct zip_file **file; /* opened files within archive */ - + char *tempdir; /* custom temp dir (needed e.g. for OS X sandboxing) */ }; @@ -354,7 +354,7 @@ struct zip_extra_field { zip_uint8_t *data; }; - + struct zip_source { struct zip_source *src; @@ -376,7 +376,7 @@ struct zip_entry { int deleted; }; - + /* file or archive comment, or filename */ @@ -388,7 +388,7 @@ struct zip_string { zip_uint32_t converted_length; /* length of converted */ }; - + /* which files to write, and in which order (name is for torrentzip sorting) */ @@ -397,13 +397,13 @@ struct zip_filelist { const char *name; }; - + extern const char * const _zip_err_str[]; extern const int _zip_nerr_str; extern const int _zip_err_type[]; - + #define ZIP_ENTRY_CHANGED(e, f) ((e)->changes && ((e)->changes->changed & (f))) @@ -411,7 +411,7 @@ extern const int _zip_err_type[]; #define ZIP_IS_RDONLY(za) ((za)->ch_flags & ZIP_AFL_RDONLY) - + zip_int64_t _zip_add_entry(struct zip *); |