Skip to content

Commit

Permalink
Fixes based on cppcheck reports
Browse files Browse the repository at this point in the history
- Made `Signal<..>::Interface::Interface(SignalType*)` explicit
- Calling constructor in Signal copy-constructor
- Made some functions const
  • Loading branch information
netromdk committed Aug 22, 2020
1 parent f0fdb40 commit 510409e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sigs.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class Signal<Ret(Args...)> final {
/// Interface that only exposes connect and disconnect methods.
class Interface final {
public:
Interface(SignalType *sig) noexcept : sig_(sig)
explicit Interface(SignalType *sig) noexcept : sig_(sig)
{
}

Expand Down Expand Up @@ -225,7 +225,7 @@ class Signal<Ret(Args...)> final {
}
}

Signal(const Signal &rhs) noexcept
Signal(const Signal &rhs) noexcept : Signal()
{
Lock lock1(entriesMutex);
Lock lock2(const_cast<Signal &>(rhs).entriesMutex);
Expand Down
4 changes: 2 additions & 2 deletions tests/General.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST(General, functor)
{
class AddOneFunctor {
public:
void operator()(int &i)
void operator()(int &i) const
{
i++;
}
Expand All @@ -63,7 +63,7 @@ TEST(General, instanceMethod)
{
class Foo {
public:
void test(int &i)
void test(int &i) const
{
i++;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TEST(Interface, functor)
{
class AddOneFunctor {
public:
void operator()(int &i)
void operator()(int &i) const
{
i++;
}
Expand All @@ -60,7 +60,7 @@ TEST(Interface, instanceMethod)
{
class Foo {
public:
void test(int &i)
void test(int &i) const
{
i++;
}
Expand Down

0 comments on commit 510409e

Please sign in to comment.