paragui-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-cvs] CVS: paragui/src/physfs/platform os2.c,1.1,1.2 unix_nocdro


From: Alexander Pipelka <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/physfs/platform os2.c,1.1,1.2 unix_nocdrom.c,1.1,1.2 Makefile.am,1.3,1.4 beos.cpp,1.2,1.3 macclassic.c,1.2,1.3 posix.c,1.2,1.3 unix.c,1.3,1.4 win32.c,1.3,1.4 darwin.c,1.1.1.1,NONE freebsd.c,1.1.1.1,NONE irix.c,1.1.1.1,NONE solaris.c,1.1.1.1,NONE
Date: Sun, 18 Aug 2002 04:12:55 -0400

Update of /cvsroot/paragui/paragui/src/physfs/platform
In directory subversions:/tmp/cvs-serv12482/src/physfs/platform

Modified Files:
        Makefile.am beos.cpp macclassic.c posix.c unix.c win32.c 
Added Files:
        os2.c unix_nocdrom.c 
Removed Files:
        darwin.c freebsd.c irix.c solaris.c 
Log Message:
synced with the devel-1-0-x tree.





Index: Makefile.am
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/platform/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Makefile.am 26 Jun 2002 08:30:11 -0000      1.3
--- Makefile.am 18 Aug 2002 08:12:53 -0000      1.4
***************
*** 1,21 ****
  noinst_LTLIBRARIES = libplatform.la
  
! if BUILD_BEOS_CPP
! libplatform_la_SOURCES = \
!       posix.c \
!       beos.cpp
  else
! libplatform_la_SOURCES = \
!       posix.c \
!       unix.c
  endif
  
- EXTRA_DIST = \
-       posix.c \
-       unix.c \
-       skeleton.c \
-       win32.c \
-       macclassic.c \
-       beos.cpp
  
! INCLUDES = -I$(top_srcdir)
--- 1,25 ----
  noinst_LTLIBRARIES = libplatform.la
  
! INCLUDES = -I$(top_srcdir)
! 
! if BUILD_BEOS
! libplatform_la_SOURCES =      \
!       posix.c                 \
!     beos.cpp
  else
! libplatform_la_SOURCES =      \
!       unix.c                  \
!       win32.c                 \
!       posix.c                 \
!       os2.c
  endif
  
  
! EXTRA_DIST =      \
!       skeleton.c    \
!       macclassic.c  \
!       win32.c       \
!       unix.c        \
!       os2.c         \
!     beos.cpp
! 

Index: beos.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/platform/beos.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** beos.cpp    26 Jun 2002 08:30:11 -0000      1.2
--- beos.cpp    18 Aug 2002 08:12:53 -0000      1.3
***************
*** 36,42 ****
  const char *__PHYSFS_platformDirSeparator = "/";
  
- /* !!! FIXME: does strerror() work for non-POSIX api calls? */
- #define get_error_str(x) strerror(x)
- 
  
  int __PHYSFS_platformInit(void)
--- 36,39 ----
***************
*** 84,92 ****
              status_t rc;
              rc = vol.GetRootDirectory(&directory);
!             BAIL_IF_MACRO(rc < B_OK, get_error_str(rc), NULL);
              rc = directory.GetEntry(&entry);
!             BAIL_IF_MACRO(rc < B_OK, get_error_str(rc), NULL);
              rc = entry.GetPath(&path);
!             BAIL_IF_MACRO(rc < B_OK, get_error_str(rc), NULL);
              const char *str = path.Path();
              BAIL_IF_MACRO(str == NULL, ERR_OS_ERROR, NULL);  /* ?! */
--- 81,89 ----
              status_t rc;
              rc = vol.GetRootDirectory(&directory);
!             BAIL_IF_MACRO(rc < B_OK, strerror(rc), NULL);
              rc = directory.GetEntry(&entry);
!             BAIL_IF_MACRO(rc < B_OK, strerror(rc), NULL);
              rc = entry.GetPath(&path);
!             BAIL_IF_MACRO(rc < B_OK, strerror(rc), NULL);
              const char *str = path.Path();
              BAIL_IF_MACRO(str == NULL, ERR_OS_ERROR, NULL);  /* ?! */
***************
*** 190,194 ****
      app_info info;
      status_t rc = roster.GetRunningAppInfo(getTeamID(), &info);
!     BAIL_IF_MACRO(rc < B_OK, get_error_str(rc), NULL);
      BEntry entry(&(info.ref), true);
      BPath path;
--- 187,191 ----
      app_info info;
      status_t rc = roster.GetRunningAppInfo(getTeamID(), &info);
!     BAIL_IF_MACRO(rc < B_OK, strerror(rc), NULL);
      BEntry entry(&(info.ref), true);
      BPath path;
***************
*** 230,234 ****
      BPath normalized(str, leaf, true);  /* force normalization of path. */
      const char *resolved_path = normalized.Path();
!     BAIL_IF_MACRO(resolved_path == NULL, ERR_FILE_NOT_FOUND, NULL);
      char *retval = (char *) malloc(strlen(resolved_path) + 1);
      BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
--- 227,231 ----
      BPath normalized(str, leaf, true);  /* force normalization of path. */
      const char *resolved_path = normalized.Path();
!     BAIL_IF_MACRO(resolved_path == NULL, ERR_NO_SUCH_FILE, NULL);
      char *retval = (char *) malloc(strlen(resolved_path) + 1);
      BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
***************
*** 248,252 ****
      {
          free(retval);
!         BAIL_MACRO(get_error_str(rc), NULL);
      } // if
  
--- 245,249 ----
      {
          free(retval);
!         BAIL_MACRO(strerror(rc), NULL);
      } // if
  
***************
*** 266,270 ****
  {
      status_t rc = acquire_sem(*((sem_id *) mutex));
!     BAIL_IF_MACRO(rc < B_OK, get_error_str(rc), 0);
      return(1);
  } /* __PHYSFS_platformGrabMutex */
--- 263,267 ----
  {
      status_t rc = acquire_sem(*((sem_id *) mutex));
!     BAIL_IF_MACRO(rc < B_OK, strerror(rc), 0);
      return(1);
  } /* __PHYSFS_platformGrabMutex */

Index: macclassic.c
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/platform/macclassic.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** macclassic.c        26 Jun 2002 08:30:11 -0000      1.2
--- macclassic.c        18 Aug 2002 08:12:53 -0000      1.3
***************
*** 61,64 ****
--- 61,151 ----
  const char *__PHYSFS_platformDirSeparator = ":";
  
