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/gsftopk | |
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/gsftopk')
-rw-r--r-- | Build/source/texk/gsftopk/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/gsftopk/gsftopk.c | 14 |
2 files changed, 11 insertions, 7 deletions
diff --git a/Build/source/texk/gsftopk/ChangeLog b/Build/source/texk/gsftopk/ChangeLog index e7cd02f0e09..a016de7d7e4 100644 --- a/Build/source/texk/gsftopk/ChangeLog +++ b/Build/source/texk/gsftopk/ChangeLog @@ -1,3 +1,7 @@ +2014-06-19 Peter Breitenlohner <peb@mppmu.mpg.de> + + * gsftopk.c: Avoid undefined behaviour when char is signed. + 2014-06-16 Peter Breitenlohner <peb@mppmu.mpg.de> * Makefile.am: Drop the obsolete ACLOCAL_AMFLAGS. diff --git a/Build/source/texk/gsftopk/gsftopk.c b/Build/source/texk/gsftopk/gsftopk.c index 1e169887b6c..fd6f2d5243a 100644 --- a/Build/source/texk/gsftopk/gsftopk.c +++ b/Build/source/texk/gsftopk/gsftopk.c @@ -1380,7 +1380,7 @@ scan_map_file(FILE *f) { while (fgets_long(f)) if (memcmp(long_line, fontname, fontlen) == 0 - && (long_line[fontlen] == '\0' || isspace(long_line[fontlen]))) { + && (long_line[fontlen] == '\0' || isspace((unsigned char)long_line[fontlen]))) { fclose(f); return True; } @@ -1464,7 +1464,7 @@ whitespace(void) c = data_getc(); if (c == '#') do c = data_getc(); while (!data_eof && c != '\n'); - else if (!isspace(c)) { + else if (!isspace((unsigned char)c)) { data_ungetc(c); break; } @@ -1477,7 +1477,7 @@ getint(void) char c; int i = 0; - do c = data_getc(); while (isspace(c)); + do c = data_getc(); while (isspace((unsigned char)c)); if (c < '0' || c > '9') oops("digit expected"); do { i = i * 10 + (c - '0'); @@ -2317,7 +2317,7 @@ Author of gsftopk: Paul Vojta."); if (mapline != NULL) { if (memcmp(mapline, fontname, fontlen) != 0 - || (mapline[fontlen] != '\0' && !isspace(mapline[fontlen]))) + || (mapline[fontlen] != '\0' && !isspace((unsigned char)mapline[fontlen]))) oops("font name does not match --mapline argument"); } else { @@ -2382,7 +2382,7 @@ Author of gsftopk: Paul Vojta."); * Parse the line from the map file. */ for (p = mapline + fontlen; *p != '\0'; ++p) { - if (isspace(*p)) continue; + if (isspace((unsigned char)*p)) continue; if (*p == '<') { char *q; char endc; @@ -2395,7 +2395,7 @@ Author of gsftopk: Paul Vojta."); /* ... and maybe a '[' */ if (*p == '[') ++p; q = p; - while (*p != '\0' && !isspace(*p)) ++p; + while (*p != '\0' && !isspace((unsigned char)*p)) ++p; endc = *p; *p = '\0'; #ifdef KPATHSEA @@ -2434,7 +2434,7 @@ Author of gsftopk: Paul Vojta."); } else { PSname = p; - while (*p != '\0' && !isspace(*p)) ++p; + while (*p != '\0' && !isspace((unsigned char)*p)) ++p; if (*p == '\0') break; } *p = '\0'; |