فهرست منبع

unpacked: let archivers "abandon" the archive instead of closing it.

This lets you preserve the PHYSFS_Io in case of error during archive opening.
Ryan C. Gordon 8 سال پیش
والد
کامیت
3c9351c0ad
9فایلهای تغییر یافته به همراه17 افزوده شده و 7 حذف شده
  1. 1 1
      src/archiver_grp.c
  2. 1 1
      src/archiver_hog.c
  3. 1 1
      src/archiver_iso9660.c
  4. 1 1
      src/archiver_mvl.c
  5. 1 1
      src/archiver_qpak.c
  6. 1 1
      src/archiver_slb.c
  7. 9 0
      src/archiver_unpacked.c
  8. 1 1
      src/archiver_wad.c
  9. 1 0
      src/physfs_internal.h

+ 1 - 1
src/archiver_grp.c

@@ -78,7 +78,7 @@ static void *GRP_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
 
 
     if (!grpLoadEntries(io, count, unpkarc))
     if (!grpLoadEntries(io, count, unpkarc))
     {
     {
-        UNPK_closeArchive(unpkarc);
+        UNPK_abandonArchive(unpkarc);
         return NULL;
         return NULL;
     } /* if */
     } /* if */
 
 

+ 1 - 1
src/archiver_hog.c

@@ -77,7 +77,7 @@ static void *HOG_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
 
 
     if (!hogLoadEntries(io, unpkarc))
     if (!hogLoadEntries(io, unpkarc))
     {
     {
-        UNPK_closeArchive(unpkarc);
+        UNPK_abandonArchive(unpkarc);
         return NULL;
         return NULL;
     } /* if */
     } /* if */
 
 

+ 1 - 1
src/archiver_iso9660.c

@@ -315,7 +315,7 @@ static void *ISO9660_openArchive(PHYSFS_Io *io, const char *filename, int forWri
 
 
     if (!iso9660LoadEntries(io, joliet, "", rootpos, rootpos + len, unpkarc))
     if (!iso9660LoadEntries(io, joliet, "", rootpos, rootpos + len, unpkarc))
     {
     {
-        UNPK_closeArchive(unpkarc);
+        UNPK_abandonArchive(unpkarc);
         return NULL;
         return NULL;
     } /* if */
     } /* if */
 
 

+ 1 - 1
src/archiver_mvl.c

@@ -72,7 +72,7 @@ static void *MVL_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
 
 
     if (!mvlLoadEntries(io, count, unpkarc))
     if (!mvlLoadEntries(io, count, unpkarc))
     {
     {
-        UNPK_closeArchive(unpkarc);
+        UNPK_abandonArchive(unpkarc);
         return NULL;
         return NULL;
     } /* if */
     } /* if */
 
 

+ 1 - 1
src/archiver_qpak.c

@@ -88,7 +88,7 @@ static void *QPAK_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
 
 
     if (!qpakLoadEntries(io, count, unpkarc))
     if (!qpakLoadEntries(io, count, unpkarc))
     {
     {
-        UNPK_closeArchive(unpkarc);
+        UNPK_abandonArchive(unpkarc);
         return NULL;
         return NULL;
     } /* if */
     } /* if */
 
 

+ 1 - 1
src/archiver_slb.c

@@ -98,7 +98,7 @@ static void *SLB_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
 
 
     if (!slbLoadEntries(io, count, unpkarc))
     if (!slbLoadEntries(io, count, unpkarc))
     {
     {
-        UNPK_closeArchive(unpkarc);
+        UNPK_abandonArchive(unpkarc);
         return NULL;
         return NULL;
     } /* if */
     } /* if */
 
 

+ 9 - 0
src/archiver_unpacked.c

@@ -51,6 +51,15 @@ void UNPK_closeArchive(void *opaque)
     } /* if */
     } /* if */
 } /* UNPK_closeArchive */
 } /* UNPK_closeArchive */
 
 
+void UNPK_abandonArchive(void *opaque)
+{
+    UNPKinfo *info = ((UNPKinfo *) opaque);
+    if (info)
+    {
+        info->io = NULL;
+        UNPK_closeArchive(info);
+    } /* if */
+} /* UNPK_abandonArchive */
 
 
 static PHYSFS_sint64 UNPK_read(PHYSFS_Io *io, void *buffer, PHYSFS_uint64 len)
 static PHYSFS_sint64 UNPK_read(PHYSFS_Io *io, void *buffer, PHYSFS_uint64 len)
 {
 {

+ 1 - 1
src/archiver_wad.c

@@ -97,7 +97,7 @@ static void *WAD_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
 
 
     if (!wadLoadEntries(io, count, unpkarc))
     if (!wadLoadEntries(io, count, unpkarc))
     {
     {
-        UNPK_closeArchive(unpkarc);
+        UNPK_abandonArchive(unpkarc);
         return NULL;
         return NULL;
     } /* if */
     } /* if */
 
 

+ 1 - 0
src/physfs_internal.h

@@ -342,6 +342,7 @@ int __PHYSFS_readAll(PHYSFS_Io *io, void *buf, const PHYSFS_uint64 len);
 
 
 /* These are shared between some archivers. */
 /* These are shared between some archivers. */
 
 
+void UNPK_abandonArchive(void *opaque);
 void UNPK_closeArchive(void *opaque);
 void UNPK_closeArchive(void *opaque);
 void *UNPK_openArchive(PHYSFS_Io *io);
 void *UNPK_openArchive(PHYSFS_Io *io);
 void *UNPK_addEntry(void *opaque, char *name, const int isdir,
 void *UNPK_addEntry(void *opaque, char *name, const int isdir,