From 73da1fd9ff3e316dca3367a013f41b2488ac4081 Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Tue, 7 Sep 2010 12:45:07 +0200 Subject: QDataStream doesn't check return values from QIODevice::write QDataStream does not check values from QIODevice::write and QIODevice::read since it cannot decide what to do in case of errors or less data written or read. The fix for this is to fix the documentation for QIODevice::writeData and QIODevice::readData to make sure implementations write and read all the requested data. Task-number: QTBUG-13108 Reviewed-by: David Boddie --- src/corelib/io/qiodevice.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 26e587d..8544fba 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1633,6 +1633,12 @@ QString QIODevice::errorString() const This function is called by QIODevice. Reimplement this function when creating a subclass of QIODevice. + When reimplementing this function it is important that this function + reads all the required data before returning. This is required in order + for QDataStream to be able to operate on the class. QDataStream assumes + all the requested information was read and therefore does not retry reading + if there was a problem. + \sa read() readLine() writeData() */ @@ -1645,6 +1651,12 @@ QString QIODevice::errorString() const This function is called by QIODevice. Reimplement this function when creating a subclass of QIODevice. + When reimplementing this function it is important that this function + writes all the data available before returning. This is required in order + for QDataStream to be able to operate on the class. QDataStream assumes + all the information was written and therefore does not retry writing if + there was a problem. + \sa read() write() */ -- cgit v0.12