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:11:52 UTC

incubator-corinthia git commit: corrected microsoft word zip error

Repository: incubator-corinthia
Updated Branches:
  refs/heads/master c65bf6cea -> 63cd96d28


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/63cd96d2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/63cd96d2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/63cd96d2

Branch: refs/heads/master
Commit: 63cd96d2858b81dcca78520f19a842bd6feff186
Parents: c65bf6c
Author: jani <ja...@apache.org>
Authored: Sun Aug 16 19:11:37 2015 +0200
Committer: jani <ja...@apache.org>
Committed: Sun Aug 16 19:11:37 2015 +0200

----------------------------------------------------------------------
 DocFormats/platform/src/README.txt    |  4 ++--
 DocFormats/platform/src/Wrapper_zip.c | 27 ++++++++++++++-------------
 2 files changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/63cd96d2/DocFormats/platform/src/README.txt
----------------------------------------------------------------------
diff --git a/DocFormats/platform/src/README.txt b/DocFormats/platform/src/README.txt
index 4b0839c..2f1bef1 100644
--- a/DocFormats/platform/src/README.txt
+++ b/DocFormats/platform/src/README.txt
@@ -4,7 +4,7 @@ Reference: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
 
 
 "version made by" (2 bytes)
-    Fixed set to 0x2D
+    Fixed set to 0x0
 
     Upper byte mapping:
          0 - MS-DOS and OS/2 (FAT / VFAT / FAT32 file systems)
@@ -55,7 +55,7 @@ Reference: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
 
 "general purpose bit flag" (2 bytes)
 
-   Fixed set to 0x06
+   Fixed set to 0x00
 
 
    Bit 0: If set, indicates that the file is encrypted.

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/63cd96d2/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;