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

Peter Kümmel syntheticpp at gmx.net
Sun Oct 14 12:03:18 UTC 2012


SVN commit 1320479 by kuemmel:

FileBuffer: ::resize()  also checks size()

 M  +2 -4      asciidatareader.cpp  
 M  +0 -1      asciifilebuffer.h  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciidatareader.cpp #1320478:1320479
@@ -98,15 +98,13 @@
       return 0;
   } else {
     bytesToRead = qMin(bytesToRead, maximalBytes);
-    if (buffer.size() <= bytesToRead) {
-      if (!buffer.resize(bytesToRead + 1))
+    if (!buffer.resize(bytesToRead + 1)) {
         return 0;
     }
   }
   file.seek(start); // expensive?
   int bytesRead = file.read(buffer.data(), bytesToRead);
-  if (buffer.size() <= bytesRead) {
-    if (!buffer.resize(bytesToRead + 1))
+  if (!buffer.resize(bytesToRead + 1)) {
       return 0;
   }
   buffer.data()[bytesRead] = '\0';
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciifilebuffer.h #1320478:1320479
@@ -39,7 +39,6 @@
   int _bufferedS;
   int _bufferedN;
 
-  inline int size() const { return _array->size(); }
   inline char* data() { return _array->data(); }
 
   inline const char* const constPointer() const { return _array->data(); }


More information about the Kst mailing list