Skip to content

Commit

Permalink
Fixed some compiler warnings on Visual Studio.
Browse files Browse the repository at this point in the history
(and maybe made a few new ones...)
  • Loading branch information
icculus committed Aug 15, 2017
1 parent 692d5e8 commit 8dfd3cf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/physfs.c
Expand Up @@ -3043,8 +3043,9 @@ int PHYSFS_stat(const char *_fname, PHYSFS_Stat *stat)
} /* PHYSFS_stat */


int __PHYSFS_readAll(PHYSFS_Io *io, void *buf, const PHYSFS_uint64 len)
int __PHYSFS_readAll(PHYSFS_Io *io, void *buf, const size_t _len)
{
const PHYSFS_uint64 len = (PHYSFS_uint64) _len;
return (io->read(io, buf, len) == len);
} /* __PHYSFS_readAll */

Expand Down
14 changes: 7 additions & 7 deletions src/physfs_archiver_zip.c
Expand Up @@ -747,7 +747,7 @@ static ZIPentry *zip_follow_symlink(PHYSFS_Io *io, ZIPinfo *info, char *path)

static int zip_resolve_symlink(PHYSFS_Io *io, ZIPinfo *info, ZIPentry *entry)
{
const PHYSFS_uint64 size = entry->uncompressed_size;
const size_t size = (size_t) entry->uncompressed_size;
char *path = NULL;
int rc = 0;

Expand All @@ -768,7 +768,7 @@ static int zip_resolve_symlink(PHYSFS_Io *io, ZIPinfo *info, ZIPentry *entry)
else /* symlink target path is compressed... */
{
z_stream stream;
const PHYSFS_uint64 complen = entry->compressed_size;
const size_t complen = (size_t) entry->compressed_size;
PHYSFS_uint8 *compressed = (PHYSFS_uint8*) __PHYSFS_smallAlloc(complen);
if (compressed != NULL)
{
Expand Down Expand Up @@ -1223,8 +1223,8 @@ static PHYSFS_sint64 zip64_find_end_of_central_dir(PHYSFS_Io *io,
/* Just try moving back at most 256k. Oh well. */
if ((offset < pos) && (pos > 4))
{
const PHYSFS_uint64 maxbuflen = 256 * 1024;
PHYSFS_uint64 len = pos - offset;
const size_t maxbuflen = 256 * 1024;
size_t len = pos - offset;
PHYSFS_uint8 *buf = NULL;
PHYSFS_sint32 i;

Expand All @@ -1246,7 +1246,7 @@ static PHYSFS_sint64 zip64_find_end_of_central_dir(PHYSFS_Io *io,
(buf[i+2] == 0x06) && (buf[i+3] == 0x06) )
{
__PHYSFS_smallFree(buf);
return pos - (len - i);
return pos - ((PHYSFS_sint64) (len - i));
} /* if */
} /* for */

Expand Down Expand Up @@ -1542,10 +1542,10 @@ static PHYSFS_Io *ZIP_openRead(void *opaque, const char *filename)
const char *ptr = strrchr(filename, '$');
if (ptr != NULL)
{
const PHYSFS_uint64 len = (PHYSFS_uint64) (ptr - filename);
const size_t len = (size_t) (ptr - filename);
char *str = (char *) __PHYSFS_smallAlloc(len + 1);
BAIL_IF(!str, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
memcpy(str, filename, (size_t) len);
memcpy(str, filename, len);
str[len] = '\0';
entry = zip_find_entry(info, str);
__PHYSFS_smallFree(str);
Expand Down
2 changes: 1 addition & 1 deletion src/physfs_platform_windows.c
Expand Up @@ -59,7 +59,7 @@
if (str == NULL) \
w_assignto = NULL; \
else { \
const PHYSFS_uint64 len = (PHYSFS_uint64) ((strlen(str) + 1) * 2); \
const size_t len = (PHYSFS_uint64) ((strlen(str) + 1) * 2); \
w_assignto = (WCHAR *) __PHYSFS_smallAlloc(len); \
if (w_assignto != NULL) \
PHYSFS_utf8ToUtf16(str, (PHYSFS_uint16 *) w_assignto, len); \
Expand Down

0 comments on commit 8dfd3cf

Please sign in to comment.