From 5dc37b351085a7b8cdc30ef2ebb349c8e5df4e2c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 4 Nov 2013 13:23:36 +0100 Subject: Sync ext/zip with pecl/zip version 1.3.2 - update libzip to version 1.11.1. We don't use any private symbol anymore - new method ZipArchive::setPassword($password) - add --with-libzip option to build with system libzip --- ext/zip/lib/zip_file_get_offset.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'ext/zip/lib/zip_file_get_offset.c') diff --git a/ext/zip/lib/zip_file_get_offset.c b/ext/zip/lib/zip_file_get_offset.c index b96fd5e480..65a011fc07 100644 --- a/ext/zip/lib/zip_file_get_offset.c +++ b/ext/zip/lib/zip_file_get_offset.c @@ -50,25 +50,27 @@ On error, fills in za->error and returns 0. */ -unsigned int -_zip_file_get_offset(struct zip *za, int idx) +zip_uint64_t +_zip_file_get_offset(const struct zip *za, zip_uint64_t idx, struct zip_error *error) { - struct zip_dirent de; - unsigned int offset; + zip_uint64_t offset; + zip_int32_t size; - offset = za->cdir->entry[idx].offset; + offset = za->entry[idx].orig->offset; - if (fseeko(za->zp, offset, SEEK_SET) != 0) { - _zip_error_set(&za->error, ZIP_ER_SEEK, errno); + if (fseeko(za->zp, (off_t)offset, SEEK_SET) != 0) { + _zip_error_set(error, ZIP_ER_SEEK, errno); return 0; } - if (_zip_dirent_read(&de, za->zp, NULL, NULL, 1, &za->error) != 0) + /* XXX: cache? */ + if ((size=_zip_dirent_size(za->zp, ZIP_EF_LOCAL, error)) < 0) return 0; - offset += LENTRYSIZE + de.filename_len + de.extrafield_len; - - _zip_dirent_finalize(&de); - - return offset; + if (offset+(zip_uint32_t)size > ZIP_OFF_MAX) { + _zip_error_set(error, ZIP_ER_SEEK, EFBIG); + return 0; + } + + return offset + (zip_uint32_t)size; } -- cgit v1.2.1 From 0a950a05005f94e56bd2a42b99a0961db86952db Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 30 Dec 2013 07:35:30 +0100 Subject: Sync with pecl/zip 1.12.4dev - update bunled libzip to 0.11.2 - expose zip_file_set_external_attributes + zip_file_get_external_attributes with new methods: ZipArchive::setExternalAttributesName ZipArchive::setExternalAttributesIndex ZipArchive::getExternalAttributesName ZipArchive::getExternalAttributesIndex --- ext/zip/lib/zip_file_get_offset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/zip/lib/zip_file_get_offset.c') diff --git a/ext/zip/lib/zip_file_get_offset.c b/ext/zip/lib/zip_file_get_offset.c index 65a011fc07..e8c199fb5b 100644 --- a/ext/zip/lib/zip_file_get_offset.c +++ b/ext/zip/lib/zip_file_get_offset.c @@ -63,7 +63,7 @@ _zip_file_get_offset(const struct zip *za, zip_uint64_t idx, struct zip_error *e return 0; } - /* XXX: cache? */ + /* TODO: cache? */ if ((size=_zip_dirent_size(za->zp, ZIP_EF_LOCAL, error)) < 0) return 0; -- cgit v1.2.1