[glibmm] Tests: More nullptr instead of 0
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Tests: More nullptr instead of 0
- Date: Mon, 23 Nov 2015 15:46:58 +0000 (UTC)
commit e0d25266312d4af282c7834925b42dfc9fdf9456
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Mon Nov 23 16:42:09 2015 +0100
Tests: More nullptr instead of 0
tests/giomm_memoryinputstream/main.cc | 2 +-
tests/glibmm_bool_arrayhandle/main.cc | 2 +-
tests/glibmm_bool_vector/main.cc | 2 +-
tests/glibmm_interface_move/main.cc | 15 +++++++++++----
tests/glibmm_null_containerhandle/main.cc | 12 ++++++------
tests/glibmm_null_vectorutils/main.cc | 12 ++++++------
tests/glibmm_vector/main.cc | 6 +++---
7 files changed, 29 insertions(+), 22 deletions(-)
---
diff --git a/tests/giomm_memoryinputstream/main.cc b/tests/giomm_memoryinputstream/main.cc
index 8228bd2..0fcc6b0 100644
--- a/tests/giomm_memoryinputstream/main.cc
+++ b/tests/giomm_memoryinputstream/main.cc
@@ -52,7 +52,7 @@ int main(int, char**)
// Add data that shall not be deleted by stream.
static const char data1[] = "Data not owned by stream.\n";
- stream->add_data(data1, sizeof data1 - 1, 0);
+ stream->add_data(data1, sizeof data1 - 1, nullptr);
// Add data that shall be deleted by destroy_func1().
char* data2 = new char[7];
diff --git a/tests/glibmm_bool_arrayhandle/main.cc b/tests/glibmm_bool_arrayhandle/main.cc
index 9f5e17b..e4247cf 100644
--- a/tests/glibmm_bool_arrayhandle/main.cc
+++ b/tests/glibmm_bool_arrayhandle/main.cc
@@ -38,7 +38,7 @@ setup_rand ()
if (!setup)
{
- std::srand (std::time (0));
+ std::srand (std::time (nullptr));
setup = true;
}
}
diff --git a/tests/glibmm_bool_vector/main.cc b/tests/glibmm_bool_vector/main.cc
index 0548d75..1e7c32a 100644
--- a/tests/glibmm_bool_vector/main.cc
+++ b/tests/glibmm_bool_vector/main.cc
@@ -38,7 +38,7 @@ setup_rand()
if(!setup)
{
setup = true;
- std::srand(std::time(0));
+ std::srand(std::time(nullptr));
}
}
diff --git a/tests/glibmm_interface_move/main.cc b/tests/glibmm_interface_move/main.cc
index 28b8e8f..31d3f85 100644
--- a/tests/glibmm_interface_move/main.cc
+++ b/tests/glibmm_interface_move/main.cc
@@ -26,9 +26,16 @@ test_Iface_get_type (void)
{
const GTypeInfo info =
{
- sizeof (TestIface), /* class_size */
- test_Iface_init, /* base_init */
- 0, 0, 0, 0, 0, 0, 0, 0
+ sizeof (TestIface), // class_size
+ test_Iface_init, // base_init
+ nullptr, // base_finalize
+ nullptr, // class_init
+ nullptr, // class_finalize
+ nullptr, // class_data
+ 0, // instance_size
+ 0, // n_preallocs
+ nullptr, // instance_init
+ nullptr // value_table
};
type = g_type_register_static (G_TYPE_INTERFACE, "TestIface",
@@ -187,7 +194,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)
- : Glib::ObjectBase(0),
+ : Glib::ObjectBase(nullptr),
Glib::Object(Glib::ConstructParams(derived_object_class_.init())),
i_(i)
{
diff --git a/tests/glibmm_null_containerhandle/main.cc b/tests/glibmm_null_containerhandle/main.cc
index 596457d..52a95e6 100644
--- a/tests/glibmm_null_containerhandle/main.cc
+++ b/tests/glibmm_null_containerhandle/main.cc
@@ -28,12 +28,12 @@ main()
Gio::init();
typedef Glib::RefPtr<Gio::Credentials> CrePtr;
- std::vector<CrePtr> v1(Glib::ArrayHandle<CrePtr>(0, Glib::OWNERSHIP_DEEP));
- std::vector<CrePtr> v2(Glib::ArrayHandle<CrePtr>(0, 5, Glib::OWNERSHIP_DEEP));
- std::vector<CrePtr> v3(Glib::ListHandle<CrePtr>(0, Glib::OWNERSHIP_DEEP));
- std::vector<CrePtr> v4(Glib::SListHandle<CrePtr>(0, Glib::OWNERSHIP_DEEP));
- std::vector<bool> v5(Glib::ArrayHandle<bool>(0, Glib::OWNERSHIP_DEEP));
- std::vector<bool> v6(Glib::ArrayHandle<bool>(0, 5, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v1(Glib::ArrayHandle<CrePtr>(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v2(Glib::ArrayHandle<CrePtr>(nullptr, 5, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v3(Glib::ListHandle<CrePtr>(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v4(Glib::SListHandle<CrePtr>(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<bool> v5(Glib::ArrayHandle<bool>(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<bool> v6(Glib::ArrayHandle<bool>(nullptr, 5, Glib::OWNERSHIP_DEEP));
if (v1.empty() && v2.empty() && v3.empty() && v4.empty() && v5.empty() && v6.empty())
{
diff --git a/tests/glibmm_null_vectorutils/main.cc b/tests/glibmm_null_vectorutils/main.cc
index 567d417..711b74d 100644
--- a/tests/glibmm_null_vectorutils/main.cc
+++ b/tests/glibmm_null_vectorutils/main.cc
@@ -26,12 +26,12 @@ main()
Gio::init();
typedef Glib::RefPtr<Gio::Credentials> CrePtr;
- std::vector<CrePtr> v1(Glib::ArrayHandler<CrePtr>::array_to_vector(0, Glib::OWNERSHIP_DEEP));
- std::vector<CrePtr> v2(Glib::ArrayHandler<CrePtr>::array_to_vector(0, 5, Glib::OWNERSHIP_DEEP));
- std::vector<CrePtr> v3(Glib::ListHandler<CrePtr>::list_to_vector(0, Glib::OWNERSHIP_DEEP));
- std::vector<CrePtr> v4(Glib::SListHandler<CrePtr>::slist_to_vector(0, Glib::OWNERSHIP_DEEP));
- std::vector<bool> v5(Glib::ArrayHandler<bool>::array_to_vector(0, Glib::OWNERSHIP_DEEP));
- std::vector<bool> v6(Glib::ArrayHandler<bool>::array_to_vector(0, 5, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v1(Glib::ArrayHandler<CrePtr>::array_to_vector(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v2(Glib::ArrayHandler<CrePtr>::array_to_vector(nullptr, 5, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v3(Glib::ListHandler<CrePtr>::list_to_vector(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v4(Glib::SListHandler<CrePtr>::slist_to_vector(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<bool> v5(Glib::ArrayHandler<bool>::array_to_vector(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<bool> v6(Glib::ArrayHandler<bool>::array_to_vector(nullptr, 5, Glib::OWNERSHIP_DEEP));
if (v1.empty() && v2.empty() && v3.empty() && v4.empty() && v5.empty() && v6.empty())
{
diff --git a/tests/glibmm_vector/main.cc b/tests/glibmm_vector/main.cc
index d184ecc..9d78c8c 100644
--- a/tests/glibmm_vector/main.cc
+++ b/tests/glibmm_vector/main.cc
@@ -72,7 +72,7 @@ print_list(GList* list)
GSList*
create_slist()
{
- GSList* head = 0;
+ GSList* head = nullptr;
for(unsigned int iter(0); iter < magic_limit; ++iter)
{
@@ -202,12 +202,12 @@ public:
{
if(glist_)
{
- g_list_foreach(glist_, reinterpret_cast<GFunc>(g_object_unref), 0);
+ g_list_foreach(glist_, reinterpret_cast<GFunc>(g_object_unref), nullptr);
g_list_free(glist_);
}
if(gslist_)
{
- g_slist_foreach(gslist_, reinterpret_cast<GFunc>(g_object_unref), 0);
+ g_slist_foreach(gslist_, reinterpret_cast<GFunc>(g_object_unref), nullptr);
g_slist_free(gslist_);
}
if(garray_)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]