You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@corinthia.apache.org by ja...@apache.org on 2015/02/23 12:39:19 UTC
[16/31] incubator-corinthia git commit: work
work
Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/b2ab848b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/b2ab848b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/b2ab848b
Branch: refs/heads/experimentzip
Commit: b2ab848bfd187b153cedcf353a6ea6ff6c5de42c
Parents: 9a40834
Author: jani <ja...@apache.org>
Authored: Fri Feb 13 12:34:42 2015 +0100
Committer: jani <ja...@apache.org>
Committed: Fri Feb 13 12:34:42 2015 +0100
----------------------------------------------------------------------
DocFormats/core/src/lib/DFZipFile.c | 8 +++++++-
DocFormats/headers/DFPlatform.h | 15 ++++++++-------
DocFormats/platform/src/Wrapper.c | 4 +++-
DocFormats/platform/src/ZipWrapper.c | 2 ++
4 files changed, 20 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b2ab848b/DocFormats/core/src/lib/DFZipFile.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/DFZipFile.c b/DocFormats/core/src/lib/DFZipFile.c
index faec05f..8414f6e 100644
--- a/DocFormats/core/src/lib/DFZipFile.c
+++ b/DocFormats/core/src/lib/DFZipFile.c
@@ -35,6 +35,7 @@ static int zipError(DFError **error, const char *format, ...)
int DFUnzip(const char *zipFilename, DFStorage *storage, DFError **error)
{
+#ifdef JANI
char entryName[4096];
DFextZipHandleP zipHandle;
@@ -71,12 +72,13 @@ int DFUnzip(const char *zipFilename, DFStorage *storage, DFError **error)
return zipError(error,"Zip directory is corrupt");
DFextZipClose(zipHandle);
-
+#endif
return 1;
}
static int zipAddFile(DFextZipHandleP zipHandle, const char *dest, DFBuffer *content, DFError **error)
{
+#ifdef JANI
if (DFextZipAppendNewFile(zipHandle, dest) < 0)
return zipError(error,"%s: Cannot create entry in zip file",dest);
@@ -85,6 +87,7 @@ static int zipAddFile(DFextZipHandleP zipHandle, const char *dest, DFBuffer *con
if (DFextZipCloseFile(zipHandle) <0)
return zipError(error,"%s: Error closing entry in zip file",dest);
+#endif
return 1;
}
@@ -92,6 +95,7 @@ static int zipAddFile(DFextZipHandleP zipHandle, const char *dest, DFBuffer *con
int DFZip(const char *zipFilename, DFStorage *storage, DFError **error)
{
+#ifdef JANI
const char **allPaths = NULL;
DFBuffer *content = NULL;
int ok = 0;
@@ -127,4 +131,6 @@ end:
if (zipHandle != NULL)
DFextZipClose(zipHandle);
return ok;
+#endif
+ return 1;
}
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b2ab848b/DocFormats/headers/DFPlatform.h
----------------------------------------------------------------------
diff --git a/DocFormats/headers/DFPlatform.h b/DocFormats/headers/DFPlatform.h
index ea517e7..8480161 100755
--- a/DocFormats/headers/DFPlatform.h
+++ b/DocFormats/headers/DFPlatform.h
@@ -65,19 +65,20 @@ void DFInitOnce(DFOnce *once, DFOnceFunction fun);
// Zip functions
typedef struct {
- void *handle;
- int zipFlag;
- int zipFirst;
+ void *handle;
+ struct DFDirEntryList *zipDirectoryEntries;
} DFextZipHandle;
typedef DFextZipHandle * DFextZipHandleP;
-DFextZipHandleP DFextZipOpen(const char *zipFilename, int doUnzip);
+DFextZipHandleP DFextZipOpen(const char *zipFilename);
+DFextZipHandleP DFextZipCreae(const char *zipFilename);
int DFextZipClose(DFextZipHandleP zipHandle);
-int DFextZipOpenNextFile(DFextZipHandleP zipHandle, char *entryName, const int maxName);
-int DFextZipAppendNewFile(DFextZipHandleP zipHandle, const char *entryName);
+int DFextZipOpenFileByName(DFextZipHandleP zipHandle, char *entryName);
+int DFextZipOpenFileByPtr(DFextZipHandleP zipHandle, DFextZipHandleP entryPtr);
+int DFextZipAppendNewFile(DFextZipHandleP zipHandle, char *entryName);
int DFextZipCloseFile(DFextZipHandleP zipHandle);
-int DFextZipReadCurrentFile(DFextZipHandleP zipHandle, void *buf, const int maxLen);
+int DFextZipReadCurrentFile (DFextZipHandleP zipHandle, void *buf, const int maxLen);
int DFextZipWriteCurrentFile(DFextZipHandleP zipHandle, const void *buf, const int len);
#endif
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b2ab848b/DocFormats/platform/src/Wrapper.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/src/Wrapper.c b/DocFormats/platform/src/Wrapper.c
index 14ed093..c623425 100644
--- a/DocFormats/platform/src/Wrapper.c
+++ b/DocFormats/platform/src/Wrapper.c
@@ -18,10 +18,11 @@
#include "zip.h"
+#ifdef JANI
DFextZipHandleP DFextZipOpen(const char *zipFilename, int doUnzip) {
DFextZipHandleP zipHandle = malloc(sizeof(DFextZipHandle));
- // no more memory
+ // no more
if (!zipHandle)
return NULL;
@@ -144,3 +145,4 @@ int DFextZipWriteCurrentFile(DFextZipHandleP zipHandle, const void *buf, const i
{
return (zipWriteInFileInZip(zipHandle->handle, buf, len) == ZIP_OK) ? 1 : -1;
}
+#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b2ab848b/DocFormats/platform/src/ZipWrapper.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/src/ZipWrapper.c b/DocFormats/platform/src/ZipWrapper.c
index 827a7d1..e512f75 100644
--- a/DocFormats/platform/src/ZipWrapper.c
+++ b/DocFormats/platform/src/ZipWrapper.c
@@ -16,6 +16,7 @@
#include "zip.h"
+#ifdef JANI
DFextZipHandleP DFextZipOpen(const char *zipFilename, int doUnzip) {
DFextZipHandleP zipHandle = malloc(sizeof(DFextZipHandle));
@@ -142,3 +143,4 @@ int DFextZipWriteCurrentFile(DFextZipHandleP zipHandle, const void *buf, const i
{
return (zipWriteInFileInZip(zipHandle->handle, buf, len) == ZIP_OK) ? 1 : -1;
}
+#endif
\ No newline at end of file