[Zope-Checkins] CVS: Zope/lib/python/OFS - Image.py:1.143
Martijn Pieters
mj@zope.com
Wed, 13 Nov 2002 14:18:15 -0500
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv23953/lib/python/OFS
Modified Files:
Image.py
Log Message:
Fix for Collector issue #671: PData chains are of equal length, except the
*first* entry (and not the last one as assumed before).
- Adjust test to create a big file that will have a Pdata entry of smaller
size
- Fix pdata_map lookups with first-entry-size in mind.
=== Zope/lib/python/OFS/Image.py 1.142 => 1.143 ===
--- Zope/lib/python/OFS/Image.py:1.142 Fri Oct 4 15:50:34 2002
+++ Zope/lib/python/OFS/Image.py Wed Nov 13 14:17:44 2002
@@ -323,7 +323,13 @@
# calculations allow us to fast-forward through the
# Pdata chain without a lot of dereferencing if we
# did the work already.
- closest_pos = start - (start % (1<<16))
+ first_size = len(pdata_map[0].data)
+ if start < first_size:
+ closest_pos = 0
+ else:
+ closest_pos = (
+ ((start - first_size) >> 16 << 16) +
+ first_size)
pos = min(closest_pos, max(pdata_map.keys()))
data = pdata_map[pos]