Преглед на файлове

Fixed some __PHYSFS_platformTell() things in stable-2.0 branch.

Ryan C. Gordon преди 14 години
родител
ревизия
f0cb6de676
променени са 4 файла, в които са добавени 6 реда и са изтрити 7 реда
  1. 1 2
      physfs_internal.h
  2. 2 2
      platform/pocketpc.c
  3. 1 1
      platform/posix.c
  4. 2 2
      platform/windows.c

+ 1 - 2
physfs_internal.h

@@ -1225,8 +1225,7 @@ int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos);
  *
  * Not all file types can "tell"; this is to be expected by the caller.
  *
- * On error, call __PHYSFS_setError() and return zero. On success, return
- *  a non-zero value.
+ * On error, call __PHYSFS_setError() and return -1. On success, return >= 0.
  */
 PHYSFS_sint64 __PHYSFS_platformTell(void *opaque);
 

+ 2 - 2
platform/pocketpc.c

@@ -467,7 +467,7 @@ PHYSFS_sint64 __PHYSFS_platformTell(void *opaque)
     LowPos = SetFilePointer(Handle, 0, &HighPos, FILE_CURRENT);
     if ((LowPos == INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR))
     {
-        BAIL_MACRO(win32strerror(), 0);
+        BAIL_MACRO(win32strerror(), -1);
     } /* if */
     else
     {
@@ -513,7 +513,7 @@ int __PHYSFS_platformEOF(void *opaque)
         return 1;  /* we're definitely at EOF. */
 
     /* Get the current position in the file */
-    if ((FilePosition = __PHYSFS_platformTell(opaque)) != 0)
+    if ((FilePosition = __PHYSFS_platformTell(opaque)) != -1)
     {
         /* Non-zero if EOF is equal to the file length */
         retval = (FilePosition == FileLength);

+ 1 - 1
platform/posix.c

@@ -383,7 +383,7 @@ int __PHYSFS_platformEOF(void *opaque)
 {
     PHYSFS_sint64 pos = __PHYSFS_platformTell(opaque);
     PHYSFS_sint64 len = __PHYSFS_platformFileLength(opaque);
-    return(pos >= len);
+    return((tell < 0) || (len < 0) || (pos >= len));
 } /* __PHYSFS_platformEOF */
 
 

+ 2 - 2
platform/windows.c

@@ -1143,7 +1143,7 @@ PHYSFS_sint64 __PHYSFS_platformTell(void *opaque)
     if ( (LowPos == PHYSFS_INVALID_SET_FILE_POINTER) &&
          (GetLastError() != NO_ERROR) )
     {
-        BAIL_MACRO(winApiStrError(), 0);
+        BAIL_MACRO(winApiStrError(), -1);
     } /* if */
     else
     {
@@ -1190,7 +1190,7 @@ int __PHYSFS_platformEOF(void *opaque)
         return 1;  /* we're definitely at EOF. */
 
     /* Get the current position in the file */
-    if ((FilePosition = __PHYSFS_platformTell(opaque)) != 0)
+    if ((FilePosition = __PHYSFS_platformTell(opaque)) != -1)
     {
         /* Non-zero if EOF is equal to the file length */
         retval = (FilePosition == FileLength);