From f859e78cb24cf69cc06e4395c58d804537f301c7 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Wed, 2 Nov 2011 13:33:37 -0400 Subject: Exceptions should be caught by reference. Found using cppcheck. --- src/Screen.cc | 2 +- src/ScreenPlacement.cc | 2 +- src/main.cc | 2 +- src/tests/StringUtiltest.cc | 2 +- util/fbrun/main.cc | 2 +- util/fbsetroot.cc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index 86799da..309ee0d 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -1548,7 +1548,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { "Focus New Windows", "Focus newly created windows"), m_resource_manager.getResource(name() + ".focusNewWindows"), saverc_cmd)); - } catch (FbTk::ResourceException e) { + } catch (FbTk::ResourceException & e) { cerr<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 diff --git a/src/main.cc b/src/main.cc index 8aea835..2afef3f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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; diff --git a/src/tests/StringUtiltest.cc b/src/tests/StringUtiltest.cc index a8d8d57..b723eef 100644 --- a/src/tests/StringUtiltest.cc +++ b/src/tests/StringUtiltest.cc @@ -137,7 +137,7 @@ int main() { cerr<<"original = "<