+ 
+ static const char *get_macos_error_string(OSErr err)
+ {
+     if (err == noErr)
+         return(NULL);
+ 
+     switch (err)
+     {
+         case fnfErr: return(ERR_NO_SUCH_FILE);
+         case notOpenErr: return(ERR_NO_SUCH_VOLUME);
+         case dirFulErr: return(ERR_DIRECTORY_FULL);
+         case dskFulErr: return(ERR_DISK_FULL);
+         case nsvErr: return(ERR_NO_SUCH_VOLUME);
+         case ioErr: return(ERR_IO_ERROR);
+         case bdNamErr: return(ERR_BAD_FILENAME);
+         case fnOpnErr: return(ERR_NOT_A_HANDLE);
+         case eofErr: return(ERR_PAST_EOF);
+         case posErr: return(ERR_SEEK_OUT_OF_RANGE);
+         case tmfoErr: return(ERR_TOO_MANY_HANDLES);
+         case wPrErr: return(ERR_VOL_LOCKED_HW);
+         case fLckdErr: return(ERR_FILE_LOCKED);
+         case vLckdErr: return(ERR_VOL_LOCKED_SW);
+         case fBsyErr: return(ERR_FILE_OR_DIR_BUSY);
+         case dupFNErr: return(ERR_FILE_ALREADY_EXISTS);
+         case opWrErr: return(ERR_FILE_ALREADY_OPEN_W);
+         case rfNumErr: return(ERR_INVALID_REFNUM);
+         case gfpErr: return(ERR_GETTING_FILE_POS);
+         case volOffLinErr: return(ERR_VOLUME_OFFLINE);
+         case permErr: return(ERR_PERMISSION_DENIED);
+         case volOnLinErr: return(ERR_VOL_ALREADY_ONLINE);
+         case nsDrvErr: return(ERR_NO_SUCH_DRIVE);
+         case noMacDskErr: return(ERR_NOT_MAC_DISK);
+         case extFSErr: return(ERR_VOL_EXTERNAL_FS);
+         case fsRnErr: return(ERR_PROBLEM_RENAME);
+         case badMDBErr: return(ERR_BAD_MASTER_BLOCK);
+         case wrPermErr: return(ERR_PERMISSION_DENIED);
+         case memFullErr: return(ERR_OUT_OF_MEMORY);
+         case dirNFErr: return(ERR_NO_SUCH_PATH);
+         case tmwdoErr: return(ERR_TOO_MANY_HANDLES);
+         case badMovErr: return(ERR_CANT_MOVE_FORBIDDEN);
+         case wrgVolTypErr: return(ERR_WRONG_VOL_TYPE);
+         case volGoneErr: return(ERR_SERVER_VOL_LOST);
+         case errFSNameTooLong: return(ERR_BAD_FILENAME);
+         case errFSNotAFolder: return(ERR_NOT_A_DIR);
+         case errFSNotAFile: return(ERR_NOT_A_FILE);
+         case fidNotFound: return(ERR_FILE_ID_NOT_FOUND);
+         case fidExists: return(ERR_FILE_ID_EXISTS);
+         case afpAccessDenied: return(ERR_ACCESS_DENIED);
+         case afpNoServer: return(ERR_SERVER_NO_RESPOND);
+         case afpUserNotAuth: return(ERR_USER_AUTH_FAILED);
+         case afpPwdExpiredErr: return(ERR_PWORD_EXPIRED);
+ 
+         case paramErr:
+         case errFSBadFSRef:
+         case errFSBadBuffer:
+         case errFSMissingName:
+         case errFSBadPosMode:
+         case errFSBadAllocFlags:
+         case errFSBadItemCount
+         case errFSBadSearchParams
+         case afpDenyConflict
+             return(ERR_PHYSFS_BAD_OS_CALL);
+ 
+         default: return(ERR_MACOS_GENERIC);
+     } /* switch */
+ 
+     return(NULL);
+ } /* get_macos_error_string */
+ 
+ 
+ static OSErr oserr(OSErr retval)
+ {
+     char buf[128];
+     const char *errstr = get_macos_error_string(retval);
+     if (errstr == ERR_MACOS_GENERIC)
+     {
+         snprintf(buf, ERR_MACOS_GENERIC, (int) retval);
+         errstr = buf;
+     } /* if */
+ 
+     if (errstr != NULL)
+         __PHYSFS_setError(errstr);
+ 
+     return(retval);
+ } /* oserr */
+ 
+ 
  static struct ProcessInfoRec procInfo;
  static FSSpec procfsspec;
***************
*** 68,72 ****
      OSErr err;
      ProcessSerialNumber psn;
!     BAIL_IF_MACRO(GetCurrentProcess(&psn) != noErr, ERR_OS_ERROR, 0);
      memset(&procInfo, '\0', sizeof (ProcessInfoRec));
      memset(&procfsspec, '\0', sizeof (FSSpec));
--- 155,159 ----
      OSErr err;
      ProcessSerialNumber psn;
!     BAIL_IF_MACRO(oserr(GetCurrentProcess(&psn)) != noErr, NULL, 0);
      memset(&procInfo, '\0', sizeof (ProcessInfoRec));
      memset(&procfsspec, '\0', sizeof (FSSpec));
***************
*** 74,78 ****
      procInfo.processAppSpec = &procfsspec;
      err = GetProcessInformation(&psn, &procInfo);
!     BAIL_IF_MACRO(err != noErr, ERR_OS_ERROR, 0);
      return(1);  /* we're golden. */
  } /* __PHYSFS_platformInit */
--- 161,165 ----
      procInfo.processAppSpec = &procfsspec;
      err = GetProcessInformation(&psn, &procInfo);
!     BAIL_IF_MACRO(oserr(err) != noErr, NULL, 0);
      return(1);  /* we're golden. */
  } /* __PHYSFS_platformInit */
