Fix clang warning 'expression with side effects'

This commit is contained in:
Mathias Gumz 2015-01-03 21:36:35 +01:00
parent fb7bc7380d
commit 60e97b968b
2 changed files with 14 additions and 9 deletions

View file

@ -303,8 +303,9 @@ void ShowClientMenuCmd::execute() {
FocusControl::Focusables::const_iterator it = list->clientList().begin(), FocusControl::Focusables::const_iterator it = list->clientList().begin(),
it_end = list->clientList().end(); it_end = list->clientList().end();
for (; it != it_end; ++it) { for (; it != it_end; ++it) {
if (typeid(**it) == typeid(FluxboxWindow) && m_pat.match(**it)) Focusable* f = *it;
m_list.push_back(static_cast<FluxboxWindow *>(*it)); if (typeid(*f) == typeid(FluxboxWindow) && m_pat.match(*f))
m_list.push_back(static_cast<FluxboxWindow *>(f));
} }
m_menu.reset(new ClientMenu(*screen, m_list, m_menu.reset(new ClientMenu(*screen, m_list,
@ -572,8 +573,9 @@ void ClientPatternTestCmd::execute() {
wit_end = windows->clientList().end(); wit_end = windows->clientList().end();
for ( ; wit != wit_end; wit++) { for ( ; wit != wit_end; wit++) {
if (typeid(**wit) == typeid(FluxboxWindow) && cp->match(**wit)) { Focusable* f = *wit;
matches.push_back(static_cast<const FluxboxWindow*>(*wit)); if (typeid(*f) == typeid(FluxboxWindow) && cp->match(*f)) {
matches.push_back(static_cast<const FluxboxWindow*>(f));
} }
} }
} }

View file

@ -86,12 +86,15 @@ void WindowListCmd::execute() {
// save old value, so we can restore it later // save old value, so we can restore it later
WinClient *old = WindowCmd<void>::client(); WinClient *old = WindowCmd<void>::client();
for (; it != it_end; ++it) { for (; it != it_end; ++it) {
if (typeid(**it) == typeid(FluxboxWindow)) Focusable* wptr = *it;
WindowCmd<void>::setWindow((*it)->fbwindow()); if (typeid(*wptr) == typeid(FluxboxWindow)) {
else if (typeid(**it) == typeid(WinClient)) WindowCmd<void>::setWindow((wptr)->fbwindow());
WindowCmd<void>::setClient(dynamic_cast<WinClient *>(*it)); } else if (typeid(*wptr) == typeid(WinClient)) {
if (!m_filter || m_filter->execute()) WindowCmd<void>::setClient(dynamic_cast<WinClient *>(wptr));
}
if (!m_filter || m_filter->execute()) {
m_cmd->execute(); m_cmd->execute();
}
} }
WindowCmd<void>::setClient(old); WindowCmd<void>::setClient(old);
} }