Sfoglia il codice sorgente

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

master
kevin 11 anni fa
parent
commit
18fc1b0a12
1 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. 5
    1
      cmLex.c

+ 5
- 1
cmLex.c Vedi File

@@ -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 )

Loading…
Annulla
Salva