corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmke...@apache.org
Subject [61/92] [abbrv] incubator-corinthia git commit: Add DFFileFormat enum
Date Wed, 17 Dec 2014 13:29:11 GMT
Add DFFileFormat enum

This defines current and future supported file formats, and comes with
functions to convert to and from a file extension.

Each DFPackage now has a file format associated with it. For those
mapped to a zip file, the format is determined by the file extension.
For those created in memory or mapped to a directory, this must be
specified by the caller at creation time.

The purpose of recording the format of a package is so that a
determination can be made whether it is valid to use in a given
situation (e.g. if it is to be treated as a word document), or what
action to take based on the type (e.g. a different code path must be
taken for docx files vs. odt files).


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/15cfc095
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/15cfc095
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/15cfc095

Branch: refs/heads/stable
Commit: 15cfc095a231116fbcbb851ce5cf1e71865d3cee
Parents: 6fb91ae
Author: Peter Kelly <peter@uxproductivity.com>
Authored: Tue Dec 2 18:31:39 2014 +0700
Committer: Peter Kelly <peter@uxproductivity.com>
Committed: Tue Dec 2 19:02:23 2014 +0700

----------------------------------------------------------------------
 DocFormats.xcodeproj/project.pbxproj            | 12 +++
 DocFormats/CMakeLists.txt                       |  2 +
 DocFormats/api/headers/DocFormats/DocFormats.h  |  1 +
 DocFormats/api/headers/DocFormats/Formats.h     | 38 +++++++++
 DocFormats/api/src/Formats.c                    | 89 ++++++++++++++++++++
 DocFormats/core/src/lib/DFPackage.c             | 31 ++++---
 DocFormats/core/src/lib/DFPackage.h             |  6 +-
 DocFormats/filters/ooxml/src/word/WordPackage.c | 12 +++
 consumers/dfutil/src/TestFunctions.c            |  2 +-
 consumers/dfutil/src/main.c                     |  4 +-
 10 files changed, 180 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/15cfc095/DocFormats.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/DocFormats.xcodeproj/project.pbxproj b/DocFormats.xcodeproj/project.pbxproj
