Fix issue with xgzarc compression fields in Zlib file archive record
authorMichael Petch <mpetch@capp-sysware.com>
Tue, 21 Jan 2014 17:40:05 +0000 (10:40 -0700)
committerMichael Petch <mpetch@capp-sysware.com>
Tue, 21 Jan 2014 17:40:05 +0000 (10:40 -0700)
xgzarc.py

index 780c4a4..985a858 100644 (file)
--- a/xgzarc.py
+++ b/xgzarc.py
@@ -98,7 +98,7 @@ class FileRecord(dict):
         return self[key]
 
     def fromstream(self, stream):
-        unpacked_data = _struct.unpack('<256B256BllllxBxB',
+        unpacked_data = _struct.unpack('<256B256BllllBBxx',
                                        stream.read(self.SIZEOFREC))
         self.name = _xgutils.delphishortstrtostr(unpacked_data[0:256])
         self.path = _xgutils.delphishortstrtostr(unpacked_data[256:512])
@@ -106,7 +106,7 @@ class FileRecord(dict):
         self.csize = unpacked_data[513]
         self.start = unpacked_data[514]
         self.crc = unpacked_data[515] & 0xffffffff
-        self.compressed = bool(unpacked_data[516] == 2)
+        self.compressed = bool(unpacked_data[516] == 0)
         self.compressionlevel = unpacked_data[517]
 
     def __str__(self):