gen_updates2.py: consistently specify endianness in struct.unpack formats
* gen_updates2.py (read_revs_dir): Consistently prefix struct.unpack formats with "<" to signify that it is little-endian data. Resolves: #1880064 Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
This commit is contained in:
parent
8c3a1d071c
commit
757b34a754
@ -144,7 +144,7 @@ def read_revs_dir(path, args, src=None, ret=None):
|
|||||||
offs = 0
|
offs = 0
|
||||||
while offs < sz:
|
while offs < sz:
|
||||||
f.seek(offs, os.SEEK_SET)
|
f.seek(offs, os.SEEK_SET)
|
||||||
hdr = struct.unpack("IiIIIIIIIIII", f.read(48))
|
hdr = struct.unpack("<IiIIIIIIIIII", f.read(48))
|
||||||
ret.append({"path": rp, "src": src or path,
|
ret.append({"path": rp, "src": src or path,
|
||||||
"cpuid": hdr[3], "pf": hdr[6], "rev": hdr[1],
|
"cpuid": hdr[3], "pf": hdr[6], "rev": hdr[1],
|
||||||
"date": hdr[2], "offs": offs, "cksum": hdr[4],
|
"date": hdr[2], "offs": offs, "cksum": hdr[4],
|
||||||
@ -152,7 +152,7 @@ def read_revs_dir(path, args, src=None, ret=None):
|
|||||||
|
|
||||||
if hdr[8] and hdr[8] - hdr[7] > 48:
|
if hdr[8] and hdr[8] - hdr[7] > 48:
|
||||||
f.seek(hdr[7], os.SEEK_CUR)
|
f.seek(hdr[7], os.SEEK_CUR)
|
||||||
ext_tbl = struct.unpack("IIIII", f.read(20))
|
ext_tbl = struct.unpack("<IIIII", f.read(20))
|
||||||
log_status("Found %u extended signatures for %s:%#x" %
|
log_status("Found %u extended signatures for %s:%#x" %
|
||||||
(ext_tbl[0], rp, offs), level=1)
|
(ext_tbl[0], rp, offs), level=1)
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ def read_revs_dir(path, args, src=None, ret=None):
|
|||||||
ext_sig_cnt = 0
|
ext_sig_cnt = 0
|
||||||
while cur_offs < offs + hdr[8] \
|
while cur_offs < offs + hdr[8] \
|
||||||
and ext_sig_cnt <= ext_tbl[0]:
|
and ext_sig_cnt <= ext_tbl[0]:
|
||||||
ext_sig = struct.unpack("III", f.read(12))
|
ext_sig = struct.unpack("<III", f.read(12))
|
||||||
ignore = args.ignore_ext_dups and \
|
ignore = args.ignore_ext_dups and \
|
||||||
(ext_sig[0] == hdr[3])
|
(ext_sig[0] == hdr[3])
|
||||||
if not ignore:
|
if not ignore:
|
||||||
|
Loading…
Reference in New Issue
Block a user