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

Peter Kümmel syntheticpp at gmx.net
Sun Jun 2 06:55:49 UTC 2013


SVN commit 1356772 by kuemmel:

fixed sized column reading could start at any row when threads are used.

 M  +3 -4      asciidatareader.cpp  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciidatareader.cpp #1356771:1356772
@@ -220,11 +220,10 @@
   if (_config._columnType == AsciiSourceConfig::Fixed) {
     //MeasureTime t("AsciiSource::readField: same width for all columns");
     const LexicalCast& lexc = LexicalCast::instance();
-    // &buffer[0] points to first row at _rowIndex[0] , so if we wanna find
-    // the column in row i by adding _rowIndex[i] we have to start at:
-    const char*const col_start = &buf.checkedData()[0] - _rowIndex[0] + _config._columnWidth * (col - 1);
+    // buf[0] points to some row start, _rowIndex[i] is absolute, so we have to substract buf.begin().
+    const char*const col_start = &buf.checkedData()[0] + _config._columnWidth * (col - 1) - buf.begin();
     for (int i = 0; i < n; ++i) {
-      v[i] = lexc.toDouble(_rowIndex[i] + col_start);
+      v[i] = lexc.toDouble(col_start + _rowIndex[i + s] );
     }
     return n;
   } else if (_config._columnType == AsciiSourceConfig::Custom) {


More information about the Kst mailing list