printf("%p \tread 0x%hhx (%c) returning 1 (shortcut)\n", this,
int(c), isprint(c) ? c : '?');
#endif
+ if (d->buffer.isEmpty())
+ readData(data, 0);
return qint64(1);
}
}
*d->pPos += lastReadChunkSize;
readSoFar += lastReadChunkSize;
// fast exit when satisfied by buffer
- if (lastReadChunkSize == maxSize && !(d->openMode & Text))
+ if (lastReadChunkSize == maxSize && !(d->openMode & Text)) {
+ if (d->buffer.isEmpty())
+ readData(data, 0);
return readSoFar;
+ }
data += lastReadChunkSize;
maxSize -= lastReadChunkSize;
int(readSoFar), int(d->pos), d->buffer.size());
debugBinaryString(data - readSoFar, readSoFar);
#endif
+
+ if (d->buffer.isEmpty())
+ readData(data, 0);
+
return readSoFar;
}
qint64 readSoFar = 0;
if (!d->buffer.isEmpty()) {
readSoFar = d->buffer.readLine(data, maxSize);
+ if (d->buffer.isEmpty())
+ readData(data,0);
if (!sequential)
d->pos += readSoFar;
#if defined QIODEVICE_DEBUG
all the requested information was read and therefore does not retry reading
if there was a problem.
+ This function will be called with maxSize 0 when the device is
+ buffered and the buffer was emptied by a call to read().
+
\sa read(), readLine(), writeData()
*/
{
Q_D(QAbstractSocket);
+ // Check if the read notifier can be enabled again.
+ if (d->socketEngine && !d->socketEngine->isReadNotificationEnabled() && d->socketEngine->isValid())
+ d->socketEngine->setReadNotificationEnabled(true);
+
+ if (!maxSize)
+ return 0;
+
// This is for a buffered QTcpSocket
if (d->isBuffered && d->buffer.isEmpty())
// if we're still connected, return 0 indicating there may be more data in the future