diff options
author | Remi Collet <remi@php.net> | 2013-11-04 13:23:36 +0100 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2013-11-04 13:23:36 +0100 |
commit | 5dc37b351085a7b8cdc30ef2ebb349c8e5df4e2c (patch) | |
tree | 33357220b91d8553c0978e6392385e0fb8e49028 /ext/zip/lib/zip_get_num_entries.c | |
parent | 2f555b8e606b5f09d635cef4d3fcbcd6939adae2 (diff) | |
download | php-git-5dc37b351085a7b8cdc30ef2ebb349c8e5df4e2c.tar.gz |
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
Diffstat (limited to 'ext/zip/lib/zip_get_num_entries.c')
-rw-r--r-- | ext/zip/lib/zip_get_num_entries.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/ext/zip/lib/zip_get_num_entries.c b/ext/zip/lib/zip_get_num_entries.c index dd392e9095..26484baff2 100644 --- a/ext/zip/lib/zip_get_num_entries.c +++ b/ext/zip/lib/zip_get_num_entries.c @@ -37,16 +37,19 @@ -ZIP_EXTERN(zip_uint64_t) -zip_get_num_entries(struct zip *za, int flags) +ZIP_EXTERN zip_int64_t +zip_get_num_entries(struct zip *za, zip_flags_t flags) { + zip_uint64_t n; + if (za == NULL) return -1; if (flags & ZIP_FL_UNCHANGED) { - if (za->cdir == NULL) - return 0; - return za->cdir->nentry; + n = za->nentry; + while (n>0 && za->entry[n-1].orig == NULL) + --n; + return (zip_int64_t)n; } - return za->nentry; + return (zip_int64_t)za->nentry; } |