From 64002648562362b97fcb78b68366b1b2118ffd5b Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Sun, 31 Dec 2017 05:35:25 +0100 Subject: Trailing whitespaces Signed-off-by: Gabriel Caruso --- ext/zip/lib/mkstemp.c | 4 +- ext/zip/lib/zip_add.c | 2 +- ext/zip/lib/zip_add_dir.c | 2 +- ext/zip/lib/zip_add_entry.c | 2 +- ext/zip/lib/zip_buffer.c | 72 ++++++++++----------- ext/zip/lib/zip_close.c | 34 +++++----- ext/zip/lib/zip_delete.c | 2 +- ext/zip/lib/zip_dir_add.c | 4 +- ext/zip/lib/zip_discard.c | 4 +- ext/zip/lib/zip_entry.c | 2 +- ext/zip/lib/zip_err_str.c | 4 +- ext/zip/lib/zip_error.c | 10 +-- ext/zip/lib/zip_error_clear.c | 2 +- ext/zip/lib/zip_error_get.c | 2 +- ext/zip/lib/zip_error_get_sys_type.c | 2 +- ext/zip/lib/zip_error_strerror.c | 6 +- ext/zip/lib/zip_error_to_str.c | 8 +-- ext/zip/lib/zip_extra_field.c | 46 ++++++------- ext/zip/lib/zip_extra_field_api.c | 40 ++++++------ ext/zip/lib/zip_fclose.c | 4 +- ext/zip/lib/zip_fdopen.c | 4 +- ext/zip/lib/zip_file_add.c | 4 +- ext/zip/lib/zip_file_error_clear.c | 2 +- ext/zip/lib/zip_file_error_get.c | 2 +- ext/zip/lib/zip_file_get_comment.c | 2 +- ext/zip/lib/zip_file_get_external_attributes.c | 2 +- ext/zip/lib/zip_file_get_offset.c | 4 +- ext/zip/lib/zip_file_rename.c | 6 +- ext/zip/lib/zip_file_replace.c | 10 +-- ext/zip/lib/zip_file_set_comment.c | 4 +- ext/zip/lib/zip_file_set_external_attributes.c | 2 +- ext/zip/lib/zip_file_set_mtime.c | 16 ++--- ext/zip/lib/zip_file_strerror.c | 2 +- ext/zip/lib/zip_filerange_crc.c | 4 +- ext/zip/lib/zip_fopen.c | 2 +- ext/zip/lib/zip_fopen_encrypted.c | 2 +- ext/zip/lib/zip_fopen_index.c | 2 +- ext/zip/lib/zip_fopen_index_encrypted.c | 2 +- ext/zip/lib/zip_fread.c | 2 +- ext/zip/lib/zip_get_archive_comment.c | 2 +- ext/zip/lib/zip_get_archive_flag.c | 2 +- ext/zip/lib/zip_get_compression_implementation.c | 2 +- ext/zip/lib/zip_get_encryption_implementation.c | 2 +- ext/zip/lib/zip_get_file_comment.c | 2 +- ext/zip/lib/zip_get_name.c | 2 +- ext/zip/lib/zip_get_num_entries.c | 2 +- ext/zip/lib/zip_get_num_files.c | 2 +- ext/zip/lib/zip_hash.c | 6 +- ext/zip/lib/zip_io_util.c | 14 ++-- ext/zip/lib/zip_memdup.c | 2 +- ext/zip/lib/zip_name_locate.c | 8 +-- ext/zip/lib/zip_new.c | 4 +- ext/zip/lib/zip_open.c | 82 ++++++++++++------------ ext/zip/lib/zip_rename.c | 2 +- ext/zip/lib/zip_replace.c | 2 +- ext/zip/lib/zip_set_archive_comment.c | 4 +- ext/zip/lib/zip_set_archive_flag.c | 4 +- ext/zip/lib/zip_set_default_password.c | 4 +- ext/zip/lib/zip_set_file_comment.c | 2 +- ext/zip/lib/zip_set_file_compression.c | 10 +-- ext/zip/lib/zip_set_name.c | 4 +- ext/zip/lib/zip_source_begin_write.c | 6 +- ext/zip/lib/zip_source_buffer.c | 40 ++++++------ ext/zip/lib/zip_source_call.c | 12 ++-- ext/zip/lib/zip_source_close.c | 4 +- ext/zip/lib/zip_source_commit_write.c | 10 +-- ext/zip/lib/zip_source_crc.c | 16 ++--- ext/zip/lib/zip_source_deflate.c | 22 +++---- ext/zip/lib/zip_source_error.c | 2 +- ext/zip/lib/zip_source_file.c | 4 +- ext/zip/lib/zip_source_filep.c | 74 ++++++++++----------- ext/zip/lib/zip_source_free.c | 10 +-- ext/zip/lib/zip_source_function.c | 8 +-- ext/zip/lib/zip_source_is_deleted.c | 2 +- ext/zip/lib/zip_source_layered.c | 6 +- ext/zip/lib/zip_source_open.c | 6 +- ext/zip/lib/zip_source_pkware.c | 8 +-- ext/zip/lib/zip_source_read.c | 2 +- ext/zip/lib/zip_source_remove.c | 14 ++-- ext/zip/lib/zip_source_rollback_write.c | 4 +- ext/zip/lib/zip_source_seek.c | 20 +++--- ext/zip/lib/zip_source_seek_write.c | 8 +-- ext/zip/lib/zip_source_stat.c | 4 +- ext/zip/lib/zip_source_supports.c | 12 ++-- ext/zip/lib/zip_source_tell.c | 4 +- ext/zip/lib/zip_source_tell_write.c | 4 +- ext/zip/lib/zip_source_window.c | 46 ++++++------- ext/zip/lib/zip_source_write.c | 4 +- ext/zip/lib/zip_source_zip.c | 6 +- ext/zip/lib/zip_source_zip_new.c | 10 +-- ext/zip/lib/zip_stat.c | 2 +- ext/zip/lib/zip_stat_index.c | 6 +- ext/zip/lib/zip_stat_init.c | 4 +- ext/zip/lib/zip_strerror.c | 2 +- ext/zip/lib/zip_string.c | 16 ++--- ext/zip/lib/zip_unchange.c | 6 +- ext/zip/lib/zip_unchange_all.c | 4 +- ext/zip/lib/zip_unchange_archive.c | 4 +- ext/zip/lib/zip_unchange_data.c | 2 +- ext/zip/lib/zip_utf-8.c | 4 +- 100 files changed, 454 insertions(+), 454 deletions(-) (limited to 'ext/zip/lib') diff --git a/ext/zip/lib/mkstemp.c b/ext/zip/lib/mkstemp.c index d1df8a5ca4..df265be214 100644 --- a/ext/zip/lib/mkstemp.c +++ b/ext/zip/lib/mkstemp.c @@ -64,7 +64,7 @@ _zip_mkstemp(char *path) return ret; } #else - int fd; + int fd; char *start, *trv; struct stat sbuf; pid_t pid; @@ -82,7 +82,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/zip_add.c b/ext/zip/lib/zip_add.c index d1be133b6d..1b42cd89b8 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 diff --git a/ext/zip/lib/zip_add_dir.c b/ext/zip/lib/zip_add_dir.c index 14bdeda112..82ec5f302c 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 diff --git a/ext/zip/lib/zip_add_entry.c b/ext/zip/lib/zip_add_entry.c index 9a9465c5f0..d72d903910 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 diff --git a/ext/zip/lib/zip_buffer.c b/ext/zip/lib/zip_buffer.c index 43864f9ba9..eae6b66ee9 100644 --- a/ext/zip/lib/zip_buffer.c +++ b/ext/zip/lib/zip_buffer.c @@ -1,10 +1,10 @@ /* zip_buffer.c -- bounds checked access to memory buffer Copyright (C) 2014 Dieter Baron and Thomas Klausner - + This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -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 @@ -49,11 +49,11 @@ _zip_buffer_free(zip_buffer_t *buffer) if (buffer == NULL) { return; } - + if (buffer->free_data) { free(buffer->data); } - + free(buffer); } @@ -69,12 +69,12 @@ zip_uint8_t * _zip_buffer_get(zip_buffer_t *buffer, zip_uint64_t length) { zip_uint8_t *data; - + if (!buffer->ok || buffer->offset + length < length || buffer->offset + length > buffer->size) { buffer->ok = false; return NULL; } - + data = buffer->data + buffer->offset; buffer->offset += length; return data; @@ -85,11 +85,11 @@ zip_uint16_t _zip_buffer_get_16(zip_buffer_t *buffer) { zip_uint8_t *data = _zip_buffer_get(buffer, 2); - + if (data == NULL) { return 0; } - + return (zip_uint16_t)(data[0] + (data[1] << 8)); } @@ -98,11 +98,11 @@ zip_uint32_t _zip_buffer_get_32(zip_buffer_t *buffer) { zip_uint8_t *data = _zip_buffer_get(buffer, 4); - + if (data == NULL) { return 0; } - + return ((((((zip_uint32_t)data[3] << 8) + data[2]) << 8) + data[1]) << 8) + data[0]; } @@ -111,7 +111,7 @@ zip_uint64_t _zip_buffer_get_64(zip_buffer_t *buffer) { zip_uint8_t *data = _zip_buffer_get(buffer, 8); - + if (data == NULL) { return 0; } @@ -125,11 +125,11 @@ zip_uint8_t _zip_buffer_get_8(zip_buffer_t *buffer) { zip_uint8_t *data = _zip_buffer_get(buffer, 1); - + if (data == NULL) { return 0; } - + return data[0]; } @@ -146,7 +146,7 @@ _zip_buffer_new(zip_uint8_t *data, zip_uint64_t size) { bool free_data = (data == NULL); zip_buffer_t *buffer; - + if (data == NULL) { if ((data = (zip_uint8_t *)malloc(size)) == NULL) { return NULL; @@ -159,13 +159,13 @@ _zip_buffer_new(zip_uint8_t *data, zip_uint64_t size) } return NULL; } - + buffer->ok = true; buffer->data = data; buffer->size = size; buffer->offset = 0; buffer->free_data = free_data; - + return buffer; } @@ -174,17 +174,17 @@ zip_buffer_t * _zip_buffer_new_from_source(zip_source_t *src, zip_uint64_t size, zip_uint8_t *buf, zip_error_t *error) { zip_buffer_t *buffer; - + if ((buffer = _zip_buffer_new(buf, size)) == NULL) { zip_error_set(error, ZIP_ER_MEMORY, 0); return NULL; } - + if (_zip_read(src, buffer->data, size, error) < 0) { _zip_buffer_free(buffer); return NULL; } - + return buffer; } @@ -207,11 +207,11 @@ int _zip_buffer_put(zip_buffer_t *buffer, const void *src, size_t length) { zip_uint8_t *dst = _zip_buffer_get(buffer, length); - + if (dst == NULL) { return -1; } - + memcpy(dst, src, length); return 0; } @@ -221,14 +221,14 @@ int _zip_buffer_put_16(zip_buffer_t *buffer, zip_uint16_t i) { zip_uint8_t *data = _zip_buffer_get(buffer, 2); - + if (data == NULL) { return -1; } data[0] = (zip_uint8_t)(i & 0xff); data[1] = (zip_uint8_t)((i >> 8) & 0xff); - + return 0; } @@ -237,16 +237,16 @@ int _zip_buffer_put_32(zip_buffer_t *buffer, zip_uint32_t i) { zip_uint8_t *data = _zip_buffer_get(buffer, 4); - + if (data == NULL) { return -1; } - + data[0] = (zip_uint8_t)(i & 0xff); data[1] = (zip_uint8_t)((i >> 8) & 0xff); data[2] = (zip_uint8_t)((i >> 16) & 0xff); data[3] = (zip_uint8_t)((i >> 24) & 0xff); - + return 0; } @@ -255,11 +255,11 @@ int _zip_buffer_put_64(zip_buffer_t *buffer, zip_uint64_t i) { zip_uint8_t *data = _zip_buffer_get(buffer, 8); - + if (data == NULL) { return -1; } - + data[0] = (zip_uint8_t)(i & 0xff); data[1] = (zip_uint8_t)((i >> 8) & 0xff); data[2] = (zip_uint8_t)((i >> 16) & 0xff); @@ -268,7 +268,7 @@ _zip_buffer_put_64(zip_buffer_t *buffer, zip_uint64_t i) data[5] = (zip_uint8_t)((i >> 40) & 0xff); data[6] = (zip_uint8_t)((i >> 48) & 0xff); data[7] = (zip_uint8_t)((i >> 56) & 0xff); - + return 0; } @@ -277,13 +277,13 @@ int _zip_buffer_put_8(zip_buffer_t *buffer, zip_uint8_t i) { zip_uint8_t *data = _zip_buffer_get(buffer, 1); - + if (data == NULL) { return -1; } - + data[0] = i; - + return 0; } @@ -295,10 +295,10 @@ _zip_buffer_set_offset(zip_buffer_t *buffer, zip_uint64_t offset) buffer->ok = false; return -1; } - + buffer->ok = true; buffer->offset = offset; - + return 0; } @@ -306,7 +306,7 @@ _zip_buffer_set_offset(zip_buffer_t *buffer, zip_uint64_t offset) int _zip_buffer_skip(zip_buffer_t *buffer, zip_uint64_t length) { zip_uint64_t offset = buffer->offset + length; - + if (offset < buffer->offset) { buffer->ok = false; return -1; diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c index b5eca67a46..b3379cfae5 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 @@ -84,7 +84,7 @@ zip_close(zip_t *za) } zip_discard(za); return 0; - } + } if (!changed) { zip_discard(za); @@ -95,7 +95,7 @@ zip_close(zip_t *za) zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); return -1; } - + if ((filelist=(zip_filelist_t *)malloc(sizeof(filelist[0])*(size_t)survivors)) == NULL) return -1; @@ -109,7 +109,7 @@ zip_close(zip_t *za) zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); return -1; } - + filelist[j].idx = i; j++; } @@ -124,7 +124,7 @@ zip_close(zip_t *za) free(filelist); return -1; } - + error = 0; for (j=0; jerror, src); return -1; @@ -266,7 +266,7 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de) 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)))) @@ -289,7 +289,7 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de) if (st.comp_method == ZIP_CM_STORE || (ZIP_CM_IS_DEFAULT(de->comp_method) && st.comp_method != de->comp_method)) { zip_source_t *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); @@ -338,7 +338,7 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de) } ret = copy_source(za, s2); - + if (zip_source_stat(s2, &st) < 0) ret = -1; @@ -374,14 +374,14 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de) if ((ret=_zip_dirent_write(za, de, flags)) < 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 (zip_source_seek_write(za->src, offend, SEEK_SET) < 0) { _zip_error_set_from_source(&za->error, za->src); return -1; @@ -406,7 +406,7 @@ copy_data(zip_t *za, zip_uint64_t len) if (_zip_write(za, buf, n) < 0) { return -1; } - + len -= n; } @@ -433,14 +433,14 @@ copy_source(zip_t *za, zip_source_t *src) break; } } - + if (n < 0) { _zip_error_set_from_source(&za->error, src); ret = -1; } zip_source_close(src); - + return ret; } @@ -449,7 +449,7 @@ static int write_cdir(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivors) { zip_int64_t cd_start, end, size; - + if ((cd_start = zip_source_tell_write(za->src)) < 0) { return -1; } @@ -457,7 +457,7 @@ write_cdir(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivors) if ((size=_zip_cdir_write(za, filelist, survivors)) < 0) { return -1; } - + if ((end = zip_source_tell_write(za->src)) < 0) { return -1; } diff --git a/ext/zip/lib/zip_delete.c b/ext/zip/lib/zip_delete.c index 34520b0310..a31be1e6b0 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 diff --git a/ext/zip/lib/zip_dir_add.c b/ext/zip/lib/zip_dir_add.c index f535b21f21..d8566cb2ce 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 @@ -75,7 +75,7 @@ zip_dir_add(zip_t *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_discard.c b/ext/zip/lib/zip_discard.c index 1876c84f0c..a26987f5d1 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 @@ -72,7 +72,7 @@ zip_discard(zip_t *za) free(za->open_source); zip_error_fini(&za->error); - + free(za); return; diff --git a/ext/zip/lib/zip_entry.c b/ext/zip/lib/zip_entry.c index 6f89006861..aee4866820 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 diff --git a/ext/zip/lib/zip_err_str.c b/ext/zip/lib/zip_err_str.c index 65698be00e..9c9adb5590 100644 --- a/ext/zip/lib/zip_err_str.c +++ b/ext/zip/lib/zip_err_str.c @@ -31,7 +31,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", "Operation not supported", @@ -71,7 +71,7 @@ const int _zip_err_type[] = { S, N, N, - N, + N, N, N, N, diff --git a/ext/zip/lib/zip_error.c b/ext/zip/lib/zip_error.c index 43ddf4f9cb..2fbfccfcb1 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 @@ -77,7 +77,7 @@ zip_error_init_with_code(zip_error_t *error, int ze) default: error->sys_err = 0; break; - } + } } @@ -85,7 +85,7 @@ ZIP_EXTERN int zip_error_system_type(const zip_error_t *error) { if (error->zip_err < 0 || error->zip_err >= _zip_nerr_str) return ZIP_ET_NONE; - + return _zip_err_type[error->zip_err]; } @@ -144,11 +144,11 @@ zip_int64_t zip_error_to_data(const zip_error_t *error, void *data, zip_uint64_t length) { int *e = (int *)data; - + if (length < sizeof(int)*2) { return -1; } - + e[0] = zip_error_code_zip(error); e[1] = zip_error_code_system(error); return sizeof(int)*2; diff --git a/ext/zip/lib/zip_error_clear.c b/ext/zip/lib/zip_error_clear.c index ec45e688e5..592476e613 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 diff --git a/ext/zip/lib/zip_error_get.c b/ext/zip/lib/zip_error_get.c index c222018993..6821e053f2 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 diff --git a/ext/zip/lib/zip_error_get_sys_type.c b/ext/zip/lib/zip_error_get_sys_type.c index 7e27bbf332..9163869a91 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 diff --git a/ext/zip/lib/zip_error_strerror.c b/ext/zip/lib/zip_error_strerror.c index 29efc8a91c..19151afe68 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 @@ -54,7 +54,7 @@ zip_error_strerror(zip_error_t *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); @@ -75,7 +75,7 @@ zip_error_strerror(zip_error_t *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 22de177842..7f046d6c8f 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 @@ -49,16 +49,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 035047827e..133322aeb1 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 @@ -41,16 +41,16 @@ zip_extra_field_t * _zip_ef_clone(const zip_extra_field_t *ef, zip_error_t *error) { zip_extra_field_t *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) @@ -59,7 +59,7 @@ _zip_ef_clone(const zip_extra_field_t *ef, zip_error_t *error) ef = ef->next; } - + return head; } @@ -89,7 +89,7 @@ _zip_ef_delete_by_id(zip_extra_field_t *ef, zip_uint16_t id, zip_uint16_t id_idx continue; } } - + i++; if (i > id_idx) break; @@ -120,7 +120,7 @@ const zip_uint8_t * _zip_ef_get_by_id(const zip_extra_field_t *ef, zip_uint16_t *lenp, zip_uint16_t id, zip_uint16_t id_idx, zip_flags_t flags, zip_error_t *error) { static const zip_uint8_t empty[1] = { '\0' }; - + int i; i = 0; @@ -215,13 +215,13 @@ _zip_ef_parse(const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags, zip_ zip_error_set(error, ZIP_ER_MEMORY, 0); return false; } - + ef_head = ef = NULL; - + while (_zip_buffer_ok(buffer) && _zip_buffer_left(buffer) >= 4) { zip_uint16_t fid, flen; zip_uint8_t *ef_data; - + fid = _zip_buffer_get_16(buffer); flen = _zip_buffer_get_16(buffer); ef_data = _zip_buffer_get(buffer, flen); @@ -232,7 +232,7 @@ _zip_ef_parse(const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags, zip_ _zip_ef_free(ef_head); return false; } - + if ((ef2=_zip_ef_new(fid, flen, ef_data, flags)) == NULL) { zip_error_set(error, ZIP_ER_MEMORY, 0); _zip_buffer_free(buffer); @@ -270,7 +270,7 @@ _zip_ef_parse(const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags, zip_ else { _zip_ef_free(ef_head); } - + return true; } @@ -280,10 +280,10 @@ _zip_ef_remove_internal(zip_extra_field_t *ef) { zip_extra_field_t *ef_head; zip_extra_field_t *prev, *next; - + ef_head = ef; prev = NULL; - + while (ef) { if (ZIP_EF_IS_INTERNAL(ef->id)) { next = ef->next; @@ -300,7 +300,7 @@ _zip_ef_remove_internal(zip_extra_field_t *ef) ef = ef->next; } } - + return ef_head; } @@ -352,7 +352,7 @@ _zip_ef_write(zip_t *za, const zip_extra_field_t *ef, zip_flags_t flags) } } } - + _zip_buffer_free(buffer); return 0; } @@ -379,28 +379,28 @@ _zip_read_local_ef(zip_t *za, zip_uint64_t idx) if (e->orig->offset + 26 > ZIP_INT64_MAX) { zip_error_set(&za->error, ZIP_ER_SEEK, EFBIG); return -1; - } + } if (zip_source_seek(za->src, (zip_int64_t)(e->orig->offset + 26), SEEK_SET) < 0) { _zip_error_set_from_source(&za->error, za->src); return -1; } - + if ((buffer = _zip_buffer_new_from_source(za->src, sizeof(b), b, &za->error)) == NULL) { return -1; } - + fname_len = _zip_buffer_get_16(buffer); ef_len = _zip_buffer_get_16(buffer); - + if (!_zip_buffer_eof(buffer)) { _zip_buffer_free(buffer); zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); return -1; } - + _zip_buffer_free(buffer); - + if (ef_len > 0) { zip_extra_field_t *ef; zip_uint8_t *ef_raw; @@ -428,7 +428,7 @@ _zip_read_local_ef(zip_t *za, zip_uint64_t idx) } 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 ed93944ac8..d537394525 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 @@ -49,10 +49,10 @@ zip_file_extra_field_delete(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_idx, zi 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; @@ -60,9 +60,9 @@ zip_file_extra_field_delete(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_idx, zi 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; } @@ -82,7 +82,7 @@ zip_file_extra_field_delete_by_id(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_i zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - + if (_zip_get_dirent(za, idx, 0, NULL) == NULL) return -1; @@ -90,10 +90,10 @@ zip_file_extra_field_delete_by_id(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_i 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); @@ -239,12 +239,12 @@ zip_file_extra_field_set(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_ui 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; @@ -252,7 +252,7 @@ zip_file_extra_field_set(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_ui if (_zip_file_extra_field_prepare_for_change(za, idx) < 0) return -1; - + de = za->entry[idx].changes; ef = de->extra_fields; @@ -294,7 +294,7 @@ zip_file_extra_field_set(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_ui 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; @@ -314,7 +314,7 @@ zip_file_extra_field_set(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_ui 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; @@ -322,7 +322,7 @@ zip_file_extra_field_set(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_ui } else de->extra_fields = ef_new; - + return 0; } @@ -332,14 +332,14 @@ int _zip_file_extra_field_prepare_for_change(zip_t *za, zip_uint64_t idx) { zip_entry_t *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; @@ -347,20 +347,20 @@ _zip_file_extra_field_prepare_for_change(zip_t *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 25a201b187..d7be325ce0 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 @@ -41,7 +41,7 @@ ZIP_EXTERN int zip_fclose(zip_file_t *zf) { int ret; - + 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 bbcdf4f6bf..c780a74280 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 @@ -51,7 +51,7 @@ zip_fdopen(int fd_orig, int _flags, int *zep) _zip_set_open_error(zep, NULL, ZIP_ER_INVAL); return NULL; } - + /* We dup() here to avoid messing with the passed in fd. We could not restore it to the original state in case of error. */ diff --git a/ext/zip/lib/zip_file_add.c b/ext/zip/lib/zip_file_add.c index 9944c0f122..b62ea40a4a 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 @@ -48,6 +48,6 @@ zip_file_add(zip_t *za, const char *name, zip_source_t *source, zip_flags_t flag 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 be454982a1..939081d785 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 diff --git a/ext/zip/lib/zip_file_error_get.c b/ext/zip/lib/zip_file_error_get.c index be764fd52d..5889e97507 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 diff --git a/ext/zip/lib/zip_file_get_comment.c b/ext/zip/lib/zip_file_get_comment.c index 55e7dc2890..be2719e3df 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 diff --git a/ext/zip/lib/zip_file_get_external_attributes.c b/ext/zip/lib/zip_file_get_external_attributes.c index b6526cf23a..4093f89486 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 0257b042bc..fe9b60e325 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 @@ -68,6 +68,6 @@ _zip_file_get_offset(const zip_t *za, zip_uint64_t idx, zip_error_t *error) 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 4400938ab5..4407c6a9ff 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 @@ -42,7 +42,7 @@ zip_file_rename(zip_t *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; @@ -55,7 +55,7 @@ zip_file_rename(zip_t *za, zip_uint64_t idx, const char *name, zip_flags_t flags 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 e430efae9e..f5a11fc9d7 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 @@ -57,7 +57,7 @@ zip_int64_t _zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *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; @@ -66,7 +66,7 @@ _zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *s 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); @@ -77,7 +77,7 @@ _zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *s } 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); @@ -101,7 +101,7 @@ _zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *s 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 e455fbd28f..b8e2ad22ea 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 @@ -79,7 +79,7 @@ zip_file_set_comment(zip_t *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 b772c31e07..0a561d0fae 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_set_mtime.c b/ext/zip/lib/zip_file_set_mtime.c index 0cdd31a672..e85958780c 100644 --- a/ext/zip/lib/zip_file_set_mtime.c +++ b/ext/zip/lib/zip_file_set_mtime.c @@ -1,10 +1,10 @@ /* zip_file_set_mtime.c -- set modification time of entry. Copyright (C) 2014 Dieter Baron and Thomas Klausner - + This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -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 @@ -37,19 +37,19 @@ ZIP_EXTERN int zip_file_set_mtime(zip_t *za, zip_uint64_t idx, time_t mtime, zip { zip_entry_t *e; int changed; - + 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; } - + e = za->entry+idx; changed = e->orig == NULL || mtime != e->orig->last_mod; - + if (changed) { if (e->changes == NULL) { if ((e->changes=_zip_dirent_clone(e->orig)) == NULL) { @@ -69,6 +69,6 @@ ZIP_EXTERN int zip_file_set_mtime(zip_t *za, zip_uint64_t idx, time_t mtime, zip } } } - + return 0; } diff --git a/ext/zip/lib/zip_file_strerror.c b/ext/zip/lib/zip_file_strerror.c index 8366f1ea92..280ff13efd 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 diff --git a/ext/zip/lib/zip_filerange_crc.c b/ext/zip/lib/zip_filerange_crc.c index f2a27fab34..45a56956c3 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 @@ -55,7 +55,7 @@ _zip_filerange_crc(zip_source_t *src, zip_uint64_t start, zip_uint64_t len, uLon _zip_error_set_from_source(error, src); return -1; } - + while (len > 0) { n = (zip_int64_t)(len > BUFSIZE ? BUFSIZE : len); if ((n = zip_source_read(src, buf, (zip_uint64_t)n)) < 0) { diff --git a/ext/zip/lib/zip_fopen.c b/ext/zip/lib/zip_fopen.c index 3adb5de651..dfedd724a1 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 diff --git a/ext/zip/lib/zip_fopen_encrypted.c b/ext/zip/lib/zip_fopen_encrypted.c index 5eaf2b04b7..3158801f9c 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 diff --git a/ext/zip/lib/zip_fopen_index.c b/ext/zip/lib/zip_fopen_index.c index 7496f9829f..52b2984b39 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 diff --git a/ext/zip/lib/zip_fopen_index_encrypted.c b/ext/zip/lib/zip_fopen_index_encrypted.c index 92258e85fe..450df97f9d 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 diff --git a/ext/zip/lib/zip_fread.c b/ext/zip/lib/zip_fread.c index 9c1cbe0c4e..1cea7dc2ff 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 diff --git a/ext/zip/lib/zip_get_archive_comment.c b/ext/zip/lib/zip_get_archive_comment.c index 78f8ca09d2..08388c80d4 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 diff --git a/ext/zip/lib/zip_get_archive_flag.c b/ext/zip/lib/zip_get_archive_flag.c index bffe10c119..47210af08d 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 diff --git a/ext/zip/lib/zip_get_compression_implementation.c b/ext/zip/lib/zip_get_compression_implementation.c index c1120d3ea9..a4601e081a 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 diff --git a/ext/zip/lib/zip_get_encryption_implementation.c b/ext/zip/lib/zip_get_encryption_implementation.c index e2f833b416..ada4e71eed 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 diff --git a/ext/zip/lib/zip_get_file_comment.c b/ext/zip/lib/zip_get_file_comment.c index d5f50bf2ab..ca62eee7ab 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 diff --git a/ext/zip/lib/zip_get_name.c b/ext/zip/lib/zip_get_name.c index d29e63658e..9a98707779 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 diff --git a/ext/zip/lib/zip_get_num_entries.c b/ext/zip/lib/zip_get_num_entries.c index c8644a4c59..59d582a8be 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 diff --git a/ext/zip/lib/zip_get_num_files.c b/ext/zip/lib/zip_get_num_files.c index cf96353fcd..7e7c76e6e7 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 diff --git a/ext/zip/lib/zip_hash.c b/ext/zip/lib/zip_hash.c index 7e217aeecd..025f42a5d5 100644 --- a/ext/zip/lib/zip_hash.c +++ b/ext/zip/lib/zip_hash.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 @@ -231,7 +231,7 @@ _zip_hash_lookup(zip_hash_t *hash, const zip_uint8_t *name, zip_flags_t flags, z } zip_error_set(error, ZIP_ER_NOENT, 0); - return -1; + return -1; } void @@ -239,7 +239,7 @@ _zip_hash_revert(zip_hash_t *hash) { zip_uint16_t i; zip_hash_entry_t *entry, *previous; - + for (i = 0; i < hash->table_size; i++) { previous = NULL; entry = hash->table[i]; diff --git a/ext/zip/lib/zip_io_util.c b/ext/zip/lib/zip_io_util.c index b16927defb..f955070b39 100644 --- a/ext/zip/lib/zip_io_util.c +++ b/ext/zip/lib/zip_io_util.c @@ -1,10 +1,10 @@ /* zip_io_util.c -- I/O helper functions Copyright (C) 1999-2015 Dieter Baron and Thomas Klausner - + This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -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 @@ -64,7 +64,7 @@ zip_uint8_t * _zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp, zip_error_t *error) { zip_uint8_t *r; - + if (length == 0 && !nulp) { return NULL; } @@ -77,7 +77,7 @@ _zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp if (buffer) { zip_uint8_t *data = _zip_buffer_get(buffer, length); - + if (data == NULL) { zip_error_set(error, ZIP_ER_MEMORY, 0); free(r); @@ -124,7 +124,7 @@ int _zip_write(zip_t *za, const void *data, zip_uint64_t length) { zip_int64_t n; - + if ((n = zip_source_write(za->src, data, length)) < 0) { _zip_error_set_from_source(&za->error, za->src); return -1; @@ -133,6 +133,6 @@ _zip_write(zip_t *za, const void *data, zip_uint64_t length) zip_error_set(&za->error, ZIP_ER_WRITE, EINTR); return -1; } - + return 0; } diff --git a/ext/zip/lib/zip_memdup.c b/ext/zip/lib/zip_memdup.c index cc6d767d91..9e91793c39 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 diff --git a/ext/zip/lib/zip_name_locate.c b/ext/zip/lib/zip_name_locate.c index 50ca40b1a9..16a3bdef87 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 @@ -68,17 +68,17 @@ _zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags, zip_error_t *e for (i=0; inentry; i++) { fn = _zip_get_name(za, i, flags, error); - + /* newly added (partially filled) entry or error */ if (fn == NULL) continue; - + if (flags & ZIP_FL_NODIR) { p = strrchr(fn, '/'); if (p) fn = p+1; } - + if (cmp(fname, fn) == 0) { _zip_error_clear(error); return (zip_int64_t)i; diff --git a/ext/zip/lib/zip_new.c b/ext/zip/lib/zip_new.c index 562dd76a36..760cb9156b 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 @@ -69,6 +69,6 @@ _zip_new(zip_error_t *error) za->nopen_source = za->nopen_source_alloc = 0; za->open_source = NULL; za->tempdir = NULL; - + return za; } diff --git a/ext/zip/lib/zip_open.c b/ext/zip/lib/zip_open.c index 29409b747d..f088a72b8b 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 @@ -88,17 +88,17 @@ zip_open_from_source(zip_source_t *src, int _flags, zip_error_t *error) { static zip_int64_t needed_support_read = -1; static zip_int64_t needed_support_write = -1; - + unsigned int flags; zip_int64_t supported; exists_t exists; - + if (_flags < 0 || src == NULL) { zip_error_set(error, ZIP_ER_INVAL, 0); return NULL; } flags = (unsigned int)_flags; - + supported = zip_source_supports(src); if (needed_support_read == -1) { needed_support_read = zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_SEEK, ZIP_SOURCE_TELL, ZIP_SOURCE_STAT, -1); @@ -118,7 +118,7 @@ zip_open_from_source(zip_source_t *src, int _flags, zip_error_t *error) } exists = _zip_file_exists(src, error); - switch (exists) { + switch (exists) { case EXISTS_ERROR: return NULL; @@ -161,7 +161,7 @@ ZIP_EXTERN int zip_archive_set_tempdir(zip_t *za, const char *tempdir) { char *new_tempdir; - + if (tempdir) { if ((new_tempdir = strdup(tempdir)) == NULL) { zip_error_set(&za->error, ZIP_ER_MEMORY, errno); @@ -170,10 +170,10 @@ zip_archive_set_tempdir(zip_t *za, const char *tempdir) } else new_tempdir = NULL; - + free(za->tempdir); za->tempdir = new_tempdir; - + return 0; } @@ -209,7 +209,7 @@ _zip_open(zip_source_t *src, unsigned int flags, zip_error_t *error) if ((za=_zip_allocate_new(src, flags, error)) == NULL) { return NULL; } - + if ((cdir = _zip_find_central_dir(za, len)) == NULL) { _zip_error_copy(error, &za->error); /* keep src so discard does not get rid of it */ @@ -233,7 +233,7 @@ _zip_open(zip_source_t *src, unsigned int flags, zip_error_t *error) zip_discard(za); return NULL; } - + if (_zip_hash_add(za->names, name, idx, ZIP_FL_UNCHANGED, &za->error) == false) { if (za->error.zip_err != ZIP_ER_EXISTS || (flags & ZIP_CHECKCONS)) { _zip_error_copy(error, &za->error); @@ -244,7 +244,7 @@ _zip_open(zip_source_t *src, unsigned int flags, zip_error_t *error) } } } - + za->ch_flags = za->flags; return za; @@ -269,7 +269,7 @@ _zip_set_open_error(int *zep, const zip_error_t *err, int 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 zip_cdir_t * @@ -286,7 +286,7 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err zip_error_set(error, ZIP_ER_NOZIP, 0); return NULL; } - + /* check for end-of-central-dir magic */ if (memcmp(_zip_buffer_get(buffer, 4), EOCD_MAGIC, 4) != 0) { zip_error_set(error, ZIP_ER_NOZIP, 0); @@ -317,10 +317,10 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err if (comment_len || (za->open_flags & ZIP_CHECKCONS)) { zip_uint64_t tail_len; - + _zip_buffer_set_offset(buffer, eocd_offset + EOCDLEN); tail_len = _zip_buffer_left(buffer); - + if (tail_len < comment_len || ((za->open_flags & ZIP_CHECKCONS) && tail_len != comment_len)) { zip_error_set(error, ZIP_ER_INCONS, 0); _zip_cdir_free(cd); @@ -339,7 +339,7 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err zip_uint8_t *data; /* if buffer already read in, use it */ _zip_buffer_set_offset(buffer, cd->offset - buf_offset); - + if ((data = _zip_buffer_get(buffer, cd->size)) == NULL) { zip_error_set(error, ZIP_ER_INCONS, 0); _zip_cdir_free(cd); @@ -353,7 +353,7 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err } else { cd_buffer = NULL; - + if (zip_source_seek(za->src, (zip_int64_t)cd->offset, SEEK_SET) < 0) { _zip_error_set_from_source(error, za->src); _zip_cdir_free(cd); @@ -380,23 +380,23 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err i++; left -= (zip_uint64_t)entry_size; } - + if (i != cd->nentry) { zip_error_set(error, ZIP_ER_INCONS, 0); _zip_buffer_free(cd_buffer); _zip_cdir_free(cd); return NULL; } - + if (za->open_flags & ZIP_CHECKCONS) { bool ok; - + if (cd_buffer) { ok = _zip_buffer_eof(cd_buffer); } else { zip_int64_t offset = zip_source_tell(za->src); - + if (offset < 0) { _zip_error_set_from_source(error, za->src); _zip_buffer_free(cd_buffer); @@ -405,7 +405,7 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err } ok = ((zip_uint64_t)offset == cd->offset + cd->size); } - + if (!ok) { zip_error_set(error, ZIP_ER_INCONS, 0); _zip_buffer_free(cd_buffer); @@ -447,7 +447,7 @@ _zip_checkcons(zip_t *za, zip_cdir_t *cd, zip_error_t *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) @@ -456,27 +456,27 @@ _zip_checkcons(zip_t *za, zip_cdir_t *cd, zip_error_t *error) zip_error_set(error, ZIP_ER_NOZIP, 0); return -1; } - + if (zip_source_seek(za->src, (zip_int64_t)cd->entry[i].orig->offset, SEEK_SET) < 0) { _zip_error_set_from_source(error, za->src); return -1; } - + if (_zip_dirent_read(&temp, za->src, NULL, true, error) == -1) { _zip_dirent_finalize(&temp); 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); } @@ -586,7 +586,7 @@ _zip_find_central_dir(zip_t *za, zip_uint64_t len) _zip_error_set_from_source(&za->error, za->src); return NULL; } - + if ((buffer = _zip_buffer_new_from_source(za->src, buflen, NULL, &za->error)) == NULL) { return NULL; } @@ -607,7 +607,7 @@ _zip_find_central_dir(zip_t *za, zip_uint64_t len) if (best <= 0) { best = _zip_checkcons(za, cdir, &error); } - + a = _zip_checkcons(za, cdirnew, &error); if (best < a) { _zip_cdir_free(cdir); @@ -628,13 +628,13 @@ _zip_find_central_dir(zip_t *za, zip_uint64_t len) } cdirnew = NULL; } - + match++; _zip_buffer_set_offset(buffer, (zip_uint64_t)(match - _zip_buffer_data(buffer))); } _zip_buffer_free(buffer); - + if (best < 0) { _zip_error_copy(&za->error, &error); _zip_cdir_free(cdir); @@ -649,7 +649,7 @@ 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; @@ -673,7 +673,7 @@ _zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags zip_error_set(error, ZIP_ER_INCONS, 0); return NULL; } - + eocd_offset = _zip_buffer_offset(buffer); _zip_buffer_get(buffer, 4); /* magic already verified */ @@ -700,7 +700,7 @@ _zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags zip_error_set(error, ZIP_ER_SEEK, EFBIG); return NULL; } - + if (offset+size > buf_offset + eocd_offset) { /* cdir spans past EOCD record */ zip_error_set(error, ZIP_ER_INCONS, 0); @@ -717,7 +717,7 @@ _zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags cd->size = size; cd->offset = offset; - + return cd; } @@ -734,13 +734,13 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse zip_uint32_t num_disks, num_disks64, eocd_disk, eocd_disk64; eocdloc_offset = _zip_buffer_offset(buffer); - + _zip_buffer_get(buffer, 4); /* magic already verified */ num_disks = _zip_buffer_get_16(buffer); eocd_disk = _zip_buffer_get_16(buffer); eocd_offset = _zip_buffer_get_64(buffer); - + if (eocd_offset > ZIP_INT64_MAX || eocd_offset + EOCD64LEN < eocd_offset) { zip_error_set(error, ZIP_ER_SEEK, EFBIG); return NULL; @@ -773,7 +773,7 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse } return NULL; } - + size = _zip_buffer_get_64(buffer); if ((flags & ZIP_CHECKCONS) && size + eocd_offset + 12 != buf_offset + eocdloc_offset) { @@ -820,7 +820,7 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse size = _zip_buffer_get_64(buffer); offset = _zip_buffer_get_64(buffer); - + if (!_zip_buffer_ok(buffer)) { zip_error_set(error, ZIP_ER_INTERNAL, 0); if (free_buffer) { @@ -850,7 +850,7 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse if ((cd=_zip_cdir_new(nentry, error)) == NULL) return NULL; - + cd->size = size; cd->offset = offset; diff --git a/ext/zip/lib/zip_rename.c b/ext/zip/lib/zip_rename.c index 14e101d79b..fb700103ff 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 diff --git a/ext/zip/lib/zip_replace.c b/ext/zip/lib/zip_replace.c index eed019a097..da92bdf0a4 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 diff --git a/ext/zip/lib/zip_set_archive_comment.c b/ext/zip/lib/zip_set_archive_comment.c index 9090eec956..23adce1dfa 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 @@ -77,6 +77,6 @@ zip_set_archive_comment(zip_t *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 2625b2e653..d817d0c004 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 @@ -39,7 +39,7 @@ ZIP_EXTERN int zip_set_archive_flag(zip_t *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 10b48062fd..029202be9e 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 @@ -45,7 +45,7 @@ zip_set_default_password(zip_t *za, const char *passwd) return -1; 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 d356693741..cbc1cb9440 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 diff --git a/ext/zip/lib/zip_set_file_compression.c b/ext/zip/lib/zip_set_file_compression.c index 7bb0bf9450..54b3867fac 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 @@ -57,11 +57,11 @@ zip_set_file_compression(zip_t *za, zip_uint64_t idx, zip_int32_t method, zip_ui } 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; @@ -82,6 +82,6 @@ zip_set_file_compression(zip_t *za, zip_uint64_t idx, zip_int32_t method, zip_ui 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 2a461437e2..4bbd249ec9 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 @@ -110,7 +110,7 @@ _zip_set_name(zip_t *za, zip_uint64_t idx, const char *name, zip_flags_t flags) else { old_str = NULL; } - + if (old_str) { if ((old_name = _zip_string_get(old_str, NULL, 0, &za->error)) == NULL) { _zip_string_free(str); diff --git a/ext/zip/lib/zip_source_begin_write.c b/ext/zip/lib/zip_source_begin_write.c index 045933771f..875c3b816f 100644 --- a/ext/zip/lib/zip_source_begin_write.c +++ b/ext/zip/lib/zip_source_begin_write.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 @@ -42,12 +42,12 @@ zip_source_begin_write(zip_source_t *src) zip_error_set(&src->error, ZIP_ER_INVAL, 0); return -1; } - + if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_BEGIN_WRITE) < 0) { return -1; } src->write_state = ZIP_SOURCE_WRITE_OPEN; - + return 0; } diff --git a/ext/zip/lib/zip_source_buffer.c b/ext/zip/lib/zip_source_buffer.c index a23ddc9c59..b34017007d 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 @@ -106,7 +106,7 @@ zip_source_buffer_create(const void *data, zip_uint64_t len, int freep, zip_erro ctx->out = NULL; ctx->mtime = time(NULL); zip_error_init(&ctx->error); - + if ((zs=zip_source_function_create(read_data, ctx, error)) == NULL) { buffer_free(ctx->in); free(ctx); @@ -132,7 +132,7 @@ read_data(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) case ZIP_SOURCE_CLOSE: return 0; - + case ZIP_SOURCE_COMMIT_WRITE: buffer_free(ctx->in); ctx->in = ctx->out; @@ -141,24 +141,24 @@ read_data(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) case ZIP_SOURCE_ERROR: return zip_error_to_data(&ctx->error, data, len); - + case ZIP_SOURCE_FREE: buffer_free(ctx->in); buffer_free(ctx->out); free(ctx); return 0; - + case ZIP_SOURCE_OPEN: ctx->in->offset = 0; return 0; - + case ZIP_SOURCE_READ: if (len > ZIP_INT64_MAX) { zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); return -1; } return buffer_read(ctx->in, data, len); - + case ZIP_SOURCE_REMOVE: { buffer_t *empty = buffer_new_read(NULL, 0, 0); @@ -166,7 +166,7 @@ read_data(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0); return -1; } - + buffer_free(ctx->in); ctx->in = empty; return 0; @@ -182,11 +182,11 @@ read_data(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) case ZIP_SOURCE_SEEK_WRITE: return buffer_seek(ctx->out, data, len, &ctx->error); - + case ZIP_SOURCE_STAT: { zip_stat_t *st; - + if (len < sizeof(*st)) { zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); return -1; @@ -201,21 +201,21 @@ read_data(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) st->comp_method = ZIP_CM_STORE; 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); } case ZIP_SOURCE_SUPPORTS: return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_SEEK, ZIP_SOURCE_TELL, ZIP_SOURCE_BEGIN_WRITE, ZIP_SOURCE_COMMIT_WRITE, ZIP_SOURCE_REMOVE, ZIP_SOURCE_ROLLBACK_WRITE, ZIP_SOURCE_SEEK_WRITE, ZIP_SOURCE_TELL_WRITE, ZIP_SOURCE_WRITE, -1); - + case ZIP_SOURCE_TELL: if (ctx->in->offset > ZIP_INT64_MAX) { zip_error_set(&ctx->error, ZIP_ER_TELL, EOVERFLOW); return -1; } return (zip_int64_t)ctx->in->offset; - - + + case ZIP_SOURCE_TELL_WRITE: if (ctx->out->offset > ZIP_INT64_MAX) { zip_error_set(&ctx->error, ZIP_ER_TELL, EOVERFLOW); @@ -241,7 +241,7 @@ static void buffer_free(buffer_t *buffer) { if (buffer == NULL) { - return; + return; } if (buffer->free_data) { @@ -344,7 +344,7 @@ buffer_read(buffer_t *buffer, zip_uint8_t *data, zip_uint64_t length) n = 0; while (n < length) { zip_uint64_t left = ZIP_MIN(length - n, buffer->fragment_size - fragment_offset); - + memcpy(data + n, buffer->fragments[i] + fragment_offset, left); n += left; @@ -361,11 +361,11 @@ static int buffer_seek(buffer_t *buffer, void *data, zip_uint64_t len, zip_error_t *error) { zip_int64_t new_offset = zip_source_seek_compute_offset(buffer->offset, buffer->size, data, len, error); - + if (new_offset < 0) { return -1; } - + buffer->offset = (zip_uint64_t)new_offset; return 0; } @@ -385,7 +385,7 @@ buffer_write(buffer_t *buffer, const zip_uint8_t *data, zip_uint64_t length, zip /* grow buffer if needed */ if (buffer->offset + length > buffer->nfragments * buffer->fragment_size) { zip_uint64_t needed_fragments = (buffer->offset + length + buffer->fragment_size - 1) / buffer->fragment_size; - + if (needed_fragments > buffer->fragments_capacity) { zip_uint64_t new_capacity = buffer->fragments_capacity; @@ -418,7 +418,7 @@ buffer_write(buffer_t *buffer, const zip_uint8_t *data, zip_uint64_t length, zip n = 0; while (n < length) { zip_uint64_t left = ZIP_MIN(length - n, buffer->fragment_size - fragment_offset); - + memcpy(buffer->fragments[i] + fragment_offset, data + n, left); n += left; diff --git a/ext/zip/lib/zip_source_call.c b/ext/zip/lib/zip_source_call.c index 21f28bc42c..64dab67fc1 100644 --- a/ext/zip/lib/zip_source_call.c +++ b/ext/zip/lib/zip_source_call.c @@ -1,10 +1,10 @@ /* zip_source_call.c -- invoke callback command on zip_source Copyright (C) 2009-2014 Dieter Baron and Thomas Klausner - + This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -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 @@ -39,7 +39,7 @@ zip_int64_t _zip_source_call(zip_source_t *src, void *data, zip_uint64_t length, zip_source_cmd_t command) { zip_int64_t ret; - + if ((src->supports & ZIP_SOURCE_MAKE_COMMAND_BITMASK(command)) == 0) { zip_error_set(&src->error, ZIP_ER_OPNOTSUPP, 0); return -1; @@ -51,11 +51,11 @@ _zip_source_call(zip_source_t *src, void *data, zip_uint64_t length, zip_source_ else { ret = src->cb.l(src->src, src->ud, data, length, command); } - + if (ret < 0) { if (command != ZIP_SOURCE_ERROR && command != ZIP_SOURCE_SUPPORTS) { int e[2]; - + if (_zip_source_call(src, e, sizeof(e), ZIP_SOURCE_ERROR) < 0) { zip_error_set(&src->error, ZIP_ER_INTERNAL, 0); } diff --git a/ext/zip/lib/zip_source_close.c b/ext/zip/lib/zip_source_close.c index 36bc84235e..5c9b3cf842 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 @@ -42,7 +42,7 @@ zip_source_close(zip_source_t *src) zip_error_set(&src->error, ZIP_ER_INVAL, 0); return -1; } - + src->open_count--; if (src->open_count == 0) { _zip_source_call(src, NULL, 0, ZIP_SOURCE_CLOSE); diff --git a/ext/zip/lib/zip_source_commit_write.c b/ext/zip/lib/zip_source_commit_write.c index ba77abc342..866aa8cb25 100644 --- a/ext/zip/lib/zip_source_commit_write.c +++ b/ext/zip/lib/zip_source_commit_write.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 @@ -42,7 +42,7 @@ zip_source_commit_write(zip_source_t *src) zip_error_set(&src->error, ZIP_ER_INVAL, 0); return -1; } - + if (src->open_count > 1) { zip_error_set(&src->error, ZIP_ER_INUSE, 0); return -1; @@ -52,13 +52,13 @@ zip_source_commit_write(zip_source_t *src) return -1; } } - + if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_COMMIT_WRITE) < 0) { src->write_state = ZIP_SOURCE_WRITE_FAILED; return -1; } - + src->write_state = ZIP_SOURCE_WRITE_CLOSED; - + return 0; } diff --git a/ext/zip/lib/zip_source_crc.c b/ext/zip/lib/zip_source_crc.c index d0548690a3..2967e47221 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 @@ -89,13 +89,13 @@ crc_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_source case ZIP_SOURCE_OPEN: ctx->position = 0; return 0; - + case ZIP_SOURCE_READ: if ((n = zip_source_read(src, data, len)) < 0) { _zip_error_set_from_source(&ctx->error, src); return -1; } - + if (n == 0) { if (ctx->crc_position == ctx->position) { ctx->crc_complete = 1; @@ -103,12 +103,12 @@ crc_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_source if (ctx->validate) { struct zip_stat st; - + if (zip_source_stat(src, &st) < 0) { _zip_error_set_from_source(&ctx->error, src); return -1; } - + if ((st.valid & ZIP_STAT_CRC) && st.crc != ctx->crc) { zip_error_set(&ctx->error, ZIP_ER_CRC, 0); return -1; @@ -154,14 +154,14 @@ crc_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_source } return 0; } - + case ZIP_SOURCE_ERROR: return zip_error_to_data(&ctx->error, data, len); case ZIP_SOURCE_FREE: free(ctx); return 0; - + case ZIP_SOURCE_SUPPORTS: { zip_int64_t mask = zip_source_supports(src); @@ -194,7 +194,7 @@ crc_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_source case ZIP_SOURCE_TELL: return (zip_int64_t)ctx->position; - + default: zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0); return -1; diff --git a/ext/zip/lib/zip_source_deflate.c b/ext/zip/lib/zip_source_deflate.c index 2574ad017e..f7d5a10091 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 @@ -39,7 +39,7 @@ struct deflate { zip_error_t error; - + bool eof; bool can_store; bool is_stored; @@ -102,11 +102,11 @@ compress_read(zip_source_t *src, struct deflate *ctx, void *data, zip_uint64_t l if (zip_error_code_zip(&ctx->error) != ZIP_ER_OK) return -1; - + if (len == 0 || ctx->is_stored) { return 0; } - + out_offset = 0; out_len = (uInt)ZIP_MIN(UINT_MAX, len); ctx->zstr.next_out = (Bytef *)data; @@ -202,7 +202,7 @@ decompress_read(zip_source_t *src, struct deflate *ctx, void *data, zip_uint64_t if (zip_error_code_zip(&ctx->error) != ZIP_ER_OK) return -1; - + if (len == 0) return 0; @@ -229,7 +229,7 @@ decompress_read(zip_source_t *src, struct deflate *ctx, void *data, zip_uint64_t } } break; - + case Z_STREAM_END: ctx->eof = 1; end = 1; @@ -333,7 +333,7 @@ deflate_compress(zip_source_t *src, void *ud, void *data, zip_uint64_t len, zip_ case ZIP_SOURCE_SUPPORTS: return ZIP_SOURCE_SUPPORTS_READABLE; - + default: zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0); return -1; @@ -381,13 +381,13 @@ deflate_decompress(zip_source_t *src, void *ud, void *data, case ZIP_SOURCE_STAT: { zip_stat_t *st; - + st = (zip_stat_t *)data; - + st->comp_method = ZIP_CM_STORE; if (st->comp_size > 0 && st->size > 0) st->comp_size = st->size; - + return 0; } @@ -397,7 +397,7 @@ deflate_decompress(zip_source_t *src, void *ud, void *data, case ZIP_SOURCE_FREE: free(ctx); return 0; - + case ZIP_SOURCE_SUPPORTS: return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, -1); diff --git a/ext/zip/lib/zip_source_error.c b/ext/zip/lib/zip_source_error.c index e09199bbef..2b876ef008 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 diff --git a/ext/zip/lib/zip_source_file.c b/ext/zip/lib/zip_source_file.c index b3cd7ab29f..dbdc5a87ff 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 @@ -42,7 +42,7 @@ zip_source_file(zip_t *za, const char *fname, zip_uint64_t start, zip_int64_t le { if (za == NULL) return NULL; - + return zip_source_file_create(fname, start, len, &za->error); } diff --git a/ext/zip/lib/zip_source_filep.c b/ext/zip/lib/zip_source_filep.c index 70255dec41..a7c594c8e1 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 @@ -75,7 +75,7 @@ struct read_file { zip_uint64_t start; /* start offset of data to read */ zip_uint64_t end; /* end offset of data to read, 0 for up to EOF */ zip_uint64_t current; /* current offset */ - + /* writing */ char *tmpname; FILE *fout; @@ -92,7 +92,7 @@ zip_source_filep(zip_t *za, FILE *file, zip_uint64_t start, zip_int64_t len) { if (za == NULL) return NULL; - + return zip_source_filep_create(file, start, len, &za->error); } @@ -114,12 +114,12 @@ _zip_source_file_or_p(const char *fname, FILE *file, zip_uint64_t start, zip_int { struct read_file *ctx; zip_source_t *zs; - + if (file == NULL && fname == NULL) { zip_error_set(error, ZIP_ER_INVAL, 0); return NULL; } - + if ((ctx=(struct read_file *)malloc(sizeof(struct read_file))) == NULL) { zip_error_set(error, ZIP_ER_MEMORY, 0); return NULL; @@ -144,10 +144,10 @@ _zip_source_file_or_p(const char *fname, FILE *file, zip_uint64_t start, zip_int else { zip_stat_init(&ctx->st); } - + ctx->tmpname = NULL; ctx->fout = NULL; - + zip_error_init(&ctx->error); ctx->supports = ZIP_SOURCE_SUPPORTS_READABLE | zip_source_make_command_bitmap(ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, -1); @@ -179,7 +179,7 @@ create_temp_output(struct read_file *ctx) int tfd; mode_t mask; FILE *tfp; - + if ((temp=(char *)malloc(strlen(ctx->fname)+8)) == NULL) { zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0); return -1; @@ -202,7 +202,7 @@ create_temp_output(struct read_file *ctx) free(temp); return -1; } - + #ifdef _WIN32 /* According to Pierre Joye, Windows in some environments per @@ -210,10 +210,10 @@ create_temp_output(struct read_file *ctx) */ _setmode(_fileno(tfp), _O_BINARY ); #endif - + ctx->fout = tfp; ctx->tmpname = temp; - + return 0; } @@ -236,7 +236,7 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) return -1; } return create_temp_output(ctx); - + case ZIP_SOURCE_COMMIT_WRITE: { mode_t mask; @@ -257,17 +257,17 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) ctx->tmpname = NULL; return 0; } - + case ZIP_SOURCE_CLOSE: if (ctx->fname) { fclose(ctx->f); ctx->f = NULL; } return 0; - + case ZIP_SOURCE_ERROR: return zip_error_to_data(&ctx->error, data, len); - + case ZIP_SOURCE_FREE: free(ctx->fname); free(ctx->tmpname); @@ -275,7 +275,7 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) fclose(ctx->f); free(ctx); return 0; - + case ZIP_SOURCE_OPEN: if (ctx->fname) { if ((ctx->f=fopen(ctx->fname, "rb")) == NULL) { @@ -283,7 +283,7 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) return -1; } } - + if (ctx->start > 0) { if (_zip_fseek_u(ctx->f, ctx->start, SEEK_SET, &ctx->error) < 0) { return -1; @@ -291,7 +291,7 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) } ctx->current = ctx->start; return 0; - + case ZIP_SOURCE_READ: if (ctx->end > 0) { n = ctx->end-ctx->current; @@ -302,7 +302,7 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) else { n = len; } - + if (n > SIZE_MAX) n = SIZE_MAX; @@ -315,14 +315,14 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) ctx->current += i; return (zip_int64_t)i; - + case ZIP_SOURCE_REMOVE: if (remove(ctx->fname) < 0) { zip_error_set(&ctx->error, ZIP_ER_REMOVE, errno); return -1; } return 0; - + case ZIP_SOURCE_ROLLBACK_WRITE: if (ctx->fout) { fclose(ctx->fout); @@ -332,7 +332,7 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) free(ctx->tmpname); ctx->tmpname = NULL; return 0; - + case ZIP_SOURCE_SEEK: { zip_int64_t new_current; int need_seek; @@ -340,14 +340,14 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) if (args == NULL) return -1; - + need_seek = 1; - + switch (args->whence) { case SEEK_SET: new_current = args->offset; break; - + case SEEK_END: if (ctx->end == 0) { if (_zip_fseek(ctx->f, args->offset, SEEK_END, &ctx->error) < 0) { @@ -376,7 +376,7 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); return -1; } - + ctx->current = (zip_uint64_t)new_current; if (need_seek) { @@ -386,15 +386,15 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) } return 0; } - + case ZIP_SOURCE_SEEK_WRITE: { zip_source_args_seek_t *args; - + args = ZIP_SOURCE_GET_ARGS(zip_source_args_seek_t, data, len, &ctx->error); if (args == NULL) { return -1; } - + if (_zip_fseek(ctx->fout, args->offset, args->whence, &ctx->error) < 0) { return -1; } @@ -411,7 +411,7 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) zip_stat_t *st; struct stat fst; int err; - + if (ctx->f) err = fstat(fileno(ctx->f), &fst); else @@ -423,7 +423,7 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) } st = (zip_stat_t *)data; - + zip_stat_init(st); st->mtime = fst.st_mtime; st->valid |= ZIP_STAT_MTIME; @@ -441,32 +441,32 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) case ZIP_SOURCE_SUPPORTS: return ctx->supports; - + case ZIP_SOURCE_TELL: return (zip_int64_t)ctx->current; - + case ZIP_SOURCE_TELL_WRITE: { off_t ret = ftello(ctx->fout); - + if (ret < 0) { zip_error_set(&ctx->error, ZIP_ER_TELL, errno); return -1; } return ret; } - + case ZIP_SOURCE_WRITE: { size_t ret; - + clearerr(ctx->fout); ret = fwrite(data, 1, len, ctx->fout); if (ret != len || ferror(ctx->fout)) { zip_error_set(&ctx->error, ZIP_ER_WRITE, errno); return -1; } - + return (zip_int64_t)ret; } diff --git a/ext/zip/lib/zip_source_free.c b/ext/zip/lib/zip_source_free.c index 9070469946..e058cac607 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 @@ -49,7 +49,7 @@ zip_source_free(zip_source_t *src) if (src->refcount > 0) { return; } - + if (ZIP_SOURCE_IS_OPEN_READING(src)) { src->open_count = 1; /* force close */ zip_source_close(src); @@ -57,13 +57,13 @@ zip_source_free(zip_source_t *src) if (ZIP_SOURCE_IS_OPEN_WRITING(src)) { zip_source_rollback_write(src); } - + if (src->source_archive && !src->source_closed) { _zip_deregister_source(src->source_archive, src); } - + (void)_zip_source_call(src, NULL, 0, ZIP_SOURCE_FREE); - + if (src->src) { zip_source_free(src->src); } diff --git a/ext/zip/lib/zip_source_function.c b/ext/zip/lib/zip_source_function.c index 1d4be93c69..184b8ddb45 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 @@ -43,7 +43,7 @@ zip_source_function(zip_t *za, zip_source_callback zcb, void *ud) if (za == NULL) { return NULL; } - + return zip_source_function_create(zcb, ud, &za->error); } @@ -58,12 +58,12 @@ zip_source_function_create(zip_source_callback zcb, void *ud, zip_error_t *error zs->cb.f = zcb; zs->ud = ud; - + zs->supports = zcb(ud, NULL, 0, ZIP_SOURCE_SUPPORTS); if (zs->supports < 0) { zs->supports = ZIP_SOURCE_SUPPORTS_READABLE; } - + return zs; } diff --git a/ext/zip/lib/zip_source_is_deleted.c b/ext/zip/lib/zip_source_is_deleted.c index e50cdd9e32..f2fc504bd5 100644 --- a/ext/zip/lib/zip_source_is_deleted.c +++ b/ext/zip/lib/zip_source_is_deleted.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_source_layered.c b/ext/zip/lib/zip_source_layered.c index 94b3310109..932a51f64d 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 @@ -51,10 +51,10 @@ zip_source_t * zip_source_layered_create(zip_source_t *src, zip_source_layered_callback cb, void *ud, zip_error_t *error) { zip_source_t *zs; - + if ((zs=_zip_source_new(error)) == NULL) return NULL; - + zip_source_keep(src); zs->src = src; zs->cb.l = cb; diff --git a/ext/zip/lib/zip_source_open.c b/ext/zip/lib/zip_source_open.c index ec5e39d542..0e56dcd5fa 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 @@ -58,7 +58,7 @@ zip_source_open(zip_source_t *src) return -1; } } - + if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_OPEN) < 0) { if (ZIP_SOURCE_IS_LAYERED(src)) { zip_source_close(src->src); @@ -68,6 +68,6 @@ zip_source_open(zip_source_t *src) } src->open_count++; - + return 0; } diff --git a/ext/zip/lib/zip_source_pkware.c b/ext/zip/lib/zip_source_pkware.c index 125e4e2c2a..d2beec410a 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 @@ -136,7 +136,7 @@ decrypt_header(zip_source_t *src, struct trad_pkware *ctx) _zip_error_set_from_source(&ctx->error, src); return -1; } - + if (n != HEADERLEN) { zip_error_set(&ctx->error, ZIP_ER_EOF, 0); return -1; @@ -198,10 +198,10 @@ pkware_decrypt(zip_source_t *src, void *ud, void *data, /* TODO: deduce HEADERLEN from size for uncompressed */ if (st->valid & ZIP_STAT_COMP_SIZE) st->comp_size -= HEADERLEN; - + return 0; } - + case ZIP_SOURCE_SUPPORTS: return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, -1); diff --git a/ext/zip/lib/zip_source_read.c b/ext/zip/lib/zip_source_read.c index 061a6f910e..a50ee71fca 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 diff --git a/ext/zip/lib/zip_source_remove.c b/ext/zip/lib/zip_source_remove.c index 470a5edaf4..3bdf7d39ae 100644 --- a/ext/zip/lib/zip_source_remove.c +++ b/ext/zip/lib/zip_source_remove.c @@ -1,10 +1,10 @@ /* zip_source_remove.c -- remove empty archive Copyright (C) 2014 Dieter Baron and Thomas Klausner - + This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -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 @@ -41,7 +41,7 @@ zip_source_remove(zip_source_t *src) if (src->write_state == ZIP_SOURCE_WRITE_REMOVED) { return 0; } - + if (ZIP_SOURCE_IS_OPEN_READING(src)) { if (zip_source_close(src) < 0) { return -1; @@ -50,12 +50,12 @@ zip_source_remove(zip_source_t *src) if (src->write_state != ZIP_SOURCE_WRITE_CLOSED) { zip_source_rollback_write(src); } - + if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_REMOVE) < 0) { return -1; } - + src->write_state = ZIP_SOURCE_WRITE_REMOVED; - + return 0; } diff --git a/ext/zip/lib/zip_source_rollback_write.c b/ext/zip/lib/zip_source_rollback_write.c index c35f30f959..7eaa958cc0 100644 --- a/ext/zip/lib/zip_source_rollback_write.c +++ b/ext/zip/lib/zip_source_rollback_write.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 @@ -41,7 +41,7 @@ zip_source_rollback_write(zip_source_t *src) if (src->write_state != ZIP_SOURCE_WRITE_OPEN && src->write_state != ZIP_SOURCE_WRITE_FAILED) { return; } - + _zip_source_call(src, NULL, 0, ZIP_SOURCE_ROLLBACK_WRITE); src->write_state = ZIP_SOURCE_WRITE_CLOSED; } diff --git a/ext/zip/lib/zip_source_seek.c b/ext/zip/lib/zip_source_seek.c index c3f47036ad..92299b8ab2 100644 --- a/ext/zip/lib/zip_source_seek.c +++ b/ext/zip/lib/zip_source_seek.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 @@ -39,7 +39,7 @@ ZIP_EXTERN int zip_source_seek(zip_source_t *src, zip_int64_t offset, int whence) { zip_source_args_seek_t args; - + if (src->source_closed) { return -1; } @@ -50,7 +50,7 @@ zip_source_seek(zip_source_t *src, zip_int64_t offset, int whence) args.offset = offset; args.whence = whence; - + return (_zip_source_call(src, &args, sizeof(args), ZIP_SOURCE_SEEK) < 0 ? -1 : 0); } @@ -60,33 +60,33 @@ zip_source_seek_compute_offset(zip_uint64_t offset, zip_uint64_t length, void *d { zip_int64_t new_offset; zip_source_args_seek_t *args = ZIP_SOURCE_GET_ARGS(zip_source_args_seek_t, data, data_length, error); - + if (args == NULL) { return -1; } - + switch (args->whence) { case SEEK_CUR: new_offset = (zip_int64_t)offset + args->offset; break; - + case SEEK_END: new_offset = (zip_int64_t)length + args->offset; break; - + case SEEK_SET: new_offset = args->offset; break; - + default: zip_error_set(error, ZIP_ER_INVAL, 0); return -1; } - + if (new_offset < 0 || (zip_uint64_t)new_offset > length) { zip_error_set(error, ZIP_ER_INVAL, 0); return -1; } - + return new_offset; } diff --git a/ext/zip/lib/zip_source_seek_write.c b/ext/zip/lib/zip_source_seek_write.c index 6660766492..32a1f526ca 100644 --- a/ext/zip/lib/zip_source_seek_write.c +++ b/ext/zip/lib/zip_source_seek_write.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 @@ -39,14 +39,14 @@ ZIP_EXTERN int zip_source_seek_write(zip_source_t *src, zip_int64_t offset, int whence) { zip_source_args_seek_t args; - + if (!ZIP_SOURCE_IS_OPEN_WRITING(src) || (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END)) { zip_error_set(&src->error, ZIP_ER_INVAL, 0); return -1; } - + args.offset = offset; args.whence = whence; - + return (_zip_source_call(src, &args, sizeof(args), ZIP_SOURCE_SEEK_WRITE) < 0 ? -1 : 0); } diff --git a/ext/zip/lib/zip_source_stat.c b/ext/zip/lib/zip_source_stat.c index a6b46d06a6..a5f80fb6a1 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 @@ -47,7 +47,7 @@ zip_source_stat(zip_source_t *src, zip_stat_t *st) } zip_stat_init(st); - + if (ZIP_SOURCE_IS_LAYERED(src)) { if (zip_source_stat(src->src, st) < 0) { _zip_error_set_from_source(&src->error, src->src); diff --git a/ext/zip/lib/zip_source_supports.c b/ext/zip/lib/zip_source_supports.c index 75a4a4626d..a0f77ddacf 100644 --- a/ext/zip/lib/zip_source_supports.c +++ b/ext/zip/lib/zip_source_supports.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 @@ -49,11 +49,11 @@ zip_source_make_command_bitmap(zip_source_cmd_t cmd0, ...) { zip_int64_t bitmap; va_list ap; - + bitmap = ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd0); - - - + + + va_start(ap, cmd0); for (;;) { int cmd = va_arg(ap, int); @@ -63,6 +63,6 @@ zip_source_make_command_bitmap(zip_source_cmd_t cmd0, ...) bitmap |= ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd); } va_end(ap); - + return bitmap; } diff --git a/ext/zip/lib/zip_source_tell.c b/ext/zip/lib/zip_source_tell.c index f1c10b5b52..1bacaafe38 100644 --- a/ext/zip/lib/zip_source_tell.c +++ b/ext/zip/lib/zip_source_tell.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 @@ -45,6 +45,6 @@ zip_source_tell(zip_source_t *src) zip_error_set(&src->error, ZIP_ER_INVAL, 0); return -1; } - + return _zip_source_call(src, NULL, 0, ZIP_SOURCE_TELL); } diff --git a/ext/zip/lib/zip_source_tell_write.c b/ext/zip/lib/zip_source_tell_write.c index 2fa150722d..bdb7180e8e 100644 --- a/ext/zip/lib/zip_source_tell_write.c +++ b/ext/zip/lib/zip_source_tell_write.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 @@ -42,6 +42,6 @@ zip_source_tell_write(zip_source_t *src) zip_error_set(&src->error, ZIP_ER_INVAL, 0); return -1; } - + return _zip_source_call(src, NULL, 0, ZIP_SOURCE_TELL_WRITE); } diff --git a/ext/zip/lib/zip_source_window.c b/ext/zip/lib/zip_source_window.c index f02d048c0c..53da556b50 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 @@ -61,31 +61,31 @@ zip_source_t * _zip_source_window_new(zip_source_t *src, zip_uint64_t start, zip_uint64_t length, zip_stat_t *st, zip_error_t *error) { struct window *ctx; - + if (src == NULL || start + length < start) { zip_error_set(error, ZIP_ER_INVAL, 0); return NULL; } - + if ((ctx=(struct window *)malloc(sizeof(*ctx))) == NULL) { zip_error_set(error, ZIP_ER_MEMORY, 0); return NULL; } - + ctx->start = start; ctx->end = start + length; zip_stat_init(&ctx->stat); zip_error_init(&ctx->error); ctx->supports = (zip_source_supports(src) & ZIP_SOURCE_SUPPORTS_SEEKABLE) | (zip_source_make_command_bitmap(ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, -1)); ctx->needs_seek = (ctx->supports & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK)) ? true : false; - + if (st) { if (_zip_stat_merge(&ctx->stat, st, error) < 0) { free(ctx); return NULL; } } - + return zip_source_layered_create(src, window_read, ctx, error); } @@ -123,10 +123,10 @@ window_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_sou switch (cmd) { case ZIP_SOURCE_CLOSE: return 0; - + case ZIP_SOURCE_ERROR: return zip_error_to_data(&ctx->error, data, len); - + case ZIP_SOURCE_FREE: free(ctx); return 0; @@ -144,7 +144,7 @@ window_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_sou return -1; } } - + } ctx->offset = ctx->start; return 0; @@ -152,17 +152,17 @@ window_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_sou case ZIP_SOURCE_READ: if (len > ctx->end - ctx->offset) len = ctx->end - ctx->offset; - + if (len == 0) return 0; - + if (ctx->needs_seek) { if (zip_source_seek(src, (zip_int64_t)ctx->offset, SEEK_SET) < 0) { _zip_error_set_from_source(&ctx->error, src); return -1; } } - + if ((ret=zip_source_read(src, data, len)) < 0) { zip_error_set(&ctx->error, ZIP_ER_EOF, 0); return -1; @@ -177,7 +177,7 @@ window_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_sou } } return ret; - + case ZIP_SOURCE_SEEK: { zip_int64_t new_offset = zip_source_seek_compute_offset(ctx->offset - ctx->start, ctx->end - ctx->start, data, len, &ctx->error); @@ -185,7 +185,7 @@ window_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_sou if (new_offset < 0) { return -1; } - + ctx->offset = (zip_uint64_t)new_offset + ctx->start; return 0; } @@ -193,21 +193,21 @@ window_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_sou case ZIP_SOURCE_STAT: { zip_stat_t *st; - + st = (zip_stat_t *)data; - + if (_zip_stat_merge(st, &ctx->stat, &ctx->error) < 0) { return -1; } return 0; } - + case ZIP_SOURCE_SUPPORTS: return ctx->supports; - + case ZIP_SOURCE_TELL: return (zip_int64_t)(ctx->offset - ctx->start); - + default: zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0); return -1; @@ -219,7 +219,7 @@ void _zip_deregister_source(zip_t *za, zip_source_t *src) { unsigned int i; - + for (i=0; inopen_source; i++) { if (za->open_source[i] == src) { za->open_source[i] = za->open_source[za->nopen_source-1]; @@ -234,7 +234,7 @@ int _zip_register_source(zip_t *za, zip_source_t *src) { zip_source_t **open_source; - + if (za->nopen_source+1 >= za->nopen_source_alloc) { unsigned int n; n = za->nopen_source_alloc + 10; @@ -246,8 +246,8 @@ _zip_register_source(zip_t *za, zip_source_t *src) za->nopen_source_alloc = n; za->open_source = open_source; } - + za->open_source[za->nopen_source++] = src; - + return 0; } diff --git a/ext/zip/lib/zip_source_write.c b/ext/zip/lib/zip_source_write.c index c98f5679ae..05a6e5a84f 100644 --- a/ext/zip/lib/zip_source_write.c +++ b/ext/zip/lib/zip_source_write.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 @@ -42,6 +42,6 @@ zip_source_write(zip_source_t *src, const void *data, zip_uint64_t length) zip_error_set(&src->error, ZIP_ER_INVAL, 0); return -1; } - + return _zip_source_call(src, (void *)data, length, ZIP_SOURCE_WRITE); } diff --git a/ext/zip/lib/zip_source_zip.c b/ext/zip/lib/zip_source_zip.c index e172ca208e..bb3f4ce363 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 @@ -46,10 +46,10 @@ zip_source_zip(zip_t *za, zip_t *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 40f1195f15..c19a2917f0 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 @@ -110,13 +110,13 @@ _zip_source_zip_new(zip_t *za, zip_t *srcza, zip_uint64_t srcidx, zip_flags_t fl if (start+len > 0 && enc_impl == NULL && comp_impl == NULL) { struct zip_stat st2; - + st2.size = len ? len : st.size-start; st2.comp_size = st2.size; st2.comp_method = ZIP_CM_STORE; st2.mtime = st.mtime; st2.valid = ZIP_STAT_SIZE|ZIP_STAT_COMP_SIZE|ZIP_STAT_COMP_METHOD|ZIP_STAT_MTIME; - + if ((src = _zip_source_window_new(srcza->src, offset+start, st2.size, &st2, &za->error)) == NULL) { return NULL; } @@ -126,14 +126,14 @@ _zip_source_zip_new(zip_t *za, zip_t *srcza, zip_uint64_t srcidx, zip_flags_t fl return NULL; } } - + if (_zip_source_set_source_archive(src, srcza) < 0) { zip_source_free(src); return NULL; } /* creating a layered source calls zip_keep() on the lower layer, so we free it */ - + if (enc_impl) { s2 = enc_impl(za, src, st.encryption_method, 0, password); zip_source_free(src); diff --git a/ext/zip/lib/zip_stat.c b/ext/zip/lib/zip_stat.c index cf8e56613c..338ee553e6 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 diff --git a/ext/zip/lib/zip_stat_index.c b/ext/zip/lib/zip_stat_index.c index 601e3f70b7..692b6e2668 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 @@ -47,7 +47,7 @@ zip_stat_index(zip_t *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)) { @@ -81,6 +81,6 @@ zip_stat_index(zip_t *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 6b7d633744..0f87f980ef 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 @@ -80,6 +80,6 @@ _zip_stat_merge(zip_stat_t *dst, const zip_stat_t *src, zip_error_t *error) dst->flags = src->flags; } dst->valid |= src->valid; - + return 0; } diff --git a/ext/zip/lib/zip_strerror.c b/ext/zip/lib/zip_strerror.c index 98c4f6b1cc..4a1dfa3021 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 diff --git a/ext/zip/lib/zip_string.c b/ext/zip/lib/zip_string.c index 307a425f78..a1608cf340 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 @@ -42,10 +42,10 @@ zip_uint32_t _zip_string_crc32(const zip_string_t *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; @@ -108,7 +108,7 @@ _zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip return string->converted; } } - + if (lenp) *lenp = string->length; return string->raw; @@ -130,7 +130,7 @@ _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, { zip_string_t *s; zip_encoding_type_t expected_encoding; - + if (length == 0) return NULL; @@ -148,7 +148,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=(zip_string_t *)malloc(sizeof(*s))) == NULL) { zip_error_set(error, ZIP_ER_MEMORY, 0); return NULL; @@ -173,7 +173,7 @@ _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, return NULL; } } - + return s; } @@ -183,6 +183,6 @@ _zip_string_write(zip_t *za, const zip_string_t *s) { if (s == NULL) return 0; - + return _zip_write(za, s->raw, s->length); } diff --git a/ext/zip/lib/zip_unchange.c b/ext/zip/lib/zip_unchange.c index 5ef5462127..09b413a84b 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 @@ -49,7 +49,7 @@ _zip_unchange(zip_t *za, zip_uint64_t idx, int allow_duplicates) { zip_int64_t i; const char *orig_name, *changed_name; - + if (idx >= za->nentry) { zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; @@ -70,7 +70,7 @@ _zip_unchange(zip_t *za, zip_uint64_t idx, int allow_duplicates) else { orig_name = NULL; } - + if ((changed_name=_zip_get_name(za, idx, 0, &za->error)) == NULL) { return -1; } diff --git a/ext/zip/lib/zip_unchange_all.c b/ext/zip/lib/zip_unchange_all.c index dc89f7fdaf..0cd3d3c05f 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 @@ -44,7 +44,7 @@ zip_unchange_all(zip_t *za) zip_uint64_t i; _zip_hash_revert(za->names); - + ret = 0; for (i=0; inentry; i++) ret |= _zip_unchange(za, i, 1); diff --git a/ext/zip/lib/zip_unchange_archive.c b/ext/zip/lib/zip_unchange_archive.c index 920255cc7e..69c6e52400 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 @@ -45,7 +45,7 @@ zip_unchange_archive(zip_t *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 839d9a3cb9..caac10724d 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 diff --git a/ext/zip/lib/zip_utf-8.c b/ext/zip/lib/zip_utf-8.c index f38eea04d2..26a274c25d 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 @@ -170,7 +170,7 @@ done: if (expected_encoding != enc && enc != ZIP_ENCODING_ASCII) return ZIP_ENCODING_ERROR; } - + return enc; } -- cgit v1.2.1