summaryrefslogtreecommitdiff
path: root/ext/zip/lib/zip_add.c
diff options
context:
space:
mode:
authorAnatoliy Belsky <ab@php.net>2012-06-04 21:30:04 +0200
committerAnatoliy Belsky <ab@php.net>2012-06-07 21:01:31 +0200
commit335a11b14b35e261c484d44a0e1b5ea9cc758e19 (patch)
tree515f54cede9e42804b4da1e1ef60d1d9f55bb633 /ext/zip/lib/zip_add.c
parent7cae4ff02c593ed212a363d65c83c38a67a27f0d (diff)
downloadphp-git-335a11b14b35e261c484d44a0e1b5ea9cc758e19.tar.gz
initial libzip upgrade patch to 0.10.1
Diffstat (limited to 'ext/zip/lib/zip_add.c')
-rw-r--r--ext/zip/lib/zip_add.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/zip/lib/zip_add.c b/ext/zip/lib/zip_add.c
index 85d5997911..6067abbac4 100644
--- a/ext/zip/lib/zip_add.c
+++ b/ext/zip/lib/zip_add.c
@@ -37,13 +37,20 @@
-ZIP_EXTERN(int)
+/*
+ NOTE: Return type is signed so we can return -1 on error.
+ The index can not be larger than ZIP_INT64_MAX since the size
+ of the central directory cannot be larger than
+ ZIP_UINT64_MAX, and each entry is larger than 2 bytes.
+*/
+
+ZIP_EXTERN(zip_int64_t)
zip_add(struct zip *za, const char *name, struct zip_source *source)
{
if (name == NULL || source == NULL) {
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
return -1;
}
-
- return _zip_replace(za, -1, name, source);
+
+ return _zip_replace(za, ZIP_UINT64_MAX, name, source);
}