version 1.1.1.1, 2012/02/21 23:48:05
|
version 1.1.1.2, 2013/07/22 01:32:11
|
Line 1
|
Line 1
|
/* |
/* |
zip_name_locate.c -- get index by name |
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. |
This file is part of libzip, a library to manipulate ZIP archives. |
The authors can be contacted at <libzip@nih.at> |
The authors can be contacted at <libzip@nih.at> |
Line 17
|
Line 17
|
3. The names of the authors may not be used to endorse or promote |
3. The names of the authors may not be used to endorse or promote |
products derived from this software without specific prior |
products derived from this software without specific prior |
written permission. |
written permission. |
| |
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS |
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS |
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
Line 55 _zip_name_locate(struct zip *za, const char *fname, in
|
Line 55 _zip_name_locate(struct zip *za, const char *fname, in
|
const char *fn, *p; |
const char *fn, *p; |
int i, n; |
int i, n; |
|
|
|
if (za == NULL) |
|
return -1; |
|
|
if (fname == NULL) { |
if (fname == NULL) { |
_zip_error_set(error, ZIP_ER_INVAL, 0); |
_zip_error_set(error, ZIP_ER_INVAL, 0); |
return -1; |
return -1; |
} |
} |
|
|
if((flags & ZIP_FL_UNCHANGED) && !za->cdir) { | if ((flags & ZIP_FL_UNCHANGED) && za->cdir == NULL) { |
return -1; | _zip_error_set(error, ZIP_ER_NOENT, 0); |
| return -1; |
} |
} |
|
|
cmp = (flags & ZIP_FL_NOCASE) ? strcmpi : strcmp; |
cmp = (flags & ZIP_FL_NOCASE) ? strcmpi : strcmp; |
Line 76 _zip_name_locate(struct zip *za, const char *fname, in
|
Line 80 _zip_name_locate(struct zip *za, const char *fname, in
|
/* newly added (partially filled) entry */ |
/* newly added (partially filled) entry */ |
if (fn == NULL) |
if (fn == NULL) |
continue; |
continue; |
| |
if (flags & ZIP_FL_NODIR) { |
if (flags & ZIP_FL_NODIR) { |
p = strrchr(fn, '/'); |
p = strrchr(fn, '/'); |
if (p) |
if (p) |