diff options
Diffstat (limited to 'src/Common/libzip/zip_name_locate.c')
-rw-r--r-- | src/Common/libzip/zip_name_locate.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/Common/libzip/zip_name_locate.c b/src/Common/libzip/zip_name_locate.c index 706093f1..6713cabe 100644 --- a/src/Common/libzip/zip_name_locate.c +++ b/src/Common/libzip/zip_name_locate.c @@ -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 @@ -41,15 +41,13 @@ ZIP_EXTERN zip_int64_t -zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags) -{ +zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags) { return _zip_name_locate(za, fname, flags, &za->error); } zip_int64_t -_zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags, zip_error_t *error) -{ +_zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags, zip_error_t *error) { int (*cmp)(const char *, const char *); const char *fn, *p; zip_uint64_t i; @@ -62,23 +60,23 @@ _zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags, zip_error_t *e return -1; } - if (flags & (ZIP_FL_NOCASE|ZIP_FL_NODIR|ZIP_FL_ENC_CP437)) { + if (flags & (ZIP_FL_NOCASE | ZIP_FL_NODIR | ZIP_FL_ENC_CP437)) { /* can't use hash table */ cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp; - for (i=0; i<za->nentry; i++) { + for (i = 0; i < za->nentry; i++) { fn = _zip_get_name(za, i, flags, error); - + /* newly added (partially filled) entry or error */ if (fn == NULL) continue; - + if (flags & ZIP_FL_NODIR) { p = strrchr(fn, '/'); if (p) - fn = p+1; + fn = p + 1; } - + if (cmp(fname, fn) == 0) { _zip_error_clear(error); return (zip_int64_t)i; |