all repos — fluxbox @ 5ae8bdf49db36b2691ce545e3285f9ee64f92148

custom fork of the fluxbox windowmanager

Pre-increment non-primitive types.

Found with cppcheck:
"Prefix ++/-- operators should be preferred for non-primitive
types. Pre-increment/decrement can be more efficient than
post-increment/decrement. Post-increment/decrement usually
involves keeping a copy of the previous value around and adds
a little extra code."
Ryan Pavlik rpavlik@iastate.edu
commit

5ae8bdf49db36b2691ce545e3285f9ee64f92148

parent

f859e78cb24cf69cc06e4395c58d804537f301c7

M src/FbCommands.ccsrc/FbCommands.cc

@@ -512,7 +512,7 @@ switch(m_mode) {

case ALL: case ALLWORKSPACE: - for(; it != itend; it++) { + for(; it != itend; ++it) { old_workspace_num= (*it)->workspaceNumber(); if (m_mode == ALL || old_workspace_num == workspace_num || (*it)->isStuck()) {

@@ -526,7 +526,7 @@

case LAST: case LASTWORKSPACE: default: - for (; it != itend; it++) { + for (; it != itend; ++it) { old_workspace_num= (*it)->workspaceNumber(); if(m_mode == LAST || old_workspace_num == workspace_num || (*it)->isStuck()) {
M src/FbTk/Font.ccsrc/FbTk/Font.cc

@@ -117,7 +117,7 @@ for (fit = font_cache.begin(); fit != font_cache.end(); fit++) {

FontImp* font = fit->second; if (font) { FontCacheIt it; - for (it = fit; it != font_cache.end(); it++) + for (it = fit; it != font_cache.end(); ++it) if (it->second == font) it->second = 0; delete font;

@@ -181,7 +181,7 @@ StringList names;

FbTk::StringUtil::stringtok<StringList>(names, name, "|"); StringListIt name_it; - for (name_it = names.begin(); name_it != names.end(); name_it++) { + for (name_it = names.begin(); name_it != names.end(); ++name_it) { FbTk::StringUtil::removeTrailingWhitespace(*name_it); FbTk::StringUtil::removeFirstWhitespace(*name_it);
M src/FbTk/ImageImlib2.ccsrc/FbTk/ImageImlib2.cc

@@ -36,7 +36,7 @@ ~ScreenImlibContextContainer() {

std::map<int, Imlib_Context>::iterator it = this->begin(); std::map<int, Imlib_Context>::iterator it_end = this->end(); - for (; it != it_end; it++) { + for (; it != it_end; ++it) { imlib_context_free(it->second); }
M src/FbTk/Menu.ccsrc/FbTk/Menu.cc

@@ -1361,7 +1361,7 @@ Menuitems::iterator it = vec.begin();

m_type_ahead.reset(); m_matches.clear(); - for (; it != vec.end(); it++) + for (; it != vec.end(); ++it) clearItem((*it)->getIndex(), true, 1); }
M src/FbTk/STLUtil.hhsrc/FbTk/STLUtil.hh

@@ -85,7 +85,7 @@ F forAllIf(C& c, I i, F f) {

typedef typename C::iterator iterator; iterator it = c.begin(); iterator end = c.end(); - for (; it != end; it++) { + for (; it != end; ++it) { if (i(*it)) f(*it); }
M src/FbTk/Timer.ccsrc/FbTk/Timer.cc

@@ -189,7 +189,7 @@ if (now.tv_sec < last_time) {

time_t delta = last_time - now.tv_sec; - for (it = m_timerlist.begin(); it != m_timerlist.end(); it++) { + for (it = m_timerlist.begin(); it != m_timerlist.end(); ++it) { (*it)->m_start.tv_sec -= delta; } }
M src/FbTk/TypeAhead.hhsrc/FbTk/TypeAhead.hh

@@ -113,7 +113,7 @@ std::string m_searchstr;

Items const *m_ref; // reference to vector we are operating on void fillValues(BaseItems const &search, Items &fillin) const { - for (BaseItemscIt it = search.begin(); it != search.end(); it++) { + for (BaseItemscIt it = search.begin(); it != search.end(); ++it) { Item_Type tmp = dynamic_cast<Item_Type>(*it); if (tmp) fillin.push_back(tmp);

@@ -153,7 +153,7 @@

// iteration based on original list of items void doSearch(char to_test, Items const &items, SearchResult &mySearchResult) const { - for (ItemscIt it = items.begin(); it != items.end(); it++) { + for (ItemscIt it = items.begin(); it != items.end(); ++it) { if ((*it)->iTypeCompareChar(to_test, stringSize()) && (*it)->isEnabled()) mySearchResult.add(*it); }

@@ -162,7 +162,7 @@

// iteration based on last SearchResult void doSearch(char to_test, BaseItems const &search, SearchResult &mySearchResult) const { - for (BaseItemscIt it = search.begin(); it != search.end(); it++) { + for (BaseItemscIt it = search.begin(); it != search.end(); ++it) { if ((*it)->iTypeCompareChar(to_test, stringSize()) && (*it)->isEnabled()) mySearchResult.add(*it); }
M src/FocusableList.ccsrc/FocusableList.cc

@@ -169,7 +169,7 @@ Focusables::const_iterator p_it = list.begin(), p_it_end = list.end();

Focusables::iterator our_it = m_list.begin(), our_it_end = m_list.end(); // walk through our list looking for corresponding entries in // parent's list, until we find the window that moved - for (; our_it != our_it_end && p_it != p_it_end; p_it++) { + for (; our_it != our_it_end && p_it != p_it_end; ++p_it) { if (*p_it == &win) { if (*our_it == &win) // win didn't move in our list return false;
M src/Keys.ccsrc/Keys.cc

@@ -146,7 +146,7 @@ int context_, bool isdouble_) {

// t_key ctor sets context_ of 0 to GLOBAL, so we must here too context_ = context_ ? context_ : GLOBAL; keylist_t::iterator it = keylist.begin(), it_end = keylist.end(); - for (; it != it_end; it++) { + for (; it != it_end; ++it) { if (*it && (*it)->type == type_ && (*it)->key == key_ && ((*it)->context & context_) > 0 && isdouble_ == (*it)->isdouble && (*it)->mod ==
M src/Remember.ccsrc/Remember.cc

@@ -240,7 +240,7 @@ string escaped_str;

escaped_str.reserve(str.capacity()); string::const_iterator i; - for (i = str.begin(); i != str.end(); i++) { + for (i = str.begin(); i != str.end(); ++i) { switch (*i) { case '(': case ')': case '[': case ']': escaped_str += '\\';

@@ -671,7 +671,7 @@ if (wc_it != m_clients.end())

return wc_it->second; else { Patterns::iterator it = m_pats->begin(); - for (; it != m_pats->end(); it++) + for (; it != m_pats->end(); ++it) if (it->first->match(winclient) && it->second->is_transient == winclient.isTransient()) { it->first->addMatch();

@@ -893,7 +893,7 @@ apps_file << endl;

Patterns::iterator git = m_pats->begin(); Patterns::iterator git_end = m_pats->end(); - for (; git != git_end; git++) { + for (; git != git_end; ++git) { if (git->second == &a) { apps_file << (a.is_transient ? " [transient]" : " [app]") << git->first->toString()<<endl;

@@ -1389,7 +1389,7 @@ Application *app = find(winclient);

if (app) { Patterns::iterator it = m_pats->begin(); - for (; it != m_pats->end(); it++) { + for (; it != m_pats->end(); ++it) { if (it->second == app) { it->first->removeMatch(); break;
M src/Screen.ccsrc/Screen.cc

@@ -1981,9 +1981,9 @@ void BScreen::clearHeads() {

if (!hasXinerama()) return; for (Workspaces::iterator i = m_workspaces_list.begin(); - i != m_workspaces_list.end(); i++) { + i != m_workspaces_list.end(); ++i) { for (Workspace::Windows::iterator win = (*i)->windowList().begin(); - win != (*i)->windowList().end(); win++) { + win != (*i)->windowList().end(); ++win) { FluxboxWindow& w = *(*win);
M src/Slit.ccsrc/Slit.cc

@@ -879,7 +879,7 @@ return;

} SlitClients::iterator it = m_client_list.begin(); - for(it++; it != m_client_list.end(); it++) { + for(++it; it != m_client_list.end(); ++it) { if ((*it) == client) { SlitClients::iterator prev = it; prev--;

@@ -900,7 +900,7 @@ return;

} SlitClients::reverse_iterator it = m_client_list.rbegin(); - for(it++; it != m_client_list.rend(); it++) { + for(++it; it != m_client_list.rend(); ++it) { if ((*it) == client) { SlitClients::reverse_iterator next = it; next--;
M src/Window.ccsrc/Window.cc

@@ -1345,7 +1345,7 @@ for (; client_it != client_it_end; ++client_it) {

WinClient &client = *(*client_it); WinClient::TransientList::iterator it = client.transientList().begin(); WinClient::TransientList::iterator it_end = client.transientList().end(); - for (; it != it_end; it++) + for (; it != it_end; ++it) if ((*it)->fbwindow()) (*it)->fbwindow()->iconify(); }

@@ -2966,7 +2966,7 @@ Workspace::Windows::iterator it = wins.begin();

Workspace::Windows::iterator it_end = wins.end(); unsigned int bw; - for (; it != it_end; it++) { + for (; it != it_end; ++it) { if ((*it) == this) continue; // skip myself
M src/WorkspaceCmd.ccsrc/WorkspaceCmd.cc

@@ -393,7 +393,7 @@ Workspace::Windows::iterator win;

Workspace::Windows normal_windows; Workspace::Windows shaded_windows; - for(win = space->windowList().begin(); win != space->windowList().end(); win++) { + for(win = space->windowList().begin(); win != space->windowList().end(); ++win) { int winhead = screen->getHead((*win)->fbWindow()); if ((winhead == head || winhead == 0) && m_pat.match(**win)) { if ((*win)->isShaded())

@@ -430,7 +430,7 @@ // place the shaded windows

// TODO: until i resolve the shadedwindow->moveResize() issue to place // them in the same columns as the normal windows i just place the shaded // windows unchanged ontop of the current head - for (i = 0, win = shaded_windows.begin(); win != shaded_windows.end(); win++, i++) { + for (i = 0, win = shaded_windows.begin(); win != shaded_windows.end(); ++win, ++i) { if (i & 1) (*win)->move(x_offs, y_offs); else

@@ -449,7 +449,7 @@ const unsigned int cal_height = max_height/rows; // height ratio (height of every window)

// Resizes and sets windows positions in columns and rows. for (i = 0; i < rows; ++i) { x_offs = screen->maxLeft(head); - for (j = 0; j < cols && normal_windows.size() > 0; ++j) { + for (j = 0; j < cols && !normal_windows.empty(); ++j) { int cell_center_x = x_offs + (x_offs + cal_width) / 2;

@@ -457,7 +457,7 @@ int cell_center_y = y_offs + (y_offs + cal_height) / 2;

unsigned int closest_dist = ~0; Workspace::Windows::iterator closest = normal_windows.end(); - for (win = normal_windows.begin(); win != normal_windows.end(); win++) { + for (win = normal_windows.begin(); win != normal_windows.end(); ++win) { int win_center_x = (*win)->frame().x() + ((*win)->frame().x() + (*win)->frame().width() / 2); int win_center_y = (*win)->frame().y() + ((*win)->frame().y() + (*win)->frame().height() / 2);

@@ -519,7 +519,7 @@ if (count == 0) {

BScreen::Icons icon_list = screen->iconList(); BScreen::Icons::reverse_iterator iconit = icon_list.rbegin(); BScreen::Icons::reverse_iterator itend= icon_list.rend(); - for(; iconit != itend; iconit++) { + for(; iconit != itend; ++iconit) { if ((*iconit)->workspaceNumber() == space || (*iconit)->isStuck()) (*iconit)->deiconify(false); }
M src/WorkspaceNameTool.ccsrc/WorkspaceNameTool.cc

@@ -88,7 +88,7 @@ unsigned int max_size = 0;

const BScreen::Workspaces& workspaces = m_screen.getWorkspacesList(); BScreen::Workspaces::const_iterator it; - for (it = workspaces.begin(); it != workspaces.end(); it++) { + for (it = workspaces.begin(); it != workspaces.end(); ++it) { max_size = std::max(m_theme->font().textWidth((*it)->name()), max_size); } // so align text dont cut the last character

@@ -104,7 +104,7 @@

unsigned int max_size = 0; const BScreen::Workspaces& workspaces = m_screen.getWorkspacesList(); BScreen::Workspaces::const_iterator it; - for (it = workspaces.begin(); it != workspaces.end(); it++) { + for (it = workspaces.begin(); it != workspaces.end(); ++it) { max_size = std::max(m_theme->font().textWidth((*it)->name()), max_size); } // so align text dont cut the last character
M src/fluxbox.ccsrc/fluxbox.cc

@@ -382,7 +382,7 @@ vector<int> scrtmp;

int scrnr = 0; FbTk::StringUtil::stringtok(vals, m_argv[i], ",:"); for (vector<string>::iterator scrit = vals.begin(); - scrit != vals.end(); scrit++) { + scrit != vals.end(); ++scrit) { scrnr = atoi(scrit->c_str()); if (scrnr >= 0 && scrnr < ScreenCount(disp)) scrtmp.push_back(scrnr);

@@ -711,7 +711,7 @@ break;

// most of them are handled in FluxboxWindow::handleEvent // but some special cases like ewmh propertys needs to be checked for (AtomHandlerContainerIt it= m_atomhandler.begin(); - it != m_atomhandler.end(); it++) { + it != m_atomhandler.end(); ++it) { if ( (*it)->propertyNotify(*winclient, e->xproperty.atom)) break; }

@@ -880,7 +880,7 @@ BScreen *screen = searchScreen(ce.window);

// note: we dont need screen nor winclient to be non-null, // it's up to the atomhandler to check that for (AtomHandlerContainerIt it= m_atomhandler.begin(); - it != m_atomhandler.end(); it++) { + it != m_atomhandler.end(); ++it) { (*it)->checkClientMessage(ce, screen, winclient); }

@@ -1042,7 +1042,7 @@ AtomHandler* Fluxbox::getAtomHandler(const string &name) {

if ( name != "" ) { AtomHandlerContainerIt it; - for (it = m_atomhandler.begin(); it != m_atomhandler.end(); it++) { + for (it = m_atomhandler.begin(); it != m_atomhandler.end(); ++it) { if (name == (*it)->getName()) return *it; }

@@ -1258,7 +1258,7 @@ StringUtil::removeTrailingWhitespace(values);

StringUtil::removeFirstWhitespace(values); StringUtil::stringtok<BScreen::WorkspaceNames>(names, values, ","); BScreen::WorkspaceNames::iterator it; - for(it = names.begin(); it != names.end(); it++) { + for(it = names.begin(); it != names.end(); ++it) { if (!(*it).empty() && (*it) != "") screen.addWorkspaceName((*it).c_str()); }

@@ -1385,7 +1385,7 @@ FluxboxWindow* win,

WinClient* client) { for (AtomHandlerContainerIt it= m_atomhandler.begin(); - it != m_atomhandler.end(); it++) { + it != m_atomhandler.end(); ++it) { (*it)->updateFocusedWindow(screen, client ? client->window() : 0 ); } }