fix printing of "negative" byte values

This commit is contained in:
Sven M. Hallberg 2015-09-16 22:17:31 +02:00
parent 7319c48e59
commit cdd1289936
2 changed files with 4 additions and 4 deletions

View file

@ -672,7 +672,7 @@ static void stringset_extend(HCFGrammar *g, HStringMap *ret,
}
void h_pprint_char(FILE *f, char c)
void h_pprint_char(FILE *f, uint8_t c)
{
switch(c) {
case '"': fputs("\\\"", f); break;
@ -685,12 +685,12 @@ void h_pprint_char(FILE *f, char c)
if (isprint((int)c)) {
fputc(c, f);
} else {
fprintf(f, "\\x%.2X", c);
fprintf(f, "\\x%.2X", (unsigned int)c);
}
}
}
static void pprint_charset_char(FILE *f, char c)
static void pprint_charset_char(FILE *f, uint8_t c)
{
switch(c) {
case '"': fputc(c, f); break;

View file

@ -102,4 +102,4 @@ void h_pprint_stringset(FILE *file, const HStringMap *set, int indent);
void h_pprint_stringmap(FILE *file, char sep,
void (*valprint)(FILE *f, void *env, void *val), void *env,
const HStringMap *map);
void h_pprint_char(FILE *file, char c);
void h_pprint_char(FILE *file, uint8_t c);