some minor bug fixes

This commit is contained in:
ceriel
1986-12-01 10:06:53 +00:00
parent ad40a77afd
commit c57d4ff268
15 changed files with 165 additions and 106 deletions

View File

@@ -411,8 +411,20 @@ again1:
/* Fall through */
case End:
*np++ = '\0';
tk->TOK_INT = str2long(&buf[1], base);
*np = '\0';
if (np >= &buf[NUMSIZE]) {
tk->TOK_INT = 1;
lexerror("constant too long");
}
else {
np = &buf[1];
while (*np == '0') np++;
tk->TOK_INT = str2long(np, base);
if (strlen(np) > 14 /* ??? */ ||
tk->TOK_INT < 0) {
lexwarning(W_ORDINARY, "overflow in constant");
}
}
if (ch == 'C' && base == 8) {
toktype = char_type;
if (tk->TOK_INT<0 || tk->TOK_INT>255) {