diff options
Diffstat (limited to 'src/corelib/io/qwindowspipereader.cpp')
-rw-r--r-- | src/corelib/io/qwindowspipereader.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp index b93fed5ba8..3055fb392e 100644 --- a/src/corelib/io/qwindowspipereader.cpp +++ b/src/corelib/io/qwindowspipereader.cpp @@ -132,17 +132,8 @@ qint64 QWindowsPipeReader::read(char *data, qint64 maxlen) actualReadBufferSize--; readSoFar = 1; } else { - qint64 bytesToRead = qMin(actualReadBufferSize, maxlen); - readSoFar = 0; - while (readSoFar < bytesToRead) { - const char *ptr = readBuffer.readPointer(); - qint64 bytesToReadFromThisBlock = qMin(bytesToRead - readSoFar, - readBuffer.nextDataBlockSize()); - memcpy(data + readSoFar, ptr, bytesToReadFromThisBlock); - readSoFar += bytesToReadFromThisBlock; - readBuffer.free(bytesToReadFromThisBlock); - actualReadBufferSize -= bytesToReadFromThisBlock; - } + readSoFar = readBuffer.read(data, qMin(actualReadBufferSize, maxlen)); + actualReadBufferSize -= readSoFar; } if (!pipeBroken) { @@ -184,7 +175,7 @@ void QWindowsPipeReader::notified(DWORD errorCode, DWORD numberOfBytesRead) case ERROR_OPERATION_ABORTED: if (stopped) break; - // fall through + Q_FALLTHROUGH(); default: emit winError(errorCode, QLatin1String("QWindowsPipeReader::notified")); pipeBroken = true; |