cmLex.c : Fixed bug in _cmLexIntMatcher().

This commit is contained in:
Kevin Larke 2015-11-12 12:39:40 -05:00
parent 0c9f02d130
commit e0d5b50a64

View File

@ -238,7 +238,8 @@ unsigned _cmLexIntMatcher( cmLex* p, const cmChar_t* cp, unsigned cn, const cm
{ {
unsigned i = 0; unsigned i = 0;
bool signFl = false; bool signFl = false;
unsigned digitCnt = 0;
for(; i<cn; ++i) for(; i<cn; ++i)
{ {
if( i==0 && cp[i]=='-' ) if( i==0 && cp[i]=='-' )
@ -249,6 +250,8 @@ unsigned _cmLexIntMatcher( cmLex* p, const cmChar_t* cp, unsigned cn, const cm
if( !isdigit(cp[i]) ) if( !isdigit(cp[i]) )
break; break;
++digitCnt;
} }
// BUG BUG BUG // BUG BUG BUG
@ -262,7 +265,7 @@ unsigned _cmLexIntMatcher( cmLex* p, const cmChar_t* cp, unsigned cn, const cm
// containing a decimal point as reals. // containing a decimal point as reals.
// if no integer was found // if no integer was found
if( (signFl && i==0) || i==0 ) if( digitCnt==0)
return 0; return 0;