***************
*** 120,124 ****
              if (PBHGetVInfoSync(&hpbr) == noErr)
              {
!                 char **tmp = realloc(retval, sizeof (char *) * cd_count + 1);
                  if (tmp)
                  {
--- 207,211 ----
              if (PBHGetVInfoSync(&hpbr) == noErr)
              {
!                 char **tmp = realloc(retval, sizeof (char *) * (cd_count + 
1));
                  if (tmp)
                  {
***************
*** 166,174 ****
          /* check parent dir of what we last looked at... */
          infoPB.dirInfo.ioDrDirID = infoPB.dirInfo.ioDrParID;
!         if (PBGetCatInfoSync(&infoPB) != noErr)
          {
              if (retval != NULL)
                  free(retval);
!             BAIL_MACRO(ERR_OS_ERROR, NULL);
          } /* if */
  
--- 253,261 ----
          /* check parent dir of what we last looked at... */
          infoPB.dirInfo.ioDrDirID = infoPB.dirInfo.ioDrParID;
!         if (oserr(PBGetCatInfoSync(&infoPB)) != noErr)
          {
              if (retval != NULL)
                  free(retval);
!             return(NULL);
          } /* if */
  
***************
*** 220,226 ****
      UseResFile(0);
      /* apparently, -16096 specifies the username. */
!     strHandle = GetString(-16096);
      UseResFile(origResourceFile);
!     BAIL_IF_MACRO(strHandle == NULL, ERR_OS_ERROR, NULL);
  
      HLock((Handle) strHandle);
--- 307,313 ----
      UseResFile(0);
      /* apparently, -16096 specifies the username. */
!     strHandle = oserr(GetString(-16096));
      UseResFile(origResourceFile);
!     BAIL_IF_MACRO(strHandle == NULL, NULL, NULL);
  
      HLock((Handle) strHandle);
***************
*** 267,271 ****
      OSErr err;
      Str255 str255;
!     int needColon = (strchr(fname, ':')  == NULL);
      int len = strlen(fname) + ((needColon) ? 1 : 0);
      if (len > 255)
--- 354,358 ----
      OSErr err;
      Str255 str255;
!     int needColon = (strchr(fname, ':') == NULL);
      int len = strlen(fname) + ((needColon) ? 1 : 0);
      if (len > 255)
***************
*** 281,290 ****
          str255[len] = ':';
  
!     err = FSMakeFSSpec(0, 0, str255, spec);
      return(err);
  } /* fnameToFSSpecNoAlias */
  
  
- /* !!! FIXME: This code is pretty heinous. */
  static OSErr fnameToFSSpec(const char *fname, FSSpec *spec)
  {
--- 368,376 ----
          str255[len] = ':';
  
!     err = oserr(FSMakeFSSpec(0, 0, str255, spec));
      return(err);
  } /* fnameToFSSpecNoAlias */
  
  
  static OSErr fnameToFSSpec(const char *fname, FSSpec *spec)
  {
***************
*** 305,317 ****
          strcpy(path, fname);
          ptr = strchr(path, ':');
!         BAIL_IF_MACRO(!ptr, ERR_FILE_NOT_FOUND, err); /* just in case */
          ptr = strchr(ptr + 1, ':');
!         BAIL_IF_MACRO(!ptr, ERR_FILE_NOT_FOUND, err); /* just in case */
          *ptr = '\0';
          err = fnameToFSSpecNoAlias(path, spec); /* get first dir. */
!         BAIL_IF_MACRO(err != noErr, ERR_OS_ERROR, err);
          start = ptr;
          ptr = strchr(start + 1, ':');
  
          do
          {
--- 391,404 ----
          strcpy(path, fname);
          ptr = strchr(path, ':');
!         BAIL_IF_MACRO(!ptr, ERR_NO_SUCH_FILE, err); /* just in case */
          ptr = strchr(ptr + 1, ':');
!         BAIL_IF_MACRO(!ptr, ERR_NO_SUCH_FILE, err); /* just in case */
          *ptr = '\0';
          err = fnameToFSSpecNoAlias(path, spec); /* get first dir. */
!         BAIL_IF_MACRO(oserr(err) != noErr, NULL, err);
          start = ptr;
          ptr = strchr(start + 1, ':');
  
+         /* Now check each element of the path for aliases... */
          do
          {
***************
*** 323,327 ****
              infoPB.dirInfo.ioFDirIndex = 0;
              err = PBGetCatInfoSync(&infoPB);
!             if (err != noErr)  /* not an alias, really a bogus path. */
                  return(fnameToFSSpecNoAlias(fname, spec)); /* reset */
  
--- 410,414 ----
              infoPB.dirInfo.ioFDirIndex = 0;
              err = PBGetCatInfoSync(&infoPB);
!             if (err != noErr)  /* not an alias, really just a bogus path. */
                  return(fnameToFSSpecNoAlias(fname, spec)); /* reset */
  
***************
*** 329,334 ****
                  spec->parID = infoPB.dirInfo.ioDrDirID;
  
!             if (ptr != NULL)
                  *ptr = '\0';
              *start = strlen(start + 1);  /* make it a pstring. */
              err = FSMakeFSSpec(spec->vRefNum, spec->parID,
--- 416,422 ----
                  spec->parID = infoPB.dirInfo.ioDrDirID;
  
!             if (ptr != NULL)  /* terminate string after next element. */
                  *ptr = '\0';
+ 
              *start = strlen(start + 1);  /* make it a pstring. */
              err = FSMakeFSSpec(spec->vRefNum, spec->parID,
***************
*** 340,344 ****
              if (err != noErr)  /* not an alias, really a bogus path. */
                  return(fnameToFSSpecNoAlias(fname, spec)); /* reset */
!             start = ptr;
              if (ptr != NULL)
                  ptr = strchr(start + 1, ':');                
--- 428,433 ----
              if (err != noErr)  /* not an alias, really a bogus path. */
                  return(fnameToFSSpecNoAlias(fname, spec)); /* reset */
! 
!             start = ptr;  /* move to the next element. */
              if (ptr != NULL)
                  ptr = strchr(start + 1, ':');                
***************
*** 348,354 ****
      else /* there's something there; make sure final file is not an alias. */
      {
!         BAIL_IF_MACRO(err != noErr, ERR_OS_ERROR, err);
          err = ResolveAliasFileWithMountFlags(spec, 1, &folder, &alias, 0);
!         BAIL_IF_MACRO(err != noErr, ERR_OS_ERROR, err);
      } /* else */
  
--- 437,443 ----
      else /* there's something there; make sure final file is not an alias. */
      {
!         BAIL_IF_MACRO(oserr(err) != noErr, NULL, err);
          err = ResolveAliasFileWithMountFlags(spec, 1, &folder, &alias, 0);
!         BAIL_IF_MACRO(oserr(err) != noErr, NULL, err);
      } /* else */
  
***************
*** 381,385 ****
      /* resolve aliases up to the actual file... */
      *ptr = '\0';
!     BAIL_IF_MACRO(fnameToFSSpec(dir, &spec) != noErr, ERR_OS_ERROR, 0);
  
      *ptr = strlen(ptr + 1);  /* ptr is now a pascal string. Yikes! */
--- 470,474 ----
      /* resolve aliases up to the actual file... */
      *ptr = '\0';
!     BAIL_IF_MACRO(fnameToFSSpec(dir, &spec) != noErr, NULL, 0);
  
      *ptr = strlen(ptr + 1);  /* ptr is now a pascal string. Yikes! */
***************
*** 389,398 ****
      infoPB.dirInfo.ioDrDirID = spec.parID;
      infoPB.dirInfo.ioFDirIndex = 0;
!     BAIL_IF_MACRO(PBGetCatInfoSync(&infoPB) != noErr, ERR_OS_ERROR, 0);
  
      err = FSMakeFSSpec(spec.vRefNum, infoPB.dirInfo.ioDrDirID,
                         (const unsigned char *) ptr, &spec);
!     BAIL_IF_MACRO(err != noErr, ERR_OS_ERROR, 0);
!     BAIL_IF_MACRO(IsAliasFile(&spec, &a, &f) != noErr, ERR_OS_ERROR, 0);
      return(a);
  } /* __PHYSFS_platformIsSymlink */
--- 478,487 ----
      infoPB.dirInfo.ioDrDirID = spec.parID;
      infoPB.dirInfo.ioFDirIndex = 0;
!     BAIL_IF_MACRO(oserr(PBGetCatInfoSync(&infoPB)) != noErr, NULL, 0);
  
      err = FSMakeFSSpec(spec.vRefNum, infoPB.dirInfo.ioDrDirID,
                         (const unsigned char *) ptr, &spec);
!     BAIL_IF_MACRO(oserr(err) != noErr, NULL, 0);
!     BAIL_IF_MACRO(oserr(IsAliasFile(&spec, &a, &f)) != noErr, NULL, 0);
      return(a);
  } /* __PHYSFS_platformIsSymlink */
***************
*** 405,409 ****
      OSErr err;
  
!     BAIL_IF_MACRO(fnameToFSSpec(fname, &spec) != noErr, ERR_OS_ERROR, 0);
      memset(&infoPB, '\0', sizeof (CInfoPBRec));
      infoPB.dirInfo.ioNamePtr = spec.name;     /* put name in here.       */
--- 494,498 ----
      OSErr err;
  
!     BAIL_IF_MACRO(fnameToFSSpec(fname, &spec) != noErr, NULL, 0);
      memset(&infoPB, '\0', sizeof (CInfoPBRec));
      infoPB.dirInfo.ioNamePtr = spec.name;     /* put name in here.       */
***************
*** 412,416 ****
      infoPB.dirInfo.ioFDirIndex = 0;           /* file (not parent) info. */
      err = PBGetCatInfoSync(&infoPB);
!     BAIL_IF_MACRO(err != noErr, ERR_OS_ERROR, 0);
      return((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) != 0);
  } /* __PHYSFS_platformIsDirectory */
--- 501,505 ----
      infoPB.dirInfo.ioFDirIndex = 0;           /* file (not parent) info. */
      err = PBGetCatInfoSync(&infoPB);
!     BAIL_IF_MACRO(oserr(err) != noErr, NULL, 0);
      return((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) != 0);
  } /* __PHYSFS_platformIsDirectory */
***************
*** 457,463 ****
                                                    int omitSymLinks)
  {
!     LinkedStringList *retval = NULL;
!     LinkedStringList *l = NULL;
!     LinkedStringList *prev = NULL;
      UInt16 i;
      UInt16 max;
--- 546,550 ----
                                                    int omitSymLinks)
  {
!     LinkedStringList *ret = NULL, *p = NULL;
      UInt16 i;
      UInt16 max;
***************
*** 467,471 ****
      long dirID;
  
!     BAIL_IF_MACRO(fnameToFSSpec(dirname, &spec) != noErr, ERR_OS_ERROR, 0);
  
      /* get the dir ID of what we want to enumerate... */
--- 554,558 ----
      long dirID;
  
!     BAIL_IF_MACRO(fnameToFSSpec(dirname, &spec) != noErr, NULL, 0);
  
      /* get the dir ID of what we want to enumerate... */
***************
*** 475,479 ****
      infoPB.dirInfo.ioDrDirID = spec.parID;    /* ID of dir.              */
      infoPB.dirInfo.ioFDirIndex = 0;           /* file (not parent) info. */
!     BAIL_IF_MACRO(PBGetCatInfoSync(&infoPB) != noErr, ERR_OS_ERROR, NULL);
  
      if ((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) == 0)
--- 562,566 ----
      infoPB.dirInfo.ioDrDirID = spec.parID;    /* ID of dir.              */
      infoPB.dirInfo.ioFDirIndex = 0;           /* file (not parent) info. */
!     BAIL_IF_MACRO(oserr(PBGetCatInfoSync(&infoPB)) != noErr, NULL, NULL);
  
      if ((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) == 0)
***************
*** 508,536 ****
  
          /* still here? Add it to the list. */
! 
!         l = (LinkedStringList *) malloc(sizeof (LinkedStringList));
!         if (l == NULL)
!             break;
! 
!         l->str = (char *) malloc(str255[0] + 1);
!         if (l->str == NULL)
!         {
!             free(l);
!             break;
!         } /* if */
! 
!         memcpy(l->str, &str255[1], str255[0]);
!         l->str[str255[0]] = '\0';
! 
!         if (retval == NULL)
!             retval = l;
!         else
!             prev->next = l;
! 
!         prev = l;
!         l->next = NULL;
      } /* for */
  
!     return(retval);
  } /* __PHYSFS_platformEnumerateFiles */
  
--- 595,602 ----
  
          /* still here? Add it to the list. */
!         ret = __PHYSFS_addToLinkedStringList(ret, &p, &str255[1], str255[0]);
      } /* for */
  
!     return(ret);
  } /* __PHYSFS_platformEnumerateFiles */
  
