physfs.c
changeset 93 74d1df359be3
parent 74 a4a5066fb640
child 100 d2f04ab4b412
equal deleted inserted replaced
92:eae010ddea96 93:74d1df359be3
     9  */
     9  */
    10 
    10 
    11 #include <stdio.h>
    11 #include <stdio.h>
    12 #include <stdlib.h>
    12 #include <stdlib.h>
    13 #include <string.h>
    13 #include <string.h>
    14 #include <sys/stat.h>
       
    15 #include <sys/types.h>
       
    16 #include <fcntl.h>
    14 #include <fcntl.h>
    17 #include <errno.h>
    15 #include <errno.h>
    18 #include <assert.h>
    16 #include <assert.h>
    19 #include "physfs.h"
    17 #include "physfs.h"
    20 
    18 
   698         /* Root out archives, and add them to search path... */
   696         /* Root out archives, and add them to search path... */
   699     if (archiveExt != NULL)
   697     if (archiveExt != NULL)
   700     {
   698     {
   701         char **rc = PHYSFS_enumerateFiles("");
   699         char **rc = PHYSFS_enumerateFiles("");
   702         char **i;
   700         char **i;
   703         int extlen = strlen(archiveExt);
   701         size_t extlen = strlen(archiveExt);
   704         char *ext;
   702         char *ext;
   705 
   703 
   706         for (i = rc; *i != NULL; i++)
   704         for (i = rc; *i != NULL; i++)
   707         {
   705         {
   708             int l = strlen(*i);
   706             size_t l = strlen(*i);
   709             if ((l > extlen) && ((*i)[l - extlen - 1] == '.'));
   707             if ((l > extlen) && ((*i)[l - extlen - 1] == '.'))
   710             {
   708             {
   711                 ext = (*i) + (l - extlen);
   709                 ext = (*i) + (l - extlen);
   712                 if (__PHYSFS_platformStricmp(ext, archiveExt) == 0)
   710                 if (__PHYSFS_platformStricmp(ext, archiveExt) == 0)
   713                 {
   711                 {
   714                     const char *d = PHYSFS_getRealDir(*i);
   712                     const char *d = PHYSFS_getRealDir(*i);
   740 char * __PHYSFS_convertToDependent(const char *prepend,
   738 char * __PHYSFS_convertToDependent(const char *prepend,
   741                                               const char *dirName,
   739                                               const char *dirName,
   742                                               const char *append)
   740                                               const char *append)
   743 {
   741 {
   744     const char *dirsep = PHYSFS_getDirSeparator();
   742     const char *dirsep = PHYSFS_getDirSeparator();
   745     int sepsize = strlen(dirsep);
   743     size_t sepsize = strlen(dirsep);
   746     char *str;
   744     char *str;
   747     char *i1;
   745     char *i1;
   748     char *i2;
   746     char *i2;
   749     size_t allocSize;
   747     size_t allocSize;
   750 
   748 
   964             retval[i] = finalList->str;
   962             retval[i] = finalList->str;
   965         free(finalList);
   963         free(finalList);
   966         finalList = next;
   964         finalList = next;
   967     } /* for */
   965     } /* for */
   968 
   966 
   969     if (retval != NULL);
   967     if (retval != NULL)
   970         retval[i] = NULL;
   968         retval[i] = NULL;
   971 
   969 
   972     return(retval);
   970     return(retval);
   973 } /* convertStringListToPhysFSList */
   971 } /* convertStringListToPhysFSList */
   974 
   972