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_archive_comment.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_archive_comment.c')
-rw-r--r-- | ext/zip/lib/zip_get_archive_comment.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/ext/zip/lib/zip_get_archive_comment.c b/ext/zip/lib/zip_get_archive_comment.c index fe97e6e8c1..202f761f4e 100644 --- a/ext/zip/lib/zip_get_archive_comment.c +++ b/ext/zip/lib/zip_get_archive_comment.c @@ -1,6 +1,6 @@ /* zip_get_archive_comment.c -- get archive comment - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <libzip@nih.at> @@ -33,28 +33,29 @@ +#include <string.h> + #include "zipint.h" -ZIP_EXTERN(const char *) -zip_get_archive_comment(struct zip *za, int *lenp, int flags) +ZIP_EXTERN const char * +zip_get_archive_comment(struct zip *za, int *lenp, zip_flags_t flags) { - if ((flags & ZIP_FL_UNCHANGED) - || (za->ch_comment_len == -1)) { - if (za->cdir) { - if (lenp != NULL) - *lenp = za->cdir->comment_len; - return za->cdir->comment; - } - else { - if (lenp != NULL) - *lenp = -1; - return NULL; - } - } - - if (lenp != NULL) - *lenp = za->ch_comment_len; - return za->ch_comment; + struct zip_string *comment; + zip_uint32_t len; + const zip_uint8_t *str; + + if ((flags & ZIP_FL_UNCHANGED) || (za->comment_changes == NULL)) + comment = za->comment_orig; + else + comment = za->comment_changes; + + if ((str=_zip_string_get(comment, &len, flags, &za->error)) == NULL) + return NULL; + + if (lenp) + *lenp = (int)len; + + return (const char *)str; } |