More FIXME cleanups.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 04 Aug 2017 22:35:49 -0400
changeset 1533 49e7fb6d5b37
parent 1532 46c93007c674
child 1534 2035d523fc6f
More FIXME cleanups.
src/physfs.h
src/physfs_platform_os2.c
src/physfs_platform_windows.c
--- a/src/physfs.h	Fri Aug 04 22:32:57 2017 -0400
+++ b/src/physfs.h	Fri Aug 04 22:35:49 2017 -0400
@@ -705,7 +705,6 @@
 PHYSFS_DECL void PHYSFS_permitSymbolicLinks(int allow);
 
 
-/* !!! FIXME: const this? */
 /**
  * \fn char **PHYSFS_getCdRomDirs(void)
  * \brief Get an array of paths to available CD-ROM drives.
@@ -2605,9 +2604,10 @@
  *  data will be either the number of seconds since the Unix epoch (midnight,
  *  Jan 1, 1970), or -1 if the information isn't available or applicable.
  *  The (filesize) field is measured in bytes.
- *  The (readonly) field tells you whether when you open a file for writing you
- *  are writing to the same file as if you were opening it, given you have
- *  enough filesystem rights to do that.  !!! FIXME: this might change.
+ *  The (readonly) field tells you whether the archive thinks a file is
+ *  not writable, but tends to be only an estimate (for example, your write
+ *  dir might overlap with a .zip file, meaning you _can_ successfully open
+ *  that path for writing, as it gets created elsewhere.
  *
  * \sa PHYSFS_stat
  * \sa PHYSFS_FileType
@@ -2783,7 +2783,11 @@
  *
  * ...in short, you're probably not going to write an HTTP implementation.
  *
- * Thread safety: TO BE DECIDED.  !!! FIXME
+ * Thread safety: PHYSFS_Io implementations are not guaranteed to be thread
+ *  safe in themselves. Under the hood where PhysicsFS uses them, the library
+ *  provides its own locks. If you plan to use them directly from separate
+ *  threads, you should either use mutexes to protect them, or don't use the
+ *  same PHYSFS_Io from two threads at the same time.
  *
  * \sa PHYSFS_mountIo
  */
@@ -3335,7 +3339,14 @@
  *  PHYSFS_setErrorCode() before returning. PhysicsFS will pass these errors
  *  back to the application unmolested in most cases.
  *
- * Thread safety: TO BE DECIDED.  !!! FIXME
+ * Thread safety: PHYSFS_Archiver implementations are not guaranteed to be
+ *  thread safe in themselves. PhysicsFS provides thread safety when it calls
+ *  into a given archiver inside the library, but it does not promise that
+ *  using the same PHYSFS_File from two threads at once is thread-safe; as
+ *  such, your PHYSFS_Archiver can assume that locking is handled for you
+ *  so long as the PHYSFS_Io you return from PHYSFS_open* doesn't change any
+ *  of your Archiver state, as the PHYSFS_Io won't be as aggressively
+ *  protected.
  *
  * \sa PHYSFS_registerArchiver
  * \sa PHYSFS_deregisterArchiver
@@ -3343,9 +3354,6 @@
  */
 typedef struct PHYSFS_Archiver
 {
-
-// !!! FIXME: split read/write interfaces?
-
     /**
      * \brief Binary compatibility information.
      *
--- a/src/physfs_platform_os2.c	Fri Aug 04 22:32:57 2017 -0400
+++ b/src/physfs_platform_os2.c	Fri Aug 04 22:35:49 2017 -0400
@@ -63,7 +63,6 @@
         case ERROR_NO_MORE_SEARCH_HANDLES: return PHYSFS_ERR_IO;
         case ERROR_SEEK_ON_DEVICE: return PHYSFS_ERR_IO;
         case ERROR_NEGATIVE_SEEK: return PHYSFS_ERR_INVALID_ARGUMENT;
-        /*!!! FIXME: Where did this go?  case ERROR_DEL_CURRENT_DIRECTORY: return ERR_DEL_CWD;*/
         case ERROR_WRITE_PROTECT: return PHYSFS_ERR_PERMISSION;
         case ERROR_WRITE_FAULT: return PHYSFS_ERR_IO;
         case ERROR_UNCERTAIN_MEDIA: return PHYSFS_ERR_IO;
--- a/src/physfs_platform_windows.c	Fri Aug 04 22:32:57 2017 -0400
+++ b/src/physfs_platform_windows.c	Fri Aug 04 22:35:49 2017 -0400
@@ -585,8 +585,7 @@
          *  NULL or the function fails.
          */
         rc = pGetDir(accessToken, &dummy, &psize);
-        assert(!rc);  /* !!! FIXME: handle this gracefully. */
-        (void) rc;
+        GOTO_IF(rc, PHYSFS_ERR_OS_ERROR, done);  /* should have failed! */
 
         /* Allocate memory for the profile directory */
         wstr = (LPWSTR) __PHYSFS_smallAlloc((psize + 1) * sizeof (WCHAR));
@@ -604,11 +603,11 @@
             } /* if */
             __PHYSFS_smallFree(wstr);
         } /* if */
-
-        CloseHandle(accessToken);
     } /* if */
 
 done:
+    if (accessToken)
+        CloseHandle(accessToken);
     FreeLibrary(lib);
     return retval;  /* We made it: hit the showers. */
 #endif