Exceptions should be caught by reference.

Found using cppcheck.
This commit is contained in:
Ryan Pavlik 2011-11-02 13:33:37 -04:00 committed by Mathias Gumz
parent db08329d8b
commit f859e78cb2
6 changed files with 6 additions and 6 deletions

View file

@ -1548,7 +1548,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
"Focus New Windows", "Focus newly created windows"),
m_resource_manager.getResource<bool>(name() + ".focusNewWindows"),
saverc_cmd));
} catch (FbTk::ResourceException e) {
} catch (FbTk::ResourceException & e) {
cerr<<e.what()<<endl;
}

View file

@ -99,7 +99,7 @@ bool ScreenPlacement::placeWindow(const FluxboxWindow &win, int head,
bool placed = false;
try {
placed = m_strategy->placeWindow(win, head, place_x, place_y);
} catch (std::bad_cast cast) {
} catch (std::bad_cast & cast) {
// This should not happen.
// If for some reason we change the PlacementStrategy in Screen
// from ScreenPlacement to something else then we might get

View file

@ -511,7 +511,7 @@ int main(int argc, char **argv) {
<< _FB_CONSOLETEXT(main, ErrorStandardException, "Standard Exception", "Error message")
<< ": "
<< e.what() << endl;
} catch (string error_str) {
} catch (string & error_str) {
cerr << _FB_CONSOLETEXT(Common, Error, "Error", "Error message header")
<< ": "
<< error_str << endl;

View file

@ -137,7 +137,7 @@ int main() {
cerr<<"original = "<<replaceme<<endl;
cerr<<"newstr = "<<newstr<<endl;
} catch (std::exception e) {
} catch (std::exception & e) {
cerr<<"exception: "<<e.what()<<endl;
}
cerr<<"Testing stringtok."<<endl;

View file

@ -227,7 +227,7 @@ int main(int argc, char **argv) {
application.eventLoop();
} catch (string errstr) {
} catch (string & errstr) {
cerr<<"Error: "<<errstr<<endl;
}
}

View file

@ -407,7 +407,7 @@ int main(int argc, char **argv) {
try {
fbsetroot app(argc, argv, display_name);
} catch (string error_str) {
} catch (string & error_str) {
_FB_USES_NLS;
cerr<<_FB_CONSOLETEXT(Common, Error, "Error", "Error message header")<<": "<<error_str<<endl;
}