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>bb10
parent
14d1097f45
commit
5c5e4582d6
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue