cppcheck performance: function parameter should be passed by reference

cppcheck found some minor cases where complex parameters were accidentally
passed by value.
This commit is contained in:
Patrick Ohly 2014-01-07 01:16:05 -08:00
parent b27e560085
commit e407d71410
6 changed files with 6 additions and 6 deletions

View file

@ -93,7 +93,7 @@ public:
}
}
void setURL(const std::string url) { initializeFlags(url); m_url = url; }
void setURL(const std::string &url) { initializeFlags(url); m_url = url; }
virtual std::string getURL() { return m_url; }
virtual bool verifySSLHost()

View file

@ -78,7 +78,7 @@ void FilteredView::doStart()
m_parent->m_removedSignal.connect(ChangeSignal_t::slot_type(boost::bind(&FilteredView::removeIndividual, this, _1, _2)).track(m_self));
}
bool FilteredView::isFull(const Entries_t local2parent,
bool FilteredView::isFull(const Entries_t &local2parent,
const boost::shared_ptr<IndividualFilter> &filter)
{
size_t newEndIndex = local2parent.end() - local2parent.begin();

View file

@ -49,7 +49,7 @@ class FilteredView : public IndividualView
void init(const boost::shared_ptr<FilteredView> &self);
bool isFull() const { return isFull(m_local2parent, m_filter); }
static bool isFull(const Entries_t local2parent,
static bool isFull(const Entries_t &local2parent,
const boost::shared_ptr<IndividualFilter> &filter);
/**

View file

@ -386,7 +386,7 @@ public:
* the sync starts and overwriting it when the connection
* closes.
*/
void setStubConnectionError(const std::string error) { m_connectionError = error; }
void setStubConnectionError(const std::string &error) { m_connectionError = error; }
std::string getStubConnectionError() { return m_connectionError; }
Server &getServer() { return m_server; }

View file

@ -110,7 +110,7 @@ bool Cmdline::parse()
/**
* Detects "--sync foo", "--sync=foo", "-s foo".
*/
static bool IsKeyword(const std::string arg,
static bool IsKeyword(const std::string &arg,
const char *longWord,
const char *shortWord)
{

View file

@ -1106,7 +1106,7 @@ private:
string m_previousLogdir; /**< remember previous log dir before creating the new one */
/** create name in current (if set) or previous logdir */
string databaseName(SyncSource &source, const string suffix, string logdir = "") {
string databaseName(SyncSource &source, const string &suffix, string logdir = "") {
if (!logdir.size()) {
logdir = m_logdir->getLogdir();
}