[Python-checkins] python/dist/src/Lib zipfile.py,1.31,1.31.8.1

bcannon at users.sourceforge.net bcannon at users.sourceforge.net
Sat Jul 10 21:19:06 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15190/Lib

Modified Files:
      Tag: release23-maint
	zipfile.py 
Log Message:
zipfile now handles file sizes over 2 GB.  Was incorrectly storing file sizes
as signed when the ZIP spec says they should be stored as unsigned.

Closes bug #679953.


Index: zipfile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v
retrieving revision 1.31
retrieving revision 1.31.8.1
diff -C2 -d -r1.31 -r1.31.8.1
*** zipfile.py	27 Jun 2003 22:25:03 -0000	1.31
--- zipfile.py	10 Jul 2004 19:19:03 -0000	1.31.8.1
***************
*** 24,30 ****
  structEndArchive = "<4s4H2lH"     # 9 items, end of archive, 22 bytes
  stringEndArchive = "PK\005\006"   # magic number for end of archive record
! structCentralDir = "<4s4B4H3l5HLl"# 19 items, central directory, 46 bytes
  stringCentralDir = "PK\001\002"   # magic number for central directory
! structFileHeader = "<4s2B4H3l2H"  # 12 items, file header record, 30 bytes
  stringFileHeader = "PK\003\004"   # magic number for file header
  
--- 24,30 ----
  structEndArchive = "<4s4H2lH"     # 9 items, end of archive, 22 bytes
  stringEndArchive = "PK\005\006"   # magic number for end of archive record
! structCentralDir = "<4s4B4HlLL5HLl"# 19 items, central directory, 46 bytes
  stringCentralDir = "PK\001\002"   # magic number for central directory
! structFileHeader = "<4s2B4HlLL2H"  # 12 items, file header record, 30 bytes
  stringFileHeader = "PK\003\004"   # magic number for file header
  
***************
*** 440,444 ****
          position = self.fp.tell()       # Preserve current position in file
          self.fp.seek(zinfo.header_offset + 14, 0)
!         self.fp.write(struct.pack("<lll", zinfo.CRC, zinfo.compress_size,
                zinfo.file_size))
          self.fp.seek(position, 0)
--- 440,444 ----
          position = self.fp.tell()       # Preserve current position in file
          self.fp.seek(zinfo.header_offset + 14, 0)
!         self.fp.write(struct.pack("<lLL", zinfo.CRC, zinfo.compress_size,
                zinfo.file_size))
          self.fp.seek(position, 0)
***************
*** 472,476 ****
          if zinfo.flag_bits & 0x08:
              # Write CRC and file sizes after the file data
!             self.fp.write(struct.pack("<lll", zinfo.CRC, zinfo.compress_size,
                    zinfo.file_size))
          self.filelist.append(zinfo)
--- 472,476 ----
          if zinfo.flag_bits & 0x08:
              # Write CRC and file sizes after the file data
!             self.fp.write(struct.pack("<lLL", zinfo.CRC, zinfo.compress_size,
                    zinfo.file_size))
          self.filelist.append(zinfo)



More information about the Python-checkins mailing list