Fixed compiler warnings on Visual Studio about const qualifiers.

This commit is contained in:
Ryan C. Gordon 2017-07-12 23:54:45 -04:00
parent 4438fe14cf
commit bf9999af2d
1 changed files with 8 additions and 9 deletions

View File

@ -85,8 +85,8 @@ static char *baseDir = NULL;
static char *userDir = NULL; static char *userDir = NULL;
static char *prefDir = NULL; static char *prefDir = NULL;
static int allowSymLinks = 0; static int allowSymLinks = 0;
static const PHYSFS_Archiver **archivers = NULL; static PHYSFS_Archiver **archivers = NULL;
static const PHYSFS_ArchiveInfo **archiveInfo = NULL; static PHYSFS_ArchiveInfo **archiveInfo = NULL;
static volatile size_t numArchivers = 0; static volatile size_t numArchivers = 0;
/* mutexes ... */ /* mutexes ... */
@ -855,7 +855,7 @@ static DirHandle *tryOpenDir(PHYSFS_Io *io, const PHYSFS_Archiver *funcs,
static DirHandle *openDirectory(PHYSFS_Io *io, const char *d, int forWriting) static DirHandle *openDirectory(PHYSFS_Io *io, const char *d, int forWriting)
{ {
DirHandle *retval = NULL; DirHandle *retval = NULL;
const PHYSFS_Archiver **i; PHYSFS_Archiver **i;
const char *ext; const char *ext;
int created_io = 0; int created_io = 0;
@ -864,7 +864,6 @@ static DirHandle *openDirectory(PHYSFS_Io *io, const char *d, int forWriting)
if (io == NULL) if (io == NULL)
{ {
/* DIR gets first shot (unlike the rest, it doesn't deal with files). */ /* DIR gets first shot (unlike the rest, it doesn't deal with files). */
extern const PHYSFS_Archiver __PHYSFS_Archiver_DIR;
retval = tryOpenDir(io, &__PHYSFS_Archiver_DIR, d, forWriting); retval = tryOpenDir(io, &__PHYSFS_Archiver_DIR, d, forWriting);
if (retval != NULL) if (retval != NULL)
return retval; return retval;
@ -1276,8 +1275,8 @@ static int archiverInUse(const PHYSFS_Archiver *arc, const DirHandle *list)
static int doDeregisterArchiver(const size_t idx) static int doDeregisterArchiver(const size_t idx)
{ {
const size_t len = (numArchivers - idx) * sizeof (void *); const size_t len = (numArchivers - idx) * sizeof (void *);
const PHYSFS_ArchiveInfo *info = archiveInfo[idx]; PHYSFS_ArchiveInfo *info = archiveInfo[idx];
const PHYSFS_Archiver *arc = archivers[idx]; PHYSFS_Archiver *arc = archivers[idx];
/* make sure nothing is still using this archiver */ /* make sure nothing is still using this archiver */
if (archiverInUse(arc, searchPath) || archiverInUse(arc, writeDir)) if (archiverInUse(arc, searchPath) || archiverInUse(arc, writeDir))
@ -1458,11 +1457,11 @@ static int doRegisterArchiver(const PHYSFS_Archiver *_archiver)
ptr = allocator.Realloc(archiveInfo, len); ptr = allocator.Realloc(archiveInfo, len);
GOTO_IF(!ptr, PHYSFS_ERR_OUT_OF_MEMORY, regfailed); GOTO_IF(!ptr, PHYSFS_ERR_OUT_OF_MEMORY, regfailed);
archiveInfo = (const PHYSFS_ArchiveInfo **) ptr; archiveInfo = (PHYSFS_ArchiveInfo **) ptr;
ptr = allocator.Realloc(archivers, len); ptr = allocator.Realloc(archivers, len);
GOTO_IF(!ptr, PHYSFS_ERR_OUT_OF_MEMORY, regfailed); GOTO_IF(!ptr, PHYSFS_ERR_OUT_OF_MEMORY, regfailed);
archivers = (const PHYSFS_Archiver **) ptr; archivers = (PHYSFS_Archiver **) ptr;
archiveInfo[numArchivers] = info; archiveInfo[numArchivers] = info;
archiveInfo[numArchivers + 1] = NULL; archiveInfo[numArchivers + 1] = NULL;
@ -1525,7 +1524,7 @@ int PHYSFS_deregisterArchiver(const char *ext)
const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void) const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void)
{ {
BAIL_IF(!initialized, PHYSFS_ERR_NOT_INITIALIZED, NULL); BAIL_IF(!initialized, PHYSFS_ERR_NOT_INITIALIZED, NULL);
return archiveInfo; return (const PHYSFS_ArchiveInfo **) archiveInfo;
} /* PHYSFS_supportedArchiveTypes */ } /* PHYSFS_supportedArchiveTypes */