Skip to content

Commit

Permalink
Fixed PHYSFS_read() and PHYSFS_write() in the dev branch.
Browse files Browse the repository at this point in the history
PHYSFS_read() and PHYSFS_write() should return number of objects written,
 not object size.

Thanks to Evgeny Podjachev for the fix!
  • Loading branch information
icculus committed Mar 14, 2012
1 parent 519046d commit 624d7f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/physfs.c
Expand Up @@ -2407,7 +2407,7 @@ PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle, void *buffer,
{
const PHYSFS_uint64 len = ((PHYSFS_uint64) size) * ((PHYSFS_uint64) count);
const PHYSFS_sint64 retval = PHYSFS_readBytes(handle, buffer, len);
return ( (retval <= 0) ? retval : (retval / ((PHYSFS_sint64) count)) );
return ( (retval <= 0) ? retval : (retval / ((PHYSFS_sint64) size)) );
} /* PHYSFS_read */


Expand Down Expand Up @@ -2457,7 +2457,7 @@ PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle, const void *buffer,
{
const PHYSFS_uint64 len = ((PHYSFS_uint64) size) * ((PHYSFS_uint64) count);
const PHYSFS_sint64 retval = PHYSFS_writeBytes(handle, buffer, len);
return ( (retval <= 0) ? retval : (retval / ((PHYSFS_sint64) count)) );
return ( (retval <= 0) ? retval : (retval / ((PHYSFS_sint64) size)) );
} /* PHYSFS_write */


Expand Down

0 comments on commit 624d7f3

Please sign in to comment.