diff options
author | Anatoliy Belsky <ab@php.net> | 2012-06-04 21:30:04 +0200 |
---|---|---|
committer | Anatoliy Belsky <ab@php.net> | 2012-06-07 21:01:31 +0200 |
commit | 335a11b14b35e261c484d44a0e1b5ea9cc758e19 (patch) | |
tree | 515f54cede9e42804b4da1e1ef60d1d9f55bb633 /ext/zip/lib/zip_name_locate.c | |
parent | 7cae4ff02c593ed212a363d65c83c38a67a27f0d (diff) | |
download | php-git-335a11b14b35e261c484d44a0e1b5ea9cc758e19.tar.gz |
initial libzip upgrade patch to 0.10.1
Diffstat (limited to 'ext/zip/lib/zip_name_locate.c')
-rw-r--r-- | ext/zip/lib/zip_name_locate.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/zip/lib/zip_name_locate.c b/ext/zip/lib/zip_name_locate.c index 96c4f937e0..08d5b1fbf8 100644 --- a/ext/zip/lib/zip_name_locate.c +++ b/ext/zip/lib/zip_name_locate.c @@ -1,6 +1,6 @@ /* zip_name_locate.c -- get index by name - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2011 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> @@ -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,16 +55,20 @@ _zip_name_locate(struct zip *za, const char *fname, int flags, const char *fn, *p; int i, n; + if (za == NULL) + return -1; + if (fname == NULL) { _zip_error_set(error, ZIP_ER_INVAL, 0); return -1; } - if((flags & ZIP_FL_UNCHANGED) && !za->cdir) { - return -1; + if ((flags & ZIP_FL_UNCHANGED) && za->cdir == NULL) { + _zip_error_set(error, ZIP_ER_NOENT, 0); + return -1; } - cmp = (flags & ZIP_FL_NOCASE) ? strcmpi : strcmp; + cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp; n = (flags & ZIP_FL_UNCHANGED) ? za->cdir->nentry : za->nentry; for (i=0; i<n; i++) { |