瀏覽代碼

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

master
kevin 11 年之前
父節點
當前提交
18fc1b0a12
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5
    1
      cmLex.c

+ 5
- 1
cmLex.c 查看文件

200
 unsigned _cmLexIntMatcher(   cmLex* p, const cmChar_t* cp, unsigned cn, const cmChar_t* keyStr )
200
 unsigned _cmLexIntMatcher(   cmLex* p, const cmChar_t* cp, unsigned cn, const cmChar_t* keyStr )
201
 {
201
 {
202
   unsigned i = 0;
202
   unsigned i = 0;
203
+  bool signFl = false;
203
   for(; i<cn; ++i)
204
   for(; i<cn; ++i)
204
   {
205
   {
205
     if( i==0 && cp[i]=='-' )
206
     if( i==0 && cp[i]=='-' )
207
+    {
208
+      signFl = true;
206
       continue;
209
       continue;
210
+    }
207
 
211
 
208
     if( !isdigit(cp[i]) )
212
     if( !isdigit(cp[i]) )
209
       break;
213
       break;
220
   // containing a decimal point as reals. 
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
 unsigned _cmLexHexMatcher(   cmLex* p, const cmChar_t* cp, unsigned cn, const cmChar_t* keyStr )
230
 unsigned _cmLexHexMatcher(   cmLex* p, const cmChar_t* cp, unsigned cn, const cmChar_t* keyStr )

Loading…
取消
儲存