physfs.c
changeset 163 fc2b8ee5b420
parent 160 b17e94892394
child 167 fd695ca50a2c
equal deleted inserted replaced
162:06ed1dc94f73 163:fc2b8ee5b420
    19 #define __PHYSICSFS_INTERNAL__
    19 #define __PHYSICSFS_INTERNAL__
    20 #include "physfs_internal.h"
    20 #include "physfs_internal.h"
    21 
    21 
    22 typedef struct __PHYSFS_ERRMSGTYPE__
    22 typedef struct __PHYSFS_ERRMSGTYPE__
    23 {
    23 {
    24     int tid;
    24     PHYSFS_uint64 tid;
    25     int errorAvailable;
    25     int errorAvailable;
    26     char errorString[80];
    26     char errorString[80];
    27     struct __PHYSFS_ERRMSGTYPE__ *next;
    27     struct __PHYSFS_ERRMSGTYPE__ *next;
    28 } ErrMsg;
    28 } ErrMsg;
    29 
    29 
   103 /* functions ... */
   103 /* functions ... */
   104 
   104 
   105 static ErrMsg *findErrorForCurrentThread(void)
   105 static ErrMsg *findErrorForCurrentThread(void)
   106 {
   106 {
   107     ErrMsg *i;
   107     ErrMsg *i;
   108     int tid;
   108     PHYSFS_uint64 tid;
   109 
   109 
   110     __PHYSFS_platformGrabMutex(errorLock);
   110     __PHYSFS_platformGrabMutex(errorLock);
   111     if (errorMessages != NULL)
   111     if (errorMessages != NULL)
   112     {
   112     {
   113         /*!!! I think tid needs to be a 64-bit value??? */
   113         tid = __PHYSFS_platformGetThreadID();
   114         tid = (int)__PHYSFS_platformGetThreadID();
       
   115 
   114 
   116         for (i = errorMessages; i != NULL; i = i->next)
   115         for (i = errorMessages; i != NULL; i = i->next)
   117         {
   116         {
   118             if (i->tid == tid)
   117             if (i->tid == tid)
   119             {
   118             {
   142         err = (ErrMsg *) malloc(sizeof (ErrMsg));
   141         err = (ErrMsg *) malloc(sizeof (ErrMsg));
   143         if (err == NULL)
   142         if (err == NULL)
   144             return;   /* uhh...? */
   143             return;   /* uhh...? */
   145 
   144 
   146         memset((void *) err, '\0', sizeof (ErrMsg));
   145         memset((void *) err, '\0', sizeof (ErrMsg));
   147         /*!!! I think tid needs to be a 64-bit value??? */
   146         err->tid = __PHYSFS_platformGetThreadID();
   148         err->tid = (int)__PHYSFS_platformGetThreadID();
       
   149 
   147 
   150         __PHYSFS_platformGrabMutex(errorLock);
   148         __PHYSFS_platformGrabMutex(errorLock);
   151         err->next = errorMessages;
   149         err->next = errorMessages;
   152         errorMessages = err;
   150         errorMessages = err;
   153         __PHYSFS_platformReleaseMutex(errorLock);
   151         __PHYSFS_platformReleaseMutex(errorLock);