corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject incubator-corinthia git commit: test cases ready, hunting last errors
Date Tue, 04 Aug 2015 15:01:14 GMT
Repository: incubator-corinthia
Updated Branches:
  refs/heads/newZipExperiment2 6451ac0fe -> 7dea936f3


test cases ready, hunting last errors


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

Branch: refs/heads/newZipExperiment2
Commit: 7dea936f311b6a93a6752e62e3252a1465eb3a56
Parents: 6451ac0
Author: jani <jani@apache.org>
Authored: Tue Aug 4 17:00:58 2015 +0200
Committer: jani <jani@apache.org>
Committed: Tue Aug 4 17:00:58 2015 +0200

----------------------------------------------------------------------
 DocFormats/headers/DFPlatform.h          |   2 +-
 DocFormats/platform/src/Wrapper_zip.c    |  26 ++-
 DocFormats/platform/tests/WrapperTests.c | 260 ++++----------------------
 DocFormats/platform/tests/test.docx      | Bin 0 -> 12833 bytes
 DocFormats/platform/tests/test.odt       | Bin 0 -> 15446 bytes
 5 files changed, 57 insertions(+), 231 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/7dea936f/DocFormats/headers/DFPlatform.h
----------------------------------------------------------------------
diff --git a/DocFormats/headers/DFPlatform.h b/DocFormats/headers/DFPlatform.h
index fb5f55f..0a29712 100644
--- a/DocFormats/headers/DFPlatform.h
+++ b/DocFormats/headers/DFPlatform.h
@@ -92,7 +92,7 @@ DFextZipHandleP DFextZipCreate(const char *zipFilename);
 unsigned char     *DFextZipReadFile(DFextZipHandleP zipHandle, DFextZipDirEntryP zipEntry);
 DFextZipDirEntryP  DFextZipWriteFile(DFextZipHandleP zipHandle, const char *fileName, const
void *buf, const int len);
 
