Fixed some compiler warnings with Visual Studio.
This commit is contained in:
parent
bf9999af2d
commit
1bacc6d6af
|
@ -344,19 +344,19 @@ static int iso_extractfilename(ISO9660Handle *handle,
|
||||||
static int iso_readimage(ISO9660Handle *handle, PHYSFS_uint64 where,
|
static int iso_readimage(ISO9660Handle *handle, PHYSFS_uint64 where,
|
||||||
void *buffer, PHYSFS_uint64 len)
|
void *buffer, PHYSFS_uint64 len)
|
||||||
{
|
{
|
||||||
int rc = -1;
|
PHYSFS_sint64 rc = -1;
|
||||||
BAIL_IF_ERRPASS(!__PHYSFS_platformGrabMutex(handle->mutex), -1);
|
BAIL_IF_ERRPASS(!__PHYSFS_platformGrabMutex(handle->mutex), -1);
|
||||||
if (where != handle->currpos)
|
if ((where != handle->currpos) && !handle->io->seek(handle->io,where))
|
||||||
GOTO_IF_ERRPASS(!handle->io->seek(handle->io,where), unlockme);
|
BAIL_MUTEX_ERRPASS(handle->mutex, -1);
|
||||||
|
|
||||||
rc = handle->io->read(handle->io, buffer, len);
|
rc = handle->io->read(handle->io, buffer, len);
|
||||||
if (rc == -1)
|
if (rc == -1)
|
||||||
{
|
{
|
||||||
handle->currpos = (PHYSFS_uint64) -1;
|
handle->currpos = (PHYSFS_uint64) -1;
|
||||||
goto unlockme;
|
BAIL_MUTEX_ERRPASS(handle->mutex, -1);
|
||||||
} /* if */
|
} /* if */
|
||||||
handle->currpos += rc;
|
handle->currpos += (PHYSFS_uint64) rc;
|
||||||
|
|
||||||
unlockme:
|
|
||||||
__PHYSFS_platformReleaseMutex(handle->mutex);
|
__PHYSFS_platformReleaseMutex(handle->mutex);
|
||||||
return rc;
|
return rc;
|
||||||
} /* iso_readimage */
|
} /* iso_readimage */
|
||||||
|
@ -653,7 +653,7 @@ static PHYSFS_uint32 iso_file_read_mem(ISO9660FileHandle *filehandle,
|
||||||
void *buffer, PHYSFS_uint64 len)
|
void *buffer, PHYSFS_uint64 len)
|
||||||
{
|
{
|
||||||
/* check remaining bytes & max obj which can be fetched */
|
/* check remaining bytes & max obj which can be fetched */
|
||||||
const PHYSFS_sint64 bytesleft = filehandle->filesize - filehandle->currpos;
|
const PHYSFS_uint64 bytesleft = filehandle->filesize - filehandle->currpos;
|
||||||
if (bytesleft < len)
|
if (bytesleft < len)
|
||||||
len = bytesleft;
|
len = bytesleft;
|
||||||
|
|
||||||
|
@ -691,15 +691,15 @@ static PHYSFS_uint32 iso_file_read_foreign(ISO9660FileHandle *filehandle,
|
||||||
|
|
||||||
/* check remaining bytes & max obj which can be fetched */
|
/* check remaining bytes & max obj which can be fetched */
|
||||||
const PHYSFS_sint64 bytesleft = filehandle->filesize - filehandle->currpos;
|
const PHYSFS_sint64 bytesleft = filehandle->filesize - filehandle->currpos;
|
||||||
if (bytesleft < len)
|
if (((PHYSFS_uint64) bytesleft) < len)
|
||||||
len = bytesleft;
|
len = bytesleft;
|
||||||
|
|
||||||
rc = filehandle->io->read(filehandle->io, buffer, len);
|
rc = filehandle->io->read(filehandle->io, buffer, len);
|
||||||
BAIL_IF_ERRPASS(rc == -1, -1);
|
BAIL_IF_ERRPASS(rc == -1, -1);
|
||||||
|
|
||||||
filehandle->currpos += rc; /* i trust my internal book keeping */
|
filehandle->currpos += rc; /* i trust my internal book keeping */
|
||||||
BAIL_IF(rc < len, PHYSFS_ERR_CORRUPT, -1);
|
BAIL_IF(((PHYSFS_uint64) rc) < len, PHYSFS_ERR_CORRUPT, -1);
|
||||||
return rc;
|
return (PHYSFS_uint32) rc;
|
||||||
} /* iso_file_read_foreign */
|
} /* iso_file_read_foreign */
|
||||||
|
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ static int iso_file_seek_foreign(ISO9660FileHandle *fhandle,
|
||||||
PHYSFS_sint64 pos;
|
PHYSFS_sint64 pos;
|
||||||
|
|
||||||
BAIL_IF(offset < 0, PHYSFS_ERR_INVALID_ARGUMENT, 0);
|
BAIL_IF(offset < 0, PHYSFS_ERR_INVALID_ARGUMENT, 0);
|
||||||
BAIL_IF(offset >= fhandle->filesize, PHYSFS_ERR_PAST_EOF, 0);
|
BAIL_IF(((PHYSFS_uint64) offset) >= fhandle->filesize, PHYSFS_ERR_PAST_EOF, 0);
|
||||||
|
|
||||||
pos = fhandle->startblock * 2048 + offset;
|
pos = fhandle->startblock * 2048 + offset;
|
||||||
BAIL_IF_ERRPASS(!fhandle->io->seek(fhandle->io, pos), -1);
|
BAIL_IF_ERRPASS(!fhandle->io->seek(fhandle->io, pos), -1);
|
||||||
|
|
|
@ -354,7 +354,7 @@ static PHYSFS_sint64 ZIP_read(PHYSFS_Io *_io, void *buf, PHYSFS_uint64 len)
|
||||||
|
|
||||||
finfo->compressed_position += (PHYSFS_uint32) br;
|
finfo->compressed_position += (PHYSFS_uint32) br;
|
||||||
finfo->stream.next_in = finfo->buffer;
|
finfo->stream.next_in = finfo->buffer;
|
||||||
finfo->stream.avail_in = (PHYSFS_uint32) br;
|
finfo->stream.avail_in = (unsigned int) br;
|
||||||
} /* if */
|
} /* if */
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
|
@ -815,9 +815,9 @@ static int zip_resolve_symlink(PHYSFS_Io *io, ZIPinfo *info, ZIPentry *entry)
|
||||||
{
|
{
|
||||||
initializeZStream(&stream);
|
initializeZStream(&stream);
|
||||||
stream.next_in = compressed;
|
stream.next_in = compressed;
|
||||||
stream.avail_in = complen;
|
stream.avail_in = (unsigned int) complen;
|
||||||
stream.next_out = (unsigned char *) path;
|
stream.next_out = (unsigned char *) path;
|
||||||
stream.avail_out = size;
|
stream.avail_out = (unsigned int) size;
|
||||||
if (zlib_err(inflateInit2(&stream, -MAX_WBITS)) == Z_OK)
|
if (zlib_err(inflateInit2(&stream, -MAX_WBITS)) == Z_OK)
|
||||||
{
|
{
|
||||||
rc = zlib_err(inflate(&stream, Z_FINISH));
|
rc = zlib_err(inflate(&stream, Z_FINISH));
|
||||||
|
@ -1537,7 +1537,7 @@ static int zip_parse_end_of_central_dir(ZIPinfo *info,
|
||||||
/* offset of central directory */
|
/* offset of central directory */
|
||||||
BAIL_IF_ERRPASS(!readui32(io, &offset32), 0);
|
BAIL_IF_ERRPASS(!readui32(io, &offset32), 0);
|
||||||
*dir_ofs = (PHYSFS_uint64) offset32;
|
*dir_ofs = (PHYSFS_uint64) offset32;
|
||||||
BAIL_IF(pos < (*dir_ofs + ui32), PHYSFS_ERR_CORRUPT, 0);
|
BAIL_IF(((PHYSFS_uint64) pos) < (*dir_ofs + ui32), PHYSFS_ERR_CORRUPT, 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For self-extracting archives, etc, there's crapola in the file
|
* For self-extracting archives, etc, there's crapola in the file
|
||||||
|
|
Loading…
Reference in New Issue