Skip to content

Commit

Permalink
Fixed Windows/PocketPC __PHYSFS_platformEOF() for zero-length files.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Aug 1, 2011
1 parent 8cd359f commit a7d5c1d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion platform/pocketpc.c
Expand Up @@ -505,14 +505,18 @@ PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque)

int __PHYSFS_platformEOF(void *opaque)
{
const PHYSFS_sint64 FileLength = __PHYSFS_platformFileLength(opaque);
PHYSFS_sint64 FilePosition;
int retval = 0;

if (FileLength == 0)
return 1; /* we're definitely at EOF. */

/* Get the current position in the file */
if ((FilePosition = __PHYSFS_platformTell(opaque)) != 0)
{
/* Non-zero if EOF is equal to the file length */
retval = FilePosition == __PHYSFS_platformFileLength(opaque);
retval = (FilePosition == FileLength);
} /* if */

return(retval);
Expand Down
6 changes: 5 additions & 1 deletion platform/windows.c
Expand Up @@ -1182,14 +1182,18 @@ PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque)

int __PHYSFS_platformEOF(void *opaque)
{
const PHYSFS_sint64 FileLength = __PHYSFS_platformFileLength(opaque);
PHYSFS_sint64 FilePosition;
int retval = 0;

if (FileLength == 0)
return 1; /* we're definitely at EOF. */

/* Get the current position in the file */
if ((FilePosition = __PHYSFS_platformTell(opaque)) != 0)
{
/* Non-zero if EOF is equal to the file length */
retval = FilePosition == __PHYSFS_platformFileLength(opaque);
retval = (FilePosition == FileLength);
} /* if */

return(retval);
Expand Down

0 comments on commit a7d5c1d

Please sign in to comment.