archivers/hog.c
changeset 657 dad3b5c307a9
parent 650 298b8bb26775
child 658 1981818c6170
equal deleted inserted replaced
656:d2c34dbf2c83 657:dad3b5c307a9
    84 static int HOG_seek(fvoid *opaque, PHYSFS_uint64 offset);
    84 static int HOG_seek(fvoid *opaque, PHYSFS_uint64 offset);
    85 static PHYSFS_sint64 HOG_fileLength(fvoid *opaque);
    85 static PHYSFS_sint64 HOG_fileLength(fvoid *opaque);
    86 static int HOG_fileClose(fvoid *opaque);
    86 static int HOG_fileClose(fvoid *opaque);
    87 static int HOG_isArchive(const char *filename, int forWriting);
    87 static int HOG_isArchive(const char *filename, int forWriting);
    88 static void *HOG_openArchive(const char *name, int forWriting);
    88 static void *HOG_openArchive(const char *name, int forWriting);
    89 static LinkedStringList *HOG_enumerateFiles(dvoid *opaque,
    89 static void HOG_enumerateFiles(dvoid *opaque, const char *dname,
    90                                             const char *dirname,
    90                                int omitSymLinks, PHYSFS_StringCallback cb,
    91                                             int omitSymLinks);
    91                                void *callbackdata);
    92 static int HOG_exists(dvoid *opaque, const char *name);
    92 static int HOG_exists(dvoid *opaque, const char *name);
    93 static int HOG_isDirectory(dvoid *opaque, const char *name, int *fileExists);
    93 static int HOG_isDirectory(dvoid *opaque, const char *name, int *fileExists);
    94 static int HOG_isSymLink(dvoid *opaque, const char *name, int *fileExists);
    94 static int HOG_isSymLink(dvoid *opaque, const char *name, int *fileExists);
    95 static PHYSFS_sint64 HOG_getLastModTime(dvoid *opaque, const char *n, int *e);
    95 static PHYSFS_sint64 HOG_getLastModTime(dvoid *opaque, const char *n, int *e);
    96 static fvoid *HOG_openRead(dvoid *opaque, const char *name, int *exist);
    96 static fvoid *HOG_openRead(dvoid *opaque, const char *name, int *exist);
   396 
   396 
   397     return(NULL);
   397     return(NULL);
   398 } /* HOG_openArchive */
   398 } /* HOG_openArchive */
   399 
   399 
   400 
   400 
   401 static LinkedStringList *HOG_enumerateFiles(dvoid *opaque,
   401 static void HOG_enumerateFiles(dvoid *opaque, const char *dname,
   402                                             const char *dirname,
   402                                int omitSymLinks, PHYSFS_StringCallback cb,
   403                                             int omitSymLinks)
   403                                void *callbackdata)
   404 {
   404 {
   405     HOGinfo *info = ((HOGinfo *) opaque);
       
   406     HOGentry *entry = info->entries;
       
   407     LinkedStringList *retval = NULL, *p = NULL;
       
   408     PHYSFS_uint32 max = info->entryCount;
       
   409     PHYSFS_uint32 i;
       
   410 
       
   411     /* no directories in HOG files. */
   405     /* no directories in HOG files. */
   412     BAIL_IF_MACRO(*dirname != '\0', ERR_NOT_A_DIR, NULL);
   406     if (*dname != '\0')
   413 
   407     {
   414     for (i = 0; i < max; i++, entry++)
   408         HOGinfo *info = (HOGinfo *) opaque;
   415         retval = __PHYSFS_addToLinkedStringList(retval, &p, entry->name, -1);
   409         HOGentry *entry = info->entries;
   416 
   410         PHYSFS_uint32 max = info->entryCount;
   417     return(retval);
   411         PHYSFS_uint32 i;
       
   412 
       
   413         for (i = 0; i < max; i++, entry++)
       
   414             cb(callbackdata, entry->name);
       
   415     } /* if */
   418 } /* HOG_enumerateFiles */
   416 } /* HOG_enumerateFiles */
   419 
   417 
   420 
   418 
   421 static HOGentry *hog_find_entry(HOGinfo *info, const char *name)
   419 static HOGentry *hog_find_entry(HOGinfo *info, const char *name)
   422 {
   420 {