diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-06-19 11:14:35 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-06-19 11:14:35 +0000 |
commit | e5b8a1a0369901d3d73384cf553619d9351679aa (patch) | |
tree | a0b0d02bb0421b6f6f1dce118d40dfe6e91147b6 /Build/source/texk/xdvik | |
parent | a7803f3483864a647563ebda46f5fa39a92bb205 (diff) |
texk/*/, utils/*/: Avoid undefined behaviour when char is signed
git-svn-id: svn://tug.org/texlive/trunk@34310 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/xdvik')
-rw-r--r-- | Build/source/texk/xdvik/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/xdvik/ft.c | 20 | ||||
-rw-r--r-- | Build/source/texk/xdvik/gui/xaw_menu.c | 2 | ||||
-rw-r--r-- | Build/source/texk/xdvik/hypertex.c | 2 |
4 files changed, 17 insertions, 12 deletions
diff --git a/Build/source/texk/xdvik/ChangeLog b/Build/source/texk/xdvik/ChangeLog index b5af6fd0449..ad44fa255c3 100644 --- a/Build/source/texk/xdvik/ChangeLog +++ b/Build/source/texk/xdvik/ChangeLog @@ -1,3 +1,8 @@ +2014-06-19 Peter Breitenlohner <peb@mppmu.mpg.de> + + * ft.c, gui/xaw_menu.c, hypertex.c: Avoid undefined behaviour + when char is signed. + 2014-06-16 Peter Breitenlohner <peb@mppmu.mpg.de> * squeeze/Makefile.am: Drop the obsolete ACLOCAL_AMFLAGS. diff --git a/Build/source/texk/xdvik/ft.c b/Build/source/texk/xdvik/ft.c index 74ef96786e4..66ca6b55723 100644 --- a/Build/source/texk/xdvik/ft.c +++ b/Build/source/texk/xdvik/ft.c @@ -209,39 +209,39 @@ set_transform(struct ftfont *ftp, double y = 0.0; for (;;) { - while (isspace(*str)) ++str; + while (isspace((unsigned char)*str)) ++str; if (*str == '\0') break; - if (isdigit(*str) || *str == '.' || *str == '-') { + if (isdigit((unsigned char)*str) || *str == '.' || *str == '-') { double arg = strtod(str, (char **) &str); - while (isspace(*str)) ++str; + while (isspace((unsigned char)*str)) ++str; if (memcmp(str, "ObliqueSlant", 12) == 0 - && (isspace(str[12]) || str[12] == '\0')) { + && (isspace((unsigned char)str[12]) || str[12] == '\0')) { arg = -tan(arg); str += 12; - while (isspace(*str)) ++str; + while (isspace((unsigned char)*str)) ++str; } if (memcmp(str, "SlantFont", 9) == 0 - && (isspace(str[9]) || str[9] == '\0')) { + && (isspace((unsigned char)str[9]) || str[9] == '\0')) { y += arg; str += 9; } else if (memcmp(str, "ExtendFont", 10) == 0 - && (isspace(str[10]) || str[10] == '\0')) { + && (isspace((unsigned char)str[10]) || str[10] == '\0')) { x *= arg; str += 10; } else return False; } else { /* other characters; presume encoding name */ - while (!isspace(*str) && *str != '\0') ++str; - while (isspace(*str)) ++str; + while (!isspace((unsigned char)*str) && *str != '\0') ++str; + while (isspace((unsigned char)*str)) ++str; if (memcmp(str, "ReEncodeFont", 12) == 0 - && (isspace(str[12]) || str[12] == '\0')) + && (isspace((unsigned char)str[12]) || str[12] == '\0')) str += 12; else return False; diff --git a/Build/source/texk/xdvik/gui/xaw_menu.c b/Build/source/texk/xdvik/gui/xaw_menu.c index c1fbd45e2e2..cc3e8bcad95 100644 --- a/Build/source/texk/xdvik/gui/xaw_menu.c +++ b/Build/source/texk/xdvik/gui/xaw_menu.c @@ -406,7 +406,7 @@ filehist_select_cb(Widget w, XtPointer client_data, XtPointer call_data) XtVaGetValues(w, XtNlabel, &label, NULL); idx = strtol(label, &ptr, 10) - 1; - while (isspace(*ptr)) + while (isspace((unsigned char)*ptr)) ptr++; TRACE_GUI((stderr, "User selected: %d, `%s'", idx, ptr)); if (idx == 0) { diff --git a/Build/source/texk/xdvik/hypertex.c b/Build/source/texk/xdvik/hypertex.c index de4de61cf56..ac9d35934c1 100644 --- a/Build/source/texk/xdvik/hypertex.c +++ b/Build/source/texk/xdvik/hypertex.c @@ -1141,7 +1141,7 @@ scan_ps_literal_text_string(const char *str) case '\n': break; case '\r': if (*(str + 1) == '\n') str++; break; default: - if (isdigit(*str)) { + if (isdigit((unsigned char)*str)) { char number[] = "xxx"; char *end; strncpy(number, str, 3); |