scripts: build: Add optimizations in file2hex.py to gzip path as well
Added recently introduced optimizations - generation in string literal form and faster generation for hexadecimal initializer list form - to gzip path as well. Signed-off-by: Irfan Ahmad <irfan.ahmad@siemens.com>
This commit is contained in:
parent
b826d46632
commit
8d42cd078b
1 changed files with 8 additions and 2 deletions
|
@ -78,8 +78,14 @@ def main():
|
||||||
gz_obj.write(fg.read(args.length))
|
gz_obj.write(fg.read(args.length))
|
||||||
|
|
||||||
content.seek(0)
|
content.seek(0)
|
||||||
for chunk in iter(lambda: content.read(8), b''):
|
if args.format == "literal":
|
||||||
make_hex(chunk)
|
print('"', end='')
|
||||||
|
for chunk in iter(lambda: content.read(1024), b''):
|
||||||
|
make_string_literal(chunk)
|
||||||
|
print('"', end='')
|
||||||
|
else:
|
||||||
|
for chunk in iter(lambda: content.read(1024), b''):
|
||||||
|
make_hex(chunk)
|
||||||
else:
|
else:
|
||||||
with open(args.file, "rb") as fp:
|
with open(args.file, "rb") as fp:
|
||||||
fp.seek(args.offset)
|
fp.seek(args.offset)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue