summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qtextstream.cpp
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2014-11-05 12:38:02 +0200
committerAlex Trotsenko <alex1973tr@gmail.com>2014-12-13 09:37:26 +0100
commit5c5e4582d60ce38868e838bced73f52febec5841 (patch)
treea91849cbd0fb435a27e980f788f6f08e450f5434 /src/corelib/io/qtextstream.cpp
parent14d1097f4577edab86c67090d5c20853f404d0ce (diff)
QTextStreamPrivate::scan(): remove unnecessary checks
The delimiter search scan() loop detects a device or string reaching the end of input and size limits. After that, 'false' is returned only when no data was read at all. So, there is no a reason to test anything except 'totalSize'. Change-Id: Ib9cc21c0f4b7863c2dafb1bb074c5cda07387b8f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qtextstream.cpp')
-rw-r--r--src/corelib/io/qtextstream.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 730329d21d..5f3177e58f 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -681,15 +681,9 @@ bool QTextStreamPrivate::scan(const QChar **ptr, int *length, int maxlen, TokenD
&& (!maxlen || totalSize < maxlen)
&& (device && (canStillReadFromDevice = fillReadBuffer())));
- // if the token was not found, but we reached the end of input,
- // then we accept what we got. if we are not at the end of input,
- // we return false.
- if (!foundToken && (!maxlen || totalSize < maxlen)
- && (totalSize == 0
- || (string && stringOffset + totalSize < string->size())
- || (device && !device->atEnd() && canStillReadFromDevice))) {
+ if (totalSize == 0) {
#if defined (QTEXTSTREAM_DEBUG)
- qDebug("QTextStreamPrivate::scan() did not find the token.");
+ qDebug("QTextStreamPrivate::scan() reached the end of input.");
#endif
return false;
}