summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-02-17 12:21:54 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2021-02-18 11:21:49 +0100
commita54177cb940dc1d11d1591621edfe3ed42b0d778 (patch)
treec1e99ae49d206ba61a24da31a5505393bd5c83f4 /src
parent94b9ee03b5646bf58c12337bbc44e38265ad15a2 (diff)
Remove redundant invalid socket check
It happens after the same socket check has lead to an early return. Prompted by a PVS-studio article. Change-Id: I63b42abed9102df73d29e6ff8a89a475751d4b91 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp8
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp8
2 files changed, 6 insertions, 10 deletions
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index a39b345d30..a817bb8300 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@@ -312,10 +312,8 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
#endif
socketDescriptor = socket;
- if (socket != -1) {
- this->socketProtocol = socketProtocol;
- this->socketType = socketType;
- }
+ this->socketProtocol = socketProtocol;
+ this->socketType = socketType;
return true;
}
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index 35422a1e80..9fcf5fbf16 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@@ -426,10 +426,8 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
sendmsg = 0;
socketDescriptor = socket;
- if (socket != INVALID_SOCKET) {
- this->socketProtocol = socketProtocol;
- this->socketType = socketType;
- }
+ this->socketProtocol = socketProtocol;
+ this->socketType = socketType;
// Make the socket nonblocking.
if (!setOption(QAbstractSocketEngine::NonBlockingSocketOption, 1)) {