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:
Ryan C. Gordon 2016-08-16 14:46:53 -04:00
parent 51f0807cb3
commit b66b2d4563
1 changed files with 2 additions and 2 deletions

View File

@ -124,7 +124,7 @@ SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxReqSize,
SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
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);
if (processedSize != NULL)
*processedSize = processedSizeLoc;
@ -139,7 +139,7 @@ SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
*/
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))
return SZ_OK;
return SZE_FAIL;