|
@@ -1178,8 +1178,8 @@ static PHYSFS_sint32 zip_find_start_of_dir(ZIPinfo *info, const char *path,
|
|
|
* Moved to seperate function so we can use alloca then immediately throw
|
|
* Moved to seperate function so we can use alloca then immediately throw
|
|
|
* away the allocated stack space...
|
|
* away the allocated stack space...
|
|
|
*/
|
|
*/
|
|
|
-static void doEnumCallback(PHYSFS_StringCallback cb, void *callbackdata,
|
|
|
|
|
- const char *str, PHYSFS_sint32 ln)
|
|
|
|
|
|
|
+static void doEnumCallback(PHYSFS_EnumFilesCallback cb, void *callbackdata,
|
|
|
|
|
+ const char *odir, const char *str, PHYSFS_sint32 ln)
|
|
|
{
|
|
{
|
|
|
char *newstr = alloca(ln + 1);
|
|
char *newstr = alloca(ln + 1);
|
|
|
if (newstr == NULL)
|
|
if (newstr == NULL)
|
|
@@ -1187,13 +1187,13 @@ static void doEnumCallback(PHYSFS_StringCallback cb, void *callbackdata,
|
|
|
|
|
|
|
|
memcpy(newstr, str, ln);
|
|
memcpy(newstr, str, ln);
|
|
|
newstr[ln] = '\0';
|
|
newstr[ln] = '\0';
|
|
|
- cb(callbackdata, newstr);
|
|
|
|
|
|
|
+ cb(callbackdata, odir, newstr);
|
|
|
} /* doEnumCallback */
|
|
} /* doEnumCallback */
|
|
|
|
|
|
|
|
|
|
|
|
|
static void ZIP_enumerateFiles(dvoid *opaque, const char *dname,
|
|
static void ZIP_enumerateFiles(dvoid *opaque, const char *dname,
|
|
|
- int omitSymLinks, PHYSFS_StringCallback cb,
|
|
|
|
|
- void *callbackdata)
|
|
|
|
|
|
|
+ int omitSymLinks, PHYSFS_EnumFilesCallback cb,
|
|
|
|
|
+ const char *origdir, void *callbackdata)
|
|
|
{
|
|
{
|
|
|
ZIPinfo *info = ((ZIPinfo *) opaque);
|
|
ZIPinfo *info = ((ZIPinfo *) opaque);
|
|
|
PHYSFS_sint32 dlen, dlen_inc, max, i;
|
|
PHYSFS_sint32 dlen, dlen_inc, max, i;
|
|
@@ -1221,7 +1221,7 @@ static void ZIP_enumerateFiles(dvoid *opaque, const char *dname,
|
|
|
char *add = e + dlen_inc;
|
|
char *add = e + dlen_inc;
|
|
|
char *ptr = strchr(add, '/');
|
|
char *ptr = strchr(add, '/');
|
|
|
PHYSFS_sint32 ln = (PHYSFS_sint32) ((ptr) ? ptr-add : strlen(add));
|
|
PHYSFS_sint32 ln = (PHYSFS_sint32) ((ptr) ? ptr-add : strlen(add));
|
|
|
- doEnumCallback(cb, callbackdata, add, ln);
|
|
|
|
|
|
|
+ doEnumCallback(cb, callbackdata, origdir, add, ln);
|
|
|
ln += dlen_inc; /* point past entry to children... */
|
|
ln += dlen_inc; /* point past entry to children... */
|
|
|
|
|
|
|
|
/* increment counter and skip children of subdirs... */
|
|
/* increment counter and skip children of subdirs... */
|