From f859e78cb24cf69cc06e4395c58d804537f301c7 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
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<bool>(name() + ".focusNewWindows"),
             saverc_cmd));
-    } catch (FbTk::ResourceException e) {
+    } catch (FbTk::ResourceException & e) {
         cerr<<e.what()<<endl;
     }
 
diff --git a/src/ScreenPlacement.cc b/src/ScreenPlacement.cc
index 73ddfa2..29c8b5f 100644
--- a/src/ScreenPlacement.cc
+++ b/src/ScreenPlacement.cc
@@ -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 
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 =  "<<replaceme<<endl;
         cerr<<"newstr   =  "<<newstr<<endl;
-    } catch (std::exception e) {
+    } catch (std::exception & e) {
         cerr<<"exception: "<<e.what()<<endl;
     }
     cerr<<"Testing stringtok."<<endl;	
diff --git a/util/fbrun/main.cc b/util/fbrun/main.cc
index edb88ff..af059d6 100644
--- a/util/fbrun/main.cc
+++ b/util/fbrun/main.cc
@@ -227,7 +227,7 @@ int main(int argc, char **argv) {
 
         application.eventLoop();
 
-    } catch (string errstr) {
+    } catch (string & errstr) {
         cerr<<"Error: "<<errstr<<endl;
     }
 }
diff --git a/util/fbsetroot.cc b/util/fbsetroot.cc
index 71ff34d..4e7981f 100644
--- a/util/fbsetroot.cc
+++ b/util/fbsetroot.cc
@@ -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;
     }
-- 
cgit v0.11.2