corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [2/3] incubator-corinthia git commit: rename testcass and prepare
Date Wed, 29 Jul 2015 20:20:27 GMT
rename testcass and prepare

prepare for new impl. of read


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

Branch: refs/heads/newZipExperiment
Commit: be6c3ce947750156bc0cb18b7db561fdbd1bca69
Parents: 8462afc
Author: jani <jani@apache.org>
Authored: Tue Jul 28 20:10:54 2015 +0200
Committer: jani <jani@apache.org>
Committed: Tue Jul 28 20:10:54 2015 +0200

----------------------------------------------------------------------
 DocFormats/headers/DFPlatform.h          |  4 +--
 DocFormats/platform/src/Wrapper.c        | 52 ++++++++++++++++++++++-----
 DocFormats/platform/tests/WrapperTests.c | 22 ++++++++----
 3 files changed, 61 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/be6c3ce9/DocFormats/headers/DFPlatform.h
----------------------------------------------------------------------
diff --git a/DocFormats/headers/DFPlatform.h b/DocFormats/headers/DFPlatform.h
index 8e10fdb..d594779 100644
--- a/DocFormats/headers/DFPlatform.h
+++ b/DocFormats/headers/DFPlatform.h
@@ -70,9 +70,7 @@ void DFInitOnce(DFOnce *once, DFOnceFunction fun);
 
 // Zip functions
 typedef struct {
-        void *handle;
-        int   zipFlag;
-        int   zipFirst;
+	int x;
         } DFextZipHandle;
 
 typedef DFextZipHandle * DFextZipHandleP;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/be6c3ce9/DocFormats/platform/src/Wrapper.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/src/Wrapper.c b/DocFormats/platform/src/Wrapper.c
index b9f37fe..1ca4ef2 100644
--- a/DocFormats/platform/src/Wrapper.c
+++ b/DocFormats/platform/src/Wrapper.c
@@ -25,41 +25,64 @@
 
 DFextZipHandleP DFextZipOpen(const char *zipFilename) {
     DFextZipHandleP zipHandle = xmalloc(sizeof(DFextZipHandle));
- 
+#if 0 
     // no more memory
     if (!zipHandle)
         return NULL;
 
     // Open file
     zipHandle->zipFirst = 1;
-    zipHandle->zipFlag = 1;
     zipHandle->handle = unzOpen(zipFilename);
 
     if (zipHandle->handle)
         return zipHandle;
 
     free(zipHandle);
+#endif
     return NULL;
 }
 
 
 
+DFextZipHandleP OLD_DFextZipOpen(const char *zipFilename) {
+	DFextZipHandleP zipHandle = xmalloc(sizeof(DFextZipHandle));
+
+#if 0
+	// no more memory
+	if (!zipHandle)
+		return NULL;
+
+	// Open file
+	zipHandle->zipFirst = 1;
+	zipHandle->handle = unzOpen(zipFilename);
+
+	if (zipHandle->handle)
+		return zipHandle;
+
+	free(zipHandle);
+#endif
+	return NULL;
+}
+
+
+
 DFextZipHandleP DFextZipCreate(const char *zipFilename) {
 	DFextZipHandleP zipHandle = xmalloc(sizeof(DFextZipHandle));
 
+#if 0
 	// no more memory
 	if (!zipHandle)
 		return NULL;
 
 	// Open file
 	zipHandle->zipFirst = 1;
-	zipHandle->zipFlag = 0;
     zipHandle->handle = zipOpen(zipFilename, APPEND_STATUS_CREATE);
 
 	if (zipHandle->handle)
 		return zipHandle;
 
 	free(zipHandle);
+#endif
 	return NULL;
 }
 
@@ -68,6 +91,7 @@ int DFextZipClose(DFextZipHandleP zipHandle)
 {
     int rc = 0;
 
+#if 0
     if (zipHandle->handle) {
         if (zipHandle->zipFlag)
             rc = (unzClose(zipHandle->handle) == UNZ_OK);
@@ -77,6 +101,7 @@ int DFextZipClose(DFextZipHandleP zipHandle)
     }
 
     free(zipHandle);
+#endif
     return rc ? 1 : -1;
 }
 
