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/02 09:13:33 UTC
incubator-corinthia git commit: I hate NULL pointers
Repository: incubator-corinthia
Updated Branches:
refs/heads/newZipExperiment2 71296b80d -> 9e243f2cd
I hate NULL pointers
Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/9e243f2c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/9e243f2c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/9e243f2c
Branch: refs/heads/newZipExperiment2
Commit: 9e243f2cdd68a66d29be796c85fea640a02355ca
Parents: 71296b8
Author: jani <ja...@apache.org>
Authored: Sat Aug 1 21:54:40 2015 +0200
Committer: jani <ja...@apache.org>
Committed: Sat Aug 1 21:54:40 2015 +0200
----------------------------------------------------------------------
DocFormats/platform/tests/WrapperTests.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/9e243f2c/DocFormats/platform/tests/WrapperTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/tests/WrapperTests.c b/DocFormats/platform/tests/WrapperTests.c
index 81dab7a..213e0b9 100644
--- a/DocFormats/platform/tests/WrapperTests.c
+++ b/DocFormats/platform/tests/WrapperTests.c
@@ -35,10 +35,12 @@ static void test_DFextZipOpen(void)
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);
+ 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");
@@ -46,10 +48,12 @@ static void test_DFextZipOpen(void)
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);
+ if (fileBuf) {
+ sprintf(tmpName, "odt_%d.xxx", i);
+ dmp = fopen(tmpName, "wb");
+ fwrite(fileBuf, 1, zip->zipFileEntries[i].uncompressedSize, dmp);
+ fclose(dmp);
+ }
}
fclose(log);
}