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 win32.c,1.1.1.1.6.3,1.1.1


From: Alexander Pipelka <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/physfs/platform win32.c,1.1.1.1.6.3,1.1.1.1.6.4
Date: Fri, 31 May 2002 04:09:19 -0400

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

Modified Files:
      Tag: devel-1-0
        win32.c 
Log Message:
more Win32 fixes
updated Win32 makefiles



Index: win32.c
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/platform/win32.c,v
retrieving revision 1.1.1.1.6.3
retrieving revision 1.1.1.1.6.4
diff -C2 -r1.1.1.1.6.3 -r1.1.1.1.6.4
*** win32.c     30 May 2002 13:54:47 -0000      1.1.1.1.6.3
--- win32.c     31 May 2002 08:09:16 -0000      1.1.1.1.6.4
***************
*** 19,22 ****
--- 19,25 ----
  const char *__PHYSFS_platformDirSeparator = "\\";
  
+ static HANDLE ProcessHandle = NULL;     /* Current process handle */
+ static DWORD ProcessID;                 /* ID assigned to current process */
+ 
  #define LOWORDER_UINT64(pos)       (PHYSFS_uint32)(pos & 0x00000000FFFFFFFF)
  #define HIGHORDER_UINT64(pos)      (PHYSFS_uint32)(pos & 0xFFFFFFFF00000000)
***************
*** 44,48 ****
  int __PHYSFS_platformInit(void)
  {
!     return(1);  /* always succeed. */
  } /* __PHYSFS_platformInit */
  
--- 47,66 ----
  int __PHYSFS_platformInit(void)
  {
!       char* basedir = NULL;
! 
!     /* Get Windows ProcessID associated with the current process */
!     ProcessID = GetCurrentProcessId();
!     /* Create a process handle associated with the current process ID */
!     ProcessHandle = GetCurrentProcess();
! 
!     if(ProcessHandle == NULL) {
!         /* Process handle is required by other win32 functions */
!         return 0;
!     }
! 
!       basedir = __PHYSFS_platformCalcBaseDir("dummy");
!       SetCurrentDirectory(basedir);
! 
!     return(1);
  } /* __PHYSFS_platformInit */
  
***************
*** 50,54 ****
  int __PHYSFS_platformDeinit(void)
  {
!     return(1);  /* always succeed. */
  } /* __PHYSFS_platformDeinit */
  
--- 68,76 ----
  int __PHYSFS_platformDeinit(void)
  {
!     if(CloseHandle(ProcessHandle) != S_OK)
!         return 0;
! 
!     /* It's all good */
!     return 1;
  } /* __PHYSFS_platformDeinit */
  
***************
*** 173,177 ****
      }
  
!     char *home = copyEnvironmentVariable("HOME");
  
      if (home != NULL)
--- 195,199 ----
      }
  
!     home = copyEnvironmentVariable("HOME");
  
      if (home != NULL)
***************
*** 627,637 ****
      /* Get current position */
      retval = SetFilePointer(FileHandle, 0, NULL, FILE_CURRENT);
!     //if(GetLastError() != NO_ERROR)
!     //{
          /* Set the error to GetLastError */
!         //__PHYSFS_setError(win32strerror());
          /* We errored out */
!         //retval = 0;
!     //}
  
      return retval;
--- 649,659 ----
      /* Get current position */
      retval = SetFilePointer(FileHandle, 0, NULL, FILE_CURRENT);
!     if(GetLastError() != NO_ERROR)
!     {
          /* Set the error to GetLastError */
!         __PHYSFS_setError(win32strerror());
          /* We errored out */
!         retval = 0;
!     }
  
      return retval;
***************
*** 670,673 ****
--- 692,699 ----
      FileHandle = (HANDLE)opaque;
  
+       if(__PHYSFS_platformFileLength(opaque) == -1) {
+               return 1;
+       }
+ 
      /* Get the current position in the file */
      if((FilePosition = __PHYSFS_platformTell(opaque)) != 0)
***************
*** 745,750 ****
  void *__PHYSFS_platformCreateMutex(void)
  {
!     return (void *)0x1;
!     //return (void *)CreateMutex(NULL, FALSE, NULL);
  } /* __PHYSFS_platformCreateMutex */
  
--- 771,775 ----
  void *__PHYSFS_platformCreateMutex(void)
  {
!     return (void *)CreateMutex(NULL, FALSE, NULL);
  } /* __PHYSFS_platformCreateMutex */
  
***************
*** 752,756 ****
  void __PHYSFS_platformDestroyMutex(void *mutex)
  {
!     //CloseHandle((HANDLE)mutex);
  } /* __PHYSFS_platformDestroyMutex */
  
--- 777,781 ----
  void __PHYSFS_platformDestroyMutex(void *mutex)
  {
!     CloseHandle((HANDLE)mutex);
  } /* __PHYSFS_platformDestroyMutex */
  
***************
*** 758,777 ****
  int __PHYSFS_platformGrabMutex(void *mutex)
  {
!       return 0;
! 
! //    int retval;
  
!     //if(WaitForSingleObject((HANDLE)mutex, INFINITE) == WAIT_FAILED)
!     //{
          /* Our wait failed for some unknown reason */
!         //retval = 1;
!     //}
!     //else
!     //{
          /* Good to go */
!         //retval = 0;
!     //}
  
!     //return retval;
  } /* __PHYSFS_platformGrabMutex */
  
--- 783,800 ----
  int __PHYSFS_platformGrabMutex(void *mutex)
  {
!     int retval;
  
!     if(WaitForSingleObject((HANDLE)mutex, INFINITE) == WAIT_FAILED)
!     {
          /* Our wait failed for some unknown reason */
!         retval = 1;
!     }
!     else
!     {
          /* Good to go */
!         retval = 0;
!     }
  
!     return retval;
  } /* __PHYSFS_platformGrabMutex */
  
***************
*** 779,783 ****
  void __PHYSFS_platformReleaseMutex(void *mutex)
  {
!     //ReleaseMutex((HANDLE)mutex);
  } /* __PHYSFS_platformReleaseMutex */
  
--- 802,806 ----
  void __PHYSFS_platformReleaseMutex(void *mutex)
  {
!     ReleaseMutex((HANDLE)mutex);
  } /* __PHYSFS_platformReleaseMutex */
  




reply via email to

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