From 08b4abe1ba64d8a945c6a5a1a3cf01df1b8d6c88 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Mon, 21 Jun 2021 15:33:52 +0300 Subject: [PATCH] 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 --- src/corelib/io/qwindowspipereader.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp index 4d2f008eebd..b417b4fd502 100644 --- a/src/corelib/io/qwindowspipereader.cpp +++ b/src/corelib/io/qwindowspipereader.cpp @@ -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 }