Replace unsigned long cast with cast to size_t (thanks, David!).
When targeting MinGW-w64's x86_64 target, unsigned long is 4 bytes but void* is 8 bytes. This mismatch triggers the pointer-to-int-cast warning. (This patch was originally David Yip's work, with uintptr_t instead of size_t).
This commit is contained in:
parent
51f0807cb3
commit
b66b2d4563
|
@ -124,7 +124,7 @@ SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxReqSize,
|
||||||
SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
|
SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
|
||||||
size_t *processedSize)
|
size_t *processedSize)
|
||||||
{
|
{
|
||||||
FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); /* HACK! */
|
FileInputStream *s = (FileInputStream *)((size_t)object - offsetof(FileInputStream, inStream)); /* HACK! */
|
||||||
const size_t processedSizeLoc = s->io->read(s->io, buffer, size);
|
const size_t processedSizeLoc = s->io->read(s->io, buffer, size);
|
||||||
if (processedSize != NULL)
|
if (processedSize != NULL)
|
||||||
*processedSize = processedSizeLoc;
|
*processedSize = processedSizeLoc;
|
||||||
|
@ -139,7 +139,7 @@ SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
|
||||||
*/
|
*/
|
||||||
SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
|
SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
|
||||||
{
|
{
|
||||||
FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); /* HACK! */
|
FileInputStream *s = (FileInputStream *)((size_t)object - offsetof(FileInputStream, inStream)); /* HACK! */
|
||||||
if (s->io->seek(s->io, (PHYSFS_uint64) pos))
|
if (s->io->seek(s->io, (PHYSFS_uint64) pos))
|
||||||
return SZ_OK;
|
return SZ_OK;
|
||||||
return SZE_FAIL;
|
return SZE_FAIL;
|
||||||
|
|
Loading…
Reference in New Issue