Exceptions should be caught by reference. Found using cppcheck.
Ryan Pavlik rpavlik@iastate.edu
6 files changed,
6 insertions(+),
6 deletions(-)
M
src/Screen.cc
→
src/Screen.cc
@@ -1548,7 +1548,7 @@ focus_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, FocusNew,
"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; }
M
src/ScreenPlacement.cc
→
src/ScreenPlacement.cc
@@ -99,7 +99,7 @@
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
M
src/main.cc
→
src/main.cc
@@ -511,7 +511,7 @@ cerr << "Fluxbox: "
<< _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;
M
src/tests/StringUtiltest.cc
→
src/tests/StringUtiltest.cc
@@ -137,7 +137,7 @@ newstr = StringUtil::replaceString(newstr, "be", "not be");
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;
M
util/fbrun/main.cc
→
util/fbrun/main.cc
@@ -227,7 +227,7 @@ fbrun.show();
application.eventLoop(); - } catch (string errstr) { + } catch (string & errstr) { cerr<<"Error: "<<errstr<<endl; } }
M
util/fbsetroot.cc
→
util/fbsetroot.cc
@@ -407,7 +407,7 @@ }
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; }