diff --git a/lexor.lex b/lexor.lex index 444d6a10d..affd9d794 100644 --- a/lexor.lex +++ b/lexor.lex @@ -620,14 +620,14 @@ S [afpnumkKMGT] error_count += 1; } /* Final catchall. something got lost or mishandled. */ - /* XXX Should we tell the luser something about the lexical state? */ + /* XXX Should we tell the user something about the lexical state? */ <*>.|\n { cerr << yylloc.text << ":" << yylloc.first_line << ": error: unmatched character ("; - if (isgraph(yytext[0])) + if (isprint(yytext[0])) cerr << yytext[0]; else - cerr << "hex " << hex << (0xffU & ((unsigned) (yytext[0]))); + cerr << "hex " << hex << ((unsigned char) yytext[0]); cerr << ")" << endl; error_count += 1; } diff --git a/verinum.cc b/verinum.cc index 4e7be7668..99dd3ec6e 100644 --- a/verinum.cc +++ b/verinum.cc @@ -516,11 +516,11 @@ string verinum::as_string() const char tmp[5]; snprintf(tmp, sizeof tmp, "\\%03o", char_val); res = res + tmp; - } else if (char_val == ' ' || isgraph(char_val)) { + } else if (isprint(char_val)) { res = res + char_val; } else { char tmp[5]; - snprintf(tmp, sizeof tmp, "\\%03o", char_val); + snprintf(tmp, sizeof tmp, "\\%03o", (unsigned char)char_val); res = res + tmp; } }