[Zope-Checkins] CVS: Zope/lib/python/OFS - Image.py:1.134.12.4
Martijn Pieters
mj@zope.com
Wed, 13 Nov 2002 14:19:57 -0500
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv24412/lib/python/OFS
Modified Files:
Tag: Zope-2_5-branch
Image.py
Log Message:
Backport of fix for #671; pdata chains have remaining size at the start, not
the end.
=== Zope/lib/python/OFS/Image.py 1.134.12.3 => 1.134.12.4 ===
--- Zope/lib/python/OFS/Image.py:1.134.12.3 Wed Aug 21 16:51:17 2002
+++ Zope/lib/python/OFS/Image.py Wed Nov 13 14:19:57 2002
@@ -321,7 +321,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]