Address a few other issues found by cppcheck

Thanks matthiaskrgr for running it.
This commit is contained in:
Celtic Minstrel 2017-03-16 17:11:06 -04:00
parent 12cf0fb45e
commit 6b251d445c
5 changed files with 12 additions and 8 deletions

View File

@ -1016,6 +1016,7 @@ struct config_has_value {
config_has_value(const std::string& name, const std::string& value)
: name_(name), value_()
{
// TODO: This is assigned here instead of in the init-list because attribute_value doesn't have a matching constructor
value_ = value;
}

View File

@ -44,6 +44,7 @@ game_board::game_board(const ter_data_cache & tdata, const config & level)
game_board::game_board(const game_board & other)
: teams_(other.teams_)
, map_(new gamemap(*(other.map_)))
, labels_(other.labels_)
, unit_id_manager_(other.unit_id_manager_)
, units_(other.units_) {}

View File

@ -55,6 +55,7 @@ public:
unit_filter(const unit_filter & o ) : impl_(o.impl_), max_matches_() {}
void swap(unit_filter & o) {
impl_.swap(o.impl_);
std::swap(max_matches_, o.max_matches_);
}
unit_filter & operator=(unit_filter o) {
swap(o);

View File

@ -36,7 +36,8 @@ namespace detail {
template<typename Ret, typename... T>
struct apply {
using result_type = void;
apply(std::function<Ret(T...)> fcn) : fcn(fcn) {}
apply(const std::function<Ret(T...)>& fcn) : fcn(fcn) {}
apply(Ret(*fcn)(T...)) : fcn(fcn) {}
void operator()(T... params) {
fcn(std::forward<T>(params)...);
}

View File

@ -564,10 +564,10 @@ struct BlendResult
struct Kernel_4x4 //kernel for preprocessing step
{
uint32_t
/**/a, b, c, d,
/**/e, f, g, h,
/**/i, j, k, l,
/**/m, n, o, p;
/**/a=0, b=0, c=0, d=0,
/**/e=0, f=0, g=0, h=0,
/**/i=0, j=0, k=0, l=0,
/**/m=0, n=0, o=0, p=0;
Kernel_4x4() {}
};
@ -625,9 +625,9 @@ BlendResult preProcessCorners(const Kernel_4x4& ker, const xbrz::ScalerCfg& cfg)
struct Kernel_3x3
{
uint32_t
/**/a, b, c,
/**/d, e, f,
/**/g, h, i;
/**/a=0, b=0, c=0,
/**/d=0, e=0, f=0,
/**/g=0, h=0, i=0;
Kernel_3x3() {}
};