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

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


SVN commit 1320480 by kuemmel:

set null at the end of read bytes

this fixes a bug in case of reading bytes different to the argument

coding sytle

 M  +2 -4      asciidatareader.cpp  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciidatareader.cpp #1320479:1320480
@@ -98,15 +98,13 @@
       return 0;
   } else {
     bytesToRead = qMin(bytesToRead, maximalBytes);
-    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.resize(bytesToRead + 1)) {
+  if (!buffer.resize(bytesRead + 1))
     return 0;
-  }
   buffer.data()[bytesRead] = '\0';
   return bytesRead;
 }


More information about the Kst mailing list