archivers/zip.c
changeset 470 27119d6e5d40
parent 468 ac9c7e9626d3
child 478 d6fa323f448d
equal deleted inserted replaced
469:e41c2b9bf868 470:27119d6e5d40
  1167                 rc = -1;
  1167                 rc = -1;
  1168             else if (ch > '/')
  1168             else if (ch > '/')
  1169                 rc = 1;
  1169                 rc = 1;
  1170             else 
  1170             else 
  1171             {
  1171             {
  1172                 
       
  1173                 if (stop_on_first_find) /* Just checking dir's existance? */
  1172                 if (stop_on_first_find) /* Just checking dir's existance? */
  1174                     return(middle);
  1173                     return(middle);
  1175 
  1174 
  1176                 if (name[dlen + 1] == '\0') /* Skip initial dir entry. */
  1175                 if (name[dlen + 1] == '\0') /* Skip initial dir entry. */
  1177                     return(middle + 1);
  1176                     return(middle + 1);
  1239 } /* ZIP_enumerateFiles */
  1238 } /* ZIP_enumerateFiles */
  1240 
  1239 
  1241 
  1240 
  1242 static int ZIP_exists(DirHandle *h, const char *name)
  1241 static int ZIP_exists(DirHandle *h, const char *name)
  1243 {
  1242 {
  1244     ZIPentry *entry = zip_find_entry((ZIPinfo *) h->opaque, name);
  1243     ZIPinfo *info = (ZIPinfo *) h->opaque;
  1245     return(entry != NULL);
  1244     int retval = (zip_find_entry(info, name) != NULL);
       
  1245 /* !!! FIXME: this would be faster the other way, I think: dirs first. */
       
  1246     if (!retval)  /* might be a directory... */
       
  1247         retval = (zip_find_start_of_dir(info, name, 1) != -1);
       
  1248     return(retval);
  1246 } /* ZIP_exists */
  1249 } /* ZIP_exists */
  1247 
  1250 
  1248 
  1251 
  1249 static PHYSFS_sint64 ZIP_getLastModTime(DirHandle *h,
  1252 static PHYSFS_sint64 ZIP_getLastModTime(DirHandle *h,
  1250                                         const char *name,
  1253                                         const char *name,
  1251                                         int *fileExists)
  1254                                         int *fileExists)
  1252 {
  1255 {
  1253     ZIPentry *entry = zip_find_entry((ZIPinfo *) h->opaque, name);
  1256     ZIPentry *entry = zip_find_entry((ZIPinfo *) h->opaque, name);
  1254     *fileExists = (entry != NULL);
  1257     *fileExists = (entry != NULL);
       
  1258     /* !!! FIXME: Fails for directories. */
  1255     BAIL_IF_MACRO(entry == NULL, NULL, -1);
  1259     BAIL_IF_MACRO(entry == NULL, NULL, -1);
  1256     return(entry->last_mod_time);
  1260     return(entry->last_mod_time);
  1257 } /* ZIP_getLastModTime */
  1261 } /* ZIP_getLastModTime */
  1258 
  1262 
  1259 
  1263