Corrected microsoft word zip error
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 writeGlobalDirAndEndRecord(DFextZipHandleP zipHandle) {
- static const char comment[] = "generated by Corinthia";
ZipDirectoryRecord dirRecord;
ZipEndRecord endRecord;
int i;
@@ -188,17 +187,19 @@
// 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 @@
// and finally the end record
fwrite(&endRecord, 1, sizeof(ZipEndRecord), zipHandle->zipFile);
- fwrite(comment, 1, sizeof(comment), zipHandle->zipFile);
}
@@ -352,7 +352,7 @@
// 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 @@
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;