From db67550db3f68fa825b7feb38fafbe4a0a33647d Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Wed, 6 Aug 2025 22:22:06 -0400 Subject: [PATCH] refactor: server: use contains when possible --- src/lib/server/Server.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index 9c0f26e99..9da6e3e44 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -800,10 +800,10 @@ bool Server::isSwitchOkay( // are we in a locked corner? first check if screen has the option set // and, if not, check the global options. const Config::ScreenOptions *options = m_config->getOptions(getName(m_active)); - if (options == nullptr || options->count(kOptionScreenSwitchCorners) == 0) { + if (options == nullptr || !options->contains(kOptionScreenSwitchCorners)) { options = m_config->getOptions(""); } - if (options != nullptr && options->count(kOptionScreenSwitchCorners) > 0) { + if (options != nullptr && options->contains(kOptionScreenSwitchCorners)) { // get corner mask and size Config::ScreenOptions::const_iterator i = options->find(kOptionScreenSwitchCorners); auto corners = static_cast(i->second); @@ -1129,7 +1129,7 @@ void Server::processOptions() void Server::handleShapeChanged(BaseClientProxy *client) { - if (m_clientSet.count(client) == 0) { + if (!m_clientSet.contains(client)) { return; } @@ -1164,7 +1164,7 @@ void Server::handleClipboardGrabbed(const Event &event, BaseClientProxy *grabber } // ignore events from unknown clients - if (m_clientSet.count(grabber) == 0) { + if (!m_clientSet.contains(grabber)) { return; } const auto *info = static_cast(event.getData()); @@ -1850,7 +1850,7 @@ void Server::onMouseWheel(int32_t xDelta, int32_t yDelta) bool Server::addClient(BaseClientProxy *client) { std::string name = getName(client); - if (m_clients.count(name) != 0) { + if (m_clients.contains(name)) { return false; }