***************
*** 558,562 ****
  
      FSSpec spec;
!     BAIL_IF_MACRO(fnameToFSSpec(path, &spec) != noErr, ERR_OS_ERROR, NULL);
      return(convFSSpecToPath(&spec, 1));
  } /* __PHYSFS_platformRealPath */
--- 624,628 ----
  
      FSSpec spec;
!     BAIL_IF_MACRO(fnameToFSSpec(path, &spec) != noErr, NULL, NULL);
      return(convFSSpecToPath(&spec, 1));
  } /* __PHYSFS_platformRealPath */
***************
*** 570,577 ****
  
      BAIL_IF_MACRO(err == noErr, ERR_FILE_EXISTS, 0);
!     BAIL_IF_MACRO(err != fnfErr, ERR_OS_ERROR, 0);
  
      err = DirCreate(spec.vRefNum, spec.parID, spec.name, &val);
!     BAIL_IF_MACRO(err != noErr, ERR_OS_ERROR, 0);
      return(1);
  } /* __PHYSFS_platformMkDir */
--- 636,643 ----
  
      BAIL_IF_MACRO(err == noErr, ERR_FILE_EXISTS, 0);
!     BAIL_IF_MACRO(err != fnfErr, NULL, 0);
  
      err = DirCreate(spec.vRefNum, spec.parID, spec.name, &val);
