summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2021-09-18 18:11:09 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2021-09-21 11:07:12 +0300
commitb362279e86149529001d33bb2082944ab9cd0cb9 (patch)
treeef6536dbc82299f9b8742ca181859500a9c8b7d9 /src/corelib/io
parent66b1b8064224824e7fff4022daa27f53acecc7ae (diff)
Refactor QWindowsPipeWriter::writeCompleted()
Change-Id: Id44215d6a96e7841330181c94cc54b6b677a153d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qwindowspipewriter.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp
index 3024742d34..2d96a3d87d 100644
--- a/src/corelib/io/qwindowspipewriter.cpp
+++ b/src/corelib/io/qwindowspipewriter.cpp
@@ -250,15 +250,12 @@ void QWindowsPipeWriter::waitCallback(PTP_CALLBACK_INSTANCE instance, PVOID cont
*/
bool QWindowsPipeWriter::writeCompleted(DWORD errorCode, DWORD numberOfBytesWritten)
{
- if (errorCode == ERROR_SUCCESS) {
+ switch (errorCode) {
+ case ERROR_SUCCESS:
bytesWrittenPending = true;
pendingBytesWrittenValue += numberOfBytesWritten;
writeBuffer.free(numberOfBytesWritten);
return true;
- }
-
- lastError = errorCode;
- switch (errorCode) {
case ERROR_PIPE_NOT_CONNECTED: // the other end has closed the pipe
case ERROR_OPERATION_ABORTED: // the operation was canceled
case ERROR_NO_DATA: // the pipe is being closed
@@ -267,8 +264,10 @@ bool QWindowsPipeWriter::writeCompleted(DWORD errorCode, DWORD numberOfBytesWrit
qErrnoWarning(errorCode, "QWindowsPipeWriter: write failed.");
break;
}
+
// The buffer is not cleared here, because the write progress
// should appear on the main thread synchronously.
+ lastError = errorCode;
return false;
}