From dc5404a3c262616a522a8437bacadd4bffebc01c Mon Sep 17 00:00:00 2001 From: James Hogan Date: Wed, 3 Nov 2021 22:18:36 +0000 Subject: [PATCH] FGButton: Make init()'s "module" parameter const FGButton::init() passes the module parameter (a non-const string reference) straight through to FGCommonInput::read_bindings() as a const reference. Change the FGButton::init() signature so that module is const there too, so that callers can pass it const string references returned by accessors without having to make copies. --- src/Input/FGButton.cxx | 3 ++- src/Input/FGButton.hxx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Input/FGButton.cxx b/src/Input/FGButton.cxx index 400de289e..677f18071 100644 --- a/src/Input/FGButton.cxx +++ b/src/Input/FGButton.cxx @@ -46,7 +46,8 @@ FGButton::~FGButton () } -void FGButton::init( const SGPropertyNode * node, const std::string & name, std::string & module ) +void FGButton::init(const SGPropertyNode* node, const std::string& name, + const std::string& module) { if (node == 0) { SG_LOG(SG_INPUT, SG_DEBUG, "No bindings for button " << name); diff --git a/src/Input/FGButton.hxx b/src/Input/FGButton.hxx index 497be1c46..b002d6446 100644 --- a/src/Input/FGButton.hxx +++ b/src/Input/FGButton.hxx @@ -32,7 +32,8 @@ class FGButton : public FGCommonInput { public: FGButton(); virtual ~FGButton(); - void init( const SGPropertyNode * node, const std::string & name, std::string & module ); + void init(const SGPropertyNode* node, const std::string& name, + const std::string& module); void update( int modifiers, bool pressed, int x = -1, int y = -1); bool is_repeatable; float interval_sec, delay_sec, release_delay_sec;