[Python-checkins] r68700 - in python/branches/py3k: Lib/zipfile.py

amaury.forgeotdarc python-checkins at python.org
Sun Jan 18 01:29:03 CET 2009


Author: amaury.forgeotdarc
Date: Sun Jan 18 01:29:02 2009
New Revision: 68700
Log:
Merged revisions 68678 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk
........
 r68678 | amaury.forgeotdarc | 2009年01月17日 23:43:50 +0100 (2009年1月17日) | 3 lines
 
 follow-up of #3997: since 0xFFFF numbers are not enough to indicate a zip64 format,
 always try to read the "zip64 end of directory structure".
........
Modified:
 python/branches/py3k/ (props changed)
 python/branches/py3k/Lib/zipfile.py
Modified: python/branches/py3k/Lib/zipfile.py
==============================================================================
--- python/branches/py3k/Lib/zipfile.py	(original)
+++ python/branches/py3k/Lib/zipfile.py	Sun Jan 18 01:29:02 2009
@@ -210,13 +210,9 @@
 # Append a blank comment and record start offset
 endrec.append(b"")
 endrec.append(filesize - sizeEndCentDir)
- if endrec[_ECD_OFFSET] == 0xffffffff:
- # the value for the "offset of the start of the central directory"
- # indicates that there is a "Zip64 end of central directory"
- # structure present, so go look for it
- return _EndRecData64(fpin, -sizeEndCentDir, endrec)
 
- return endrec
+ # Try to read the "Zip64 end of central directory" structure
+ return _EndRecData64(fpin, -sizeEndCentDir, endrec)
 
 # Either this is not a ZIP file, or it is a ZIP file with an archive
 # comment. Search the end of the file for the "end of central directory"
@@ -237,11 +233,10 @@
 # Append the archive comment and start offset
 endrec.append(comment)
 endrec.append(maxCommentStart + start)
- if endrec[_ECD_OFFSET] == 0xffffffff:
- # There is apparently a "Zip64 end of central directory"
- # structure present, so go look for it
- return _EndRecData64(fpin, start - filesize, endrec)
- return endrec
+
+ # Try to read the "Zip64 end of central directory" structure
+ return _EndRecData64(fpin, maxCommentStart + start - filesize,
+ endrec)
 
 # Unable to find a valid end of central directory structure
 return


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /