-Added type casting that Ryan needs to approve.
-MSVC complained about implicit 64-bit to 32-bit conversions.
This commit is contained in:
parent
5d5f15ca9a
commit
0217b7cdd7
|
@ -130,7 +130,8 @@ static PHYSFS_sint64 GRP_read(FileHandle *handle, void *buffer,
|
|||
void *fh = finfo->handle;
|
||||
PHYSFS_sint64 curPos = __PHYSFS_platformTell(fh);
|
||||
PHYSFS_uint64 bytesLeft = (finfo->startPos + finfo->size) - curPos;
|
||||
PHYSFS_uint32 objsLeft = bytesLeft / objSize;
|
||||
/*!!! If objSize is '1' it's quite likely that objsLeft will be greater than 32-bits */
|
||||
PHYSFS_uint32 objsLeft = (PHYSFS_uint32)(bytesLeft / objSize);
|
||||
|
||||
if (objsLeft < objCount)
|
||||
objCount = objsLeft;
|
||||
|
@ -157,7 +158,8 @@ static PHYSFS_sint64 GRP_tell(FileHandle *handle)
|
|||
static int GRP_seek(FileHandle *handle, PHYSFS_uint64 offset)
|
||||
{
|
||||
GRPfileinfo *finfo = (GRPfileinfo *) (handle->opaque);
|
||||
int newPos = finfo->startPos + offset;
|
||||
/*!!! Why isn't newPos a 64-bit??? */
|
||||
int newPos = (int)(finfo->startPos + offset);
|
||||
|
||||
BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
|
||||
BAIL_IF_MACRO(newPos > finfo->startPos + finfo->size, ERR_PAST_EOF, 0);
|
||||
|
@ -287,7 +289,8 @@ static LinkedStringList *GRP_enumerateFiles(DirHandle *h,
|
|||
PHYSFS_uint8 buf[16];
|
||||
GRPinfo *g = (GRPinfo *) (h->opaque);
|
||||
void *fh = g->handle;
|
||||
int i;
|
||||
/*!!! This should be a uint32 and not an int...look at loops below */
|
||||
PHYSFS_uint32 i;
|
||||
LinkedStringList *retval = NULL;
|
||||
LinkedStringList *l = NULL;
|
||||
LinkedStringList *prev = NULL;
|
||||
|
@ -299,6 +302,7 @@ static LinkedStringList *GRP_enumerateFiles(DirHandle *h,
|
|||
/* jump to first file entry... */
|
||||
BAIL_IF_MACRO(!__PHYSFS_platformSeek(fh, 16), NULL, NULL);
|
||||
|
||||
/*!!! i needs to be unsigned */
|
||||
for (i = 0; i < g->totalEntries; i++)
|
||||
{
|
||||
BAIL_IF_MACRO(__PHYSFS_platformRead(fh, buf, 16, 1) != 1, NULL, retval);
|
||||
|
@ -337,7 +341,8 @@ static PHYSFS_sint32 getFileEntry(DirHandle *h, const char *name,
|
|||
PHYSFS_uint8 buf[16];
|
||||
GRPinfo *g = (GRPinfo *) (h->opaque);
|
||||
void *fh = g->handle;
|
||||
int i;
|
||||
/*!!! This should be a uint32 and not an int...look at loops below */
|
||||
PHYSFS_uint32 i;
|
||||
char *ptr;
|
||||
int retval = (g->totalEntries + 1) * 16; /* offset of raw file data */
|
||||
|
||||
|
|
|
@ -168,7 +168,9 @@ static int ZIP_seek(FileHandle *handle, PHYSFS_uint64 offset)
|
|||
|
||||
while (offset > 0)
|
||||
{
|
||||
PHYSFS_uint32 chunk = (offset > bufsize) ? bufsize : offset;
|
||||
/* !!! - RYAN, CHECK THIS CAST */
|
||||
/* !!! This should be okay since offset will be <= bufsize */
|
||||
PHYSFS_uint32 chunk = (offset > bufsize) ? bufsize : (PHYSFS_uint32)offset;
|
||||
PHYSFS_sint32 rc = unzReadCurrentFile(fh, buf, chunk);
|
||||
BAIL_IF_MACRO(rc == 0, ERR_IO_ERROR, 0); /* shouldn't happen. */
|
||||
BAIL_IF_MACRO(rc == UNZ_ERRNO, ERR_IO_ERROR, 0);
|
||||
|
@ -271,7 +273,9 @@ static char *ZIP_realpath(unzFile fh, unz_file_info *info, ZIPentry *entry)
|
|||
static int version_does_symlinks(uLong version)
|
||||
{
|
||||
int retval = 0;
|
||||
unsigned char hosttype = ((version >> 8) & 0xFF);
|
||||
/* !!! - RYAN, CHECK THIS CAST */
|
||||
/* !!! - You AND the result with 0xFF, so it can't be larger than 0xFF */
|
||||
unsigned char hosttype = (unsigned char)((version >> 8) & 0xFF);
|
||||
|
||||
/*
|
||||
* These are the platforms that can build an archive with symlinks,
|
||||
|
|
Loading…
Reference in New Issue