!     BAIL_IF_MACRO(oserr(err) != noErr, NULL, 0);
      return(1);
  } /* __PHYSFS_platformMkDir */
***************
*** 584,594 ****
      FSSpec spec;
      OSErr err = fnameToFSSpec(fname, &spec);
!     BAIL_IF_MACRO((err != noErr) && (err != fnfErr), ERR_OS_ERROR, NULL);
      if (err == fnfErr)
      {
!         BAIL_IF_MACRO(!createIfMissing, ERR_FILE_NOT_FOUND, NULL);
          err = HCreate(spec.vRefNum, spec.parID, spec.name,
                        procInfo.processSignature, 'BINA');
!         BAIL_IF_MACRO(err != noErr, ERR_OS_ERROR, NULL);
          created = 1;
      } /* if */
--- 650,660 ----
      FSSpec spec;
      OSErr err = fnameToFSSpec(fname, &spec);
!     BAIL_IF_MACRO((err != noErr) && (err != fnfErr), NULL, NULL);
      if (err == fnfErr)
      {
!         BAIL_IF_MACRO(!createIfMissing, ERR_NO_SUCH_FILE, NULL);
          err = HCreate(spec.vRefNum, spec.parID, spec.name,
                        procInfo.processSignature, 'BINA');
!         BAIL_IF_MACRO(oserr(err) != noErr, NULL, NULL);
          created = 1;
      } /* if */
***************
*** 602,611 ****
      } /* if */
  
!     if (HOpenDF(spec.vRefNum, spec.parID, spec.name, perm, retval) != noErr)
      {
          free(retval);
          if (created)
              HDelete(spec.vRefNum, spec.parID, spec.name);
!         BAIL_MACRO(ERR_OS_ERROR, NULL);
      } /* if */
  
--- 668,678 ----
      } /* if */
  
!     err = HOpenDF(spec.vRefNum, spec.parID, spec.name, perm, retval)
!     if (oserr(err) != noErr)
      {
          free(retval);
          if (created)
              HDelete(spec.vRefNum, spec.parID, spec.name);
!         return(NULL);
      } /* if */
  
***************
*** 619,626 ****
      if (retval != NULL)   /* got a file; seek to start. */
      {
!         if (SetFPos(*retval, fsFromStart, 0) != noErr)
          {
              FSClose(*retval);
!             BAIL_MACRO(ERR_OS_ERROR, NULL);
          } /* if */
      } /* if */
--- 686,693 ----
      if (retval != NULL)   /* got a file; seek to start. */
      {
!         if (oserr(SetFPos(*retval, fsFromStart, 0)) != noErr)
          {
              FSClose(*retval);
!             return(NULL);
          } /* if */
      } /* if */
***************
*** 635,643 ****
      if (retval != NULL)   /* got a file; truncate it. */
      {
!         if ((SetEOF(*retval, 0) != noErr) ||
!             (SetFPos(*retval, fsFromStart, 0) != noErr))
          {
              FSClose(*retval);
!             BAIL_MACRO(ERR_OS_ERROR, NULL);
          } /* if */
      } /* if */
--- 702,710 ----
      if (retval != NULL)   /* got a file; truncate it. */
      {
!         if ((oserr(SetEOF(*retval, 0)) != noErr) ||
!             (oserr(SetFPos(*retval, fsFromStart, 0)) != noErr))
          {
              FSClose(*retval);
!             return(NULL);
          } /* if */
      } /* if */
***************
*** 652,659 ****
      if (retval != NULL)   /* got a file; seek to end. */
      {
!         if (SetFPos(*retval, fsFromLEOF, 0) != noErr)
          {
              FSClose(*retval);
!             BAIL_MACRO(ERR_OS_ERROR, NULL);
          } /* if */
      } /* if */
--- 719,726 ----
      if (retval != NULL)   /* got a file; seek to end. */
      {
!         if (oserr(SetFPos(*retval, fsFromLEOF, 0)) != noErr)
          {
              FSClose(*retval);
!             return(NULL);
          } /* if */
      } /* if */
***************
*** 673,678 ****
      {
          br = size;
!         BAIL_IF_MACRO(FSRead(ref, &br, buffer) != noErr, ERR_OS_ERROR, i);
!         BAIL_IF_MACRO(br != size, ERR_OS_ERROR, i);
          buffer = ((PHYSFS_uint8 *) buffer) + size;
      } /* for */
--- 740,745 ----
      {
          br = size;
!         BAIL_IF_MACRO(oserr(FSRead(ref, &br, buffer)) != noErr, NULL, i);
!         BAIL_IF_MACRO(br != size, NULL, i);  /* !!! FIXME: seek back if only 
read part of an object! */
          buffer = ((PHYSFS_uint8 *) buffer) + size;
      } /* for */
***************
*** 692,697 ****
      {
          bw = size;
!         BAIL_IF_MACRO(FSWrite(ref, &bw, buffer) != noErr, ERR_OS_ERROR, i);
!         BAIL_IF_MACRO(bw != size, ERR_OS_ERROR, i);
          buffer = ((PHYSFS_uint8 *) buffer) + size;
      } /* for */
--- 759,764 ----
      {
          bw = size;
!         BAIL_IF_MACRO(oserr(FSWrite(ref, &bw, buffer)) != noErr, NULL, i);
!         BAIL_IF_MACRO(bw != size, NULL, i); /* !!! FIXME: seek back if only 
wrote part of an object! */
          buffer = ((PHYSFS_uint8 *) buffer) + size;
      } /* for */
***************
*** 705,709 ****
      SInt16 ref = *((SInt16 *) opaque);
      OSErr err = SetFPos(ref, fsFromStart, (SInt32) pos);
!     BAIL_IF_MACRO(err != noErr, ERR_OS_ERROR, 0);
      return(1);
  } /* __PHYSFS_platformSeek */
--- 772,776 ----
      SInt16 ref = *((SInt16 *) opaque);
      OSErr err = SetFPos(ref, fsFromStart, (SInt32) pos);
!     BAIL_IF_MACRO(oserr(err) != noErr, NULL, 0);
      return(1);
  } /* __PHYSFS_platformSeek */
***************
*** 714,718 ****
      SInt16 ref = *((SInt16 *) opaque);
      SInt32 curPos;
