Bug in utoi(), which made it ignore a leading minus sign when
[sgt/halibut] / error.c
diff --git a/error.c b/error.c
index 2a2c6cd..00d007d 100644 (file)
--- a/error.c
+++ b/error.c
@@ -18,7 +18,8 @@ static void do_error(int code, va_list ap) {
     char c;
     int i, j;
     char *sp, *sp2;
-    wchar_t *wsp, *wsp2, wc;
+    wchar_t *wsp, *wsp2;
+    unsigned wc;
     filepos fpos, fpos2, *fposp;
     int flags = 0;
 
@@ -376,7 +377,7 @@ static void do_error(int code, va_list ap) {
        break;  
       case err_sfntbadglyph:
        fpos = *va_arg(ap, filepos *);
-       wc = va_arg(ap, wchar_t);
+       wc = va_arg(ap, unsigned);
        sprintf(error,
                "warning: character U+%04X references an non-existent glyph",
                wc);
@@ -392,7 +393,7 @@ static void do_error(int code, va_list ap) {
     if (flags & PREFIX)
        fputs("halibut: ", stderr);
     if (flags & FILEPOS) {
-       fprintf(stderr, "%s:", fpos.filename);
+       fprintf(stderr, "%s:", fpos.filename ? fpos.filename : "<standard input>");
        if (fpos.line > 0)
            fprintf(stderr, "%d:", fpos.line);
        if (fpos.col > 0)