Pārlūkot izejas kodu

cmLex.c: Fixed bug where a '-' with no following digits was interpretted as a integer.

master
kevin 11 gadus atpakaļ
vecāks
revīzija
18fc1b0a12
1 mainītis faili ar 5 papildinājumiem un 1 dzēšanām
  1. 5
    1
      cmLex.c

+ 5
- 1
cmLex.c Parādīt failu

@@ -200,10 +200,14 @@ unsigned _cmLexRealMatcher(  cmLex* p, const cmChar_t* cp, unsigned cn, const cm
200 200
 unsigned _cmLexIntMatcher(   cmLex* p, const cmChar_t* cp, unsigned cn, const cmChar_t* keyStr )
201 201
 {
202 202
   unsigned i = 0;
203
+  bool signFl = false;
203 204
   for(; i<cn; ++i)
204 205
   {
205 206
     if( i==0 && cp[i]=='-' )
207
+    {
208
+      signFl = true;
206 209
       continue;
210
+    }
207 211
 
208 212
     if( !isdigit(cp[i]) )
209 213
       break;
@@ -220,7 +224,7 @@ unsigned _cmLexIntMatcher(   cmLex* p, const cmChar_t* cp, unsigned cn, const cm
220 224
   // containing a decimal point as reals. 
221 225
  
222 226
 
223
-  return i;
227
+  return signFl && i==1 ? 0 : i;
224 228
 }
225 229
 
226 230
 unsigned _cmLexHexMatcher(   cmLex* p, const cmChar_t* cp, unsigned cn, const cmChar_t* keyStr )

Notiek ielāde…
Atcelt
Saglabāt