casts, to make int <-> char conversions explicit

This commit is contained in:
rlar 2010-11-02 17:31:19 +00:00
parent 6ac005103b
commit 6e3bbd49ae
12 changed files with 48 additions and 32 deletions

View File

@ -1,3 +1,17 @@
2010-11-02 Robert Larice
* src/frontend/inpcom.c ,
* src/frontend/parser/lexical.c ,
* src/frontend/quote.c ,
* src/frontend/subckt.c ,
* src/main.c ,
* src/spicelib/parser/inpcfix.c ,
* src/xspice/cmpp/pp_lst.c ,
* src/xspice/cmpp/util.c ,
* src/xspice/icm/digital/d_source/cfunc.mod ,
* src/xspice/icm/digital/d_state/cfunc.mod ,
* src/xspice/ipc/ipctiein.c :
casts, to make int <-> char conversions explicit
2010-11-02 Robert Larice
* src/frontend/display.c ,
* src/frontend/numparam/mystring.c :

View File

@ -135,7 +135,7 @@ readline(FILE *fd)
while((c = getc(fd)) != EOF) {
if (strlen == 0 && (c == '\t' || c == ' ')) /* Leading spaces away */
continue;
strptr[strlen] = c;
strptr[strlen] = (char) c;
strlen++;
if( strlen >= memlen ) {
memlen += STRGROW;
@ -1217,7 +1217,8 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c
/* lower case the file name for later string compares */
/* s_ptr = strdup(s); */
s_lower = strdup(s);
for(s_ptr = s_lower; *s_ptr && (*s_ptr != '\n'); s_ptr++) *s_ptr = tolower(*s_ptr);
for(s_ptr = s_lower; *s_ptr && (*s_ptr != '\n'); s_ptr++)
*s_ptr = (char) tolower(*s_ptr);
found_library = FALSE;
for ( i = 0; i < num_libraries; i++ ) {
@ -1356,7 +1357,8 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c
premature end. If premature end is reached, spew
error and zap the line. */
if ( !ciprefix( "write", buffer ) ) { // exclude 'write' command so filename case preserved
for (s = buffer; *s && (*s != '\n') && (*s != '\0'); s++) *s = tolower(*s);
for (s = buffer; *s && (*s != '\n') && (*s != '\0'); s++)
*s = (char) tolower(*s);
if (!*s) {
//fprintf(cp_err, "Warning: premature EOF\n");
}
@ -1701,7 +1703,7 @@ inp_casefix(char *string)
while (*string) {
#ifdef HAS_ASCII
/* ((*string) & 0177): mask off all but the first seven bits, 0177: octal */
*string = strip(*string);
*string = (char) strip(*string);
#endif
if (*string == '"') {
*string++ = ' ';
@ -1714,7 +1716,7 @@ inp_casefix(char *string)
if (!isspace(*string) && !isprint(*string))
*string = '_';
if (isupper(*string))
*string = tolower(*string);
*string = (char) tolower(*string);
string++;
}
return;

View File

@ -138,7 +138,7 @@ nloop: i = 0;
gotchar:
if ((c != EOF) && (c != ESCAPE))
linebuf[j++] = c;
linebuf[j++] = (char) c;
if (c != EOF)
numeofs = 0;
if (i == NEW_BSIZE_SP - 1) {
@ -156,7 +156,7 @@ gotchar:
c = strip(c); /* Don't need to do this really. */
if ((c == '\\' && DIR_TERM != '\\') || (c == '\026') /* ^V */ ) {
c = quote(string ? *string++ : input(cp_inp_cur));
linebuf[j++] = strip(c);
linebuf[j++] = (char) strip(c);
}
if ((c == '\n') && cp_bqflag)
c = ' ';
@ -202,8 +202,8 @@ gotchar:
if ((c == '\n') || (c == EOF) || (c == ESCAPE))
goto gotchar;
else {
buf[i++] = quote(c);
linebuf[j++] = c;
buf[i++] = (char) quote(c);
linebuf[j++] = (char) c;
}
}
linebuf[j++] = '\'';
@ -218,14 +218,14 @@ gotchar:
if ((c == '\n') || (c == EOF) || (c == ESCAPE))
goto gotchar;
else if (c == '\\') {
linebuf[j++] = c;
linebuf[j++] = (char) c;
c = (string ? *string++ :
input(cp_inp_cur));
buf[i++] = quote(c);
linebuf[j++] = c;
buf[i++] = (char) quote(c);
linebuf[j++] = (char) c;
} else {
buf[i++] = c;
linebuf[j++] = c;
buf[i++] = (char) c;
linebuf[j++] = (char) c;
}
}
buf[i++] = d;
@ -289,19 +289,19 @@ gotchar:
} goto ldefault;
case ';': /*CDHW semicolon inside parentheses is part of expression CDHW*/
if (paren > 0) {
buf[i++]=c;
buf[i++] = (char) c;
break;
} goto ldefault;
case '&': /* va: $&name is one word */
if (i==1 && buf[i-1]=='$' && c=='&') {
buf[i++]=c;
buf[i++] = (char) c;
break;
} goto ldefault; /* else continue with default ... */
case '<':
case '>': /* va: <=, >= are unbreakable words */
if(string)
if (i==0 && (*string=='=')) {
buf[i++]=c;
buf[i++] = (char) c;
break;
} goto ldefault; /* else continue with default ... */
default:
@ -313,7 +313,7 @@ ldefault: if ((cp_chars[c] & CPC_BRL) && (i > 0)) {
newword;
}
}
buf[i++] = c;
buf[i++] = (char) c;
if (cp_chars[c] & CPC_BRR) {
if ((c != '<') || (i < 2) ||
(buf[i - 2] != '$')) {

View File

@ -24,7 +24,7 @@ cp_wstrip(char *str)
if (str)
while ((c = *str)) { /* assign and test */
d = strip(c);
d = (char) strip(c);
if (c != d)
*str = d;
str++;
@ -39,7 +39,7 @@ cp_quoteword(char *str)
{
if (str)
while (*str) {
*str = quote(*str);
*str = (char) quote(*str);
str++;
}
return;

View File

@ -2095,7 +2095,7 @@ static int
inp_numnodes(char c)
{
if (isupper(c))
c = tolower(c);
c = (char) tolower(c);
switch (c) {
case ' ':
case '\t':

View File

@ -472,7 +472,7 @@ prompt(void)
if (*(s + 1))
p += sprintf(p, "%c", strip(*++s));
default:
*p = strip(*s); ++p;
*p = (char) strip(*s); ++p;
break;
}
s++;

View File

@ -17,7 +17,7 @@ void INPcaseFix(register char *string)
while (*string) {
if (isupper(*string)) {
*string = tolower(*string);
*string = (char) tolower(*string);
}
string++;
}

View File

@ -1061,7 +1061,7 @@ static Status_t read_udn_type_name(
name[i] = '\0';
}
else if(c != EOF)
name[i++] = c;
name[i++] = (char) c;
} while((c != EOF) && (! found));
}
} while((c != EOF) && (! found));

View File

@ -79,7 +79,7 @@ void str_to_lower(char *s)
for(i = 0; (c = s[i]) != '\0'; i++)
if(isalpha(c))
if(isupper(c))
s[i] = tolower(c);
s[i] = (char) tolower(c);
}

View File

@ -381,7 +381,7 @@ float *p_value ) /* OUT - The numerical value */
else {
if(isupper(c))
c = tolower(c);
c = (char) tolower(c);
switch(c) {
@ -425,7 +425,7 @@ float *p_value ) /* OUT - The numerical value */
break;
}
if(islower(c1))
c1 = toupper(c1);
c1 = (char) toupper(c1);
if(c1 == 'E')
scale_factor = 1.0e6;
else if(c1 == 'I')

View File

@ -440,7 +440,7 @@ float *p_value ) /* OUT - The numerical value */
else {
if(islower(c))
c = tolower(c);
c = (char) tolower(c);
switch(c) {
@ -484,7 +484,7 @@ float *p_value ) /* OUT - The numerical value */
break;
}
if(islower(c1))
c1 = toupper(c1);
c1 = (char) toupper(c1);
if(c1 == 'E')
scale_factor = 1.0e6;
else if(c1 == 'I')

View File

@ -206,7 +206,7 @@ void ipc_send_stdout(void)
len = 0;
while( (c=fgetc(stdout)) != EOF) {
if(c != '\n') {
buf[len] = c;
buf[len] = (char) c;
len++;
}
if((c == '\n') || (len == IPC_MAX_LINE_LEN)) {
@ -252,7 +252,7 @@ void ipc_send_stderr(void)
len = 0;
while( (c=fgetc(stderr)) != EOF) {
if(c != '\n') {
buf[len] = c;
buf[len] = (char) c;
len++;
}
if((c == '\n') || (len == IPC_MAX_LINE_LEN)) {
@ -336,7 +336,7 @@ Ipc_Boolean_t ipc_screen_name(char *name, char *mapped_name)
}
else {
if(islower(name[i]))
mapped_name[i] = toupper(name[i]);
mapped_name[i] = (char) toupper(name[i]);
else
mapped_name[i] = name[i];
}