[glibmm] Tests: Make single-parameter constructors explicit.



commit ab7f526b51ff16165ab0d9334464a8ff81a3b29b
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Dec 12 10:36:52 2016 +0100

    Tests: Make single-parameter constructors explicit.
    
    Noticed by cppcheck.

 tests/giomm_listmodel/main.cc       |    2 +-
 tests/giomm_stream_vfuncs/main.cc   |    2 +-
 tests/glibmm_interface_move/main.cc |    2 +-
 tests/glibmm_variant/main.cc        |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/tests/giomm_listmodel/main.cc b/tests/giomm_listmodel/main.cc
index f40a943..1016b58 100644
--- a/tests/giomm_listmodel/main.cc
+++ b/tests/giomm_listmodel/main.cc
@@ -255,7 +255,7 @@ void test_store_sorted1()
 class MyObject : public Glib::Object
 {
 protected:
-  MyObject(int id) : m_id(id) {}
+  explicit MyObject(int id) : m_id(id) {}
 
 public:
   static Glib::RefPtr<MyObject> create(int id)
diff --git a/tests/giomm_stream_vfuncs/main.cc b/tests/giomm_stream_vfuncs/main.cc
index f70a1fa..7284ebb 100644
--- a/tests/giomm_stream_vfuncs/main.cc
+++ b/tests/giomm_stream_vfuncs/main.cc
@@ -32,7 +32,7 @@ public:
   }
 
 protected:
-  Base64OutputStream(const Glib::RefPtr<Gio::OutputStream>& base_stream)
+  explicit Base64OutputStream(const Glib::RefPtr<Gio::OutputStream>& base_stream)
     : Gio::FilterOutputStream(base_stream), column(0), bit_count(0), bit_buffer(0), column_width(72) {}
 
   gssize write_vfunc(const void* buffer, gsize count, const Glib::RefPtr<Gio::Cancellable>& cancellable) 
override
diff --git a/tests/glibmm_interface_move/main.cc b/tests/glibmm_interface_move/main.cc
index c097cbb..1685b33 100644
--- a/tests/glibmm_interface_move/main.cc
+++ b/tests/glibmm_interface_move/main.cc
@@ -187,7 +187,7 @@ public:
 
   // A real application would never make the constructor public.
   // It would instead have a protected constructor and a public create() method.
-  DerivedObject(int i)
+  explicit DerivedObject(int i)
   : Glib::ObjectBase(nullptr),
     Glib::Object(Glib::ConstructParams(derived_object_class_.init())),
     i_(i)
diff --git a/tests/glibmm_variant/main.cc b/tests/glibmm_variant/main.cc
index 8ac5d50..dca4ee3 100644
--- a/tests/glibmm_variant/main.cc
+++ b/tests/glibmm_variant/main.cc
@@ -401,7 +401,7 @@ get_log_flags()
 
 struct WarnCatcher
 {
-  WarnCatcher(const std::string& domain)
+  explicit WarnCatcher(const std::string& domain)
   : m_domain(domain), m_old_flags(g_log_set_fatal_mask(m_domain.c_str(), get_log_flags()))
   {
   }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]