Commit 85fe15bb authored by Tim Peters's avatar Tim Peters

Get rid of all code defining or referencing t32.

Such code never made sense; it was all of the form

    t32 = 1L << 32
    if something < 0:
        something = t32 - something

which is a way to change negative integers into
gigantic positive integers greater than 4 billion, and
never made sense in context.  Possibly

        something = t32 + something

was intended, but that never made sense in context either.

In any case, `something` is invariably obtained from
struct.unpack using the "H" format code, and that never
returns a negative integer to begin with.
parent 28c6dd29
......@@ -42,8 +42,6 @@ from ZODB.FileStorage.format \
from ZODB.loglevels import BLATHER
from ZODB.fsIndex import fsIndex
t32 = 1L << 32
packed_version = "FS21"
logger = logging.getLogger('ZODB.FileStorage')
......@@ -1653,8 +1651,6 @@ def read_index(file, name, index, vindex, tindex, stop='\377'*8,
break
tid, tl, status, ul, dl, el = unpack(TRANS_HDR, h)
if el < 0:
el = t32 - el
if tid <= ltid:
logger.warning("%s time-stamp reduction at %s", name, pos)
......
......@@ -127,7 +127,7 @@ import struct
import logging
from ZODB.POSException import POSKeyError
from ZODB.utils import u64, oid_repr, t32
from ZODB.utils import u64, oid_repr
class CorruptedError(Exception):
......@@ -342,8 +342,7 @@ class TxnHeader(object):
self.ulen = ulen
self.dlen = dlen
self.elen = elen
if elen < 0:
self.elen = t32 - elen
assert elen >= 0
def asString(self):
s = struct.pack(TRANS_HDR, self.tid, self.tlen, self.status,
......
......@@ -81,7 +81,7 @@ except ImportError:
import ZODB
import ZODB.FileStorage
from ZODB.utils import t32, u64
from ZODB.utils import u64
from ZODB.FileStorage import RecordIterator
from persistent.TimeStamp import TimeStamp
......@@ -108,8 +108,6 @@ def read_txn_header(f, pos, file_size, outp, ltid):
raise EOFError
tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h)
if el < 0: el=t32-el
tl = u64(stl)
if pos + (tl + 8) > file_size:
......
......@@ -25,7 +25,6 @@ import warnings
from persistent.TimeStamp import TimeStamp
__all__ = ['z64',
't32',
'p64',
'u64',
'U64',
......@@ -61,16 +60,6 @@ def deprecated36(msg):
z64 = '\0'*8
# TODO The purpose of t32 is unclear. Code that uses it is usually
# of the form:
#
# if e < 0:
# e = t32 - e
#
# Doesn't make sense (since e is negative, it creates a number larger than
# t32). If users said "e += t32", *maybe* it would make sense.
t32 = 1L << 32
assert sys.hexversion >= 0x02030000
# The distinction between ints and longs is blurred in Python 2.2,
......
......@@ -117,8 +117,6 @@ def check_trec(path, file, pos, ltid, file_size):
raise FormatError("%s truncated at %s" % (path, pos))
tid, stl, status, ul, dl, el = struct.unpack(">8s8scHHH", h)
if el < 0:
el = t32 - el
tmeta_len = TREC_HDR_LEN + ul + dl + el
if tid <= ltid:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment