Navigation Menu

Skip to content

Commit

Permalink
Enough fixes to get the Build engine working with ZIP files instead of
Browse files Browse the repository at this point in the history
 GRPs. Currently does case-insensitive searching, which will change.
  • Loading branch information
icculus committed Jul 23, 2001
1 parent c83a824 commit bb35ebe
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions archivers/zip.c
Expand Up @@ -96,7 +96,7 @@ static int ZIP_seek(FileHandle *handle, int offset)
{
/* this blows. */
unzFile fh = ((ZIPfileinfo *) (handle->opaque))->handle;
char *buf;
char *buf = NULL;
int bufsize = 4096 * 2;

BAIL_IF_MACRO(unztell(fh) == offset, NULL, 1);
Expand Down Expand Up @@ -342,7 +342,7 @@ static LinkedStringList *ZIP_enumerateFiles(DirHandle *h,
continue;

buf[dlen] = '\0';
if (strcmp(d, buf) != 0) /* not same directory? */
if (__PHYSFS_platformStricmp(d, buf) != 0) /* not same directory? */
continue;

add_file = buf + dlen + 1;
Expand All @@ -356,7 +356,7 @@ static LinkedStringList *ZIP_enumerateFiles(DirHandle *h,
*ptr = '\0';
for (j = retval; j != NULL; j = j->next)
{
if (strcmp(j->str, ptr) == 0)
if (__PHYSFS_platformStricmp(j->str, ptr) == 0)
break;
} /* for */

Expand Down Expand Up @@ -521,14 +521,23 @@ static FileHandle *ZIP_openRead(DirHandle *h, const char *filename)
f = unzOpen(name);
BAIL_IF_MACRO(f == NULL, ERR_IO_ERROR, NULL);

if ( (unzLocateFile(f, filename, 1) != UNZ_OK) ||
( (finfo = (ZIPfileinfo *) malloc(sizeof (ZIPfileinfo))) == NULL ) ||
(unzOpenCurrentFile(f) != UNZ_OK) )
if ( (unzLocateFile(f, filename, 2) != UNZ_OK) ||
(unzOpenCurrentFile(f) != UNZ_OK) ||
( (finfo = (ZIPfileinfo *) malloc(sizeof (ZIPfileinfo))) == NULL ) )
{
unzClose(f);
BAIL_IF_MACRO(1, ERR_IO_ERROR, NULL);
} /* if */

if ( (!(retval = (FileHandle *) malloc(sizeof (FileHandle)))) ||
(!(retval->opaque = (ZIPfileinfo *) malloc(sizeof (ZIPfileinfo)))) )
{
if (retval)
free(retval);
unzClose(f);
BAIL_IF_MACRO(1, ERR_OUT_OF_MEMORY, NULL);
} /* if */

finfo->handle = f;
retval->opaque = (void *) finfo;
retval->funcs = &__PHYSFS_FileFunctions_ZIP;
Expand Down

0 comments on commit bb35ebe

Please sign in to comment.