src/archiver_lzma.c
changeset 1113 2136d64bd1ad
parent 1111 20d7c2d95a98
child 1118 2e09fc635fdd
--- a/src/archiver_lzma.c	Tue Aug 24 10:03:25 2010 -0400
+++ b/src/archiver_lzma.c	Tue Aug 24 10:05:58 2010 -0400
@@ -430,13 +430,12 @@
 } /* LZMA_fileClose */
 
 
-static int LZMA_isArchive(const char *filename, int forWriting)
+/* !!! FIXME: don't open/close file here, merge with openArchive(). */
+static int isLzma(const char *filename)
 {
     PHYSFS_uint8 sig[k7zSignatureSize];
     void *in;
 
-    BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
-
     in = __PHYSFS_platformOpenRead(filename);
     BAIL_IF_MACRO(in == NULL, NULL, 0);
 
@@ -451,7 +450,7 @@
 
     /* Test whether sig is the 7z signature */
     return TestSignatureCandidate(sig);
-} /* LZMA_isArchive */
+} /* isLzma */
 
 
 static void *LZMA_openArchive(const char *name, int forWriting)
@@ -460,7 +459,7 @@
     LZMAarchive *archive = NULL;
 
     BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, NULL);
-    BAIL_IF_MACRO(!LZMA_isArchive(name,forWriting), ERR_UNSUPPORTED_ARCHIVE, 0);
+    BAIL_IF_MACRO(!isLzma(name), ERR_UNSUPPORTED_ARCHIVE, NULL);
 
     archive = (LZMAarchive *) allocator.Malloc(sizeof (LZMAarchive));
     BAIL_IF_MACRO(archive == NULL, ERR_OUT_OF_MEMORY, NULL);
@@ -721,7 +720,6 @@
 const PHYSFS_Archiver __PHYSFS_Archiver_LZMA =
 {
     &__PHYSFS_ArchiveInfo_LZMA,
-    LZMA_isArchive,          /* isArchive() method      */
     LZMA_openArchive,        /* openArchive() method    */
     LZMA_enumerateFiles,     /* enumerateFiles() method */
     LZMA_exists,             /* exists() method         */