diff --git a/src/lib/arch/unix/ArchNetworkBSD.cpp b/src/lib/arch/unix/ArchNetworkBSD.cpp index 992cbcf70..ed468ab7f 100644 --- a/src/lib/arch/unix/ArchNetworkBSD.cpp +++ b/src/lib/arch/unix/ArchNetworkBSD.cpp @@ -166,10 +166,8 @@ void ArchNetworkBSD::closeSocketForRead(ArchSocket s) { assert(s != nullptr); - if (shutdown(s->m_fd, 0) == -1) { - if (errno != ENOTCONN) { - throwError(errno); - } + if ((shutdown(s->m_fd, 0) == -1) && (errno != ENOTCONN)) { + throwError(errno); } } @@ -177,10 +175,8 @@ void ArchNetworkBSD::closeSocketForWrite(ArchSocket s) { assert(s != nullptr); - if (shutdown(s->m_fd, 1) == -1) { - if (errno != ENOTCONN) { - throwError(errno); - } + if ((shutdown(s->m_fd, 1) == -1) && (errno != ENOTCONN)) { + throwError(errno); } } diff --git a/src/lib/deskflow/App.cpp b/src/lib/deskflow/App.cpp index be51a5875..9976f9e0f 100644 --- a/src/lib/deskflow/App.cpp +++ b/src/lib/deskflow/App.cpp @@ -134,13 +134,11 @@ void App::setupFileLogging() void App::loggingFilterWarning() const { - if (CLOG->getFilter() > CLOG->getConsoleMaxLevel()) { - if (argsBase().m_logFile == nullptr) { - LOG( - (CLOG_WARN "log messages above %s are NOT sent to console (use file logging)", - CLOG->getFilterName(CLOG->getConsoleMaxLevel())) - ); - } + if ((CLOG->getFilter() > CLOG->getConsoleMaxLevel()) && (argsBase().m_logFile == nullptr)) { + LOG( + (CLOG_WARN "log messages above %s are NOT sent to console (use file logging)", + CLOG->getFilterName(CLOG->getConsoleMaxLevel())) + ); } } diff --git a/src/lib/net/FingerprintDatabase.cpp b/src/lib/net/FingerprintDatabase.cpp index 22762b541..3a3337d33 100644 --- a/src/lib/net/FingerprintDatabase.cpp +++ b/src/lib/net/FingerprintDatabase.cpp @@ -25,15 +25,11 @@ void FingerprintDatabase::readStream(QTextStream &in) if (!in.device() && !in.string()) return; - if (in.device()) { - if (!in.device()->isReadable()) - return; - } + if (in.device() && !in.device()->isReadable()) + return; - if (in.string()) { - if (in.string()->isEmpty()) - return; - } + if (in.string() && in.string()->isEmpty()) + return; QString line; while (!in.atEnd()) { @@ -63,10 +59,8 @@ bool FingerprintDatabase::writeStream(QTextStream &out) if (!out.device() && !out.string()) return false; - if (out.device()) { - if (!out.device()->isWritable()) - return false; - } + if (out.device() && !out.device()->isWritable()) + return false; for (const auto &fingerprint : std::as_const(m_fingerprints)) { out << fingerprint.toDbLine() << "\n"; diff --git a/src/lib/net/SecureSocket.cpp b/src/lib/net/SecureSocket.cpp index 815812a85..0fbdb9923 100644 --- a/src/lib/net/SecureSocket.cpp +++ b/src/lib/net/SecureSocket.cpp @@ -443,12 +443,10 @@ int SecureSocket::secureAccept(int socket) // If not fatal and no retry, state is good if (retry == 0) { - if (m_securityLevel == SecurityLevel::PeerAuth) { - if (!verifyCertFingerprint(Settings::tlsTrustedClientsDb())) { - retry = 0; - disconnect(); - return -1; // Fail - } + if (m_securityLevel == SecurityLevel::PeerAuth && !verifyCertFingerprint(Settings::tlsTrustedClientsDb())) { + retry = 0; + disconnect(); + return -1; // Fail } m_secureReady = true; LOG((CLOG_INFO "accepted secure socket")); diff --git a/src/lib/net/SocketMultiplexer.cpp b/src/lib/net/SocketMultiplexer.cpp index dc9beb80e..1f9fa8e27 100644 --- a/src/lib/net/SocketMultiplexer.cpp +++ b/src/lib/net/SocketMultiplexer.cpp @@ -108,12 +108,10 @@ void SocketMultiplexer::removeSocket(ISocket *socket) // remove job. rather than removing it from the map we put nullptr // in the list instead so the order of jobs in the list continues // to match the order of jobs in pfds in serviceThread(). - if (SocketJobMap::iterator i = m_socketJobMap.find(socket); i != m_socketJobMap.end()) { - if (*(i->second) != nullptr) { - delete *(i->second); - *(i->second) = nullptr; - m_update = true; - } + if (SocketJobMap::iterator i = m_socketJobMap.find(socket); i != m_socketJobMap.end() && (*(i->second) != nullptr)) { + delete *(i->second); + *(i->second) = nullptr; + m_update = true; } // unlock the job list diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp index 445b85bfa..840eba012 100644 --- a/src/lib/platform/XWindowsScreen.cpp +++ b/src/lib/platform/XWindowsScreen.cpp @@ -1050,10 +1050,8 @@ void XWindowsScreen::openIM() XIMStyle style = 0; for (unsigned short i = 0; i < styles->count_styles; ++i) { style = styles->supported_styles[i]; - if ((style & XIMPreeditNothing) != 0) { - if ((style & (XIMStatusNothing | XIMStatusNone)) != 0) { - break; - } + if (((style & XIMPreeditNothing) != 0) && ((style & (XIMStatusNothing | XIMStatusNone)) != 0)) { + break; } } XFree(styles); @@ -1148,11 +1146,8 @@ void XWindowsScreen::handleSystemEvent(const Event &event, void *) // this is a hot key onHotKey(xevent->xkey, isRepeat); return; - } else if (!m_isOnScreen) { - // this might be a hot key - if (onHotKey(xevent->xkey, isRepeat)) { - return; - } + } else if (!m_isOnScreen && onHotKey(xevent->xkey, isRepeat)) { + return; } bool down = (isRepeat || xevent->type == KeyPress); diff --git a/src/lib/platform/XWindowsScreenSaver.cpp b/src/lib/platform/XWindowsScreenSaver.cpp index fe4d838ee..bbcd90cdd 100644 --- a/src/lib/platform/XWindowsScreenSaver.cpp +++ b/src/lib/platform/XWindowsScreenSaver.cpp @@ -65,11 +65,9 @@ XWindowsScreenSaver::XWindowsScreenSaver(Display *display, Window window, void * #if HAVE_X11_EXTENSIONS_DPMS_H int eventBase; int errorBase; - if (DPMSQueryExtension(m_display, &eventBase, &errorBase)) { - if (DPMSCapable(m_display)) { - // we have DPMS - m_dpms = true; - } + if (DPMSQueryExtension(m_display, &eventBase, &errorBase) && DPMSCapable(m_display)) { + // we have DPMS + m_dpms = true; } #endif @@ -159,11 +157,9 @@ bool XWindowsScreenSaver::handleXEvent(const XEvent *xevent) break; case PropertyNotify: - if (xevent->xproperty.state == PropertyNewValue) { - if (isXScreenSaver(xevent->xproperty.window)) { - // found the xscreensaver - setXScreenSaver(xevent->xcreatewindow.window); - } + if (xevent->xproperty.state == PropertyNewValue && isXScreenSaver(xevent->xproperty.window)) { + // found the xscreensaver + setXScreenSaver(xevent->xcreatewindow.window); } break;