fix printing of "negative" byte values
This commit is contained in:
parent
7319c48e59
commit
cdd1289936
2 changed files with 4 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue