diff options
author | Michael Meskes <meskes@postgresql.org> | 2001-04-02 08:17:24 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2001-04-02 08:17:24 +0000 |
commit | e6851f056a8f8f87dd17f3559f77a53f9526cf72 (patch) | |
tree | e3073a7d96bd867fb4b32ad72689c0af3b59ff2f /src/interfaces/ecpg/preproc/pgc.l | |
parent | ba8b844f5afd661379bad00c1969c14f12cdb068 (diff) |
Synced pgc.l with scan.l.
Diffstat (limited to 'src/interfaces/ecpg/preproc/pgc.l')
-rw-r--r-- | src/interfaces/ecpg/preproc/pgc.l | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index e8896e3cc60..6c05ccf32e5 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -12,7 +12,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.77 2001/02/21 18:53:47 tgl Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.78 2001/04/02 08:17:24 meskes Exp $ * *------------------------------------------------------------------------- */ @@ -335,13 +335,20 @@ cppline {space}*#(.*\\{line_end})*.* startlit(); } <xh>{xhstop} { + long val; char* endptr; BEGIN(SQL); errno = 0; - yylval.ival = strtol(literalbuf, &endptr, 16); - if (*endptr != '\0' || errno == ERANGE) + val = strtol(literalbuf, &endptr, 16); + if (*endptr != '\0' || errno == ERANGE +#ifdef HAVE_LONG_INT_64 + /* if long > 32 bits, check for overflow of int4 */ + || val != (long) ((int32) val) +#endif + ) mmerror(ET_ERROR, "Bad hexadecimal integer input"); + yylval.ival = val; return ICONST; } @@ -498,16 +505,23 @@ cppline {space}*#(.*\\{line_end})*.* return PARAM; } <C,SQL>{integer} { + long val; char* endptr; errno = 0; - yylval.ival = strtol((char *)yytext, &endptr,10); - if (*endptr != '\0' || errno == ERANGE) + val = strtol((char *)yytext, &endptr,10); + if (*endptr != '\0' || errno == ERANGE +#ifdef HAVE_LONG_INT_64 + /* if long > 32 bits, check for overflow of int4 */ + || val != (long) ((int32) val) +#endif + ) { errno = 0; yylval.str = mm_strdup((char*)yytext); return FCONST; } + yylval.ival = val; return ICONST; } <SQL>{ip} { |