Skip to content

Commit

Permalink
Replace unsigned long cast with cast to size_t (thanks, David!).
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
icculus committed Aug 16, 2016
1 parent 51f0807 commit b66b2d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/archiver_lzma.c
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit b66b2d4

Please sign in to comment.