Fossil SCM

When generating ZIP archives, files with zero bytes are 'Stored', not 'Deflated'.

mistachkin 2016-01-07 18:22 trunk
Commit ecedaf93991c66a4a9d311f0f97a62253f51a7be
1 file changed +1 -1
+1 -1
--- src/zip.c
+++ src/zip.c
@@ -143,11 +143,11 @@
143143
144144
/* Fill in as much of the header as we know.
145145
*/
146146
nBlob = pFile ? blob_size(pFile) : 0;
147147
if( pFile ){ /* This is a file, possibly empty... */
148
- iMethod = 8;
148
+ iMethod = (nBlob>0) ? 8 : 0; /* Cannot compress zero bytes. */
149149
switch( mPerm ){
150150
case PERM_LNK: iMode = 0120755; break;
151151
case PERM_EXE: iMode = 0100755; break;
152152
default: iMode = 0100644; break;
153153
}
154154
--- src/zip.c
+++ src/zip.c
@@ -143,11 +143,11 @@
143
144 /* Fill in as much of the header as we know.
145 */
146 nBlob = pFile ? blob_size(pFile) : 0;
147 if( pFile ){ /* This is a file, possibly empty... */
148 iMethod = 8;
149 switch( mPerm ){
150 case PERM_LNK: iMode = 0120755; break;
151 case PERM_EXE: iMode = 0100755; break;
152 default: iMode = 0100644; break;
153 }
154
--- src/zip.c
+++ src/zip.c
@@ -143,11 +143,11 @@
143
144 /* Fill in as much of the header as we know.
145 */
146 nBlob = pFile ? blob_size(pFile) : 0;
147 if( pFile ){ /* This is a file, possibly empty... */
148 iMethod = (nBlob>0) ? 8 : 0; /* Cannot compress zero bytes. */
149 switch( mPerm ){
150 case PERM_LNK: iMode = 0120755; break;
151 case PERM_EXE: iMode = 0100755; break;
152 default: iMode = 0100644; break;
153 }
154

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button