scripts/log_parser: Handle signed and unsigned char length modifier
The C standard specifies 'hh' as a length modifier indicating an integer conversion specifier applies to a signed char or unsigned char argument. Python doesn't do that, so replace relevant %hh with %h. Also fix the handling of %ll so that it applies to all integer specifiers as well. Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
af22475f98
commit
389f061c8d
1 changed files with 6 additions and 3 deletions
|
@ -79,9 +79,12 @@ def formalize_fmt_string(fmt_str):
|
|||
"""Replace unsupported formatter"""
|
||||
new_str = fmt_str
|
||||
|
||||
# Python doesn't support %lld or %llu so need to remove extra 'l'
|
||||
new_str = new_str.replace("%lld", "%ld")
|
||||
new_str = new_str.replace("%llu", "%lu")
|
||||
for spec in ['d', 'i', 'o', 'u', 'x', 'X']:
|
||||
# Python doesn't support %ll for integer specifiers, so remove extra 'l'
|
||||
new_str = new_str.replace("%ll" + spec, "%l" + spec)
|
||||
|
||||
# Python doesn't support %hh for integer specifiers, so remove extra 'h'
|
||||
new_str = new_str.replace("%hh" + spec, "%h" + spec)
|
||||
|
||||
# No %p for pointer either, so use %x
|
||||
new_str = new_str.replace("%p", "0x%x")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue