0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Fixes parsing larger numbers on 64bit platforms.

This commit is contained in:
Ondrej Zajicek 2011-12-22 13:44:43 +01:00
parent be4cd99a36
commit c32c3f88f0

View File

@ -129,10 +129,10 @@ include ^{WHITE}*include{WHITE}*\".*\"{WHITE}*;
0x{XIGIT}+ { 0x{XIGIT}+ {
char *e; char *e;
long int l; unsigned long int l;
errno = 0; errno = 0;
l = strtoul(yytext+2, &e, 16); l = strtoul(yytext+2, &e, 16);
if (e && *e || errno == ERANGE || (long int)(int) l != l) if (e && *e || errno == ERANGE || (unsigned long int)(unsigned int) l != l)
cf_error("Number out of range"); cf_error("Number out of range");
cf_lval.i = l; cf_lval.i = l;
return NUM; return NUM;
@ -140,10 +140,10 @@ include ^{WHITE}*include{WHITE}*\".*\"{WHITE}*;
{DIGIT}+ { {DIGIT}+ {
char *e; char *e;
long int l; unsigned long int l;
errno = 0; errno = 0;
l = strtoul(yytext, &e, 10); l = strtoul(yytext, &e, 10);
if (e && *e || errno == ERANGE || (long int)(int) l != l) if (e && *e || errno == ERANGE || (unsigned long int)(unsigned int) l != l)
cf_error("Number out of range"); cf_error("Number out of range");
cf_lval.i = l; cf_lval.i = l;
return NUM; return NUM;