From 624d7f3a42ff560029497ed772b31133f06cc1d5 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 14 Mar 2012 05:47:15 -0400 Subject: [PATCH] Fixed PHYSFS_read() and PHYSFS_write() in the dev branch. PHYSFS_read() and PHYSFS_write() should return number of objects written, not object size. Thanks to Evgeny Podjachev for the fix! --- src/physfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physfs.c b/src/physfs.c index 595b437..5516592 100644 --- a/src/physfs.c +++ b/src/physfs.c @@ -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 */ @@ -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 */