!     BAIL_IF_MACRO(GetFPos(ref, &curPos) != noErr, ERR_OS_ERROR, -1);
      return((PHYSFS_sint64) curPos);
  } /* __PHYSFS_platformTell */
--- 781,785 ----
      SInt16 ref = *((SInt16 *) opaque);
      SInt32 curPos;
!     BAIL_IF_MACRO(oserr(GetFPos(ref, &curPos)) != noErr, NULL, -1);
      return((PHYSFS_sint64) curPos);
  } /* __PHYSFS_platformTell */
***************
*** 723,727 ****
      SInt16 ref = *((SInt16 *) opaque);
      SInt32 eofPos;
!     BAIL_IF_MACRO(GetEOF(ref, &eofPos) != noErr, ERR_OS_ERROR, -1);
      return((PHYSFS_sint64) eofPos);
  } /* __PHYSFS_platformFileLength */
--- 790,794 ----
      SInt16 ref = *((SInt16 *) opaque);
      SInt32 eofPos;
!     BAIL_IF_MACRO(oserr(GetEOF(ref, &eofPos)) != noErr, NULL, -1);
      return((PHYSFS_sint64) eofPos);
  } /* __PHYSFS_platformFileLength */
***************
*** 732,737 ****
      SInt16 ref = *((SInt16 *) opaque);
      SInt32 eofPos, curPos;
!     BAIL_IF_MACRO(GetEOF(ref, &eofPos) != noErr, ERR_OS_ERROR, 1);
!     BAIL_IF_MACRO(GetFPos(ref, &curPos) != noErr, ERR_OS_ERROR, 1);
      return(curPos >= eofPos);
  } /* __PHYSFS_platformEOF */
--- 799,804 ----
      SInt16 ref = *((SInt16 *) opaque);
      SInt32 eofPos, curPos;
!     BAIL_IF_MACRO(oserr(GetEOF(ref, &eofPos)) != noErr, NULL, 1);
!     BAIL_IF_MACRO(oserr(GetFPos(ref, &curPos)) != noErr, NULL, 1);
      return(curPos >= eofPos);
  } /* __PHYSFS_platformEOF */
***************
*** 744,748 ****
      memset(&pb, '\0', sizeof (ParamBlockRec));
      pb.ioParam.ioRefNum = ref;
!     BAIL_IF_MACRO(PBFlushFileSync(&pb) != noErr, ERR_OS_ERROR, 0);
      return(1);
  } /* __PHYSFS_platformFlush */
--- 811,815 ----
      memset(&pb, '\0', sizeof (ParamBlockRec));
      pb.ioParam.ioRefNum = ref;
!     BAIL_IF_MACRO(oserr(PBFlushFileSync(&pb)) != noErr, NULL, 0);
      return(1);
  } /* __PHYSFS_platformFlush */
***************
*** 753,771 ****
      SInt16 ref = *((SInt16 *) opaque);
      SInt16 vRefNum;
-     HParamBlockRec hpbr;
      Str63 volName;
  
!     BAIL_IF_MACRO(GetVRefNum (ref, &vRefNum) != noErr, ERR_OS_ERROR, 0);
! 
!     memset(&hpbr, '\0', sizeof (HParamBlockRec));
!     hpbr.volumeParam.ioNamePtr = volName;
!     hpbr.volumeParam.ioVRefNum = vRefNum;
!     hpbr.volumeParam.ioVolIndex = 0;
!     BAIL_IF_MACRO(PBHGetVInfoSync(&hpbr) != noErr, ERR_OS_ERROR, 0);
  
!     BAIL_IF_MACRO(FSClose(ref) != noErr, ERR_OS_ERROR, 0);
      free(opaque);
  
!     FlushVol(volName, vRefNum);
      return(1);
  } /* __PHYSFS_platformClose */
--- 820,843 ----
      SInt16 ref = *((SInt16 *) opaque);
      SInt16 vRefNum;
      Str63 volName;
+     int flushVol = 0;
  
!     if (GetVRefNum(ref, &vRefNum) == noErr)
!     {
!         HParamBlockRec hpbr;
!         memset(&hpbr, '\0', sizeof (HParamBlockRec));
!         hpbr.volumeParam.ioNamePtr = volName;
!         hpbr.volumeParam.ioVRefNum = vRefNum;
!         hpbr.volumeParam.ioVolIndex = 0;
!         if (PBHGetVInfoSync(&hpbr) == noErr)
!             flushVol = 1;
!     } /* if */
  
!     BAIL_IF_MACRO(oserr(FSClose(ref)) != noErr, NULL, 0);
      free(opaque);
  
!     if (flushVol)
!         FlushVol(volName, vRefNum);  /* update catalog info, etc. */
! 
      return(1);
  } /* __PHYSFS_platformClose */
***************
*** 776,782 ****
      FSSpec spec;
      OSErr err;
!     BAIL_IF_MACRO(fnameToFSSpec(path, &spec) != noErr, ERR_OS_ERROR, 0);
      err = HDelete(spec.vRefNum, spec.parID, spec.name);
!     BAIL_IF_MACRO(err != noErr, ERR_OS_ERROR, 0);
      return(1);
  } /* __PHYSFS_platformDelete */
--- 848,854 ----
      FSSpec spec;
      OSErr err;
!     BAIL_IF_MACRO(fnameToFSSpec(path, &spec) != noErr, NULL, 0);
      err = HDelete(spec.vRefNum, spec.parID, spec.name);
!     BAIL_IF_MACRO(oserr(err) != noErr, NULL, 0);
      return(1);
  } /* __PHYSFS_platformDelete */
***************
*** 813,817 ****
      UInt32 modDate;
  
!     BAIL_IF_MACRO(fnameToFSSpec(fname, &spec) != noErr, ERR_OS_ERROR, -1);
  
      memset(&infoPB, '\0', sizeof (CInfoPBRec));
--- 885,890 ----
      UInt32 modDate;
  
!     if (fnameToFSSpec(fname, &spec) != noErr)
!         return(-1); /* fnameToFSSpec() sets physfs error message. */
  
      memset(&infoPB, '\0', sizeof (CInfoPBRec));
***************
*** 820,824 ****
      infoPB.dirInfo.ioDrDirID = spec.parID;
      infoPB.dirInfo.ioFDirIndex = 0;
!     BAIL_IF_MACRO(PBGetCatInfoSync(&infoPB) != noErr, ERR_OS_ERROR, -1);
  
      modDate = ((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) != 0) ?
--- 893,897 ----
      infoPB.dirInfo.ioDrDirID = spec.parID;
      infoPB.dirInfo.ioFDirIndex = 0;
