From: Barry Warsaw Date: Thu, 31 Aug 2000 23:28:52 +0000 (+0000) Subject: GNUTranslations._parse(): Fix portability problems on 64-bit machines X-Git-Tag: v2.0b1~114 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9a2d9d7f04f2ed08574c670bb5ee8ead2a4048ce;p=python GNUTranslations._parse(): Fix portability problems on 64-bit machines by masking all unsigned integers with 0xffffffff. --- diff --git a/Lib/gettext.py b/Lib/gettext.py index c2a549ff68..f5190a3ba6 100644 --- a/Lib/gettext.py +++ b/Lib/gettext.py @@ -129,14 +129,18 @@ class GNUTranslations(NullTranslations): def _parse(self, fp): """Override this method to support alternative .mo formats.""" + # We need to & all 32 bit unsigned integers with 0xffffff for + # portability to 64 bit machines. + MASK = 0xffffffff unpack = struct.unpack filename = getattr(fp, 'name', '') # Parse the .mo file header, which consists of 5 little endian 32 # bit words. self._catalog = catalog = {} buf = fp.read() + buflen = len(buf) # Are we big endian or little endian? - magic = unpack('