From 5b18aeffbbd1641962f2ae374a3cb773fe7a6d6e Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sat, 9 Apr 2022 21:54:38 +0930 Subject: Replace use of ctype functions with internal version where only ASCII chars are used In !309 Taylor R Campbell found a number of instances of ctype incorrectly passed a signed char. In many cases, where only ASCII characters are used, the code should have been using the cairo version of the ctype function to avoid locale issues. --- util/cairo-trace/trace.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'util') diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c index fd9a4a38a..61e57f4d8 100644 --- a/util/cairo-trace/trace.c +++ b/util/cairo-trace/trace.c @@ -47,6 +47,8 @@ # include #endif +#include "cairo-ctype-inline.h" + #ifndef TRUE #define TRUE 1 #define FALSE 0 @@ -565,7 +567,7 @@ _trace_dtostr (char *buffer, size_t size, double d) if (*p == '+' || *p == '-') p++; - while (isdigit (*p)) + while (_cairo_isdigit (*p)) p++; if (strncmp (p, decimal_point, decimal_point_len) == 0) @@ -585,7 +587,7 @@ _trace_dtostr (char *buffer, size_t size, double d) if (*p == '+' || *p == '-') p++; - while (isdigit (*p)) + while (_cairo_isdigit (*p)) p++; if (strncmp (p, decimal_point, decimal_point_len) == 0) { @@ -651,7 +653,7 @@ _trace_vprintf (const char *fmt, va_list ap) f++; } - while (isdigit (*f)) + while (_cairo_isdigit (*f)) f++; length_modifier = 0; @@ -1850,7 +1852,7 @@ _encode_string_literal (char *out, int max, max -= 2; break; default: - if (isprint (c) || isspace (c)) { + if (_cairo_isprint (c)) { *out++ = c; } else { int octal = 0; @@ -1920,7 +1922,7 @@ ESCAPED_CHAR: _trace_printf ("\\%c", c); break; default: - if (isprint (c) || isspace (c)) { + if (_cairo_isprint (c)) { _trace_printf ("%c", c); } else { char buf[4] = { '\\' }; -- cgit v1.2.1