[Kst] branches/work/kst/portto4/kst/src/datasources/ascii

Peter Kümmel syntheticpp at gmx.net
Mon Aug 30 19:12:58 CEST 2010


SVN commit 1170065 by kuemmel:

msvc debug is allergic against negative char values

 M  +4 -4      asciisource.cpp  
 M  +3 -2      kst_atof.cpp  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1170064:1170065
@@ -283,7 +283,7 @@
         if (comment && comment < &(tmpbuf[i])) {
           comment = strpbrk(&(tmpbuf[i]), del);
         }
-      } else if (!is_comment && !isspace(tmpbuf[i])) {  
+      } else if (!is_comment && !isspace((unsigned char)tmpbuf[i])) {  
         // FIXME: this breaks custom delimiters
         has_dat = true;
       }
@@ -383,7 +383,7 @@
             incol = true;
             ++i_col;
             if (i_col == col) {
-              if (isdigit(_tmpBuffer[ch]) || _tmpBuffer[ch] == '-' || _tmpBuffer[ch] == '.' || _tmpBuffer[ch] == '+') {
+              if (isdigit((unsigned char)_tmpBuffer[ch]) || _tmpBuffer[ch] == '-' || _tmpBuffer[ch] == '.' || _tmpBuffer[ch] == '+') {
                 v[i] = lexc.toDouble(&_tmpBuffer[0] + ch);
               } else if (ch + 2 < bufread && tolower(_tmpBuffer[ch]) == 'i' &&
                   tolower(_tmpBuffer[ch + 1]) == 'n' && tolower(_tmpBuffer[ch + 2]) == 'f') {
@@ -403,7 +403,7 @@
 
       v[i] = Kst::NOPOINT;
       for (int ch = _rowIndex[s] - bufstart; ch < bufread; ++ch) {
-        if (isspace(_tmpBuffer[ch])) {
+        if (isspace((unsigned char)_tmpBuffer[ch])) {
           if (_tmpBuffer[ch] == '\n' || _tmpBuffer[ch] == '\r') {
             break;
           } else {
@@ -416,7 +416,7 @@
             incol = true;
             ++i_col;
             if (i_col == col) {
-              if (isdigit(_tmpBuffer[ch]) || _tmpBuffer[ch] == '-' || _tmpBuffer[ch] == '.' || _tmpBuffer[ch] == '+') {
+              if (isdigit((unsigned char)_tmpBuffer[ch]) || _tmpBuffer[ch] == '-' || _tmpBuffer[ch] == '.' || _tmpBuffer[ch] == '+') {
                 v[i] = lexc.toDouble(&_tmpBuffer[0] + ch);
               } else if (ch + 2 < bufread && tolower(_tmpBuffer[ch]) == 'i' &&
                   tolower(_tmpBuffer[ch + 1]) == 'n' && tolower(_tmpBuffer[ch + 2]) == 'f') {
--- branches/work/kst/portto4/kst/src/datasources/ascii/kst_atof.cpp #1170064:1170065
@@ -13,9 +13,10 @@
 
 
 #ifdef KST_USE_KST_ATOF
-double LexicalCast::toDouble(const char* p) const
+double LexicalCast::toDouble(const char* signedp) const
 {
-	int c;
+	unsigned char* p = (unsigned char*)signedp;
+	unsigned char c;
 	double fl, flexp, exp5;
 	double big = 72057594037927936.;  /*2^56*/
 	int nd;


More information about the Kst mailing list