index 01304c0..3cd558a 100644
--- a/DocFormats.xcodeproj/project.pbxproj
+++ b/DocFormats.xcodeproj/project.pbxproj
@@ -155,6 +155,10 @@
 		D01E24E61A205A1500F4C04D /* DFXML.h in Headers */ = {isa = PBXBuildFile; fileRef = D01E245B1A205A1500F4C04D
/* DFXML.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		D01E24E71A205A1500F4C04D /* DFXMLForward.h in Headers */ = {isa = PBXBuildFile; fileRef
= D01E245C1A205A1500F4C04D /* DFXMLForward.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		D01E24E81A205A1500F4C04D /* DFXMLForward.h in Headers */ = {isa = PBXBuildFile; fileRef
= D01E245C1A205A1500F4C04D /* DFXMLForward.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		D0416D171A2DD7F20064BE57 /* Formats.h in Headers */ = {isa = PBXBuildFile; fileRef = D0416D161A2DD7F20064BE57
/* Formats.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		D0416D181A2DD7F40064BE57 /* Formats.h in Headers */ = {isa = PBXBuildFile; fileRef = D0416D161A2DD7F20064BE57
/* Formats.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		D0416D1A1A2DD8060064BE57 /* Formats.c in Sources */ = {isa = PBXBuildFile; fileRef = D0416D191A2DD8060064BE57
/* Formats.c */; };
+		D0416D1B1A2DD8060064BE57 /* Formats.c in Sources */ = {isa = PBXBuildFile; fileRef = D0416D191A2DD8060064BE57
/* Formats.c */; };
 		D04459371A20635B00A2E37E /* ODF.c in Sources */ = {isa = PBXBuildFile; fileRef = D044592F1A20635B00A2E37E
/* ODF.c */; };
 		D04459381A20635B00A2E37E /* ODF.h in Headers */ = {isa = PBXBuildFile; fileRef = D04459301A20635B00A2E37E
/* ODF.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		D04459391A20635B00A2E37E /* ODFManifest.c in Sources */ = {isa = PBXBuildFile; fileRef
= D04459311A20635B00A2E37E /* ODFManifest.c */; };
@@ -532,6 +536,8 @@
 		D01E245A1A205A1500F4C04D /* DFXML.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType
= sourcecode.c.c; path = DFXML.c; sourceTree = "<group>"; };
 		D01E245B1A205A1500F4C04D /* DFXML.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType
= sourcecode.c.h; path = DFXML.h; sourceTree = "<group>"; };
 		D01E245C1A205A1500F4C04D /* DFXMLForward.h */ = {isa = PBXFileReference; fileEncoding =
4; lastKnownFileType = sourcecode.c.h; path = DFXMLForward.h; sourceTree = "<group>";
};
+		D0416D161A2DD7F20064BE57 /* Formats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType
= sourcecode.c.h; name = Formats.h; path = api/headers/DocFormats/Formats.h; sourceTree =
"<group>"; };
+		D0416D191A2DD8060064BE57 /* Formats.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType
= sourcecode.c.c; name = Formats.c; path = api/src/Formats.c; sourceTree = "<group>";
};
 		D044592F1A20635B00A2E37E /* ODF.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType
= sourcecode.c.c; path = ODF.c; sourceTree = "<group>"; };
 		D04459301A20635B00A2E37E /* ODF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType
= sourcecode.c.h; path = ODF.h; sourceTree = "<group>"; };
 		D04459311A20635B00A2E37E /* ODFManifest.c */ = {isa = PBXFileReference; fileEncoding =
4; lastKnownFileType = sourcecode.c.c; path = ODFManifest.c; sourceTree = "<group>";
};
@@ -724,6 +730,8 @@
 			isa = PBXGroup;
 			children = (
 				D074ED561A2B04BC000C3704 /* DocFormats.h */,
+				D0416D191A2DD8060064BE57 /* Formats.c */,
+				D0416D161A2DD7F20064BE57 /* Formats.h */,
 				D00C675E1A2ACDB0000233A3 /* Operations.c */,
 				D074ED571A2B04BC000C3704 /* Operations.h */,
 			);
@@ -1277,6 +1285,7 @@
 				D0A787941A210EA900723FE8 /* win32tc.h in Headers */,
 				D01E24691A205A1500F4C04D /* CSS.h in Headers */,
 				D0ADB3941A2054C6003D645D /* WordPackage.h in Headers */,
+				D0416D171A2DD7F20064BE57 /* Formats.h in Headers */,
 				D01E24E51A205A1500F4C04D /* DFXML.h in Headers */,
 				D0A787621A210EA900723FE8 /* iconvtc.h in Headers */,
 				D0B113CD1A205F67009610A5 /* HTMLToLaTeX.h in Headers */,
@@ -1387,6 +1396,7 @@
 				D0ADB3A91A2054C6003D645D /* WordTheme.h in Headers */,
 				D01E246A1A205A1500F4C04D /* CSS.h in Headers */,
 				D0ADB3951A2054C6003D645D /* WordPackage.h in Headers */,
+				D0416D181A2DD7F40064BE57 /* Formats.h in Headers */,
 				D0A787631A210EA900723FE8 /* iconvtc.h in Headers */,
 				D0B113CF1A205F70009610A5 /* HTMLToLaTeX.h in Headers */,
 				D01E24E61A205A1500F4C04D /* DFXML.h in Headers */,
@@ -1586,6 +1596,7 @@
 				D0ADB3621A2054C6003D645D /* WordLenses.c in Sources */,
 				D01E24CB1A205A1500F4C04D /* DFZipFile.c in Sources */,
 				D0A7874E1A210EA900723FE8 /* config.c in Sources */,
+				D0416D1A1A2DD8060064BE57 /* Formats.c in Sources */,
 				D0B113CC1A205F67009610A5 /* HTMLToLaTeX.c in Sources */,
 				D0ADB3A61A2054C6003D645D /* WordTheme.c in Sources */,
 				D0A7878C1A210EA900723FE8 /* utf8.c in Sources */,
@@ -1704,6 +1715,7 @@
 				D0ADB3631A2054C6003D645D /* WordLenses.c in Sources */,
 				D01E24CC1A205A1500F4C04D /* DFZipFile.c in Sources */,
 				D0A7874F1A210EA900723FE8 /* config.c in Sources */,
+				D0416D1B1A2DD8060064BE57 /* Formats.c in Sources */,
 				D0B113CE1A205F70009610A5 /* HTMLToLaTeX.c in Sources */,
 				D0ADB3A71A2054C6003D645D /* WordTheme.c in Sources */,
 				D0A7878D1A210EA900723FE8 /* utf8.c in Sources */,

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/15cfc095/DocFormats/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/DocFormats/CMakeLists.txt b/DocFormats/CMakeLists.txt
index 3c7143a..b59351c 100644
--- a/DocFormats/CMakeLists.txt
+++ b/DocFormats/CMakeLists.txt
@@ -35,7 +35,9 @@ set(GroupRoot
 
 set(GroupAPI
     api/headers/DocFormats/DocFormats.h
+    api/headers/DocFormats/Formats.h
     api/headers/DocFormats/Operations.h
+    api/src/Formats.c
     api/src/Operations.c)
 
 set(GroupCoreCommon

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/15cfc095/DocFormats/api/headers/DocFormats/DocFormats.h
----------------------------------------------------------------------
diff --git a/DocFormats/api/headers/DocFormats/DocFormats.h b/DocFormats/api/headers/DocFormats/DocFormats.h
index 7f5fbf7..3723f7d 100644
--- a/DocFormats/api/headers/DocFormats/DocFormats.h
+++ b/DocFormats/api/headers/DocFormats/DocFormats.h
@@ -13,3 +13,4 @@
 // limitations under the License.
 
 #include <DocFormats/Operations.h>
+#include <DocFormats/Formats.h>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/15cfc095/DocFormats/api/headers/DocFormats/Formats.h
----------------------------------------------------------------------
diff --git a/DocFormats/api/headers/DocFormats/Formats.h b/DocFormats/api/headers/DocFormats/Formats.h
new file mode 100644
index 0000000..fb83f40
--- /dev/null
+++ b/DocFormats/api/headers/DocFormats/Formats.h
@@ -0,0 +1,38 @@
+// Copyright 2012-2014 UX Productivity Pty Ltd
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef DocFormats_Formats_h
+#define DocFormats_Formats_h
+
+typedef enum {
+    DFFileFormatUnknown  = 0,
+    DFFileFormatHTML,
+    DFFileFormatDocx,
+    DFFileFormatXlsx,
+    DFFileFormatPptx,
+    DFFileFormatOdt,
+    DFFileFormatOds,
+    DFFileFormatOdp,
+    DFFileFormatMarkdown,
+    DFFileFormatLaTeX,
+    DFFileFormatRTF,
+    DFFileFormatScriv,
+    DFFileFormatEPUB,
+} DFFileFormat;
+
+DFFileFormat DFFileFormatFromFilename(const char *filename);
+DFFileFormat DFFileFormatFromExtension(const char *ext);
+const char *DFFileFormatToExtension(DFFileFormat format);
+
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/15cfc095/DocFormats/api/src/Formats.c
----------------------------------------------------------------------
diff --git a/DocFormats/api/src/Formats.c b/DocFormats/api/src/Formats.c
new file mode 100644
index 0000000..3d194de
--- /dev/null
+++ b/DocFormats/api/src/Formats.c
@@ -0,0 +1,89 @@
+// Copyright 2012-2014 UX Productivity Pty Ltd
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include <DocFormats/Formats.h>
+#include "DFFilesystem.h"
+#include "DFString.h"
+#include <stdlib.h>
+
+DFFileFormat DFFileFormatFromFilename(const char *filename)
+{
+    char *ext = DFPathExtension(filename);
+    DFFileFormat format = DFFileFormatFromExtension(ext);
+    free(ext);
+    return format;
+}
+
+DFFileFormat DFFileFormatFromExtension(const char *ext)
+{
+    if (DFStringEqualsCI(ext,"html"))
+        return DFFileFormatHTML;
+    else if (DFStringEqualsCI(ext,"docx"))
+        return DFFileFormatDocx;
+    else if (DFStringEqualsCI(ext,"xlsx"))
+        return DFFileFormatXlsx;
+    else if (DFStringEqualsCI(ext,"pptx"))
+        return DFFileFormatPptx;
+    else if (DFStringEqualsCI(ext,"odt"))
+        return DFFileFormatOdt;
+    else if (DFStringEqualsCI(ext,"ods"))
+        return DFFileFormatOds;
+    else if (DFStringEqualsCI(ext,"odp"))
+        return DFFileFormatOdp;
+    else if (DFStringEqualsCI(ext,"md"))
+        return DFFileFormatMarkdown;
+    else if (DFStringEqualsCI(ext,"tex"))
+        return DFFileFormatLaTeX;
+    else if (DFStringEqualsCI(ext,"rtf"))
+        return DFFileFormatRTF;
+    else if (DFStringEqualsCI(ext,"scriv"))
+        return DFFileFormatScriv;
+    else if (DFStringEqualsCI(ext,"epub"))
+        return DFFileFormatEPUB;
+    else
+        return DFFileFormatUnknown;
+}
+
+const char *DFFileFormatToExtension(DFFileFormat format)
+{
+    switch (format) {
+        case DFFileFormatUnknown:
+            return NULL;
+        case DFFileFormatHTML:
+            return "html";
+        case DFFileFormatDocx:
+            return "docx";
+        case DFFileFormatXlsx:
+            return "xlsx";
+        case DFFileFormatPptx:
+            return "pptx";
+        case DFFileFormatOdt:
+            return "odt";
+        case DFFileFormatOds:
+            return "ods";
+        case DFFileFormatOdp:
+            return "odp";
+        case DFFileFormatMarkdown:
+            return "md";
+        case DFFileFormatLaTeX:
+            return "tex";
+        case DFFileFormatRTF:
+            return "rtf";
+        case DFFileFormatScriv:
+            return "scriv";
+        case DFFileFormatEPUB:
+            return "epub";
+    }
+    return NULL;
+}

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/15cfc095/DocFormats/core/src/lib/DFPackage.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/DFPackage.c b/DocFormats/core/src/lib/DFPackage.c
index eeb1a88..0ee3a8a 100644
--- a/DocFormats/core/src/lib/DFPackage.c
+++ b/DocFormats/core/src/lib/DFPackage.c
@@ -36,6 +36,7 @@ struct DFPackageOps {
 
 struct DFPackage {
     size_t retainCount;
+    DFFileFormat format;
     char *rootPath;
     char *zipFilename;
     DFHashTable *files;
@@ -316,21 +317,26 @@ static char *fixPath(const char *input)
     return result;
 }
 
-DFPackage *DFPackageNewFilesystem(const char *rootPath)
+static DFPackage *DFPackageNew(DFFileFormat format, const DFPackageOps *ops)
 {
     DFPackage *package = (DFPackage *)calloc(1,sizeof(DFPackage));
     package->retainCount = 1;
+    package->format = format;
+    package->ops = ops;
+    return package;
+}
+
+DFPackage *DFPackageNewFilesystem(const char *rootPath, DFFileFormat format)
+{
+    DFPackage *package = DFPackageNew(format,&fsOps);
     package->rootPath = strdup(rootPath);
-    package->ops = &fsOps;
     return package;
 }
 
-DFPackage *DFPackageNewMemory(void)
+DFPackage *DFPackageNewMemory(DFFileFormat format)
 {
-    DFPackage *package = (DFPackage *)calloc(1,sizeof(DFPackage));
-    package->retainCount = 1;
+    DFPackage *package = DFPackageNew(format,&memOps);
     package->files = DFHashTableNew((DFCopyFunction)DFBufferRetain,(DFFreeFunction)DFBufferRelease);
-    package->ops = &memOps;
     return package;
 }
 
@@ -342,10 +348,8 @@ DFPackage *DFPackageCreateZip(const char *filename, DFError **error)
         return NULL;
     }
 
-    DFPackage *package = (DFPackage *)calloc(1,sizeof(DFPackage));
-    package->retainCount = 1;
+    DFPackage *package = DFPackageNew(DFFileFormatFromFilename(filename),&zipOps);
     package->files = DFHashTableNew((DFCopyFunction)DFBufferRetain,(DFFreeFunction)DFBufferRelease);
-    package->ops = &zipOps;
     package->zipFilename = strdup(filename);
     return package;
 }
@@ -357,10 +361,8 @@ DFPackage *DFPackageOpenZip(const char *filename, DFError **error)
         return NULL;
     }
 
-    DFPackage *package = (DFPackage *)calloc(1,sizeof(DFPackage));
-    package->retainCount = 1;
+    DFPackage *package = DFPackageNew(DFFileFormatFromFilename(filename),&zipOps);
     package->files = DFHashTableNew((DFCopyFunction)DFBufferRetain,(DFFreeFunction)DFBufferRelease);
-    package->ops = &zipOps;
     package->zipFilename = strdup(filename);
 
     if (!DFUnzip(filename,package,error)) {
@@ -388,6 +390,11 @@ void DFPackageRelease(DFPackage *package)
     free(package);
 }
 
+DFFileFormat DFPackageFormat(DFPackage *package)
+{
+    return package->format;
+}
+
 int DFPackageSave(DFPackage *package, DFError **error)
 {
     return package->ops->save(package,error);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/15cfc095/DocFormats/core/src/lib/DFPackage.h
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/DFPackage.h b/DocFormats/core/src/lib/DFPackage.h
index 2a85bf6..cb02c55 100644
--- a/DocFormats/core/src/lib/DFPackage.h
+++ b/DocFormats/core/src/lib/DFPackage.h
@@ -17,15 +17,17 @@
 
 #include "DFError.h"
 #include "DFTypes.h"
+#include <DocFormats/Formats.h>
 
 typedef struct DFPackage DFPackage;
 
-DFPackage *DFPackageNewFilesystem(const char *rootPath);
-DFPackage *DFPackageNewMemory(void);
+DFPackage *DFPackageNewFilesystem(const char *rootPath, DFFileFormat format);
+DFPackage *DFPackageNewMemory(DFFileFormat format);
 DFPackage *DFPackageCreateZip(const char *filename, DFError **error);
 DFPackage *DFPackageOpenZip(const char *filename, DFError **error);
 DFPackage *DFPackageRetain(DFPackage *package);
 void DFPackageRelease(DFPackage *package);
+DFFileFormat DFPackageFormat(DFPackage *package);
 int DFPackageSave(DFPackage *package, DFError **error);
 
 int DFPackageRead(DFPackage *package, const char *path, void **buf, size_t *nbytes, DFError
**error);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/15cfc095/DocFormats/filters/ooxml/src/word/WordPackage.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordPackage.c b/DocFormats/filters/ooxml/src/word/WordPackage.c
index 866ec05..0c5703e 100644
--- a/DocFormats/filters/ooxml/src/word/WordPackage.c
+++ b/DocFormats/filters/ooxml/src/word/WordPackage.c
@@ -179,6 +179,12 @@ static void addMissingParts(WordPackage *package)
 
 WordPackage *WordPackageOpenNew(DFPackage *store, DFError **error)
 {
+    if (DFPackageFormat(store) != DFFileFormatDocx) {
+        DFErrorFormat(error,"Incorrect format: Expected %s, got %s",
+                      DFFileFormatToExtension(DFFileFormatDocx),DFFileFormatToExtension(DFPackageFormat(store)));
+        return NULL;
+    }
+
     OPCPackage *opc = OPCPackageOpenNew(store,error);
     if (opc == NULL)
         return NULL;
@@ -210,6 +216,12 @@ WordPackage *WordPackageOpenNew(DFPackage *store, DFError **error)
 
 WordPackage *WordPackageOpenFrom(DFPackage *store, DFError **error)
 {
+    if (DFPackageFormat(store) != DFFileFormatDocx) {
+        DFErrorFormat(error,"Incorrect format: Expected %s, got %s",
+                      DFFileFormatToExtension(DFFileFormatDocx),DFFileFormatToExtension(DFPackageFormat(store)));
+        return NULL;
+    }
+
     OPCPackage *opc = OPCPackageOpenFrom(store,error);
     if (opc == NULL)
         return NULL;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/15cfc095/consumers/dfutil/src/TestFunctions.c
----------------------------------------------------------------------
diff --git a/consumers/dfutil/src/TestFunctions.c b/consumers/dfutil/src/TestFunctions.c
index a9ff3dd..bc8a2d3 100644
--- a/consumers/dfutil/src/TestFunctions.c
+++ b/consumers/dfutil/src/TestFunctions.c
@@ -209,7 +209,7 @@ static DFHashTable *getFlags(int argc, const char **argv)
 
 static void Word_testCreate(TestCase *script, int argc, const char **argv)
 {
-    DFPackage *rawPackage = DFPackageNewMemory();
+    DFPackage *rawPackage = DFPackageNewMemory(DFFileFormatDocx);
     WordPackage *wordPackage = NULL;
 
     DFDocument *htmlDoc = NULL;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/15cfc095/consumers/dfutil/src/main.c
----------------------------------------------------------------------
diff --git a/consumers/dfutil/src/main.c b/consumers/dfutil/src/main.c
index 18f1a74..c7e52cf 100644
--- a/consumers/dfutil/src/main.c
+++ b/consumers/dfutil/src/main.c
@@ -92,13 +92,13 @@ static int runCommand(int argc, const char **argv, DFError **dferr)
     }
 #endif
     else if ((argc == 4) && !strcmp(argv[1],"-zip")) {
-        DFPackage *package = DFPackageNewFilesystem(argv[3]);
+        DFPackage *package = DFPackageNewFilesystem(argv[3],DFFileFormatUnknown);
         int r = DFZip(argv[2],package,dferr);
         DFPackageRelease(package);
         return r;
     }
     else if ((argc == 4) && !strcmp(argv[1],"-unzip")) {
-        DFPackage *package = DFPackageNewFilesystem(argv[3]);
+        DFPackage *package = DFPackageNewFilesystem(argv[3],DFFileFormatUnknown);
         int r = DFUnzip(argv[2],package,dferr);
         DFPackageRelease(package);
         return r;


Mime
View raw message