[glibmm] More use of nullptr instead of 0.



commit 9ff4c7be6e8250f7fa59436f00ea707b41e23a72
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Nov 19 13:53:58 2015 +0100

    More use of nullptr instead of 0.

 gio/giomm/contenttype.cc      |    6 +++---
 gio/src/actiongroup.hg        |    4 ++--
 gio/src/application.ccg       |    6 +++---
 gio/src/asyncinitable.ccg     |    4 ++--
 gio/src/datainputstream.ccg   |   12 ++++++------
 gio/src/dbusconnection.ccg    |    4 ++--
 gio/src/dbusintrospection.ccg |    2 +-
 glib/src/optionentry.ccg      |    4 ++--
 glib/src/optionentry.hg       |    2 +-
 glib/src/thread.ccg           |    2 +-
 10 files changed, 23 insertions(+), 23 deletions(-)
---
diff --git a/gio/giomm/contenttype.cc b/gio/giomm/contenttype.cc
index 74efd24..ecd983f 100644
--- a/gio/giomm/contenttype.cc
+++ b/gio/giomm/contenttype.cc
@@ -80,7 +80,7 @@ Glib::ustring content_type_guess(const std::string& filename,
   const std::basic_string<guchar>& data, bool& result_uncertain)
 {
   gboolean c_result_uncertain = FALSE;
-  const gchar *c_filename = filename.empty () ? NULL : filename.c_str ();
+  const gchar *c_filename = filename.empty () ? nullptr : filename.c_str ();
   gchar* cresult = g_content_type_guess(c_filename, data.c_str(),
     data.size(), &c_result_uncertain);
   result_uncertain = c_result_uncertain;
@@ -91,7 +91,7 @@ Glib::ustring content_type_guess(const std::string& filename,
   const guchar* data, gsize data_size, bool& result_uncertain)
 {
   gboolean c_result_uncertain = FALSE;
-  const gchar *c_filename = filename.empty () ? NULL : filename.c_str ();
+  const gchar *c_filename = filename.empty () ? nullptr : filename.c_str ();
   gchar* cresult = g_content_type_guess(c_filename, data,
     data_size, &c_result_uncertain);
   result_uncertain = c_result_uncertain;
@@ -102,7 +102,7 @@ Glib::ustring content_type_guess(const std::string& filename,
   const std::string& data, bool& result_uncertain)
 {
   gboolean c_result_uncertain = FALSE;
-  const gchar *c_filename = filename.empty () ? NULL : filename.c_str ();
+  const gchar *c_filename = filename.empty () ? nullptr : filename.c_str ();
   gchar* cresult = g_content_type_guess(c_filename, (const guchar*)data.c_str(),
     data.size(), &c_result_uncertain);
   result_uncertain = c_result_uncertain;
diff --git a/gio/src/actiongroup.hg b/gio/src/actiongroup.hg
index a1d5d33..99af197 100644
--- a/gio/src/actiongroup.hg
+++ b/gio/src/actiongroup.hg
@@ -76,7 +76,7 @@ public:
 
   _WRAP_METHOD(Glib::VariantContainerBase get_action_state_hint(const Glib::ustring& action_name) const, 
g_action_group_get_action_state_hint, deprecated "Use the get_action_state() method that takes an output 
parameter instead.")
 
-  //TODO: How do we check for a NULL Variant?
+  //TODO: How do we check for a nullptr Variant?
   /**
    * Requests a hint about the valid range of values for the state of the
    * named action within the action group
@@ -105,7 +105,7 @@ public:
 
   _WRAP_METHOD(Glib::VariantBase get_action_state(const Glib::ustring& action_name) const, 
g_action_group_get_action_state, deprecated "Use the get_action_state() method that takes an output parameter 
instead.")
 
-  //TODO: How do we check for a NULL Variant?
+  //TODO: How do we check for a nullptr Variant?
   /** Queries the current state of the named action within the action group.
    *
    * If the action is not stateful then a null Variant will be returned.  If the
diff --git a/gio/src/application.ccg b/gio/src/application.ccg
index c24eb3c..0c29013 100644
--- a/gio/src/application.ccg
+++ b/gio/src/application.ccg
@@ -132,8 +132,8 @@ static const Glib::SignalProxyInfo Application_signal_open_info =
 // similarly to the corresponding Glib::OptionGroup::add_entry*() methods.
 // There is an important difference: In add_main_option_entry*() we can't pass
 // an Application pointer to the used GOptionGroup.
-// g_application_add_main_option_entries() creates a GOptionGroup with user_data == NULL.
-// Therefore Application_option_arg_callback() is called with data == NULL.
+// g_application_add_main_option_entries() creates a GOptionGroup with user_data == nullptr.
+// Therefore Application_option_arg_callback() is called with data == nullptr.
 // Application_option_arg_callback() does not know which Application instance
 // the command-line option belongs to. All Application instances (usually only one)
 // share a map, mapping the long command option name to an OptionArgCallbackData.
@@ -313,7 +313,7 @@ void Application_Class::open_callback(GApplication* self, GFile** files,
   if(obj_base && obj_base->is_derived_())
   {
     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
-    if(obj) // This can be NULL during destruction.
+    if(obj) // This can be nullptr during destruction.
     {
       try // Trap C++ exceptions which would normally be lost because this is a C callback.
       {
diff --git a/gio/src/asyncinitable.ccg b/gio/src/asyncinitable.ccg
index df26f6f..11a6d9b 100644
--- a/gio/src/asyncinitable.ccg
+++ b/gio/src/asyncinitable.ccg
@@ -62,7 +62,7 @@ void AsyncInitable_Class::init_async_vfunc_callback(GAsyncInitable* self,
   if(obj_base && obj_base->is_derived_())
   {
     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
-    if(obj) // This can be NULL during destruction.
+    if(obj) // This can be nullptr during destruction.
     {
       try // Trap C++ exceptions which would normally be lost because this is a C callback.
       {
@@ -121,7 +121,7 @@ gboolean AsyncInitable_Class::init_finish_vfunc_callback(GAsyncInitable* self,
   if(obj_base && obj_base->is_derived_())
   {
     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
-    if(obj) // This can be NULL during destruction.
+    if(obj) // This can be nullptr during destruction.
     {
       try // Trap C++ exceptions which would normally be lost because this is a C callback.
       {
diff --git a/gio/src/datainputstream.ccg b/gio/src/datainputstream.ccg
index 8dd8b31..ffc4d97 100644
--- a/gio/src/datainputstream.ccg
+++ b/gio/src/datainputstream.ccg
@@ -28,7 +28,7 @@ bool DataInputStream::read_line(std::string& line, const Glib::RefPtr<Cancellabl
 {
   GError* gerror = nullptr;
   char* c_line = g_data_input_stream_read_line(gobj(),
-                                               0, // pass NULL since we can easily determine the length from 
the returned std::string
+                                               nullptr, // pass nullptr since we can easily determine the 
length from the returned std::string
                                                Glib::unwrap(cancellable),
                                                &gerror);
   if(gerror)
@@ -46,7 +46,7 @@ bool DataInputStream::read_line(std::string& line)
 {
   GError* gerror = nullptr;
   char* c_line = g_data_input_stream_read_line(gobj(),
-                                               0, // pass NULL since we can easily determine the length from 
the returned std::string
+                                               nullptr, // pass nullptr since we can easily determine the 
length from the returned std::string
                                                0,
                                                &gerror);
   if(gerror)
@@ -98,7 +98,7 @@ bool DataInputStream::read_until(std::string& data, const std::string& stop_char
   GError* gerror = nullptr;
   char* c_str = g_data_input_stream_read_until(gobj(),
                                                stop_chars.c_str(),
-                                               0, // pass NULL since we can easily determine the length from 
the returned std::string
+                                               nullptr, // pass nullptr since we can easily determine the 
length from the returned std::string
                                                Glib::unwrap(cancellable),
                                                &gerror);
   if(gerror)
@@ -119,7 +119,7 @@ bool DataInputStream::read_until(std::string& data, const std::string& stop_char
   GError* gerror = nullptr;
   char* c_str = g_data_input_stream_read_until(gobj(),
                                                stop_chars.c_str(),
-                                               0, // pass NULL since we can easily determine the length from 
the returned std::string
+                                               nullptr, // pass nullptr since we can easily determine the 
length from the returned std::string
                                                0,
                                                &gerror);
   if(gerror)
@@ -172,7 +172,7 @@ bool DataInputStream::read_upto(std::string& data, const std::string& stop_chars
   GError* gerror = nullptr;
   char* c_str = g_data_input_stream_read_upto(gobj(),
                                                stop_chars.c_str(), -1, /* null-terminated */
-                                               0, // pass NULL since we can easily determine the length from 
the returned std::string
+                                               nullptr, // pass nullptr since we can easily determine the 
length from the returned std::string
                                                Glib::unwrap(cancellable),
                                                &gerror);
   if(gerror)
@@ -193,7 +193,7 @@ bool DataInputStream::read_upto(std::string& data, const std::string& stop_chars
   GError* gerror = nullptr;
   char* c_str = g_data_input_stream_read_upto(gobj(),
     stop_chars.c_str(), -1, /* null-terminated */
-    0, // pass NULL since we can easily determine the length from the returned std::string
+    nullptr, // pass nullptr since we can easily determine the length from the returned std::string
     0,
     &gerror);
 
diff --git a/gio/src/dbusconnection.ccg b/gio/src/dbusconnection.ccg
index 935a5d6..465d126 100644
--- a/gio/src/dbusconnection.ccg
+++ b/gio/src/dbusconnection.ccg
@@ -781,9 +781,9 @@ void Connection::emit_signal(
 {
   GError* gerror = nullptr;
 
-  // Strings are checked to see if they are empty so that NULL can be passed
+  // Strings are checked to see if they are empty so that nullptr can be passed
   // for those strings to the C API.  This is done because some strings such as
-  // the bus name can be NULL in the C API meaning that the signal should be
+  // the bus name can be nullptr in the C API meaning that the signal should be
   // emitted to all the listeners.
   g_dbus_connection_emit_signal(gobj(),
     (destination_bus_name.empty() ? 0 : destination_bus_name.c_str()),
diff --git a/gio/src/dbusintrospection.ccg b/gio/src/dbusintrospection.ccg
index 771dbef..788ea31 100644
--- a/gio/src/dbusintrospection.ccg
+++ b/gio/src/dbusintrospection.ccg
@@ -27,7 +27,7 @@ namespace DBus
 {
 
 //We hand-code this because g_dbus_node_info_lookup_interface() doesn't
-//do this when it takes a NULL.
+//do this when it takes a nullptr.
 //See bug https://bugzilla.gnome.org/show_bug.cgi?id=646417
 Glib::RefPtr<InterfaceInfo> NodeInfo::lookup_interface()
 {
diff --git a/glib/src/optionentry.ccg b/glib/src/optionentry.ccg
index 85df578..1548aab 100644
--- a/glib/src/optionentry.ccg
+++ b/glib/src/optionentry.ccg
@@ -102,10 +102,10 @@ void OptionEntry::set_long_name(const Glib::ustring& value)
     gobject_->long_name = nullptr;
   }
 
-  //Note that we do not use NULL for an empty string,
+  //Note that we do not use nullptr for an empty string,
   //because G_OPTION_REMAINING is actually a "", so it actually has a distinct meaning:
   //TODO: Wrap G_OPTION_REMAINING in C++ somehow, maybe as an explicit set_long_name(void) or 
set_is_remaining()? murrayc.
-  gobj()->long_name = (value).c_str() ? g_strdup((value).c_str()) : 0;
+  gobj()->long_name = (value).c_str() ? g_strdup((value).c_str()) : nullptr;
 }
 
 void OptionEntry::set_description(const Glib::ustring& value)
diff --git a/glib/src/optionentry.hg b/glib/src/optionentry.hg
index 8ff4a11..246aa96 100644
--- a/glib/src/optionentry.hg
+++ b/glib/src/optionentry.hg
@@ -67,7 +67,7 @@ public:
 
   OptionEntry& operator=(const OptionEntry& src);
 
-  //#m4 _CONVERSION(`Glib::ustring',`const gchar*',`($3).empty() ? NULL : g_strdup(($3).c_str())')
+  //#m4 _CONVERSION(`Glib::ustring',`const gchar*',`($3).empty() ? nullptr : g_strdup(($3).c_str())')
 
   _MEMBER_GET(long_name, long_name, Glib::ustring, const char*)
 
diff --git a/glib/src/thread.ccg b/glib/src/thread.ccg
index cfca218..b1cacc2 100644
--- a/glib/src/thread.ccg
+++ b/glib/src/thread.ccg
@@ -75,7 +75,7 @@ Thread* Thread::create(const sigc::slot<void>& slot, bool /* joinable */)
 
   GError* error = nullptr;
 
-  const auto thread = g_thread_try_new(NULL,
+  const auto thread = g_thread_try_new(nullptr,
       &call_thread_entry_slot, slot_copy, &error);
 
   if(error)


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