Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Archive implementation (Build Groupfiles), other tweaks.
  • Loading branch information
icculus committed Jul 8, 2001
1 parent 2622be3 commit ee508bb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -38,14 +38,14 @@ debugging := true
# Note that various archives may need external libraries.
#-----------------------------------------------------------------------------#
use_archive_zip := false
use_archive_grp := true

#-----------------------------------------------------------------------------#
# Set to "true" if you'd like to build a DLL. Set to "false" otherwise.
#-----------------------------------------------------------------------------#
#build_dll := false
build_dll := true


#-----------------------------------------------------------------------------#
# Set one of the below. Currently, none of these are used.
#-----------------------------------------------------------------------------#
Expand Down
13 changes: 7 additions & 6 deletions archivers/dir.c
Expand Up @@ -19,8 +19,8 @@
#include "physfs_internal.h"

extern const DirFunctions __PHYSFS_DirFunctions_DIR;
static const FileFunctions __PHYSFS_FileHandle_DIR;
static const FileFunctions __PHYSFS_FileHandle_DIRW;
static const FileFunctions __PHYSFS_FileFunctions_DIR;
static const FileFunctions __PHYSFS_FileFunctions_DIRW;

static int DIR_read(FileHandle *handle, void *buffer,
unsigned int objSize, unsigned int objCount)
Expand Down Expand Up @@ -112,7 +112,8 @@ static DirHandle *DIR_openArchive(const char *name, int forWriting)
int namelen = strlen(name);
int seplen = strlen(dirsep);

BAIL_IF_MACRO(!DIR_isArchive(name, 0), ERR_UNSUPPORTED_ARCHIVE, NULL);
BAIL_IF_MACRO(!DIR_isArchive(name, forWriting),
ERR_UNSUPPORTED_ARCHIVE, NULL);

retval = malloc(sizeof (DirHandle));
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
Expand Down Expand Up @@ -210,7 +211,7 @@ static FileHandle *doOpen(DirHandle *h, const char *name, const char *mode)

retval->opaque = (void *) rc;
retval->dirHandle = h;
retval->funcs = &__PHYSFS_FileHandle_DIR;
retval->funcs = &__PHYSFS_FileFunctions_DIR;
return(retval);
} /* doOpen */

Expand Down Expand Up @@ -275,7 +276,7 @@ static void DIR_dirClose(DirHandle *h)



static const FileFunctions __PHYSFS_FileHandle_DIR =
static const FileFunctions __PHYSFS_FileFunctions_DIR =
{
DIR_read, /* read() method */
NULL, /* write() method */
Expand All @@ -286,7 +287,7 @@ static const FileFunctions __PHYSFS_FileHandle_DIR =
};


static const FileFunctions __PHYSFS_FileHandle_DIRW =
static const FileFunctions __PHYSFS_FileFunctions_DIRW =
{
NULL, /* read() method */
DIR_write, /* write() method */
Expand Down
14 changes: 7 additions & 7 deletions archivers/zip.c
Expand Up @@ -56,37 +56,37 @@ static DirHandle *ZIP_openArchive(const char *name, int forWriting)
} /* ZIP_openArchive */


static LinkedStringList *ZIP_enumerateFiles(DirHandle *r, const char *dirname)
static LinkedStringList *ZIP_enumerateFiles(DirHandle *h, const char *dirname)
{
} /* ZIP_enumerateFiles */


static int ZIP_exists(DirHandle *r, const char *name)
static int ZIP_exists(DirHandle *h, const char *name)
{
} /* ZIP_exists */


static int ZIP_isDirectory(DirHandle *r, const char *name)
static int ZIP_isDirectory(DirHandle *h, const char *name)
{
} /* ZIP_isDirectory */


static int ZIP_isSymLink(DirHandle *r, const char *name)
static int ZIP_isSymLink(DirHandle *h, const char *name)
{
} /* ZIP_isSymLink */


static FileHandle *ZIP_openRead(DirHandle *r, const char *filename)
static FileHandle *ZIP_openRead(DirHandle *h, const char *filename)
{
} /* ZIP_openRead */


static void ZIP_dirClose(DirHandle *r)
static void ZIP_dirClose(DirHandle *h)
{
} /* ZIP_dirClose */


static const FileFunctions __PHYSFS_FileHandle_ZIP =
static const FileFunctions __PHYSFS_FileFunctions_ZIP =
{
ZIP_read, /* read() method */
NULL, /* write() method */
Expand Down
8 changes: 8 additions & 0 deletions physfs.c
Expand Up @@ -54,6 +54,10 @@ static const PHYSFS_ArchiveInfo *supported_types[] =
&__PHYSFS_ArchiveInfo_ZIP,
#endif

#if (defined PHYSFS_SUPPORTS_GRP)
&__PHYSFS_ArchiveInfo_GRP,
#endif

NULL
};

Expand All @@ -63,6 +67,10 @@ static const DirFunctions *dirFunctions[] =
&__PHYSFS_DirFunctions_ZIP,
#endif

#if (defined PHYSFS_SUPPORTS_GRP)
&__PHYSFS_DirFunctions_GRP,
#endif

&__PHYSFS_DirFunctions_DIR,
NULL
};
Expand Down
2 changes: 1 addition & 1 deletion physfs_internal.h
Expand Up @@ -239,7 +239,7 @@ typedef struct __PHYSFS_DIRFUNCTIONS__
#define ERR_SYMLINK_DISALLOWED "Symbolic links are disabled"
#define ERR_NO_WRITE_DIR "Write directory is not set"
#define ERR_NO_SUCH_FILE "No such file"

#define ERR_PAST_EOF "Past end of file"

/*
* Call this to set the message returned by PHYSFS_getLastError().
Expand Down

0 comments on commit ee508bb

Please sign in to comment.