From 60e97b968bcd712762c7ee30e350d63e4038fb63 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Sat, 3 Jan 2015 21:36:35 +0100 Subject: [PATCH] Fix clang warning 'expression with side effects' --- src/FbCommands.cc | 10 ++++++---- src/WorkspaceCmd.cc | 13 ++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/FbCommands.cc b/src/FbCommands.cc index c8cf4aed..10d98e74 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc @@ -303,8 +303,9 @@ void ShowClientMenuCmd::execute() { FocusControl::Focusables::const_iterator it = list->clientList().begin(), it_end = list->clientList().end(); for (; it != it_end; ++it) { - if (typeid(**it) == typeid(FluxboxWindow) && m_pat.match(**it)) - m_list.push_back(static_cast(*it)); + Focusable* f = *it; + if (typeid(*f) == typeid(FluxboxWindow) && m_pat.match(*f)) + m_list.push_back(static_cast(f)); } m_menu.reset(new ClientMenu(*screen, m_list, @@ -572,8 +573,9 @@ void ClientPatternTestCmd::execute() { wit_end = windows->clientList().end(); for ( ; wit != wit_end; wit++) { - if (typeid(**wit) == typeid(FluxboxWindow) && cp->match(**wit)) { - matches.push_back(static_cast(*wit)); + Focusable* f = *wit; + if (typeid(*f) == typeid(FluxboxWindow) && cp->match(*f)) { + matches.push_back(static_cast(f)); } } } diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index 2af6b2f8..45985681 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc @@ -86,12 +86,15 @@ void WindowListCmd::execute() { // save old value, so we can restore it later WinClient *old = WindowCmd::client(); for (; it != it_end; ++it) { - if (typeid(**it) == typeid(FluxboxWindow)) - WindowCmd::setWindow((*it)->fbwindow()); - else if (typeid(**it) == typeid(WinClient)) - WindowCmd::setClient(dynamic_cast(*it)); - if (!m_filter || m_filter->execute()) + Focusable* wptr = *it; + if (typeid(*wptr) == typeid(FluxboxWindow)) { + WindowCmd::setWindow((wptr)->fbwindow()); + } else if (typeid(*wptr) == typeid(WinClient)) { + WindowCmd::setClient(dynamic_cast(wptr)); + } + if (!m_filter || m_filter->execute()) { m_cmd->execute(); + } } WindowCmd::setClient(old); }