Correctly print octal escape sequences, when the char has negative value.
authorChristoph Mallon <christoph.mallon@gmx.de>
Mon, 8 Dec 2008 08:19:48 +0000 (08:19 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Mon, 8 Dec 2008 08:19:48 +0000 (08:19 +0000)
[r24382]

ast.c

diff --git a/ast.c b/ast.c
index bf93a14..85c35c9 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -259,7 +259,7 @@ static void print_quoted_string(const string_t *const string, char border, int s
                        /* FALLTHROUGH */
                default:
                        if (!isprint(*c)) {
-                               fprintf(out, "\\%03o", (unsigned)*c);
+                               fprintf(out, "\\%03o", (unsigned)(unsigned char)*c);
                                break;
                        }
                        fputc(*c, out);