-/* $OpenBSD: output.c,v 1.18 2014/01/08 22:36:37 millert Exp $ */
+/* $OpenBSD: output.c,v 1.19 2014/01/08 22:55:59 millert Exp $ */
/* $NetBSD: output.c,v 1.4 1996/03/19 03:21:41 jtc Exp $ */
/*
int c;
s = name;
- c = *s;
+ c = (unsigned char)*s;
if (c == '"')
{
- c = *++s;
+ c = (unsigned char)*++s;
if (!isalpha(c) && c != '_' && c != '$')
return (0);
- while ((c = *++s) != '"')
+ while ((c = (unsigned char)*++s) != '"')
{
if (!isalnum(c) && c != '_' && c != '$')
return (0);
if (!isalpha(c) && c != '_' && c != '$')
return (0);
- while ((c = *++s))
+ while ((c = (unsigned char)*++s))
{
if (!isalnum(c) && c != '_' && c != '$')
return (0);
{
fprintf(code_file, "#define ");
if (dflag) fprintf(defines_file, "#define ");
- c = *s;
+ c = (unsigned char)*s;
if (c == '"')
{
- while ((c = *++s) != '"')
+ while ((c = (unsigned char)*++s) != '"')
{
putc(c, code_file);
if (dflag) putc(c, defines_file);
putc(c, code_file);
if (dflag) putc(c, defines_file);
}
- while ((c = *++s));
+ while ((c = (unsigned char)*++s));
}
++outline;
fprintf(code_file, " %d\n", symbol_value[i]);
in = input_file;
out = code_file;
- c = *cptr;
+ c = (unsigned char)*cptr;
if (c == '\n')
{
++lineno;
++outline;
fprintf(out, line_format, lineno, input_file_name);
}
- do { putc(c, out); } while ((c = *++cptr) != '\n');
+ do { putc(c, out); } while ((c = (unsigned char)*++cptr) != '\n');
++outline;
putc('\n', out);
last = '\n';
-/* $OpenBSD: reader.c,v 1.24 2014/01/08 21:40:25 millert Exp $ */
+/* $OpenBSD: reader.c,v 1.25 2014/01/08 22:55:59 millert Exp $ */
/* $NetBSD: reader.c,v 1.5 1996/03/19 03:21:43 jtc Exp $ */
/*
default:
cptr = s;
- return (*s);
+ return ((unsigned char)*s);
}
}
}
int c;
char *t_cptr = cptr;
- c = *++cptr;
+ c = (unsigned char)*++cptr;
if (isalpha(c))
{
cinc = 0;
cachec(c);
else
break;
- c = *++cptr;
+ c = (unsigned char)*++cptr;
}
cachec(NUL);
fprintf(f, "#ident \"");
for (;;)
{
- c = *++cptr;
+ c = (unsigned char)*++cptr;
if (c == '\n')
{
fprintf(f, "\"\n");
if (!lflag) fprintf(f, line_format, lineno, input_file_name);
loop:
- c = *cptr++;
+ c = (unsigned char)*cptr++;
switch (c)
{
case '\n':
putc(c, f);
for (;;)
{
- c = *cptr++;
+ c = (unsigned char)*cptr++;
putc(c, f);
if (c == quote)
{
unterminated_string(s_lineno, s_line, s_cptr);
if (c == '\\')
{
- c = *cptr++;
+ c = (unsigned char)*cptr++;
putc(c, f);
if (c == '\n')
{
case '/':
putc(c, f);
need_newline = 1;
- c = *cptr;
+ c = (unsigned char)*cptr;
if (c == '/')
{
putc('*', f);
- while ((c = *++cptr) != '\n')
+ while ((c = (unsigned char)*++cptr) != '\n')
{
if (c == '*' && cptr[1] == '/')
fprintf(f, "* ");
++cptr;
for (;;)
{
- c = *cptr++;
+ c = (unsigned char)*cptr++;
putc(c, f);
if (c == '*' && *cptr == '/')
{
depth = 0;
loop:
- c = *cptr++;
+ c = (unsigned char)*cptr++;
putc(c, text_file);
if (dflag) putc(c, union_file);
switch (c)
quote = c;
for (;;)
{
- c = *cptr++;
+ c = (unsigned char)*cptr++;
putc(c, text_file);
if (dflag) putc(c, union_file);
if (c == quote)
unterminated_string(s_lineno, s_line, s_cptr);
if (c == '\\')
{
- c = *cptr++;
+ c = (unsigned char)*cptr++;
putc(c, text_file);
if (dflag) putc(c, union_file);
if (c == '\n')
}
case '/':
- c = *cptr;
+ c = (unsigned char)*cptr;
if (c == '/')
{
putc('*', text_file);
if (dflag) putc('*', union_file);
- while ((c = *++cptr) != '\n')
+ while ((c = (unsigned char)*++cptr) != '\n')
{
if (c == '*' && cptr[1] == '/')
{
++cptr;
for (;;)
{
- c = *cptr++;
+ c = (unsigned char)*cptr++;
putc(c, text_file);
if (dflag) putc(c, union_file);
if (c == '*' && *cptr == '/')
char *s_line = dup_line();
char *s_cptr = s_line + (cptr - line);
- quote = *cptr++;
+ quote = (unsigned char)*cptr++;
cinc = 0;
for (;;)
{
- c = *cptr++;
+ c = (unsigned char)*cptr++;
if (c == quote) break;
if (c == '\n') unterminated_string(s_lineno, s_line, s_cptr);
if (c == '\\')
{
char *c_cptr = cptr - 1;
- c = *cptr++;
+ c = (unsigned char)*cptr++;
switch (c)
{
case '\n':
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
n = c - '0';
- c = *cptr;
+ c = (unsigned char)*cptr;
if (IS_OCTAL(c))
{
n = (n << 3) + (c - '0');
- c = *++cptr;
+ c = (unsigned char)*++cptr;
if (IS_OCTAL(c))
{
n = (n << 3) + (c - '0');
break;
case 'x':
- c = *cptr++;
+ c = (unsigned char)*cptr++;
n = hexval(c);
if (n < 0 || n >= 16)
illegal_character(c_cptr);
for (;;)
{
- c = *cptr;
+ c = (unsigned char)*cptr;
i = hexval(c);
if (i < 0 || i >= 16) break;
++cptr;
strcmp(name, "$end") == 0)
return (1);
- if (name[0] == '$' && name[1] == '$' && isdigit(name[2]))
+ if (name[0] == '$' && name[1] == '$' && isdigit((unsigned char)name[2]))
{
s = name + 3;
- while (isdigit(*s)) ++s;
+ while (isdigit((unsigned char)*s)) ++s;
if (*s == NUL) return (1);
}
int c;
cinc = 0;
- for (c = *cptr; IS_IDENT(c); c = *++cptr)
+ for (c = (unsigned char)*cptr; IS_IDENT(c); c = (unsigned char)*++cptr)
cachec(c);
cachec(NUL);
int n;
n = 0;
- for (c = *cptr; isdigit(c); c = *++cptr)
+ for (c = (unsigned char)*cptr; isdigit(c); c = (unsigned char)*++cptr)
n = 10*n + (c - '0');
return (n);
illegal_tag(t_lineno, t_line, t_cptr);
cinc = 0;
- do { cachec(c); c = *++cptr; } while (IS_IDENT(c));
+ do { cachec(c); c = (unsigned char)*++cptr; } while (IS_IDENT(c));
cachec(NUL);
c = nextc();
* Stay away from nextc - doesn't
* detect EOL and will read to EOF.
*/
- c = *++cptr;
+ c = (unsigned char)*++cptr;
if (c == EOF) unexpected_EOF();
for (;;)
}
else
{
- c = *++cptr;
+ c = (unsigned char)*++cptr;
if (c == EOF) unexpected_EOF();
}
}
bucket *bp;
int s_lineno = lineno;
- c = *cptr;
+ c = (unsigned char)*cptr;
if (c == '\'' || c == '"')
bp = get_literal();
else
depth = 0;
loop:
- c = *cptr;
+ c = (unsigned char)*cptr;
if (c == '$')
{
if (cptr[1] == '<')
++cptr;
tag = get_tag();
- c = *cptr;
+ c = (unsigned char)*cptr;
if (c == '$')
{
fprintf(f, "yyval.%s", tag);
free(d_line);
goto loop;
}
- else if (c == '-' && isdigit(cptr[1]))
+ else if (c == '-' && isdigit((unsigned char)cptr[1]))
{
++cptr;
i = -get_number() - n;
cptr += 2;
goto loop;
}
- else if (isdigit(cptr[1]))
+ else if (isdigit((unsigned char)cptr[1]))
{
++cptr;
i = get_number();
do
{
putc(c, f);
- c = *++cptr;
+ c = (unsigned char)*++cptr;
} while (isalnum(c) || c == '_' || c == '$');
goto loop;
}
quote = c;
for (;;)
{
- c = *cptr++;
+ c = (unsigned char)*cptr++;
putc(c, f);
if (c == quote)
{
unterminated_string(s_lineno, s_line, s_cptr);
if (c == '\\')
{
- c = *cptr++;
+ c = (unsigned char)*cptr++;
putc(c, f);
if (c == '\n')
{
}
case '/':
- c = *cptr;
+ c = (unsigned char)*cptr;
if (c == '/')
{
putc('*', f);
- while ((c = *++cptr) != '\n')
+ while ((c = (unsigned char)*++cptr) != '\n')
{
if (c == '*' && cptr[1] == '/')
fprintf(f, "* ");
++cptr;
for (;;)
{
- c = *cptr++;
+ c = (unsigned char)*cptr++;
putc(c, f);
if (c == '*' && *cptr == '/')
{
int c;
bucket *bp = NULL;
- c = cptr[1];
+ c = (unsigned char)cptr[1];
if (c == '%' || c == '\\')
{
cptr += 2;
((c = cptr[2]) == 'r' || c == 'R') &&
((c = cptr[3]) == 'e' || c == 'E') &&
((c = cptr[4]) == 'c' || c == 'C') &&
- ((c = cptr[5], !IS_IDENT(c))))
+ ((c = (unsigned char)cptr[5], !IS_IDENT(c))))
cptr += 5;
else
syntax_error(lineno, line, cptr);