[Scummvm-git-logs] scummvm master -> cb06b8ce2ec05d2f709953fca55ce6765b48ab1a
aquadran
aquadran at gmail.com
Thu Nov 11 23:23:09 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
cb06b8ce2e DEVTOOLS: Return string encoded in Mac-Roman on error
Commit: cb06b8ce2ec05d2f709953fca55ce6765b48ab1a
https://github.com/scummvm/scummvm/commit/cb06b8ce2ec05d2f709953fca55ce6765b48ab1a
Author: eientei (log.butt at gmail.com)
Date: 2021-11-12T00:23:06+01:00
Commit Message:
DEVTOOLS: Return string encoded in Mac-Roman on error
Changed paths:
devtools/dumper-companion.py
diff --git a/devtools/dumper-companion.py b/devtools/dumper-companion.py
index 651b73eccb..b9a7c4c7e0 100755
--- a/devtools/dumper-companion.py
+++ b/devtools/dumper-companion.py
@@ -102,16 +102,16 @@ def decode_macjapanese(text: ByteString) -> str:
elif (0x81 <= hi <= 0x9F) or (0xE0 <= hi <= 0xFC): # two-byte sequence
lo = next(i_text, None)
if lo is None:
- print(f"WARNING: Mac Japanese sequence missing second byte 0x{hi:02x}, decoding as MacRoman")
- res += int.to_bytes(hi, 1, 'little').decode('mac-roman')
- hi = next(i_text, None)
- continue
+ print(f"WARNING: Mac Japanese sequence missing second byte 0x{hi:02x}")
+ return text.decode('mac-roman')
hi_key = f'{hi:02x}'
lo_key = lo - 0x40
- if decode_map.get(hi_key) is None or decode_map[hi_key][lo_key] is None:
- raise Exception(
- f"No mapping for MacJapanese sequence 0x{hi_key}{lo:02x}"
- )
+ if lo_key < 0:
+ print(f"WARNING: second byte out of range 0x{lo:02x}")
+ return text.decode('mac-roman')
+ elif decode_map.get(hi_key) is None or decode_map[hi_key][lo_key] is None:
+ print(f"WARNING: No mapping for MacJapanese sequence 0x{hi_key}{lo:02x}")
+ return text.decode('mac-roman')
assert_tmp = decode_map[hi_key][lo_key]
assert assert_tmp # mypy assert
res += assert_tmp
More information about the Scummvm-git-logs
mailing list