Bläddra i källkod

cmCsv.c Included some input file line numbers in some error message.

master
kevin 11 år sedan
förälder
incheckning
36430c0d0a
1 ändrade filer med 7 tillägg och 4 borttagningar
  1. 7
    4
      cmCsv.c

+ 7
- 4
cmCsv.c Visa fil

330
 
330
 
331
   // allocate cell memory
331
   // allocate cell memory
332
   if(( cp = cmLHeapAllocZ(p->heapH, sizeof(cmCsvCell_t) )) == NULL )
332
   if(( cp = cmLHeapAllocZ(p->heapH, sizeof(cmCsvCell_t) )) == NULL )
333
-    return _cmCsvError(p,kMemAllocErrCsvRC,"Cell allocation failed. for row: %i column %i.",cellRow,cellCol);
333
+    return _cmCsvError(p,kMemAllocErrCsvRC,"Cell allocation failed. for row: %i column %i.",cellRow+1,cellCol+1);
334
 
334
 
335
   cp->row   = cellRow;
335
   cp->row   = cellRow;
336
   cp->col   = cellCol;
336
   cp->col   = cellCol;
482
         {
482
         {
483
           const cmCsvUdef_t* u;
483
           const cmCsvUdef_t* u;
484
           if((u = _cmCsvFindUdef(p,lexTId)) == NULL )
484
           if((u = _cmCsvFindUdef(p,lexTId)) == NULL )
485
-            rc = _cmCsvError(p, kSyntaxErrCsvRC, "Unrecognized token type: '%s' for token: '%s'.",cmLexIdToLabel(p->lexH,lexTId),buf);
485
+            rc = _cmCsvError(p, kSyntaxErrCsvRC, "Unrecognized token type: '%s' for token: '%s' row:%i col:%i.",cmLexIdToLabel(p->lexH,lexTId),buf,csvRowIdx+1,csvColIdx+1);
486
           else
486
           else
487
             flags = kStrCsvTFl | kUdefCsvTFl;            
487
             flags = kStrCsvTFl | kUdefCsvTFl;            
488
         }
488
         }
490
 
490
 
491
     // if no error occurred and the token is not a comma  and the cell is not empty
491
     // if no error occurred and the token is not a comma  and the cell is not empty
492
     if( rc == kOkCsvRC && lexTId != kCommaLexTId && strlen(buf) > 0 )
492
     if( rc == kOkCsvRC && lexTId != kCommaLexTId && strlen(buf) > 0 )
493
-      rc = _cmCsvCreateCell( p, buf,flags, csvRowIdx, csvColIdx, lexTId );
493
+      if((rc = _cmCsvCreateCell( p, buf,flags, csvRowIdx, csvColIdx, lexTId )) != kOkCsvRC )
494
+        rc = _cmCsvError(p,rc,"CSV cell create fail on row:%i col:%i\n",csvRowIdx+1,csvColIdx+1);
494
   }
495
   }
495
 
496
 
496
- 
497
+  if( lexTId == kErrorLexTId )
498
+    rc = _cmCsvError(p, kSyntaxErrCsvRC,"The lexer encountered an unrecognized token row:%i col:%i.",csvRowIdx+1,csvColIdx+1);
499
+
497
   return rc;
500
   return rc;
498
 }
501
 }
499
 
502
 

Laddar…
Avbryt
Spara