QWindowsPipeReader::read(): remove redundant checks

An initial EOF check is not required here because the code below
correctly handles this case. Also, the condition '!pipeBroken' means
that the pipe reader is in the 'Running' state.

Change-Id: I608d932c4e38f8224d9e655272e61295e55414e0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
This commit is contained in:
Alex Trotsenko 2021-06-21 15:33:52 +03:00
parent 991b64a7e5
commit 08b4abe1ba

View File

@ -186,9 +186,6 @@ qint64 QWindowsPipeReader::bytesAvailable() const
*/
qint64 QWindowsPipeReader::read(char *data, qint64 maxlen)
{
if (pipeBroken && actualReadBufferSize == 0)
return 0; // signal EOF
mutex.lock();
qint64 readSoFar;
// If startAsyncRead() has read data, copy it to its destination.
@ -203,8 +200,7 @@ qint64 QWindowsPipeReader::read(char *data, qint64 maxlen)
mutex.unlock();
if (!pipeBroken) {
if (state == Running)
startAsyncRead();
startAsyncRead();
if (readSoFar == 0)
return -2; // signal EWOULDBLOCK
}