Code drop from //branches/cupcake/...@124589

This commit is contained in:
The Android Open Source Project
2008-12-17 18:03:49 -08:00
parent d3aa4000e4
commit dcc08f073b
110 changed files with 3320 additions and 610634 deletions

View File

@@ -520,7 +520,11 @@ def DownloadDirectoryHierarchy(ep, src, dest, timeout=0):
buf.fromfile(ep.stdout, 4)
(adler32,) = struct.unpack('>i', buf) # adler32 wants a signed int ('i')
data_adler32 = zlib.adler32(data)
if adler32 != data_adler32:
# Because of a difference in behavior of zlib.adler32 on 32-bit and 64-bit
# systems (one returns signed values, the other unsigned), we take the
# modulo 2**32 of the checksums, and compare those.
# See also http://bugs.python.org/issue1202
if (adler32 % (2**32)) != (data_adler32 % (2**32)):
Trace('adler32 does not match: calculated 0x%08x != expected 0x%08x' %
(data_adler32, adler32))
return False