More enumeration fixes. I still hate this code.
This commit is contained in:
parent
55b7638892
commit
a4d07b8e10
|
@ -1258,7 +1258,7 @@ static LinkedStringList *ZIP_enumerateFiles(DirHandle *h,
|
||||||
LinkedStringList *retval = NULL, *p = NULL;
|
LinkedStringList *retval = NULL, *p = NULL;
|
||||||
PHYSFS_uint32 dlen = strlen(dirname);
|
PHYSFS_uint32 dlen = strlen(dirname);
|
||||||
|
|
||||||
if (dirname[dlen - 1] == '/')
|
if ((dlen > 0) && (dirname[dlen - 1] == '/'))
|
||||||
dlen--;
|
dlen--;
|
||||||
|
|
||||||
i = zip_find_start_of_dir(info, dirname, 0);
|
i = zip_find_start_of_dir(info, dirname, 0);
|
||||||
|
@ -1275,8 +1275,7 @@ static LinkedStringList *ZIP_enumerateFiles(DirHandle *h,
|
||||||
if ( ((omitSymLinks) && (zip_entry_is_symlink(entry))) ||
|
if ( ((omitSymLinks) && (zip_entry_is_symlink(entry))) ||
|
||||||
(*add_file == '\0') ) /* skip links and the dir entry itself. */
|
(*add_file == '\0') ) /* skip links and the dir entry itself. */
|
||||||
{
|
{
|
||||||
i++;
|
if (++i >= max) break; else continue;
|
||||||
continue;
|
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
slash = strchr(add_file, '/'); /* handle subdirs under dirname... */
|
slash = strchr(add_file, '/'); /* handle subdirs under dirname... */
|
||||||
|
@ -1297,8 +1296,7 @@ static LinkedStringList *ZIP_enumerateFiles(DirHandle *h,
|
||||||
{
|
{
|
||||||
if (info->entries[i].name[dlen] == '/')
|
if (info->entries[i].name[dlen] == '/')
|
||||||
{
|
{
|
||||||
i++; /* skip it. */
|
if (++i >= max) break; else continue;
|
||||||
continue;
|
|
||||||
} /* if */
|
} /* if */
|
||||||
} /* if */
|
} /* if */
|
||||||
slash = NULL;
|
slash = NULL;
|
||||||
|
|
Loading…
Reference in New Issue