decompiler: GUInt properties for gunichar needs conversion

Fix #148

Signed-off-by: Hubert Figuière <hub@figuiere.net>
This commit is contained in:
Hubert Figuière 2024-03-11 23:17:02 -04:00
parent d47955c5a2
commit 7823b5b2a8
4 changed files with 27 additions and 0 deletions

View file

@ -118,6 +118,15 @@ class DecompileCtx:
if type is None:
self.print(f"{name}: {escape_quote(value)};")
elif type.assignable_to(UIntType()):
try:
val = int(value)
self.print(f"{name}: {value};")
except:
# Properties like 'invisible-char' are a unicode char
# in a guint, so we convert manually. Unlike in format.
val = ord(value)
self.print(f"{name}: {val};")
elif type.assignable_to(FloatType()):
self.print(f"{name}: {value};")
elif type.assignable_to(BoolType()):