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/16 19:14:40 UTC
incubator-corinthia git commit: Corrected microsoft word zip error
Repository: incubator-corinthia
Updated Branches:
refs/heads/Release_0.1 d9694aec0 -> b98137626
Corrected microsoft word zip error
Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/b9813762
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/b9813762
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/b9813762
Branch: refs/heads/Release_0.1
Commit: b9813762678723792d5601668ba0cb47002d58aa
Parents: d9694ae
Author: jani <ja...@apache.org>
Authored: Sun Aug 16 19:14:21 2015 +0200
Committer: jani <ja...@apache.org>
Committed: Sun Aug 16 19:14:21 2015 +0200
----------------------------------------------------------------------
DocFormats/platform/src/Wrapper_zip.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b9813762/DocFormats/platform/src/Wrapper_zip.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/src/Wrapper_zip.c b/DocFormats/platform/src/Wrapper_zip.c
index 90f8d1e..3141a4a 100644
--- a/DocFormats/platform/src/Wrapper_zip.c
+++ b/DocFormats/platform/src/Wrapper_zip.c
@@ -179,7 +179,6 @@ static void releaseMemory(DFextZipHandleP zipHandle) {
static void writeGlobalDirAndEndRecord(DFextZipHandleP zipHandle) {
- static const char comment[] = "generated by Corinthia";
ZipDirectoryRecord dirRecord;
ZipEndRecord endRecord;
int i;
@@ -188,17 +187,19 @@ static void writeGlobalDirAndEndRecord(DFextZipHandleP zipHandle) {
// Prepare constant part of records
endRecord.signature = ZipEndRecord_signature;
endRecord.diskNumber = endRecord.centralDirectoryDiskNumber = endRecord.numEntriesThisDisk = 0;
+ endRecord.numEntriesThisDisk =
endRecord.numEntries = zipHandle->zipFileCount;
endRecord.centralDirectoryOffset = ftell(zipHandle->zipFile);
- endRecord.zipCommentLength = strlen(comment);
+ endRecord.zipCommentLength = 0;
dirRecord.signature = ZipDirectoryRecord_signature;
- dirRecord.versionMadeBy = 0x2D;
- dirRecord.versionNeededToExtract = 0x14;
- dirRecord.lastModFileTime = dirRecord.lastModFileDate =
- dirRecord.crc32 = dirRecord.extraFieldLength = dirRecord.fileCommentLength =
- dirRecord.diskNumberStart = dirRecord.internalFileAttributes = 0;
- dirRecord.generalPurposeBitFlag = 0x0006;
+ dirRecord.versionMadeBy = 0;
+ dirRecord.versionNeededToExtract = 20;
+ dirRecord.lastModFileDate = 32;
+ dirRecord.lastModFileTime = dirRecord.crc32 = dirRecord.extraFieldLength =
+ dirRecord.fileCommentLength = dirRecord.diskNumberStart = 0;
+ dirRecord.internalFileAttributes = 1;
+ dirRecord.generalPurposeBitFlag = 0x0000;
dirRecord.externalFileAttributes = 0;
// loop through all directory entries, write to disk while collecting size
@@ -217,7 +218,6 @@ static void writeGlobalDirAndEndRecord(DFextZipHandleP zipHandle) {
// and finally the end record
fwrite(&endRecord, 1, sizeof(ZipEndRecord), zipHandle->zipFile);
- fwrite(comment, 1, sizeof(comment), zipHandle->zipFile);
}
@@ -352,7 +352,7 @@ DFextZipDirEntryP DFextZipWriteFile(DFextZipHandleP zipHandle, const char *fileN
// prepare to deflate
strm.zalloc = Z_NULL;
strm.zfree = strm.opaque = Z_NULL;
- if (deflateInit2(&strm, Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY) != Z_OK)
+ if (deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY) != Z_OK)
return NULL;
// deflate buffer
@@ -369,9 +369,10 @@ DFextZipDirEntryP DFextZipWriteFile(DFextZipHandleP zipHandle, const char *fileN
entryPtr->compressedSize = strm.total_out;
// prepare local header
- header.versionNeededToExtract = 0x0014;
- header.generalPurposeBitFlag = 0x0006;
- header.lastModFileTime = header.lastModFileDate = header.extraFieldLength = header.crc32 = 0;
+ header.versionNeededToExtract = 20;
+ header.generalPurposeBitFlag = 0;
+ header.lastModFileDate = 32;
+ header.lastModFileTime = header.extraFieldLength = header.crc32 = 0;
header.signature = ZipFileHeader_signature;
header.compressionMethod = entryPtr->compressionMethod;
header.compressedSize = entryPtr->compressedSize;