[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference into lp:widelands
The proposal to merge lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference into lp:widelands has been updated. Status: Needs review => Merged For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference/+merge/326257 -- Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference into lp:widelands
The proposal to merge lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference into lp:widelands has been updated. Commit Message changed to: Pass function arguments per const reference where possible. For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference/+merge/326257 -- Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference into lp:widelands
@bunnybot merge -- https://code.launchpad.net/~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference/+merge/326257 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference into lp:widelands
Continuous integration builds have changed state: Travis build 2360. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/246575895. Appveyor build 2188. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_986611_cppcheck_pass_by_reference-2188. -- https://code.launchpad.net/~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference/+merge/326257 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference into lp:widelands
Thanks for the review - I have reverted those changes. -- https://code.launchpad.net/~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference/+merge/326257 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference into lp:widelands
Review: Needs Fixing Diff comments: > > === modified file 'src/graphic/text/rt_render.cc' > --- src/graphic/text/rt_render.cc 2017-06-01 08:52:15 + > +++ src/graphic/text/rt_render.cc 2017-06-24 11:37:18 + > @@ -969,7 +969,7 @@ > public: > TagHandler(Tag& tag, > FontCache& fc, > -NodeStyle ns, This changes semantics and is almost certainly wrong (also a few times below). Either NodeStyle -> const NodeStyle& or keep passing by value. > +NodeStyle& ns, > ImageCache* image_cache, > RendererStyle& renderer_style, > const UI::FontSets& fontsets) -- https://code.launchpad.net/~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference/+merge/326257 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference into lp:widelands. Commit message: Pass function arguments per (const) reference where possible. Requested reviews: Widelands Developers (widelands-dev) Related bugs: Bug #986611 in widelands: "Issues reported by cppcheck" https://bugs.launchpad.net/widelands/+bug/986611 For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference/+merge/326257 This cleanup should gain us a bit of performance. Changes are pretty trivial (argument -> (const) argument&) -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-986611-cppcheck-pass-by-reference into lp:widelands. === modified file 'src/base/i18n.cc' --- src/base/i18n.cc 2017-01-25 18:55:59 + +++ src/base/i18n.cc 2017-06-24 11:37:18 + @@ -76,7 +76,7 @@ /** * Set the localedir. This should usually only be done once */ -void set_localedir(std::string dname) { +void set_localedir(const std::string& dname) { localedir = dname; } @@ -157,7 +157,7 @@ * Set the locale to the given string. * Code inspired by wesnoth.org */ -void set_locale(std::string name) { +void set_locale(const std::string& name) { const std::map<std::string, std::string> kAlternatives = { {"ar", "ar,ar_AR,ar_AE,ar_BH,ar_DZ,ar_EG,ar_IN,ar_IQ,ar_JO,ar_KW,ar_LB,ar_LY,ar_MA,ar_OM,ar_" "QA,ar_SA,ar_SD,ar_SY,ar_TN,ar_YE"}, === modified file 'src/base/i18n.h' --- src/base/i18n.h 2017-01-25 18:55:59 + +++ src/base/i18n.h 2017-06-24 11:37:18 + @@ -52,10 +52,10 @@ }; void init_locale(); -void set_locale(std::string); +void set_locale(const std::string&); const std::string& get_locale(); -void set_localedir(std::string); +void set_localedir(const std::string&); const std::string& get_localedir(); // Localize a list of 'items'. The last 2 items are concatenated with "and" or === modified file 'src/editor/tools/tool_action.h' --- src/editor/tools/tool_action.h 2017-01-25 18:55:59 + +++ src/editor/tools/tool_action.h 2017-06-24 11:37:18 + @@ -46,7 +46,7 @@ Widelands::Map& m, Widelands::NodeAndTriangle<> c, EditorInteractive& p, - EditorActionArgs nargs) + const EditorActionArgs& nargs) : tool(t), i(ind), map(m), center(c), parent(p) { args = new EditorActionArgs(parent); *args = nargs; === modified file 'src/graphic/text/rt_errors.h' --- src/graphic/text/rt_errors.h 2017-01-25 18:55:59 + +++ src/graphic/text/rt_errors.h 2017-06-24 11:37:18 + @@ -28,7 +28,7 @@ class Exception : public std::exception { public: - Exception(std::string msg) : std::exception(), msg_(msg) { + explicit Exception(const std::string& msg) : std::exception(), msg_(msg) { } const char* what() const noexcept override { return msg_.c_str(); @@ -41,7 +41,7 @@ #define DEF_ERR(Name) \ class Name : public Exception { \ public: \ - Name(std::string msg) : Exception(msg) { \ + explicit Name(const std::string& msg) : Exception(msg) { \ }\ }; === modified file 'src/graphic/text/rt_errors_impl.h' --- src/graphic/text/rt_errors_impl.h 2017-01-25 18:55:59 + +++ src/graphic/text/rt_errors_impl.h 2017-06-24 11:37:18 + @@ -28,7 +28,7 @@ struct SyntaxErrorImpl : public SyntaxError { SyntaxErrorImpl( - size_t line, size_t col, std::string expected, std::string got, std::string next_chars) + size_t line, size_t col, const std::string& expected, const std::string& got, const std::string& next_chars) : SyntaxError( (boost::format( "Syntax error at %1%:%2%: expected %3%, got '%4%'. String continues with: '%5%'") % === modified file 'src/graphic/text/rt_parse.h' --- src/graphic/text/rt_parse.h 2017-01-25 18:55:59 + +++ src/graphic/text/rt_parse.h 2017-06-24 11:37:18 + @@ -104,7 +104,7 @@ } Child(Tag* t) : tag(t) { } - Child(std::string t) : tag(nullptr), text(t) { + Child(const std::string& t) : tag(nullptr), text(t) { } ~Child() { if (tag) === modified file 'src/graphic/text/rt_render.cc' --- src/graphic/text/rt_render.cc 2017-06-01 08:52:15 + +++ src/graphic/text/rt_render.cc 2017-06-24 11:37:18 + @@ -969,7 +969,7 @@ public: TagHandler(Tag& tag, FontCache& fc, - NodeStyl