!     BAIL_IF_MACRO(oserr(PBGetCatInfoSync(&infoPB)) != noErr, NULL, -1);
  
      modDate = ((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) != 0) ?

Index: posix.c
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/platform/posix.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** posix.c     26 Jun 2002 08:30:11 -0000      1.2
--- posix.c     18 Aug 2002 08:12:53 -0000      1.3
***************
*** 11,14 ****
--- 11,16 ----
  #endif
  
+ #if (!defined WIN32)
+ 
  #if (defined __STRICT_ANSI__)
  #define __PHYSFS_DOING_STRICT_ANSI__
***************
*** 217,223 ****
                                                    int omitSymLinks)
  {
!     LinkedStringList *retval = NULL;
!     LinkedStringList *l = NULL;
!     LinkedStringList *prev = NULL;
      DIR *dir;
      struct dirent *ent;
--- 219,223 ----
                                                    int omitSymLinks)
  {
!     LinkedStringList *retval = NULL, *p = NULL;
      DIR *dir;
      struct dirent *ent;
***************
*** 249,258 ****
      } /* if */
  
!     while (1)
      {
-         ent = readdir(dir);
-         if (ent == NULL)   /* we're done. */
-             break;
- 
          if (strcmp(ent->d_name, ".") == 0)
              continue;
--- 249,254 ----
      } /* if */
  
!     while ((ent = readdir(dir)) != NULL)
      {
          if (strcmp(ent->d_name, ".") == 0)
              continue;
***************
*** 279,302 ****
          } /* if */
  
!         l = (LinkedStringList *) malloc(sizeof (LinkedStringList));
!         if (l == NULL)
!             break;
! 
!         l->str = (char *) malloc(strlen(ent->d_name) + 1);
!         if (l->str == NULL)
!         {
!             free(l);
!             break;
!         } /* if */
! 
!         strcpy(l->str, ent->d_name);
! 
!         if (retval == NULL)
!             retval = l;
!         else
!             prev->next = l;
! 
!         prev = l;
!         l->next = NULL;
      } /* while */
  
--- 275,279 ----
          } /* if */
  
!         retval = __PHYSFS_addToLinkedStringList(retval, &p, ent->d_name, -1);
      } /* while */
  
***************
*** 363,370 ****
  
      fd = open(filename, mode, S_IRUSR | S_IWUSR);
!     if (fd < 0) {
!         __PHYSFS_setError(strerror(errno));
!               return NULL;
!       }
  
      retval = (int *) malloc(sizeof (int));
--- 340,344 ----
  
      fd = open(filename, mode, S_IRUSR | S_IWUSR);
!     BAIL_IF_MACRO(fd < 0, strerror(errno), NULL);
  
      retval = (int *) malloc(sizeof (int));
***************
*** 498,501 ****
--- 472,476 ----
      int fd = *((int *) opaque);
      BAIL_IF_MACRO(close(fd) == -1, strerror(errno), 0);
+     free(opaque);
      return(1);
  } /* __PHYSFS_platformClose */
***************
*** 515,518 ****
--- 490,495 ----
      return statbuf.st_mtime;
  } /* __PHYSFS_platformGetLastModTime */
+ 
+ #endif /* !defined WIN32 */
  
  /* end of posix.c ... */

Index: unix.c
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/platform/unix.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** unix.c      26 Jun 2002 08:30:11 -0000      1.3
--- unix.c      18 Aug 2002 08:12:53 -0000      1.4
***************
*** 11,21 ****
  #endif
  
! #if (!defined __BEOS__) /* BeOS uses beos.cpp and posix.c ... */
! 
! #if ((defined __APPLE__) && (defined __MACH__))
! #  if (!defined __DARWIN__)
! #    define __DARWIN__
! #  endif
! #endif
  
  #include <stdio.h>
--- 11,16 ----
  #endif
  
! /* BeOS uses beos.cpp and posix.c ... Cygwin and such use win32.c ... */
! #if ((!defined __BEOS__) && (!defined WIN32))
  
  #include <stdio.h>
***************
*** 23,27 ****
  #include <string.h>
  #include <ctype.h>
- #include <pthread.h>
  #include <unistd.h>
  #include <sys/types.h>
--- 18,21 ----
***************
*** 32,44 ****
  #include <time.h>
  #include <errno.h>
  
! #if (!defined __DARWIN__)
! #include <mntent.h>
! #else
! #include <sys/ucred.h>
  #endif
  
! #include <sys/mount.h>
  
  
  #define __PHYSICSFS_INTERNAL__
--- 26,45 ----
  #include <time.h>
  #include <errno.h>
+ #include <sys/mount.h>
  
! #if (!defined PHYSFS_NO_PTHREADS_SUPPORT)
! #include <pthread.h>
  #endif
  
! #ifdef PHYSFS_HAVE_SYS_UCRED_H
! #  ifdef PHYSFS_HAVE_MNTENT_H
! #    undef PHYSFS_HAVE_MNTENT_H /* don't do both... */
! #  endif
! #  include <sys/ucred.h>
! #endif
  
+ #ifdef PHYSFS_HAVE_MNTENT_H
+ #include <mntent.h>
+ #endif
  
  #define __PHYSICSFS_INTERNAL__
***************
*** 61,66 ****
  
  
  
! #if (defined __DARWIN__)
  
  char **__PHYSFS_platformDetectAvailableCDs(void)
--- 62,80 ----
  
  
+ #ifdef PHYSFS_NO_CDROM_SUPPORT
+ 
+ /* Stub version for platforms without CD-ROM support. */
+ char **__PHYSFS_platformDetectAvailableCDs(void)
+ {
+     char **retval = (char **) malloc(sizeof (char *));
+     BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
+     *retval = NULL;
+     return(retval);
+ } /* __PHYSFS_platformDetectAvailableCDs */
+ 
+ #else
+ 
  
! #ifdef PHYSFS_HAVE_SYS_UCRED_H
  
  char **__PHYSFS_platformDetectAvailableCDs(void)
***************
*** 68,85 ****
      char **retval = (char **) malloc(sizeof (char *));
      int cd_count = 1;  /* We count the NULL entry. */
!     struct statfs* mntbufp = NULL;
      int mounts;
!     int ii;
  
      BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
  
!     mounts = getmntinfo( &mntbufp, MNT_WAIT );
  