-int DFextZipClose(DFextZipHandleP zipHandle);
+void DFextZipClose(DFextZipHandleP zipHandle);
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/7dea936f/DocFormats/platform/src/Wrapper_zip.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/src/Wrapper_zip.c b/DocFormats/platform/src/Wrapper_zip.c
index adc9b47..18b6e64 100644
--- a/DocFormats/platform/src/Wrapper_zip.c
+++ b/DocFormats/platform/src/Wrapper_zip.c
@@ -180,8 +180,8 @@ static void releaseMemory(DFextZipHandleP zipHandle) {
 		int count = zipHandle->zipCreateMode ? zipHandle->zipCreateMode : zipHandle->zipFileCount;
 		if (count) {
 			for (int i = 0; i < count; i++) {
-				DFextZipDirEntry *zipDirEntry = zipHandle->zipFileEntries + (i * sizeof(zipDirEntry));
-				if (zipDirEntry->fileName)
+				DFextZipDirEntry *zipDirEntry = &zipHandle->zipFileEntries[i];
+				if (zipDirEntry->fileName != NULL)
 					free(zipDirEntry->fileName);
 			}
 			free(zipHandle->zipFileEntries);
@@ -236,7 +236,7 @@ DFextZipHandleP DFextZipOpen(const char *zipFilename) {
     DFextZipHandleP zipHandle = xmalloc(sizeof(DFextZipHandle));
 
 	// open zip file for reading
-	zipHandle->zipCreateMode = 0;
+	zipHandle->zipCreateMode = zipHandle->zipFileCount = 0;
 	zipHandle->zipFile       = fopen(zipFilename, "rb");
 	if (zipHandle->zipFile
 		&& !readDirectory(zipHandle->zipFile, zipHandle))
@@ -318,7 +318,7 @@ unsigned char *DFextZipReadFile(DFextZipHandleP zipHandle, DFextZipDirEntryP
zip
 
 DFextZipHandleP DFextZipCreate(const char *zipFilename) {
 	DFextZipHandleP zipHandle = xmalloc(sizeof(DFextZipHandle));
-
+	int             memSize;
 	// Open file for write
 	if ((zipHandle->zipFile = fopen(zipFilename, "wb")) == NULL) {
 		free(zipHandle);
@@ -326,7 +326,12 @@ DFextZipHandleP DFextZipCreate(const char *zipFilename) {
 	}
 
 	// prepare to add files
-	zipHandle->zipFileCount = 0;
+	zipHandle->zipFileCount   = 0;
+	zipHandle->zipCreateMode  = FILECOUNT_ALLOC_SIZE;
+	memSize                   = zipHandle->zipCreateMode * sizeof(DFextZipDirEntry);
+
+	zipHandle->zipFileEntries = xmalloc(memSize);
+	bzero(zipHandle->zipFileEntries, memSize);
 	return zipHandle;
 }
 
@@ -341,7 +346,8 @@ DFextZipDirEntryP DFextZipWriteFile(DFextZipHandleP zipHandle, const char
*fileN
 	// do we have space for one more entry ?
 	if (zipHandle->zipFileCount >= zipHandle->zipCreateMode) {
 		zipHandle->zipCreateMode += FILECOUNT_ALLOC_SIZE;
-		zipHandle->zipFileEntries = xrealloc(zipHandle->zipFileEntries, zipHandle->zipCreateMode
* sizeof(DFextZipDirEntryP));
+		zipHandle->zipFileEntries = xrealloc(zipHandle->zipFileEntries, zipHandle->zipCreateMode
* sizeof(DFextZipDirEntry));
+		bzero(&zipHandle->zipFileEntries[zipHandle->zipFileCount], FILECOUNT_ALLOC_SIZE
* sizeof(DFextZipDirEntry));
 	}
 
 	// prepare local and global file entry
@@ -376,8 +382,9 @@ DFextZipDirEntryP DFextZipWriteFile(DFextZipHandleP zipHandle, const char
*fileN
 	header.fileNameLength         = fileNameLength;
 
 	// put data to file
-	fwrite(&header, 1, sizeof(header), zipHandle->zipFile);
-	fwrite(entryPtr->fileName, 1, fileNameLength, zipHandle->zipFile);
+	fwrite(&header,            1, sizeof(header),        zipHandle->zipFile);
+	fwrite(entryPtr->fileName, 1, fileNameLength,        zipHandle->zipFile);
+	fwrite(outbuf,             1, header.compressedSize, zipHandle->zipFile);
 
 	// cleanup
 	free(outbuf);
@@ -387,12 +394,11 @@ DFextZipDirEntryP DFextZipWriteFile(DFextZipHandleP zipHandle, const
char *fileN
 
 
 
-int DFextZipClose(DFextZipHandleP zipHandle)
+void DFextZipClose(DFextZipHandleP zipHandle)
 {
 	if (zipHandle->zipFileCount)
 		writeGlobalDirAndEndRecord(zipHandle);
 
 	fclose(zipHandle->zipFile);
 	releaseMemory(zipHandle);
-	return 0;
 }

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/7dea936f/DocFormats/platform/tests/WrapperTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/tests/WrapperTests.c b/DocFormats/platform/tests/WrapperTests.c
index cacfa1b..5a46786 100644
--- a/DocFormats/platform/tests/WrapperTests.c
+++ b/DocFormats/platform/tests/WrapperTests.c
@@ -1,4 +1,4 @@
-// Licensed to the Apache Software Foundation (ASF) under one
+// Licensed to the Apache Software Foundation (ASF) under one
 // or more contributor license agreements.  See the NOTICE file
 // distributed with this work for additional information
 // regarding copyright ownership.  The ASF licenses this file
@@ -15,250 +15,70 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <string.h>
+#include <stdlib.h>
 #include <stddef.h>
 #include <stdio.h>
 #include "DFUnitTest.h"
 #include "DFPlatform.h"
 
 
-static const char * const zipNames1[] = {
-	"[Content_Types].xml",
-	"_rels / .rels",
-	"word / _rels / document.xml.rels",
-	"word / document.xml",
-	"word / theme / theme1.xml",
-	"word / settings.xml",
-	"word / fontTable.xml",
-	"word / webSettings.xml",
-	"docProps / app.xml",
-	"docProps / core.xml",
-	"word / styles.xml",
-	""
-};
-static const char * const zipNames2[] = {
-	"mimetype",
-	"Configurations2 / statusbar / ",
-	"Configurations2 / accelerator / current.xml",
-	"Configurations2 / floater / ",
-	"Configurations2 / popupmenu / ",
-	"Configurations2 / progressbar / ",
-	"Configurations2 / menubar / ",
-	"Configurations2 / toolbar / ",
-	"Configurations2 / images / Bitmaps / ",
-	"content.xml",
-	"styles.xml",
-	"meta.xml",
-	"Thumbnails / thumbnail.png",
-	"settings.xml",
-	"META - INF / manifest.xml"
-	""
-};
-
-static const char * const zipFiles1[] = {
-	/* file 1 "[Content_Types].xml" */
-	"< ? xml version = \"1.0\" encoding = \"UTF-8\" standalone = \"yes\" ? >\n"
-	"<Types xmlns = \"http://schemas.openxmlformats.org/package/2006/content-types\"><Default
Extension = \"rels\" ContentType = \"application"
-	"/vnd.openxmlformats-package.relationships+xml\" / ><Default Extension = \"xml\" ContentType
= \"application/xml\" / ><Override PartName ="
-	" \"/word/document.xml\" ContentType = \"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml\"
/ ><Override P"
-	"artName = \"/word/styles.xml\" ContentType = \"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml\"
/ ><Override P"
-	"artName = \"/word/settings.xml\" ContentType = \"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml\"
/ ><Overri"
-	"de PartName = \"/word/webSettings.xml\" ContentType = \"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml\"
"
-	"/ ><Override PartName = \"/word/fontTable.xml\" ContentType = \"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+"
-	"xml\" / ><Override PartName = \"/word/theme/theme1.xml\" ContentType = \"application/vnd.openxmlformats-officedocument.theme+xml\"
/ ><Ov"
-	"erride PartName = \"/docProps/core.xml\" ContentType = \"application/vnd.openxmlformats-package.core-properties+xml\"
/ ><Override PartNa"
-	"me = \"/docProps/app.xml\" ContentType = \"application/vnd.openxmlformats-officedocument.extended-properties+xml\"
/ >< / Types>",
-
-	/* file 2 "_rels / .rels" */
-	"< ? xml version = \"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
-	"<Relationships xmlns = \"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship
Id=\"rId3\" Type=\"http://schemas.o"
-	"penxmlformats.org/officeDocument/2006/relationships/extended-properties\" Target=\"docProps/app.xml\"/><Relationship
Id=\"rId2\" Type=\"h"
-	"ttp://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\"
Target=\"docProps/core.xml\"/><Relationship Id=\"r"
-	"Id1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\"
Target=\"word/document.xml\"/></Relatio"
-	"nships>", 
-
-	/* file 3 "word / _rels / document.xml.rels" */
-	"< ? xml version = \"1.0\" encoding = \"UTF-8\" standalone = \"yes\" ? >\n"
-	"<Relationships xmlns = \"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship
Id = \"rId3\" Type = \"http://schem"
-	"as.openxmlformats.org/officeDocument/2006/relationships/webSettings\" Target = \"webSettings.xml\"
/ ><Relationship Id = \"rId2\" Type = "
-	"\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings\" Target
= \"settings.xml\" / ><Relationship Id = \"rId1\""
-	" Type = \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\"
Target = \"styles.xml\" / ><Relationship Id = \"rI"
-	"d5\" Type = \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\"
Target = \"theme/theme1.xml\" / ><Relationship "
-	"Id = \"rId4\" Type = \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable\"
Target = \"fontTable.xml\" / >< / "
-	"Relationships>",
-	
-	/* file 4 "word / document.xml" */
-	"< ? xml version = \"1.0\" encoding = \"UTF-8\" standalone = \"yes\" ? >\n"
-	"<w:document xmlns : wpc = \"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\"
xmlns : mc = \"http://schemas.openxmlfor"
-	"mats.org/markup-compatibility/2006\" xmlns : o = \"urn:schemas-microsoft-com:office:office\"
xmlns : r = \"http://schemas.openxmlformats."
-	"org/officeDocument/2006/relationships\" xmlns : m = \"http://schemas.openxmlformats.org/officeDocument/2006/math\"
xmlns : v = \"urn:sche"
-	"mas-microsoft-com:vml\" xmlns : wp14 = \"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\"
xmlns : wp = \"http://sche"
-	"mas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns : w10 = \"urn:schemas-microsoft-com:office:word\"
xmlns : w = \"http:"
-	"//schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns : w14 = \"http://schemas.microsoft.com/office/word/2010/wordml\"
xmlns : "
-	"w15 = \"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns : wpg = \"http://schemas.microsoft.com/office/word/2010/wordprocessi"
-	"ngGroup\" xmlns : wpi = \"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\"
xmlns : wne = \"http://schemas.microsoft.com/"
-	"office/word/2006/wordml\" xmlns : wps = \"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\"
mc : Ignorable = \"w14 w15 "
-	"wp14\"><w:body><w:p w : rsidR = \"00932A4D\" w : rsidRDefault = \"00932A4D\"><w:pPr><w:rPr><w:noProof
/ >< / w:rPr>< / w:pPr><w:r><w:rPr>"
-	"<w:noProof / >< / w:rPr><w:t xml : space = \"preserve\">Lorem ipsum dolor
sit amet, consectetuer adipiscing elit. < / w:t>< / w:r><w:r w "
-	": rsidRPr = \"00932A4D\"><w:rPr><w:noProof / ><w:lang w : val = \"es-ES\"
/ >< / w:rPr><w:t xml : space = \"preserve\">Maecenas porttitor"
-	" congue massa.Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero,
sit amet commodo magna eros quis urna.Nunc vive"
-	"rra imperdiet enim.Fusce est.Vivamus a tellus.Pellentesque habitant morbi tristique senectus
et netus et malesuada fames ac turpis egesta"
-	"s. < / w:t>< / w:r><w:r><w:rPr><w:noProof / >< / w:rPr><w:t>Proin
pharetra nonummy pede.Mauris et orci.Aenean nec lorem.< / w:t>< / w:r><"
-	" / w:p><w:p w : rsidR = \"00932A4D\" w : rsidRDefault = \"00932A4D\"><w:pPr><w:rPr><w:noProof
/ >< / w:rPr>< / w:pPr><w:r><w:rPr><w:noPro"
-	"of / >< / w:rPr><w:t>In porttitor.Donec laoreet nonummy augue.Suspendisse
dui purus, scelerisque at, vulputate vitae, pretium mattis, nun"
-	"c.Mauris eget neque at sem venenatis eleifend.Ut nonummy.Fusce aliquet pede non pede.Suspendisse
dapibus lorem pellentesque magna.Integer"
-	" nulla.Donec blandit feugiat ligula.Donec hendrerit, felis et imperdiet euismod, purus
ipsum pretium metus, in lacinia nulla nisl eget sa"
-	"pien.< / w:t>< / w:r>< / w:p><w:p w : rsidR = \"00932A4D\" w : rsidRDefault
= \"00932A4D\"><w:pPr><w:rPr><w:noProof / >< / w:rPr>< / w:pP"
-	"r><w:r><w:rPr><w:noProof / >< / w:rPr><w:t xml : space =
\"preserve\">Donec ut est in lectus consequat consequat.Etiam eget dui.Aliquam e"
-	"rat volutpat.Sed at lorem in nunc porta tristique.Proin nec augue. < / w:t>< /
w:r><w:r w : rsidRPr = \"00932A4D\"><w:rPr><w:noProof / ><"
-	"w:lang w : val = \"es-ES\" / >< / w:rPr><w:t xml : space = \"preserve\">Quisque
aliquam tempor magna.Pellentesque habitant morbi tristiqu"
-	"e senectus et netus et malesuada fames ac turpis egestas.Nunc ac magna.Maecenas odio dolor,
vulputate vel, auctor ac, accumsan id, felis."
-	" < / w:t>< / w:r><w:r><w:rPr><w:noProof / >< / w:rPr><w:t>Pellentesque
cursus sagittis felis.< / w:t>< / w:r>< / w:p><w:p w : rsidR = \"0"
-	"0932A4D\" w : rsidRDefault = \"00932A4D\"><w:pPr><w:rPr><w:noProof /
>< / w:rPr>< / w:pPr><w:r w : rsidRPr = \"00932A4D\"><w:rPr><w:noPro"
-	"of / ><w:lang w : val = \"es-ES\" / >< / w:rPr><w:t xml : space = \"preserve\">Pellentesque
porttitor, velit lacinia egestas auctor, diam"
-	" eros tempus arcu, nec vulputate augue magna vel risus.Cras non magna vel ante adipiscing
rhoncus.Vivamus a mi.Morbi neque.Aliquam erat v"
-	"olutpat.Integer ultrices lobortis eros.Pellentesque habitant morbi tristique senectus et
netus et malesuada fames ac turpis egestas.Proin"
-	" semper, ante vitae sollicitudin posuere, metus quam iaculis nibh, vitae scelerisque nunc
massa eget pede.Sed velit urna, interdum vel, u"
-	"ltricies vel, faucibus at, quam. < / w:t>< / w:r><w:r><w:rPr><w:noProof
/ >< / w:rPr><w:t>Donec elit est, consectetuer eget, consequat qu"
-	"is, tempus quis, wisi.< / w:t>< / w:r>< / w:p><w:p w : rsidR = \"00932A4D\"
w : rsidRDefault = \"00932A4D\"><w:pPr><w:rPr><w:noProof / ><"
-	"/ w:rPr>< / w:pPr><w:r><w:rPr><w:noProof / >< / w:rPr><w:t>In
in nunc.Class aptent taciti sociosqu ad litora torquent per conubia nostra,"
-	" per inceptos hymenaeos.Donec ullamcorper fringilla eros.Fusce in sapien eu purus dapibus
commodo.Cum sociis natoque penatibus et magnis "
-	"dis parturient montes, nascetur ridiculus mus.Cras faucibus condimentum odio.Sed ac ligula.Aliquam
at eros.Etiam at ligula et tellus ulla"
-	"mcorper ultrices.In fermentum, lorem non cursus porttitor, diam urna accumsan lacus, sed
interdum wisi nibh nec nisl.< / w:t>< / w:r>< / "
-	"w:p><w:p w : rsidR = \"00932A4D\" w : rsidRPr = \"00932A4D\" w : rsidRDefault = \"00932A4D\"><w:pPr><w:rPr><w:noProof
/ ><w:lang w : val "
-	"= \"es-ES\" / >< / w:rPr>< / w:pPr><w:r><w:rPr><w:noProof
/ >< / w:rPr><w:t xml : space = \"preserve\">Ut tincidunt volutpat urna.Mauris
"
-	"eleifend nulla eget mauris.Sed cursus quam id felis. < / w:t>< / w:r><w:r
w : rsidRPr = \"00932A4D\"><w:rPr><w:noProof / ><w:lang w : val"
-	" = \"es-ES\" / >< / w:rPr><w:t>Curabitur posuere quam vel nibh.Cras dapibus
dapibus nisl.Vestibulum quis dolor a felis congue vehicula.Ma"
-	"ecenas pede purus, tristique ac, tempus eget, egestas quis, mauris.Curabitur non eros.Nullam
hendrerit bibendum justo.Fusce iaculis, est "
-	"quis lacinia pretium, pede metus molestie lacus, at gravida wisi ante at libero.< /
w:t>< / w:r>< / w:p><w:p w : rsidR = \"00932A4D\" w :"
-	" rsidRPr = \"00932A4D\" w : rsidRDefault = \"00932A4D\"><w:pPr><w:rPr><w:noProof
/ ><w:lang w : val = \"es-ES\" / >< / w:rPr>< / w:pPr><w"
-	":r w : rsidRPr = \"00932A4D\"><w:rPr><w:noProof / ><w:lang w : val =
\"es-ES\" / >< / w:rPr><w:t>Quisque ornare placerat risus.Ut molesti"
-	"e magna at mi.Integer aliquet mauris et nibh.Ut mattis ligula posuere velit.Nunc sagittis.Curabitur
varius fringilla nisl.Duis pretium mi"
-	" euismod erat.Maecenas id augue.Nam vulputate.Duis a quam non neque lobortis malesuada.<
/ w:t>< / w:r>< / w:p><w:p w : rsidR = \"00932A4"
-	"D\" w : rsidRPr = \"00932A4D\" w : rsidRDefault = \"00932A4D\"><w:pPr><w:rPr><w:noProof
/ ><w:lang w : val = \"es-ES\" / >< / w:rPr>< / w"
-	":pPr><w:r w : rsidRPr = \"00932A4D\"><w:rPr><w:noProof / ><w:lang
w : val = \"es-ES\" / >< / w:rPr><w:t>Praesent euismod.Donec nulla augu"
-	"e, venenatis scelerisque, dapibus a, consequat at, leo.Pellentesque libero lectus, tristique
ac, consectetuer sit amet, imperdiet ut, jus"
-	"to.Sed aliquam odio vitae tortor.Proin hendrerit tempus arcu.In hac habitasse platea dictumst.Suspendisse
potenti.Vivamus vitae massa adi"
-	"piscing est lacinia sodales.Donec metus massa, mollis vel, tempus placerat, vestibulum
condimentum, ligula.Nunc lacus metus, posuere eget"
-	", lacinia eu, varius quis, libero.< / w:t>< / w:r><w:bookmarkStart w : id
= \"0\" w : name = \"_GoBack\" / ><w:bookmarkEnd w : id = \"0\""
-	"/ >< / w:p><w:sectPr w : rsidR = \"00932A4D\" w : rsidRPr = \"00932A4D\"><w:pgSz
w : w = \"12240\" w : h = \"15840\" / ><w:pgMar w : top "
-	"= \"1440\" w : right = \"1440\" w : bottom = \"1440\" w : left = \"1440\" w : header =
\"720\" w : footer = \"720\" w : gutter = \"0\" / "
-	"><w:cols w : space = \"720\" / ><w:docGrid w : linePitch = \"360\" / ><
/ w:sectPr>< / w:body>< / w:document>",
-
-	/* file 5 "word / theme / theme1.xml" */
-
-	
-	/* file 6 "word / settings.xml" */
-
-
-	/* file 7 "word / fontTable.xml" */
-
-
-	/* file 8 "word / webSettings.xml" */
-
-
-	/* file 9 "docProps / app.xml" */
-
-
-	/* file 10 "docProps / core.xml" */
-
-
-	/* file 11 "word / styles.xml" */
-
-
-	/* TERMINATION */
-	""
-};
-static const char * const zipFiles2[] = {
-	/* file 1 "mimetype" */
-
-
-	/* file 2 "Configurations2 / statusbar / " */
-
-
-	/* file 3 "Configurations2 / accelerator / current.xml" */
 
+static void doZip(char *name) {
+	DFextZipHandleP   zip;
+	DFextZipDirEntryP zipDir;
+	int               inp, out;
+	unsigned char    *fileBuf[20];
+	char              fileName[20][200];
+	int               fileLen[20];
+	char              tmpName[100];
 
-	/* file 4 "Configurations2 / floater / " */
 
+	zip = DFextZipOpen(name);
+	utassert((zip != NULL), "cannot open/read zip");
 
-	/* file 5 "Configurations2 / popupmenu / " */
-
-
-	/* file 6 "Configurations2 / progressbar / " */
-
-
-	/* file 7 "Configurations2 / menubar / " */
-
-
-	/* file 8 "Configurations2 / toolbar / " */
-
-
-	/* file 9 "Configurations2 / images / Bitmaps / " */
-
-
-	/* file 10 "content.xml" */
-
-
-	/* file 11 "styles.xml" */
-
-
-	/* file 12 "meta.xml" */
+	for (inp = 0; inp < zip->zipFileCount; inp++) {
+		strcpy(fileName[inp], zip->zipFileEntries[inp].fileName);
+		fileLen[inp] = zip->zipFileEntries[inp].uncompressedSize;
+		fileBuf[inp] = DFextZipReadFile(zip, &zip->zipFileEntries[inp]);
+		utassert((fileBuf[inp] != NULL), "cannot read file in zip");
+	}
+	DFextZipClose(zip);
+	zip = NULL;
 
 
-	/* file 13 "Thumbnails / thumbnail.png" */
+	sprintf(tmpName, "new_%s", name);
+	zip = DFextZipCreate(tmpName);
+	utassert((zip != NULL), "cannot create zip");
 
+	for (out = 0; out < inp; out++) {
+		zipDir = DFextZipWriteFile(zip, fileName[out], fileBuf[out], fileLen[out]);
+		utassert((zipDir != NULL), "cannot write file in zip");
+		free(fileBuf[out]);
+	}
+	DFextZipClose(zip);
+}
 
-	/* file 14 "settings.xml" */
 
 
-	/* file 15 "META - INF / manifest.xml" */
+static void test_DFextZipOOXML(void)
+{
+	doZip("test.docx");
+}
 
-	/* TERMINATION */
-	""
-};
 
 
-static void test_DFextZip(void)
+static void test_DFextZipODF(void)
 {
-	DFextZipHandleP zip;
-	int             i;
-	unsigned char  *fileBuf;
-	char            tmpName[20];
-	FILE           *log, *dmp;
-
-	zip = DFextZipOpen("test.docx");
-	log = fopen("docx_log.txt", "w");
-	for (i = 0; i < zip->zipFileCount; i++) {
-		fileBuf = DFextZipReadFile(zip, &zip->zipFileEntries[i]);
-		fprintf(log, "id(%d) method(%d) name(%s)\n", i, zip->zipFileEntries[i].compressionMethod,
zip->zipFileEntries[i].fileName);
-		if (fileBuf) {
-			sprintf(tmpName, "odt_%d.xxx", i);
-			dmp = fopen(tmpName, "wb");
-			fwrite(fileBuf, 1, zip->zipFileEntries[i].uncompressedSize, dmp);
-			fclose(dmp);
-		}
-	}
-	fclose(log);
-	zip = DFextZipOpen("test.odt");
-	log = fopen("odt_log.txt", "w");
-	for (i = 0; i < zip->zipFileCount; i++) {
-		fileBuf = DFextZipReadFile(zip, &zip->zipFileEntries[i]);
-		fprintf(log, "id(%d) name(%s)\n", i, zip->zipFileEntries[i].fileName);
-		if (fileBuf) {
-			sprintf(tmpName, "odt_%d.xxx", i);
-			dmp = fopen(tmpName, "wb");
-			fwrite(fileBuf, 1, zip->zipFileEntries[i].uncompressedSize, dmp);
-			fclose(dmp);
-		}
-	}
-	fclose(log);
+	doZip("test.odt");
 }
 
 
 
 TestGroup PlatformWrapperTests = {
     "platform.wrapper", {
-		    { "DFextZip", PlainTest, test_DFextZip },
-            { NULL,       PlainTest, NULL          }
+		    { "DFextZipOOXML", PlainTest, test_DFextZipOOXML },
+			{ "DFextZipODF",   PlainTest, test_DFextZipODF },
+			{ NULL,            PlainTest, NULL }
     }
 };

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/7dea936f/DocFormats/platform/tests/test.docx
----------------------------------------------------------------------
diff --git a/DocFormats/platform/tests/test.docx b/DocFormats/platform/tests/test.docx
new file mode 100644
index 0000000..9de8bc3
Binary files /dev/null and b/DocFormats/platform/tests/test.docx differ

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/7dea936f/DocFormats/platform/tests/test.odt
----------------------------------------------------------------------
diff --git a/DocFormats/platform/tests/test.odt b/DocFormats/platform/tests/test.odt
new file mode 100644
index 0000000..53421ff
Binary files /dev/null and b/DocFormats/platform/tests/test.odt differ


Mime
View raw message