From aa42c517097cb707add9812cb75daa95dc459a82 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sat, 28 Nov 2020 22:25:22 -0330 Subject: [PATCH] Fix gcc warning: use const references instead of pass by value for exceptions. --- src/common/JoyMap.cxx | 2 +- src/common/KeyMap.cxx | 2 +- src/common/PJoystickHandler.cxx | 2 +- src/common/PKeyboardHandler.cxx | 4 ++-- src/common/PhysicalJoystick.cxx | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/JoyMap.cxx b/src/common/JoyMap.cxx index 6b8c95b42..f62385160 100644 --- a/src/common/JoyMap.cxx +++ b/src/common/JoyMap.cxx @@ -240,7 +240,7 @@ int JoyMap::loadMapping(const json& eventMappings, const EventMode mode) ); i++; - } catch (json::exception) { + } catch (const json::exception&) { Logger::error("ignoring invalid joystick event"); } } diff --git a/src/common/KeyMap.cxx b/src/common/KeyMap.cxx index 2e493b331..de0ee2383 100644 --- a/src/common/KeyMap.cxx +++ b/src/common/KeyMap.cxx @@ -208,7 +208,7 @@ int KeyMap::loadMapping(const json& mappings, const EventMode mode) { ); i++; - } catch (json::exception) { + } catch (const json::exception&) { Logger::error("ignoring bad keyboard mapping"); } } diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx index e38fbf813..3b41cf854 100644 --- a/src/common/PJoystickHandler.cxx +++ b/src/common/PJoystickHandler.cxx @@ -47,7 +47,7 @@ PhysicalJoystickHandler::PhysicalJoystickHandler( try { mappings = json::parse(serializedMapping); - } catch (json::exception) { + } catch (const json::exception&) { Logger::info("converting legacy joystick mappings"); mappings = convertLegacyMapping(serializedMapping); diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index 6b60ae914..5f3091aae 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -74,7 +74,7 @@ void PhysicalKeyboardHandler::loadSerializedMappings(const string& serializedMap try { mapping = json::parse(serializedMapping); - } catch (json::exception) { + } catch (const json::exception&) { Logger::info("converting legacy keyboard mappings"); mapping = KeyMap::convertLegacyMapping(serializedMapping); @@ -82,7 +82,7 @@ void PhysicalKeyboardHandler::loadSerializedMappings(const string& serializedMap try { myKeyMap.loadMapping(mapping, mode); - } catch (json::exception) { + } catch (const json::exception&) { Logger::error("ignoring bad keyboard mappings"); } } diff --git a/src/common/PhysicalJoystick.cxx b/src/common/PhysicalJoystick.cxx index 488d1f318..8cbb6a8d8 100644 --- a/src/common/PhysicalJoystick.cxx +++ b/src/common/PhysicalJoystick.cxx @@ -87,7 +87,7 @@ bool PhysicalJoystick::setMap(const json& map) try { joyMap.loadMapping(entry.value(), eventModeFromJsonName(entry.key())); - } catch (json::exception) { + } catch (const json::exception&) { Logger::error("ignoring invalid json mapping for " + entry.key()); }