summaryrefslogtreecommitdiff
path: root/src/corelib/io
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-11-16 12:36:48 +0100
committerJoão Abecasis <joao@abecasis.name>2009-11-17 14:00:37 +0100
commit6f5fb0be85b1d7cc9f93b615b5034c882e946301 (patch)
treeb18d08550ce8a5b39fb20e3b3ea91afcb45ad3af /src/corelib/io
parent1e6180c1de906864d2d6d73a9e18ed67574d4ed8 (diff)
downloadqt4-tools-6f5fb0be85b1d7cc9f93b615b5034c882e946301.tar.gz
There should only be one write buffer at a time in QFile
To be sure, we should explicitly use the size of that buffer and not the whole QRingBuffer when flushing the data. With this change, we make violations of the one-buffer-rule explicitly fail on flush(), but we avoid corrupting data and reading past the buffer's end. Reviewed-by: Markus Goetz
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qfile.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index c9b26032ea..d4077bcb23 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -1339,7 +1339,7 @@ QFile::setPermissions(const QString &fileName, Permissions permissions)
static inline qint64 _qfile_writeData(QAbstractFileEngine *engine, QRingBuffer *buffer)
{
- qint64 ret = engine->write(buffer->readPointer(), buffer->size());
+ qint64 ret = engine->write(buffer->readPointer(), buffer->nextDataBlockSize());
if (ret > 0)
buffer->free(ret);
return ret;