For UNICODE use char in comparison to ' '

only as unsigned char
This commit is contained in:
Holger Vogt 2019-12-07 18:05:35 +01:00
parent 577020e9c7
commit c0b9ef41b1
2 changed files with 14 additions and 14 deletions

View File

@ -81,7 +81,7 @@ stripsomespace(DSTRINGPTR dstr_p, bool incontrol)
char *s = ds_get_buf(dstr_p);
int i = 0;
while (s[i] && (s[i] <= ' '))
while (s[i] && ((unsigned char)s[i] <= ' '))
i++;
if ((i > 0) && s[i] && strchr(markers, s[i]))
@ -116,7 +116,7 @@ stripbraces(DSTRINGPTR dstr_p)
pscopy(&tstr, s, brace);
if (brace[-1] > ' ')
if ((unsigned char)brace[-1] > ' ')
cadd(&tstr, ' ');
cadd(&tstr, ' ');
@ -127,7 +127,7 @@ stripbraces(DSTRINGPTR dstr_p)
}
cadd(&tstr, ' ');
if (*j_ptr >= ' ')
if ((unsigned char)(* j_ptr) >= ' ')
cadd(&tstr, ' ');
int ilen = (int) ds_get_length(&tstr);

View File

@ -509,15 +509,15 @@ defsubckt(dico_t *dico, const struct card *card)
while (*s && (*s != '.'))
s++; /* skip 1st dotword */
while (*s && (*s > ' '))
while (*s && ((unsigned char) (*s) > ' '))
s++;
while (*s && (*s <= ' '))
while (*s && ((unsigned char) (*s) <= ' '))
s++; /* skip blank */
s_end = s;
while (*s_end && (*s_end > ' '))
while (*s_end && ((unsigned char) (*s_end) > ' '))
s_end++;
if (s_end > s) {
@ -574,7 +574,7 @@ keyword(const char *keys, const char *s, const char *s_end)
const char *p = s;
while ((p < s_end) && (*p == *keys))
p++, keys++;
if ((p >= s_end) && (*keys <= ' '))
if ((p >= s_end) && ((unsigned char) (*keys) <= ' '))
return j;
keys = strchr(keys, ' ');
if (!keys)
@ -723,7 +723,7 @@ fetchoperator(dico_t *dico,
level = 8;
} else {
state = S_init;
if (c > ' ')
if ((unsigned char) c > ' ')
error = message(dico, "Syntax error: letter [%c]\n", c);
}
@ -859,7 +859,7 @@ formula(dico_t *dico, const char *s, const char *s_end, bool *perror)
}
/* trim trailing whitespace */
while ((s_end > s) && (s_end[-1] <= ' '))
while ((s_end > s) && ((unsigned char) (s_end[-1]) <= ' '))
s_end--;
state = S_init;
@ -1222,7 +1222,7 @@ getexpress(nupa_type *type, DSTRINGPTR tstr_p, const char *s)
const char *p;
nupa_type tpe;
while ((s < s_end - 1) && (*s <= ' '))
while ((s < s_end - 1) && ((unsigned char)(* s) <= ' '))
s++; /*white space ? */
if (*s == '"') { /* string constant */
@ -1235,7 +1235,7 @@ getexpress(nupa_type *type, DSTRINGPTR tstr_p, const char *s)
do
p++;
while ((p < s_end) && (*p <= ' '));
while ((p < s_end) && ((unsigned char)(*p) <= ' '));
tpe = NUPA_STRING;
@ -1309,11 +1309,11 @@ nupa_assignment(dico_t *dico, const char *s, char mode)
DS_CREATE(tstr, 200); /* temporary dstrings */
DS_CREATE(ustr, 200);
while ((p < s_end) && (*p <= ' '))
while ((p < s_end) && ((unsigned char) (*p) <= ' '))
p++;
if (*p == '.') /* skip any dot keyword */
while (*p > ' ')
while ((unsigned char) (*p) > ' ')
p++;
while (p < s_end) {
@ -1509,7 +1509,7 @@ nupa_subcktcall(dico_t *dico, const char *s, const char *x,
jp = getexpress(NULL, &ustr, jp);
} else {
jp++;
if (*kp > ' ')
if ((unsigned char) (*kp) > ' ')
message(dico, "Subckt call, symbol %c not understood\n", *kp);
}