I don't object, but have a request: can you explore if changing the type of
the respective variable, instead of adding casts, is equivalent? Especially
the changes in parse_escape_string look as if that's possible.
(I consider such type change only better than casts, if the former doesn't
cause further casts elsewhere, of course).
Changing signed integers to unsigned just to avoid casts for
printf-like functions is a bad idea. The reason is that in
some expressions, using unsigned types can silently modify
the value of a signed type when implicitly converted to
unsigned.