C++: const and const ref enhancements

Found with clang and/or cppcheck.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
This commit is contained in:
Patrick Ohly 2017-12-13 01:04:58 -08:00
parent bd6adff9a5
commit f797987710
3 changed files with 4 additions and 5 deletions

View file

@ -408,7 +408,7 @@ struct GErrorCXX {
GError *release() { GError *gerror = m_gerror; m_gerror = NULL; return gerror; }
/** checks whether the current error is the one passed as parameters */
bool matches(GQuark domain, gint code) { return g_error_matches(m_gerror, domain, code); }
bool matches(GQuark domain, gint code) const { return g_error_matches(m_gerror, domain, code); }
/**
* Use this when passing GErrorCXX instance to C functions which need to set it.

View file

@ -1694,7 +1694,7 @@ void SyncSourceAdmin::entry2mapid(const string &key, const string &value, sysync
void SyncSourceAdmin::init(SyncSource::Operations &ops,
const boost::shared_ptr<ConfigNode> &config,
const std::string adminPropertyName,
const std::string &adminPropertyName,
const boost::shared_ptr<ConfigNode> &mapping)
{
m_configNode = config;

View file

@ -857,7 +857,6 @@ template<class F> class OperationWrapperSwitch<F, 0, sysync::TSyError>
PreSignal &getPreSignal() const { return const_cast<PreSignal &>(m_pre); }
PostSignal &getPostSignal() const { return const_cast<PostSignal &>(m_post); }
OperationWrapperSwitch(SyncSourceName &source) :
m_source(source),
m_pre(OperationSlotInvoker(source)),
@ -2150,7 +2149,7 @@ class SyncSource : virtual public SyncSourceBase, public SyncSourceConfig, publi
/* implementation of SyncSourceBase */
virtual std::string getName() const { return SyncSourceConfig::getName(); }
virtual std::string getDisplayName() const { return m_name.c_str(); }
virtual std::string getDisplayName() const { return m_name; }
virtual void setDisplayName(const std::string &name) { m_name = name; }
virtual long getNumDeleted() const { return m_numDeleted; }
virtual void setNumDeleted(long num) { m_numDeleted = num; }
@ -2994,7 +2993,7 @@ class SyncSourceAdmin : public virtual SyncSourceBase
/** flexible initialization */
void init(SyncSource::Operations &ops,
const boost::shared_ptr<ConfigNode> &config,
const std::string adminPropertyName,
const std::string &adminPropertyName,
const boost::shared_ptr<ConfigNode> &mapping);
/**