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/08/01 21:52:55 UTC
[2/2] 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/71296b80
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/71296b80
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/71296b80
Branch: refs/heads/newZipExperiment2
Commit: 71296b80d248cf46e9e5610deb37dcbf39ee492a
Parents: 3af27c1
Author: jani <ja...@apache.org>
Authored: Sat Aug 1 21:52:34 2015 +0200
Committer: jani <ja...@apache.org>
Committed: Sat Aug 1 21:52:34 2015 +0200
----------------------------------------------------------------------
DocFormats/platform/src/Wrapper_zip.c | 2 +-
DocFormats/platform/tests/WrapperTests.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/71296b80/DocFormats/platform/src/Wrapper_zip.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/src/Wrapper_zip.c b/DocFormats/platform/src/Wrapper_zip.c
index ab6f8ee..cccc75f 100644
--- a/DocFormats/platform/src/Wrapper_zip.c
+++ b/DocFormats/platform/src/Wrapper_zip.c
@@ -217,7 +217,7 @@ unsigned char *DFextZipReadFile(DFextZipHandleP zipHandle, DFextZipDirEntryP zip
// interesting a zip file that is uncompressed, have to handle that
if (zipEntry->compressionMethod == 0
- && (fread(fileBuf, 1, zipEntry->uncompressedSize, zipHandle->zipFile) < zipEntry->uncompressedSize
+ && (fread(fileBuf, 1, zipEntry->uncompressedSize, zipHandle->zipFile) < (unsigned long)zipEntry->uncompressedSize
|| ferror(zipHandle->zipFile))) {
free(fileBuf);
return NULL;
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/71296b80/DocFormats/platform/tests/WrapperTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/tests/WrapperTests.c b/DocFormats/platform/tests/WrapperTests.c
index fcf5979..81dab7a 100644
--- a/DocFormats/platform/tests/WrapperTests.c
+++ b/DocFormats/platform/tests/WrapperTests.c
@@ -27,12 +27,31 @@ static void test_DFextZipOpen(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) name(%s)\n", i, zip->zipFileEntries[i].fileName);
+ sprintf(tmpName, "docx_%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);
+ sprintf(tmpName, "odt_%d.xxx", i);
+ dmp = fopen(tmpName, "wb");
+ fwrite(fileBuf, 1, zip->zipFileEntries[i].uncompressedSize, dmp);
+ fclose(dmp);
+ }
+ fclose(log);
}