Stupid fix for zip_find_entry().
This commit is contained in:
parent
5af008eac3
commit
5fe652d7ad
|
@ -535,6 +535,8 @@ static ZIPentry *zip_find_entry(ZIPinfo *info, const char *path, int *isDir)
|
||||||
|
|
||||||
else /* substring match...might be dir or entry or nothing. */
|
else /* substring match...might be dir or entry or nothing. */
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
if (isDir != NULL)
|
if (isDir != NULL)
|
||||||
{
|
{
|
||||||
*isDir = (thispath[pathlen] == '/');
|
*isDir = (thispath[pathlen] == '/');
|
||||||
|
@ -544,12 +546,27 @@ static ZIPentry *zip_find_entry(ZIPinfo *info, const char *path, int *isDir)
|
||||||
|
|
||||||
if (thispath[pathlen] == '\0') /* found entry? */
|
if (thispath[pathlen] == '\0') /* found entry? */
|
||||||
return(&a[middle]);
|
return(&a[middle]);
|
||||||
/* adjust search params, try again. */
|
|
||||||
else if (thispath[pathlen] > '/')
|
/* substring match; search remaining space to find it... */
|
||||||
hi = middle - 1;
|
for (i = lo; i < hi; i++)
|
||||||
else
|
{
|
||||||
lo = middle + 1;
|
thispath = a[i].name;
|
||||||
} /* if */
|
if (strncmp(path, thispath, pathlen) == 0)
|
||||||
|
{
|
||||||
|
if (isDir != NULL)
|
||||||
|
{
|
||||||
|
*isDir = (thispath[pathlen] == '/');
|
||||||
|
if (*isDir)
|
||||||
|
return(NULL);
|
||||||
|
} /* if */
|
||||||
|
|
||||||
|
if (thispath[pathlen] == '\0') /* found entry? */
|
||||||
|
return(&a[i]);
|
||||||
|
} /* if */
|
||||||
|
} /* for */
|
||||||
|
break;
|
||||||
|
|
||||||
|
} /* else */
|
||||||
} /* while */
|
} /* while */
|
||||||
|
|
||||||
if (isDir != NULL)
|
if (isDir != NULL)
|
||||||
|
|
Loading…
Reference in New Issue