From ddc9229efc976c3bf24e630c45a07aa26d64ce58 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 18 Apr 2013 19:19:30 +0200 Subject: [PATCH] use var passed by reference --- lib/libconfigfile/configfile.cpp | 4 ++-- lib/libconfigfile/configfile.h | 4 ++-- lib/libnet/network_interfaces.cpp | 20 ++++++++++---------- lib/libnet/network_interfaces.h | 8 ++++---- src/gui/components/cc_frm.h | 2 +- src/gui/components/cc_frm_icons.cpp | 2 +- src/gui/moviebrowser.h | 2 +- src/gui/movieinfo.cpp | 2 +- src/gui/widget/messagebox.cpp | 12 ++++++------ src/gui/widget/messagebox.h | 12 ++++++------ src/timerd/timermanager.cpp | 2 +- src/timerd/timermanager.h | 2 +- 12 files changed, 36 insertions(+), 36 deletions(-) diff --git a/lib/libconfigfile/configfile.cpp b/lib/libconfigfile/configfile.cpp index d7713ab2e..354d5ec97 100644 --- a/lib/libconfigfile/configfile.cpp +++ b/lib/libconfigfile/configfile.cpp @@ -394,7 +394,7 @@ void CConfigFile::setString(const std::string & key, const std::string & val) unknownKeyQueryedFlag = tmpUnknownKeyQueryedFlag; } -void CConfigFile::setInt32Vector(const std::string & key, const std::vector vec) +void CConfigFile::setInt32Vector(const std::string & key, const std::vector &vec) { bool tmpUnknownKeyQueryedFlag = unknownKeyQueryedFlag; unknownKeyQueryedFlag = false; @@ -419,7 +419,7 @@ void CConfigFile::setInt32Vector(const std::string & key, const std::vector vec) +void CConfigFile::setStringVector(const std::string & key, const std::vector &vec) { bool tmpUnknownKeyQueryedFlag = unknownKeyQueryedFlag; unknownKeyQueryedFlag = false; diff --git a/lib/libconfigfile/configfile.h b/lib/libconfigfile/configfile.h index 9d2c39853..5a247a556 100644 --- a/lib/libconfigfile/configfile.h +++ b/lib/libconfigfile/configfile.h @@ -91,10 +91,10 @@ class CConfigFile // vectors // std::vector getStringVector(const std::string & key); - void setStringVector(const std::string & key, const std::vector vec); + void setStringVector(const std::string & key, const std::vector &vec); std::vector getInt32Vector(const std::string & key); - void setInt32Vector(const std::string & key, const std::vector vec); + void setInt32Vector(const std::string & key, const std::vector &vec); // // flags diff --git a/lib/libnet/network_interfaces.cpp b/lib/libnet/network_interfaces.cpp index f97b2b9fe..d1107887f 100644 --- a/lib/libnet/network_interfaces.cpp +++ b/lib/libnet/network_interfaces.cpp @@ -34,7 +34,7 @@ * */ -bool read_file(const std::string filename, std::list &line) +bool read_file(const std::string &filename, std::list &line) { std::string s; std::ifstream in(filename.c_str()); @@ -50,7 +50,7 @@ bool read_file(const std::string filename, std::list &line) return true; } -bool write_file(const std::string filename, const std::list line) +bool write_file(const std::string &filename, const std::list &line) { std::ofstream out(filename.c_str()); @@ -63,7 +63,7 @@ bool write_file(const std::string filename, const std::list line) return true; } -std::list::iterator add_attributes(const std::map attribute, std::list &line, std::list::iterator here) +std::list::iterator add_attributes(const std::map &attribute, std::list &line, std::list::iterator here) { for (std::map::const_iterator it = attribute.begin(); it != attribute.end(); ++it) { @@ -74,7 +74,7 @@ std::list::iterator add_attributes(const std::map attribute) +bool write_interface(const std::string &filename, const std::string &name, const bool automatic_start, const std::string &family, const std::string &method, const std::map &attribute) { std::string s; std::list line; @@ -215,7 +215,7 @@ bool write_interface(const std::string filename, const std::string name, const b return write_file(filename, line); } -bool read_interface(const std::string filename, const std::string name, bool &automatic_start, std::string &family, std::string &method, std::map &attribute) +bool read_interface(const std::string &filename, const std::string &name, bool &automatic_start, std::string &family, std::string &method, std::map &attribute) { std::string s; std::string t; @@ -309,7 +309,7 @@ bool read_interface(const std::string filename, const std::string name, bool &au return true; } -bool getInetAttributes(const std::string name, bool &automatic_start, std::string &address, std::string &netmask, std::string &broadcast, std::string &gateway) +bool getInetAttributes(const std::string &name, bool &automatic_start, std::string &address, std::string &netmask, std::string &broadcast, std::string &gateway) { std::string family; std::string method; @@ -343,14 +343,14 @@ bool getInetAttributes(const std::string name, bool &automatic_start, std::strin return true; } -bool addLoopbackDevice(const std::string name, const bool automatic_start) +bool addLoopbackDevice(const std::string &name, const bool automatic_start) { std::map attribute; return write_interface("/etc/network/interfaces", name, automatic_start, "inet", "loopback", attribute); } -bool setStaticAttributes(const std::string name, const bool automatic_start, const std::string address, const std::string netmask, const std::string broadcast, const std::string gateway, bool wireless) +bool setStaticAttributes(const std::string &name, const bool automatic_start, const std::string &address, const std::string &netmask, const std::string &broadcast, const std::string &gateway, bool wireless) { std::map attribute; @@ -371,7 +371,7 @@ bool setStaticAttributes(const std::string name, const bool automatic_start, con return write_interface("/etc/network/interfaces", name, automatic_start, "inet", "static", attribute); } -bool setDhcpAttributes(const std::string name, const bool automatic_start, bool wireless) +bool setDhcpAttributes(const std::string &name, const bool automatic_start, bool wireless) { std::map attribute; char hostname[100]; diff --git a/lib/libnet/network_interfaces.h b/lib/libnet/network_interfaces.h index a9e526159..457bac3b8 100644 --- a/lib/libnet/network_interfaces.h +++ b/lib/libnet/network_interfaces.h @@ -24,12 +24,12 @@ #include -bool getInetAttributes(const std::string name, bool &automatic_start, std::string &address, std::string &netmask, std::string &broadcast, std::string &gateway); +bool getInetAttributes(const std::string &name, bool &automatic_start, std::string &address, std::string &netmask, std::string &broadcast, std::string &gateway); -bool addLoopbackDevice(const std::string name, const bool automatic_start); +bool addLoopbackDevice(const std::string &name, const bool automatic_start); -bool setStaticAttributes(const std::string name, const bool automatic_start, const std::string address, const std::string netmask, const std::string broadcast, const std::string gateway, bool wireless = false); +bool setStaticAttributes(const std::string &name, const bool automatic_start, const std::string &address, const std::string &netmask, const std::string &broadcast, const std::string &gateway, bool wireless = false); -bool setDhcpAttributes(const std::string name, const bool automatic_start, bool wireless = false); +bool setDhcpAttributes(const std::string &name, const bool automatic_start, bool wireless = false); #endif /* __network_interfaces_h__ */ diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index f5b41de3f..3a916298a 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -72,7 +72,7 @@ class CComponentsIconForm : public CComponentsForm public: CComponentsIconForm(); - CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector v_icon_names, bool has_shadow = CC_SHADOW_OFF, + CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector &v_icon_names, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); // ~CComponentsIconForm(); //inherited from CComponentsForm diff --git a/src/gui/components/cc_frm_icons.cpp b/src/gui/components/cc_frm_icons.cpp index 9ee4f431b..5bb8fe615 100644 --- a/src/gui/components/cc_frm_icons.cpp +++ b/src/gui/components/cc_frm_icons.cpp @@ -41,7 +41,7 @@ CComponentsIconForm::CComponentsIconForm() } -CComponentsIconForm::CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector v_icon_names, bool has_shadow, +CComponentsIconForm::CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector &v_icon_names, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { initVarIconForm(); diff --git a/src/gui/moviebrowser.h b/src/gui/moviebrowser.h index 154b7364f..70f9523a9 100644 --- a/src/gui/moviebrowser.h +++ b/src/gui/moviebrowser.h @@ -87,7 +87,7 @@ /* percent */ #define MIN_BROWSER_FRAME_HEIGHT 10 #define MAX_BROWSER_FRAME_HEIGHT 80 -void strReplace(std::string& orig, const char* fstr, const std::string rstr); +void strReplace(std::string& orig, const char* fstr, const std::string &rstr); /* !!!! Do NOT change the order of the enum, just add items at the end !!!! */ typedef enum diff --git a/src/gui/movieinfo.cpp b/src/gui/movieinfo.cpp index 684d9babd..4059faa67 100644 --- a/src/gui/movieinfo.cpp +++ b/src/gui/movieinfo.cpp @@ -614,7 +614,7 @@ int find_next_char(char to_find, char *text, int start_pos, int end_pos) } //void CMovieInfo::strReplace(std::string& orig, const char* fstr, const std::string rstr) -void strReplace(std::string & orig, const char *fstr, const std::string rstr) +void strReplace(std::string & orig, const char *fstr, const std::string &rstr) { // replace all occurrence of fstr with rstr and, and returns a reference to itself size_t index = 0; diff --git a/src/gui/widget/messagebox.cpp b/src/gui/widget/messagebox.cpp index 9e8bddfbf..f70dab35d 100644 --- a/src/gui/widget/messagebox.cpp +++ b/src/gui/widget/messagebox.cpp @@ -40,17 +40,17 @@ #include #include -CMessageBox::CMessageBox(const neutrino_locale_t Caption, const char * const Text, const int Width, const char * const Icon, const CMessageBox::result_ Default, const uint32_t ShowButtons) : CHintBoxExt(Caption, Text, Width, Icon) +CMessageBox::CMessageBox(const neutrino_locale_t Caption, const char * const Text, const int Width, const char * const Icon, const CMessageBox::result_ &Default, const uint32_t ShowButtons) : CHintBoxExt(Caption, Text, Width, Icon) { Init(Default, ShowButtons); } -CMessageBox::CMessageBox(const neutrino_locale_t Caption, ContentLines& Lines, const int Width, const char * const Icon, const CMessageBox::result_ Default, const uint32_t ShowButtons) : CHintBoxExt(Caption, Lines, Width, Icon) +CMessageBox::CMessageBox(const neutrino_locale_t Caption, ContentLines& Lines, const int Width, const char * const Icon, const CMessageBox::result_ &Default, const uint32_t ShowButtons) : CHintBoxExt(Caption, Lines, Width, Icon) { Init(Default, ShowButtons); } -void CMessageBox::Init(const CMessageBox::result_ Default, const uint32_t ShowButtons) +void CMessageBox::Init(const CMessageBox::result_ &Default, const uint32_t ShowButtons) { #define BtnCount 3 returnDefaultOnTimeout = false; @@ -274,7 +274,7 @@ int CMessageBox::exec(int timeout) return res; } -int ShowMsgUTF(const neutrino_locale_t Caption, const char * const Text, const CMessageBox::result_ Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout) +int ShowMsgUTF(const neutrino_locale_t Caption, const char * const Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout) { CMessageBox* messageBox = new CMessageBox(Caption, Text, Width, Icon, Default, ShowButtons); messageBox->returnDefaultValueOnTimeout(returnDefaultOnTimeout); @@ -285,12 +285,12 @@ int ShowMsgUTF(const neutrino_locale_t Caption, const char * const Text, const C return res; } -int ShowLocalizedMessage(const neutrino_locale_t Caption, const neutrino_locale_t Text, const CMessageBox::result_ Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout) +int ShowLocalizedMessage(const neutrino_locale_t Caption, const neutrino_locale_t Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout) { return ShowMsgUTF(Caption, g_Locale->getText(Text), Default, ShowButtons, Icon, Width, timeout,returnDefaultOnTimeout); } -int ShowMsgUTF(const neutrino_locale_t Caption, const std::string & Text, const CMessageBox::result_ Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout) +int ShowMsgUTF(const neutrino_locale_t Caption, const std::string & Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout) { return ShowMsgUTF(Caption, Text.c_str(), Default, ShowButtons, Icon, Width, timeout,returnDefaultOnTimeout); } diff --git a/src/gui/widget/messagebox.h b/src/gui/widget/messagebox.h index 67e063e0a..46178788a 100644 --- a/src/gui/widget/messagebox.h +++ b/src/gui/widget/messagebox.h @@ -87,21 +87,21 @@ class CMessageBox : public CHintBoxExt } buttons; // Text & Caption are always UTF-8 encoded - CMessageBox(const neutrino_locale_t Caption, const char * const Text, const int Width = 500, const char * const Icon = NULL, const CMessageBox::result_ Default = mbrYes, const uint32_t ShowButtons = mbAll); + CMessageBox(const neutrino_locale_t Caption, const char * const Text, const int Width = 500, const char * const Icon = NULL, const CMessageBox::result_ &Default = mbrYes, const uint32_t ShowButtons = mbAll); - CMessageBox(const neutrino_locale_t Caption, ContentLines& Lines, const int Width = 500, const char * const Icon = NULL, const CMessageBox::result_ Default = mbrYes, const uint32_t ShowButtons = mbAll); + CMessageBox(const neutrino_locale_t Caption, ContentLines& Lines, const int Width = 500, const char * const Icon = NULL, const CMessageBox::result_ &Default = mbrYes, const uint32_t ShowButtons = mbAll); int exec(int timeout = -1); void returnDefaultValueOnTimeout(bool returnDefault); private: - void Init(const CMessageBox::result_ Default, const uint32_t ShowButtons); + void Init(const CMessageBox::result_ &Default, const uint32_t ShowButtons); }; // Text is always UTF-8 encoded -int ShowLocalizedMessage(const neutrino_locale_t Caption, const neutrino_locale_t Text, const CMessageBox::result_ Default, const uint32_t ShowButtons, const char * const Icon = NULL, const int Width = 450, const int timeout = -1, bool returnDefaultOnTimeout = false); -int ShowMsgUTF(const neutrino_locale_t Caption, const char * const Text, const CMessageBox::result_ Default, const uint32_t ShowButtons, const char * const Icon = NULL, const int Width = 450, const int timeout = -1, bool returnDefaultOnTimeout = false); // UTF-8 -int ShowMsgUTF(const neutrino_locale_t Caption, const std::string & Text, const CMessageBox::result_ Default, const uint32_t ShowButtons, const char * const Icon = NULL, const int Width = 450, const int timeout = -1, bool returnDefaultOnTimeout = false); // UTF-8 +int ShowLocalizedMessage(const neutrino_locale_t Caption, const neutrino_locale_t Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon = NULL, const int Width = 450, const int timeout = -1, bool returnDefaultOnTimeout = false); +int ShowMsgUTF(const neutrino_locale_t Caption, const char * const Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon = NULL, const int Width = 450, const int timeout = -1, bool returnDefaultOnTimeout = false); // UTF-8 +int ShowMsgUTF(const neutrino_locale_t Caption, const std::string & Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon = NULL, const int Width = 450, const int timeout = -1, bool returnDefaultOnTimeout = false); // UTF-8 void DisplayErrorMessage(const char * const ErrorMsg); // UTF-8 void DisplayInfoMessage(const char * const InfoMsg); // UTF-8 diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index 583ec2211..3d77889d6 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -1103,7 +1103,7 @@ CTimerEvent_Record::CTimerEvent_Record(time_t announce_Time, time_t alarm_Time, event_id_t epgID, time_t epg_starttime, unsigned char apids, CTimerd::CTimerEventRepeat evrepeat, - uint32_t repeatcount, const std::string recDir) : + uint32_t repeatcount, const std::string &recDir) : CTimerEvent(getEventType(), announce_Time, alarm_Time, stop_Time, evrepeat, repeatcount) { eventInfo.epgID = epgID; diff --git a/src/timerd/timermanager.h b/src/timerd/timermanager.h index db2224311..76b4b2749 100644 --- a/src/timerd/timermanager.h +++ b/src/timerd/timermanager.h @@ -123,7 +123,7 @@ class CTimerEvent_Record : public CTimerEvent time_t epg_starttime = 0, unsigned char apids = TIMERD_APIDS_STD, CTimerd::CTimerEventRepeat evrepeat = CTimerd::TIMERREPEAT_ONCE, - uint32_t repeatcount = 1, const std::string recDir = ""); + uint32_t repeatcount = 1, const std::string &recDir = ""); CTimerEvent_Record(CConfigFile *config, int iId); virtual ~CTimerEvent_Record(){}; virtual CTimerd::CTimerEventTypes getEventType(void) const { return CTimerd::TIMER_RECORD; };