From e798d0b18acfb6756a614aec3e7b4bcb1ef5ff58 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 21 Nov 2016 12:55:54 +0100 Subject: [PATCH] qnativesocketengine_winrt - do not shadow a variable We first hide identifier 'hr' and then later we check the one that was never correctly initialized. Task-number: QTBUG-57226 Change-Id: Ibbf1bb99aa752c2e4090caf4533dc5f5b71b5e41 Reviewed-by: Oliver Wolff --- src/network/socket/qnativesocketengine_winrt.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index 32fafc2cb0..934c8fe785 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -252,19 +252,18 @@ bool QNativeSocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket:: // Start processing incoming data if (d->socketType == QAbstractSocket::TcpSocket) { - HRESULT hr; - QEventDispatcherWinRT::runOnXamlThread([d, &hr, socket, this]() { + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d, socket, this]() { ComPtr buffer; HRESULT hr = g->bufferFactory->Create(READ_BUFFER_SIZE, &buffer); - RETURN_OK_IF_FAILED("initialize(): Could not create buffer"); + RETURN_HR_IF_FAILED("initialize(): Could not create buffer"); ComPtr stream; hr = socket->get_InputStream(&stream); - RETURN_OK_IF_FAILED("initialize(): Could not obtain input stream"); + RETURN_HR_IF_FAILED("initialize(): Could not obtain input stream"); hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, d->readOp.GetAddressOf()); - RETURN_OK_IF_FAILED_WITH_ARGS("initialize(): Failed to read from the socket buffer (%s).", + RETURN_HR_IF_FAILED_WITH_ARGS("initialize(): Failed to read from the socket buffer (%s).", socketDescription(this).constData()); hr = d->readOp->put_Completed(Callback(d, &QNativeSocketEnginePrivate::handleReadyRead).Get()); - RETURN_OK_IF_FAILED_WITH_ARGS("initialize(): Failed to set socket read callback (%s).", + RETURN_HR_IF_FAILED_WITH_ARGS("initialize(): Failed to set socket read callback (%s).", socketDescription(this).constData()); return S_OK; });