Merge pull request #92 from lzutao/fix-ctype
Cast argument to unsigned char before passing to ctype.h function
This commit is contained in:
4
mpc.c
4
mpc.c
@@ -2443,7 +2443,7 @@ mpc_val_t *mpcf_float(mpc_val_t *x) {
|
||||
|
||||
mpc_val_t *mpcf_strtriml(mpc_val_t *x) {
|
||||
char *s = x;
|
||||
while (isspace(*s)) {
|
||||
while (isspace((unsigned char)*s)) {
|
||||
memmove(s, s+1, strlen(s));
|
||||
}
|
||||
return s;
|
||||
@@ -2452,7 +2452,7 @@ mpc_val_t *mpcf_strtriml(mpc_val_t *x) {
|
||||
mpc_val_t *mpcf_strtrimr(mpc_val_t *x) {
|
||||
char *s = x;
|
||||
size_t l = strlen(s);
|
||||
while (isspace(s[l-1])) {
|
||||
while (isspace((unsigned char)s[l-1])) {
|
||||
s[l-1] = '\0'; l--;
|
||||
}
|
||||
return s;
|
||||
|
Reference in New Issue
Block a user