diff options
Diffstat (limited to 'fitz/obj_print.c')
-rw-r--r-- | fitz/obj_print.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/fitz/obj_print.c b/fitz/obj_print.c index d53d888a..30b34d95 100644 --- a/fitz/obj_print.c +++ b/fitz/obj_print.c @@ -100,10 +100,10 @@ static void fmt_str(struct fmt *fmt, fz_obj *obj) fmt_puts(fmt, "\\("); else if (c == ')') fmt_puts(fmt, "\\)"); - else if (c < 32 || c > 126) { + else if (c < 32 || c >= 127) { char buf[16]; fmt_putc(fmt, '\\'); - sprintf(buf, "%o", c); + sprintf(buf, "%03o", c); fmt_puts(fmt, buf); } else @@ -139,7 +139,7 @@ static void fmt_name(struct fmt *fmt, fz_obj *obj) for (i = 0; s[i]; i++) { if (isdelim(s[i]) || iswhite(s[i]) || - s[i] == '#' || s[i] < 32 || s[i] > 127) + s[i] == '#' || s[i] < 32 || s[i] >= 127) { fmt_putc(fmt, '#'); c = (s[i] >> 4) & 0xf; @@ -255,11 +255,7 @@ static void fmt_obj(struct fmt *fmt, fz_obj *obj) c = (unsigned char)str[i]; if (strchr("()\\\n\r\t\b\f", c)) added ++; - else if (c < 8) - added ++; - else if (c < 32) - added += 2; - else if (c >= 127) + else if (c < 32 || c >= 127) added += 3; } if (added < len) |