misc/libphysfs/archiver_zip.c
changeset 10017 de822cd3df3a
parent 8524 a65e9bcf0a03
child 12217 ea891871f481
equal deleted inserted replaced
10015:4feced261c68 10017:de822cd3df3a
   486                 (buf[i + 1] == 0x4B) &&
   486                 (buf[i + 1] == 0x4B) &&
   487                 (buf[i + 2] == 0x05) &&
   487                 (buf[i + 2] == 0x05) &&
   488                 (buf[i + 3] == 0x06) )
   488                 (buf[i + 3] == 0x06) )
   489             {
   489             {
   490                 found = 1;  /* that's the signature! */
   490                 found = 1;  /* that's the signature! */
   491                 break;  
   491                 break;
   492             } /* if */
   492             } /* if */
   493         } /* for */
   493         } /* for */
   494 
   494 
   495         if (found)
   495         if (found)
   496             break;
   496             break;
   550 } /* zip_free_entries */
   550 } /* zip_free_entries */
   551 
   551 
   552 
   552 
   553 /*
   553 /*
   554  * This will find the ZIPentry associated with a path in platform-independent
   554  * This will find the ZIPentry associated with a path in platform-independent
   555  *  notation. Directories don't have ZIPentries associated with them, but 
   555  *  notation. Directories don't have ZIPentries associated with them, but
   556  *  (*isDir) will be set to non-zero if a dir was hit.
   556  *  (*isDir) will be set to non-zero if a dir was hit.
   557  */
   557  */
   558 static ZIPentry *zip_find_entry(const ZIPinfo *info, const char *path,
   558 static ZIPentry *zip_find_entry(const ZIPinfo *info, const char *path,
   559                                 int *isDir)
   559                                 int *isDir)
   560 {
   560 {
   722 
   722 
   723     BAIL_IF_MACRO(!io->seek(io, entry->offset), ERRPASS, 0);
   723     BAIL_IF_MACRO(!io->seek(io, entry->offset), ERRPASS, 0);
   724 
   724 
   725     path = (char *) __PHYSFS_smallAlloc(size + 1);
   725     path = (char *) __PHYSFS_smallAlloc(size + 1);
   726     BAIL_IF_MACRO(!path, PHYSFS_ERR_OUT_OF_MEMORY, 0);
   726     BAIL_IF_MACRO(!path, PHYSFS_ERR_OUT_OF_MEMORY, 0);
   727     
   727 
   728     if (entry->compression_method == COMPMETH_NONE)
   728     if (entry->compression_method == COMPMETH_NONE)
   729         rc = __PHYSFS_readAll(io, path, size);
   729         rc = __PHYSFS_readAll(io, path, size);
   730 
   730 
   731     else  /* symlink target path is compressed... */
   731     else  /* symlink target path is compressed... */
   732     {
   732     {
  1443             char ch = name[dlen];
  1443             char ch = name[dlen];
  1444             if ('/' < ch) /* make sure this isn't just a substr match. */
  1444             if ('/' < ch) /* make sure this isn't just a substr match. */
  1445                 rc = -1;
  1445                 rc = -1;
  1446             else if ('/' > ch)
  1446             else if ('/' > ch)
  1447                 rc = 1;
  1447                 rc = 1;
  1448             else 
  1448             else
  1449             {
  1449             {
  1450                 if (stop_on_first_find) /* Just checking dir's existance? */
  1450                 if (stop_on_first_find) /* Just checking dir's existance? */
  1451                     return middle;
  1451                     return middle;
  1452 
  1452 
  1453                 if (name[dlen + 1] == '\0') /* Skip initial dir entry. */
  1453                 if (name[dlen + 1] == '\0') /* Skip initial dir entry. */