In non-windows platfoms, the `size_t` type may not necessarily use
the `%lu` format specification. For example in 32 bits platforms
instead it needs to be `%u`. Therefore, for non-windows platforms,
it is better to define PRI_SIZET more precisely.
Silences these types of warnings in 32 bits non-windows platforms:
libretro-common/file/config_file.c: In function ‘config_get_size_t’:
libretro-common/file/config_file.c:694:32: warning: format ‘%lu’ expects
argument of type ‘long unsigned int *’, but argument 3 has type
‘size_t * {aka unsigned int *}’ [-Wformat=]
if (sscanf(entry->value, "%" PRI_SIZET, &val) == 1)
^~~
Discussed in #8191
This allows optionally sorting configure files and is needed to fix the
order of inputs in the autoconfig profiles which should not be sorted
alphabetically.
Fixes https://github.com/libretro/RetroArch/issues/7873
The "z" modifier was introduced in c99, but using "l" instead
seems to work.
setting_list.c: In function ‘setting_get_string_representation_size’:
setting_list.c:175:24: warning: ISO C90 does not support the ‘z’ gnu_printf length modifier [-Wformat=]
snprintf(s, len, "%" PRI_SIZET,
^~~
setting_list.c: In function ‘setting_get_string_representation_size_in_mb’:
setting_list.c:183:24: warning: ISO C90 does not support the ‘z’ gnu_printf length modifier [-Wformat=]
snprintf(s, len, "%" PRI_SIZET,
^~~
setting_list.c: In function ‘setting_set_with_string_representation’:
setting_list.c:508:24: warning: ISO C90 does not support the ‘z’ gnu_scanf length modifier [-Wformat=]
sscanf(value, "%" PRI_SIZET, setting->value.target.sizet);
^~~
libretro-common/file/config_file.c: In function ‘config_get_size_t’:
libretro-common/file/config_file.c:692:32: warning: ISO C90 does not support the ‘z’ gnu_scanf length modifier [-Wformat=]
if (sscanf(entry->value, "%" PRI_SIZET, &val) == 1
`menu_animation_update` enumerates `menu_animation.list` to process each
`tween`. It was observed that some tweens execute a callback that
pushes more animations via `menu_animation_push`. During the push, if
the tween `list` does not have enough space, a `realloc` occurs,
potentially invalidating the existing list. The remaining pointer access
in menu_animation_update is therefore invalid. Best case is the memory
is unused and thus does not affect the program. Worst case is memory
corruption.