!     for ( ii=0; ii < mounts; ++ii ) {
          int add_it = 0;
  
!         if ( strcmp( mntbufp[ii].f_fstypename, "iso9660") == 0 )
              add_it = 1;
!         else if ( strcmp( mntbufp[ii].f_fstypename, "cd9660") == 0 )
              add_it = 1;
  
--- 82,100 ----
      char **retval = (char **) malloc(sizeof (char *));
      int cd_count = 1;  /* We count the NULL entry. */
!     struct statfs *mntbufp = NULL;
      int mounts;
!     int i;
  
      BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
  
!     mounts = getmntinfo(&mntbufp, MNT_WAIT);
  
!     for (i = 0; i < mounts; i++)
!     {
          int add_it = 0;
  
!         if (strcmp(mntbufp[i].f_fstypename, "iso9660") == 0)
              add_it = 1;
!         else if (strcmp( mntbufp[i].f_fstypename, "cd9660") == 0)
              add_it = 1;
  
***************
*** 88,105 ****
          if (add_it)
          {
!             char **tmp = realloc(retval, sizeof (char *) * cd_count + 1);
              if (tmp)
              {
                  retval = tmp;
!                 retval[cd_count-1] = (char *)
!                                 malloc(strlen(mntbufp[ ii ].f_mntonname) + 1);
!                 if (retval[cd_count-1])
                  {
!                     strcpy(retval[cd_count-1], mntbufp[ ii ].f_mntonname);
                      cd_count++;
                  } /* if */
              } /* if */
          } /* if */
!     }
  
      retval[cd_count - 1] = NULL;
--- 103,120 ----
          if (add_it)
          {
!             char **tmp = realloc(retval, sizeof (char *) * (cd_count + 1));
              if (tmp)
              {
                  retval = tmp;
!                 retval[cd_count - 1] = (char *)
!                                 malloc(strlen(mntbufp[i].f_mntonname) + 1);
!                 if (retval[cd_count - 1])
                  {
!                     strcpy(retval[cd_count - 1], mntbufp[i].f_mntonname);
                      cd_count++;
                  } /* if */
              } /* if */
          } /* if */
!     } /* for */
  
      retval[cd_count - 1] = NULL;
***************
*** 107,113 ****
  } /* __PHYSFS_platformDetectAvailableCDs */
  
  
- #else  /* non-Darwin implementation... */
  
  
  char **__PHYSFS_platformDetectAvailableCDs(void)
--- 122,129 ----
  } /* __PHYSFS_platformDetectAvailableCDs */
  
+ #endif
  
  
+ #ifdef PHYSFS_HAVE_MNTENT_H
  
  char **__PHYSFS_platformDetectAvailableCDs(void)
***************
*** 134,145 ****
          if (add_it)
          {
!             char **tmp = realloc(retval, sizeof (char *) * cd_count + 1);
              if (tmp)
              {
                  retval = tmp;
                  retval[cd_count-1] = (char *) malloc(strlen(ent->mnt_dir) + 
1);
!                 if (retval[cd_count-1])
                  {
!                     strcpy(retval[cd_count-1], ent->mnt_dir);
                      cd_count++;
                  } /* if */
--- 150,161 ----
          if (add_it)
          {
!             char **tmp = realloc(retval, sizeof (char *) * (cd_count + 1));
              if (tmp)
              {
                  retval = tmp;
                  retval[cd_count-1] = (char *) malloc(strlen(ent->mnt_dir) + 
1);
!                 if (retval[cd_count - 1])
                  {
!                     strcpy(retval[cd_count - 1], ent->mnt_dir);
                      cd_count++;
                  } /* if */
***************
*** 156,159 ****
--- 172,177 ----
  #endif
  
+ #endif  /* !PHYSFS_NO_CDROM_SUPPORT */
+ 
  
  /* this is in posix.c ... */
***************
*** 242,251 ****
  
  
- PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
- {
-     return((PHYSFS_uint64) ((PHYSFS_uint32) pthread_self()));
- } /* __PHYSFS_platformGetThreadID */
- 
- 
  /* Much like my college days, try to sleep for 10 milliseconds at a time... */
  void __PHYSFS_platformTimeslice(void)
--- 260,263 ----
***************
*** 269,272 ****
--- 281,302 ----
  
  
+ #if (defined PHYSFS_NO_PTHREADS_SUPPORT)
+ 
+ PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) { return(0x0001); }
+ void *__PHYSFS_platformCreateMutex(void) { return((void *) 0x0001); }
+ void __PHYSFS_platformDestroyMutex(void *mutex) {}
+ int __PHYSFS_platformGrabMutex(void *mutex) { return(1); }
+ void __PHYSFS_platformReleaseMutex(void *mutex) {}
+ 
+ #else
+ 
+ #define PHTREAD_TO_UI64(thr) ((PHYSFS_uint64) (thr))
+ 
+ PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
+ {
+     return(PHTREAD_TO_UI64(pthread_self()));
+ } /* __PHYSFS_platformGetThreadID */
+ 
+ 
  void *__PHYSFS_platformCreateMutex(void)
  {
***************
*** 303,307 ****
  } /* __PHYSFS_platformReleaseMutex */
  
! #endif /* !defined __BEOS__ */
  
  /* end of unix.c ... */
--- 333,340 ----
  } /* __PHYSFS_platformReleaseMutex */
  
! #endif /* !PHYSFS_NO_PTHREADS_SUPPORT */
! 
! 
! #endif /* !defined __BEOS__ && !defined WIN32 */
  
  /* end of unix.c ... */

Index: win32.c
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/platform/win32.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** win32.c     26 Jun 2002 08:30:11 -0000      1.3
--- win32.c     18 Aug 2002 08:12:53 -0000      1.4
***************
*** 11,17 ****
--- 11,21 ----
  #endif
  
+ #ifdef WIN32
+ 
  #include <windows.h>
  #include <stdio.h>
  #include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
[...1390 lines suppressed...]
!     {
!         FILETIME ft;
!         BOOL rc;
!         const char *err;
!         win32file *f = (win32file *) __PHYSFS_platformOpenRead(fname);
!         BAIL_IF_MACRO(f == NULL, NULL, -1)
!         rc = GetFileTime(f->handle, NULL, NULL, &ft);
!         err = win32strerror();
!         CloseHandle(f->handle);
!         free(f);
!         BAIL_IF_MACRO(!rc, err, -1);
!         retval = FileTimeToPhysfsTime(&ft);
!     } /* if */
  
!     return(retval);
  } /* __PHYSFS_platformGetLastModTime */
+ 
+ #endif
  
  /* end of win32.c ... */

--- darwin.c DELETED ---

--- freebsd.c DELETED ---

--- irix.c DELETED ---

--- solaris.c DELETED ---





reply via email to

[Prev in Thread] Current Thread [Next in Thread]