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

Peter Kümmel syntheticpp at gmx.net
Tue Oct 16 14:48:05 UTC 2012


SVN commit 1320710 by kuemmel:

use a default value for chunk size

 M  +5 -4      asciifilebuffer.cpp  
 M  +2 -1      asciifilebuffer.h  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciifilebuffer.cpp #1320709:1320710
@@ -23,7 +23,9 @@
 extern size_t maxAllocate;
 
 //-------------------------------------------------------------------------------------------
-AsciiFileBuffer::AsciiFileBuffer() : _file(0), _begin(-1), _bytesRead(0)
+AsciiFileBuffer::AsciiFileBuffer() : 
+  _file(0), _begin(-1), _bytesRead(0),
+  _defaultChunkSize(qMin((size_t) 10 * MB, maxAllocate))
 {
 }
 
@@ -141,7 +143,7 @@
   }
 
   // reading whole file into one array failed, try to read into smaller arrays
-  int chunkSize = qMin((size_t) 10 * MB, maxAllocate);
+  int chunkSize = _defaultChunkSize;
   _fileData = splitFile(chunkSize, rowIndex, start, bytesToRead);
   _bytesRead = 0;
   foreach (AsciiFileData chunk, _fileData) {
@@ -170,8 +172,7 @@
   if (!_file)
     return;
 
-  int chunkSize = qMin((size_t) 10 * MB, maxAllocate);
-  chunkSize = 2 * MB;
+  int chunkSize = _defaultChunkSize;
   _fileData = splitFile(chunkSize, rowIndex, start, bytesToRead);
   _bytesRead = 0;
   AsciiFileData master;
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciifilebuffer.h #1320709:1320710
@@ -16,8 +16,8 @@
 #include "asciifiledata.h"
 
 #include <QVector>
+#include <stdlib.h>
 
-
 class AsciiFileBuffer
 {
 public:
@@ -44,6 +44,7 @@
   QVector<AsciiFileData> _fileData;
   int _begin;
   int _bytesRead;
+  const int _defaultChunkSize;
 
   void logData(const QVector<AsciiFileData>& chunks) const;
   const QVector<AsciiFileData> splitFile(int chunkSize, const RowIndex& rowIndex, int start, int bytesToRead) const;


More information about the Kst mailing list