Browse Source

FIXME cleanups.

Ryan C. Gordon 23 years ago
parent
commit
959a15e27f
5 changed files with 17 additions and 16 deletions
  1. 0 1
      archivers/grp.c
  2. 3 3
      archivers/zip.c
  3. 2 2
      extras/physfshttpd.c
  4. 7 5
      platform/macclassic.c
  5. 5 5
      platform/win32.c

+ 0 - 1
archivers/grp.c

@@ -300,7 +300,6 @@ static LinkedStringList *GRP_enumerateFiles(DirHandle *h,
     LinkedStringList *l = NULL;
     LinkedStringList *l = NULL;
     LinkedStringList *prev = NULL;
     LinkedStringList *prev = NULL;
 
 
-    /* !!! FIXME: Does this consider "/" ? */
     if (*dirname != '\0')   /* no directories in GRP files. */
     if (*dirname != '\0')   /* no directories in GRP files. */
         return(NULL);
         return(NULL);
 
 

+ 3 - 3
archivers/zip.c

@@ -409,7 +409,7 @@ static DirHandle *ZIP_openArchive(const char *name, int forWriting)
 } /* ZIP_openArchive */
 } /* ZIP_openArchive */
 
 
 
 
-/* !!! This is seriously ugly. */
+/* !!! FIXME: This is seriously ugly. */
 static LinkedStringList *ZIP_enumerateFiles(DirHandle *h,
 static LinkedStringList *ZIP_enumerateFiles(DirHandle *h,
                                             const char *dirname,
                                             const char *dirname,
                                             int omitSymLinks)
                                             int omitSymLinks)
@@ -515,7 +515,7 @@ static LinkedStringList *ZIP_enumerateFiles(DirHandle *h,
 } /* ZIP_enumerateFiles */
 } /* ZIP_enumerateFiles */
 
 
 
 
-/* !!! This is seriously ugly. */
+/* !!! FIXME: This is seriously ugly. */
 static int ZIP_exists_symcheck(DirHandle *h, const char *name, int follow)
 static int ZIP_exists_symcheck(DirHandle *h, const char *name, int follow)
 {
 {
     char buf[MAXZIPENTRYSIZE];
     char buf[MAXZIPENTRYSIZE];
@@ -623,7 +623,7 @@ static int ZIP_isDirectory(DirHandle *h, const char *name)
     BAIL_IF_MACRO(is_sym, ERR_TOO_MANY_SYMLINKS, 0);
     BAIL_IF_MACRO(is_sym, ERR_TOO_MANY_SYMLINKS, 0);
 
 
     dlen = strlen(name);
     dlen = strlen(name);
-    /* !!! yikes. Better way to check? */
+    /* !!! FIXME: yikes. Better way to check? */
     retval = (((ZIPinfo *)(h->opaque))->entries[retval].name[dlen] == '/');
     retval = (((ZIPinfo *)(h->opaque))->entries[retval].name[dlen] == '/');
     return(retval);
     return(retval);
 } /* ZIP_isDirectory */
 } /* ZIP_isDirectory */

+ 2 - 2
extras/physfshttpd.c

@@ -81,7 +81,7 @@ static void feed_file_http(const char *ipstr, int sock, const char *fname)
     {
     {
         printf("%s: Can't open [%s]: %s.\n",
         printf("%s: Can't open [%s]: %s.\n",
                ipstr, fname, PHYSFS_getLastError());
                ipstr, fname, PHYSFS_getLastError());
-        write(sock, txt404, strlen(txt404));  /* !!! Check retval */
+        write(sock, txt404, strlen(txt404));  /* !!! FIXME: Check retval */
     } /* if */
     } /* if */
     else
     else
     {
     {
@@ -94,7 +94,7 @@ static void feed_file_http(const char *ipstr, int sock, const char *fname)
                 break;
                 break;
             } /* if */
             } /* if */
 
 
-            write(sock, buffer, (int) br);   /* !!! CHECK THIS RETVAL! */
+            write(sock, buffer, (int) br);   /* !!! FIXME: CHECK THIS RETVAL! */
         } while (!PHYSFS_eof(in));
         } while (!PHYSFS_eof(in));
 
 
         PHYSFS_close(in);
         PHYSFS_close(in);

+ 7 - 5
platform/macclassic.c

@@ -266,7 +266,7 @@ static OSErr fnameToFSSpecNoAlias(const char *fname, FSSpec *spec)
 {
 {
     OSErr err;
     OSErr err;
     Str255 str255;
     Str255 str255;
-    int needColon = (strchr(fname, ':')  == NULL);
+    int needColon = (strchr(fname, ':') == NULL);
     int len = strlen(fname) + ((needColon) ? 1 : 0);
     int len = strlen(fname) + ((needColon) ? 1 : 0);
     if (len > 255)
     if (len > 255)
         return(bdNamErr);
         return(bdNamErr);
@@ -285,7 +285,6 @@ static OSErr fnameToFSSpecNoAlias(const char *fname, FSSpec *spec)
 } /* fnameToFSSpecNoAlias */
 } /* fnameToFSSpecNoAlias */
 
 
 
 
