src/archiver_hog.c
changeset 1115 bc7257f4f8da
parent 1113 2136d64bd1ad
child 1118 2e09fc635fdd
equal deleted inserted replaced
1114:db75213cb4b5 1115:bc7257f4f8da
    53  * One HOGinfo is kept for each open HOG archive.
    53  * One HOGinfo is kept for each open HOG archive.
    54  */
    54  */
    55 typedef struct
    55 typedef struct
    56 {
    56 {
    57     char *filename;
    57     char *filename;
    58     PHYSFS_sint64 last_mod_time;
       
    59     PHYSFS_uint32 entryCount;
    58     PHYSFS_uint32 entryCount;
    60     HOGentry *entries;
    59     HOGentry *entries;
    61 } HOGinfo;
    60 } HOGinfo;
    62 
    61 
    63 /*
    62 /*
   286 } /* hog_load_entries */
   285 } /* hog_load_entries */
   287 
   286 
   288 
   287 
   289 static void *HOG_openArchive(const char *name, int forWriting)
   288 static void *HOG_openArchive(const char *name, int forWriting)
   290 {
   289 {
   291     PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
       
   292     HOGinfo *info = (HOGinfo *) allocator.Malloc(sizeof (HOGinfo));
   290     HOGinfo *info = (HOGinfo *) allocator.Malloc(sizeof (HOGinfo));
   293 
   291 
   294     BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
   292     BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
   295     memset(info, '\0', sizeof (HOGinfo));
   293     memset(info, '\0', sizeof (HOGinfo));
   296     info->filename = (char *) allocator.Malloc(strlen(name) + 1);
   294     info->filename = (char *) allocator.Malloc(strlen(name) + 1);
   298 
   296 
   299     if (!hog_load_entries(name, forWriting, info))
   297     if (!hog_load_entries(name, forWriting, info))
   300         goto HOG_openArchive_failed;
   298         goto HOG_openArchive_failed;
   301 
   299 
   302     strcpy(info->filename, name);
   300     strcpy(info->filename, name);
   303     info->last_mod_time = modtime;
       
   304 
   301 
   305     return info;
   302     return info;
   306 
   303 
   307 HOG_openArchive_failed:
   304 HOG_openArchive_failed:
   308     if (info != NULL)
   305     if (info != NULL)
   450     if (!entry)
   447     if (!entry)
   451         return 0;
   448         return 0;
   452 
   449 
   453     stat->filesize = entry->size;
   450     stat->filesize = entry->size;
   454     stat->filetype = PHYSFS_FILETYPE_REGULAR;
   451     stat->filetype = PHYSFS_FILETYPE_REGULAR;
   455     stat->modtime = info->last_mod_time;
   452     stat->modtime = -1;
   456     stat->createtime = info->last_mod_time;
   453     stat->createtime = -1;
   457     stat->accesstime = -1;
   454     stat->accesstime = -1;
   458     stat->readonly = 1;
   455     stat->readonly = 1;
   459 
   456 
   460     return 1;
   457     return 1;
   461 } /* HOG_stat */
   458 } /* HOG_stat */