@@ -84,8 +109,8 @@ int DFextZipClose(DFextZipHandleP zipHandle)
 
 int DFextZipOpenNextFile(DFextZipHandleP zipHandle, char *entryName, const int maxName)
 {
-    int rc;
-
+#if 0
+	int rc;
 
     if (zipHandle->zipFlag) {
         unz_file_info info;
@@ -119,16 +144,18 @@ int DFextZipOpenNextFile(DFextZipHandleP zipHandle, char *entryName,
const int m
     }
 
     // ready to read
+#endif
     return 1;
 }
 
 int DFextZipAppendNewFile(DFextZipHandleP zipHandle, const char *entryName)
 {
+#if 0
     zip_fileinfo fileinfo;
     memset(&fileinfo, 0, sizeof(fileinfo));
 
-    if (zipHandle->zipFlag)
-        return -1; // Zip file is open in read-only mode
+   if (zipHandle->zipFlag)
+      return -1; // Zip file is open in read-only mode
 
     if (zipOpenNewFileInZip(zipHandle->handle,
                             entryName,
@@ -140,16 +167,19 @@ int DFextZipAppendNewFile(DFextZipHandleP zipHandle, const char *entryName)
                             Z_DEFAULT_COMPRESSION) != ZIP_OK) {
         return -1;
     }
-
+#endif
     return 1;
 }
 
 int DFextZipCloseFile(DFextZipHandleP zipHandle)
 {
+#if 0
     if (zipHandle->zipFlag)
         return (unzCloseCurrentFile(zipHandle->handle) != UNZ_OK) ? -1 : 1;
     else
         return (zipCloseFileInZip(zipHandle->handle) != UNZ_OK) ? -1 : 1;
+#endif
+	return 0;
 }
 
 
@@ -157,14 +187,20 @@ int DFextZipCloseFile(DFextZipHandleP zipHandle)
 
 int DFextZipReadCurrentFile(DFextZipHandleP zipHandle, void *buf, const int maxLen)
 {
+#if 0
     return unzReadCurrentFile(zipHandle->handle, buf, maxLen);
+#endif
+	return 0;
 }
 
 
 
 int DFextZipWriteCurrentFile(DFextZipHandleP zipHandle, const void *buf, const int len)
 {
+#if 0
     return (zipWriteInFileInZip(zipHandle->handle, buf, len) == ZIP_OK) ? 1 : -1;
+#endif
+	return 0;
 }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/be6c3ce9/DocFormats/platform/tests/WrapperTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/tests/WrapperTests.c b/DocFormats/platform/tests/WrapperTests.c
index 5f5d74b..19ed4ae 100644
--- a/DocFormats/platform/tests/WrapperTests.c
+++ b/DocFormats/platform/tests/WrapperTests.c
@@ -29,6 +29,15 @@ static void test_DFextZipOpen(void)
 
 
 
+static void test_DFextZipCreate(void)
+{
+#if 0
+	int DFextZipOpen(const char *zipFilename, int doUnzip) {
+#endif
+}
+
+
+
 static void test_DFextZipClose(void)
 {
 #if 0
@@ -76,12 +85,13 @@ static void test_DFextZipWriteCurrentFile(void)
 
 TestGroup PlatformWrapperTests = {
     "platform.wrapper", {
-            { "DFextZipOpen",            PlainTest, test_DFextZipOpen   },
-            { "DFextZipClose",           PlainTest, test_DFextZipClose },
-            { "DFextZipOpenNextFile",    PlainTest, test_DFextZipOpenNextFile },
-            { "DFextZipCloseFile",       PlainTest, test_DFextZipCloseFile },
-            { "DFextZipReadCurrentFile", PlainTest, test_DFextZipReadCurrentFile },
+		    { "DFextZipOpen",             PlainTest, test_DFextZipCreate  },
+            { "DFextZipOpen",             PlainTest, test_DFextZipOpen   },
+            { "DFextZipClose",            PlainTest, test_DFextZipClose },
+            { "DFextZipOpenNextFile",     PlainTest, test_DFextZipOpenNextFile },
+            { "DFextZipCloseFile",        PlainTest, test_DFextZipCloseFile },
+            { "DFextZipReadCurrentFile",  PlainTest, test_DFextZipReadCurrentFile },
             { "DFextZipWriteCurrentFile", PlainTest, test_DFextZipWriteCurrentFile },
-            { NULL, PlainTest, NULL }
+            { NULL,                       PlainTest, NULL }
     }
 };


Mime
View raw message