[QTextStream::read.*] Return earlier when nothing has been read

There is no any sense in detecting the encoding of an empty string ;)

Change-Id: I1c7af07bd7c3e7e7cf67421a2cb3a1123ca57650
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
bb10
Konstantin Ritt 2015-05-01 07:56:18 +04:00
parent 315b359bc1
commit 985e7d8094
1 changed files with 3 additions and 3 deletions

View File

@ -447,6 +447,9 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes)
bytesRead = device->read(buf, sizeof(buf));
}
if (bytesRead <= 0)
return false;
#ifndef QT_NO_TEXTCODEC
// codec auto detection, explicitly defaults to locale encoding if the
// codec has been set to 0.
@ -470,9 +473,6 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes)
qt_prettyDebug(buf, qMin(32,int(bytesRead)) , int(bytesRead)).constData(), int(sizeof(buf)), int(bytesRead));
#endif
if (bytesRead <= 0)
return false;
int oldReadBufferSize = readBuffer.size();
#ifndef QT_NO_TEXTCODEC
// convert to unicode