Skip to content

Commit

Permalink
Merge pull request #7472 from tkelman/isspace-uchar
Browse files Browse the repository at this point in the history
cast to unsigned char for each use of isspace
  • Loading branch information
JeffBezanson committed Jun 30, 2014
2 parents a2313ce + 6dcdd57 commit 4936634
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ DLLEXPORT int jl_substrtod(char *str, size_t offset, int len, double *out)
char *bstr = str+offset;
char *pend = bstr+len;
int err = 0;
if (!(*pend == '\0' || isspace(*pend) || *pend == ',')) {
if (!(*pend == '\0' || isspace((unsigned char)*pend) || *pend == ',')) {
// confusing data outside substring. must copy.
char *newstr = malloc(len+1);
memcpy(newstr, bstr, len);
Expand All @@ -635,7 +635,7 @@ DLLEXPORT int jl_strtod(char *str, double *out)
(errno==ERANGE && (*out==0 || *out==HUGE_VAL || *out==-HUGE_VAL)))
return 1;
while (*p != '\0') {
if (!isspace(*p))
if (!isspace((unsigned char)*p))
return 1;
p++;
}
Expand All @@ -654,7 +654,7 @@ DLLEXPORT int jl_substrtof(char *str, int offset, int len, float *out)
char *bstr = str+offset;
char *pend = bstr+len;
int err = 0;
if (!(*pend == '\0' || isspace(*pend) || *pend == ',')) {
if (!(*pend == '\0' || isspace((unsigned char)*pend) || *pend == ',')) {
// confusing data outside substring. must copy.
char *newstr = malloc(len+1);
memcpy(newstr, bstr, len);
Expand Down Expand Up @@ -689,7 +689,7 @@ DLLEXPORT int jl_strtof(char *str, float *out)
(errno==ERANGE && (*out==0 || *out==HUGE_VALF || *out==-HUGE_VALF)))
return 1;
while (*p != '\0') {
if (!isspace(*p))
if (!isspace((unsigned char)*p))
return 1;
p++;
}
Expand Down
10 changes: 5 additions & 5 deletions src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ extern "C" DLLEXPORT void jl_read_sonames(void)
ssize_t n = getline(&line, &sz, ldc);
if (n == -1)
break;
if (n > 2 && isspace(line[0])) {
if (n > 2 && isspace((unsigned char)line[0])) {
int i=0;
while (isspace(line[++i])) ;
while (isspace((unsigned char)line[++i])) ;
char *name = &line[i];
char *dot = strstr(name, ".so");
i=0;
Expand All @@ -28,10 +28,10 @@ extern "C" DLLEXPORT void jl_read_sonames(void)
continue;

// Detect if this entry is for the current architecture
while (!isspace(dot[++i])) ;
while (isspace(dot[++i])) ;
while (!isspace((unsigned char)dot[++i])) ;
while (isspace((unsigned char)dot[++i])) ;
int j = i;
while (!isspace(dot[++j])) ;
while (!isspace((unsigned char)dot[++j])) ;
char *arch = strstr(dot+i,"x86-64");
if (arch != NULL && arch < dot + j) {
#ifdef _P32
Expand Down
2 changes: 1 addition & 1 deletion src/flisp/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static char nextchar(void)
} while ((char)ch != '\n');
c = (char)ch;
}
} while (c==' ' || isspace(c));
} while (c==' ' || isspace((unsigned char)c));
return c;
}

Expand Down
2 changes: 1 addition & 1 deletion src/support/strtod.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ double strtod_c(const char *nptr, char **endptr)
p = nptr;

/* parse leading spaces */
while (isspace(*p)) {
while (isspace((unsigned char)*p)) {
p++;
}

Expand Down

0 comments on commit 4936634

Please sign in to comment.