-/* !!! FIXME: This code is pretty heinous. */
 static OSErr fnameToFSSpec(const char *fname, FSSpec *spec)
 static OSErr fnameToFSSpec(const char *fname, FSSpec *spec)
 {
 {
     Boolean alias = 0;
     Boolean alias = 0;
@@ -313,6 +312,7 @@ static OSErr fnameToFSSpec(const char *fname, FSSpec *spec)
         start = ptr;
         start = ptr;
         ptr = strchr(start + 1, ':');
         ptr = strchr(start + 1, ':');
 
 
+        /* Now check each element of the path for aliases... */
         do
         do
         {
         {
             CInfoPBRec infoPB;
             CInfoPBRec infoPB;
@@ -322,14 +322,15 @@ static OSErr fnameToFSSpec(const char *fname, FSSpec *spec)
             infoPB.dirInfo.ioDrDirID = spec->parID;
             infoPB.dirInfo.ioDrDirID = spec->parID;
             infoPB.dirInfo.ioFDirIndex = 0;
             infoPB.dirInfo.ioFDirIndex = 0;
             err = PBGetCatInfoSync(&infoPB);
             err = PBGetCatInfoSync(&infoPB);
-            if (err != noErr)  /* not an alias, really a bogus path. */
+            if (err != noErr)  /* not an alias, really just a bogus path. */
                 return(fnameToFSSpecNoAlias(fname, spec)); /* reset */
                 return(fnameToFSSpecNoAlias(fname, spec)); /* reset */
 
 
             if ((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) != 0)
             if ((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) != 0)
                 spec->parID = infoPB.dirInfo.ioDrDirID;
                 spec->parID = infoPB.dirInfo.ioDrDirID;
 
 
-            if (ptr != NULL)
+            if (ptr != NULL)  /* terminate string after next element. */
                 *ptr = '\0';
                 *ptr = '\0';
+
             *start = strlen(start + 1);  /* make it a pstring. */
             *start = strlen(start + 1);  /* make it a pstring. */
             err = FSMakeFSSpec(spec->vRefNum, spec->parID,
             err = FSMakeFSSpec(spec->vRefNum, spec->parID,
                                (const unsigned char *) start, spec);
                                (const unsigned char *) start, spec);
@@ -339,7 +340,8 @@ static OSErr fnameToFSSpec(const char *fname, FSSpec *spec)
             err = ResolveAliasFileWithMountFlags(spec, 1, &folder, &alias, 0);
             err = ResolveAliasFileWithMountFlags(spec, 1, &folder, &alias, 0);
             if (err != noErr)  /* not an alias, really a bogus path. */
             if (err != noErr)  /* not an alias, really a bogus path. */
                 return(fnameToFSSpecNoAlias(fname, spec)); /* reset */
                 return(fnameToFSSpecNoAlias(fname, spec)); /* reset */
-            start = ptr;
+
+            start = ptr;  /* move to the next element. */
             if (ptr != NULL)
             if (ptr != NULL)
                 ptr = strchr(start + 1, ':');                
                 ptr = strchr(start + 1, ':');                
         } while (start != NULL);
         } while (start != NULL);

+ 5 - 5
platform/win32.c

@@ -785,7 +785,7 @@ PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer,
     PHYSFS_sint64 retval;
     PHYSFS_sint64 retval;
 
 
     /* Read data from the file */
     /* Read data from the file */
-    /*!!! - uint32 might be a greater # than DWORD */
+    /* !!! FIXME: uint32 might be a greater # than DWORD */
     if(!ReadFile(FileHandle, buffer, count * size, &CountOfBytesRead, NULL))
     if(!ReadFile(FileHandle, buffer, count * size, &CountOfBytesRead, NULL))
     {
     {
         BAIL_MACRO(win32strerror(), -1);
         BAIL_MACRO(win32strerror(), -1);
@@ -793,7 +793,7 @@ PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer,
     else
     else
     {
     {
         /* Return the number of "objects" read. */
         /* Return the number of "objects" read. */
-        /* !!! - What if not the right amount of bytes was read to make an object? */
+        /* !!! FIXME: What if not the right amount of bytes was read to make an object? */
         retval = CountOfBytesRead / size;
         retval = CountOfBytesRead / size;
     } /* else */
     } /* else */
 
 
@@ -809,7 +809,7 @@ PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer,
     PHYSFS_sint64 retval;
     PHYSFS_sint64 retval;
 
 
     /* Read data from the file */
     /* Read data from the file */
-    /*!!! - uint32 might be a greater # than DWORD */
+    /* !!! FIXME: uint32 might be a greater # than DWORD */
     if(!WriteFile(FileHandle, buffer, count * size, &CountOfBytesWritten, NULL))
     if(!WriteFile(FileHandle, buffer, count * size, &CountOfBytesWritten, NULL))
     {
     {
         BAIL_MACRO(win32strerror(), -1);
         BAIL_MACRO(win32strerror(), -1);
@@ -817,7 +817,7 @@ PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer,
     else
     else
     {
     {
         /* Return the number of "objects" read. */
         /* Return the number of "objects" read. */
-        /*!!! - What if not the right number of bytes was written? */
+        /* !!! FIXME: What if not the right number of bytes was written? */
         retval = CountOfBytesWritten / size;
         retval = CountOfBytesWritten / size;
     } /* else */
     } /* else */
 
 
@@ -834,7 +834,7 @@ int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos)
     /* Get the high order 32-bits of the position */
     /* Get the high order 32-bits of the position */
     HighOrderPos = HIGHORDER_UINT64(pos);
     HighOrderPos = HIGHORDER_UINT64(pos);
 
 
-    /*!!! SetFilePointer needs a signed 64-bit value. */
+    /* !!! FIXME: SetFilePointer needs a signed 64-bit value. */
     /* Move pointer "pos" count from start of file */
     /* Move pointer "pos" count from start of file */
     rc = SetFilePointer(FileHandle, LOWORDER_UINT64(pos),
     rc = SetFilePointer(FileHandle, LOWORDER_UINT64(pos),
                         &HighOrderPos, FILE_BEGIN);
                         &HighOrderPos, FILE_BEGIN);