[PATCH:libXfont 2/2] Fix is*() usage.
Thomas Klausner
wiz at NetBSD.org
Wed Feb 25 12:45:50 PST 2015
The argument must be an unsigned char or -1; in these cases
we know it's not -1 so cast it to unsigned char.
Fixes
warning: array subscript is of type 'char' [-Wchar-subscripts]
Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
---
src/FreeType/ftfuncs.c | 6 +++---
src/FreeType/xttcap.c | 2 +-
src/bitmap/bdfutils.c | 4 ++--
src/util/fontxlfd.c | 10 +++++-----
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c
index a4969d1..c440fde 100644
--- a/src/FreeType/ftfuncs.c
+++ b/src/FreeType/ftfuncs.c
@@ -2061,7 +2061,7 @@ restrict_code_range_by_str(int count,unsigned short *refFirstCol,
long val;
/* skip comma and/or space */
- while (',' == *p || isspace(*p))
+ while (',' == *p || isspace((unsigned char)*p))
p++;
/* begin point */
@@ -2079,7 +2079,7 @@ restrict_code_range_by_str(int count,unsigned short *refFirstCol,
}
/* skip space */
- while (isspace(*p))
+ while (isspace((unsigned char)*p))
p++;
if (',' != *p && '\0' != *p) {
@@ -2092,7 +2092,7 @@ restrict_code_range_by_str(int count,unsigned short *refFirstCol,
break;
/* skip space */
- while (isspace(*p))
+ while (isspace((unsigned char)*p))
p++;
val = strtol(p, (char **)&q, 0);
diff --git a/src/FreeType/xttcap.c b/src/FreeType/xttcap.c
index cee752e..e30e0f9 100644
--- a/src/FreeType/xttcap.c
+++ b/src/FreeType/xttcap.c
@@ -632,7 +632,7 @@ SPropRecValList_add_by_font_cap(SDynPropRecValList *pThisList,
}
break;
}
- if ( !isdigit(*p) )
+ if ( !isdigit((unsigned char)*p) )
break;
}
}
diff --git a/src/bitmap/bdfutils.c b/src/bitmap/bdfutils.c
index 288148b..438d197 100644
--- a/src/bitmap/bdfutils.c
+++ b/src/bitmap/bdfutils.c
@@ -207,11 +207,11 @@ bdfIsInteger(char *str)
char c;
c = *str++;
- if (!(isdigit(c) || c == '-' || c == '+'))
+ if (!(isdigit((unsigned char)c) || c == '-' || c == '+'))
return (FALSE);
while ((c = *str++))
- if (!isdigit(c))
+ if (!isdigit((unsigned char)c))
return (FALSE);
return (TRUE);
diff --git a/src/util/fontxlfd.c b/src/util/fontxlfd.c
index 974128e..99a3679 100644
--- a/src/util/fontxlfd.c
+++ b/src/util/fontxlfd.c
@@ -145,9 +145,9 @@ xlfd_double_to_text(double value, char *buffer, int space_required)
if (value == 0.0) exponent = 0;
/* Figure out how many digits are significant */
- while (p1 >= buffer && (!isdigit(*p1) || *p1 == '0')) p1--;
+ while (p1 >= buffer && (!isdigit((unsigned char)*p1) || *p1 == '0')) p1--;
ndigits = 0;
- while (p1 >= buffer) if (isdigit(*p1--)) ndigits++;
+ while (p1 >= buffer) if (isdigit((unsigned char)*p1--)) ndigits++;
/* Figure out notation to use */
if (exponent >= XLFD_NDIGITS || ndigits - exponent > XLFD_NDIGITS + 1)
@@ -278,7 +278,7 @@ GetMatrix(char *ptr, FontScalablePtr vals, int which)
matrix = vals->point_matrix;
else return (char *)0;
- while (isspace(*ptr)) ptr++;
+ while (isspace((unsigned char)*ptr)) ptr++;
if (*ptr == '[')
{
/* This is a matrix containing real numbers. It would be nice
@@ -292,13 +292,13 @@ GetMatrix(char *ptr, FontScalablePtr vals, int which)
(ptr = readreal(ptr, matrix + 2)) &&
(ptr = readreal(ptr, matrix + 3)))
{
- while (isspace(*ptr)) ptr++;
+ while (isspace((unsigned char)*ptr)) ptr++;
if (*ptr != ']')
ptr = (char *)0;
else
{
ptr++;
- while (isspace(*ptr)) ptr++;
+ while (isspace((unsigned char)*ptr)) ptr++;
if (*ptr == '-')
{
if (which == POINTSIZE_MASK)
--
2.3.0
More information about the xorg-devel
mailing list