[gnome-commander/gcmd-1-10: 52/57] C++ cast, use nullptr instead of NULL



commit 4d7c0035daab2871187703e5e4c924b0ba6caa78
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Wed Apr 10 21:50:30 2019 +0200

    C++ cast, use nullptr instead of NULL

 src/intviewer/scroll-box.cc          | 34 +++++++++++++++++-----------------
 src/intviewer/search-progress-dlg.cc | 30 +++++++++++++++---------------
 2 files changed, 32 insertions(+), 32 deletions(-)
---
diff --git a/src/intviewer/scroll-box.cc b/src/intviewer/scroll-box.cc
index d154b42a..9251bf94 100644
--- a/src/intviewer/scroll-box.cc
+++ b/src/intviewer/scroll-box.cc
@@ -36,7 +36,7 @@
 using namespace std;
 
 
-static GtkTableClass *parent_class = NULL;
+static GtkTableClass *parent_class = nullptr;
 
 // Class Private Data
 struct ScrollBoxPrivate
@@ -65,11 +65,11 @@ GtkType scroll_box_get_type ()
         GTypeInfo info =
         {
             sizeof (ScrollBoxClass),
-            NULL,
-            NULL,
+            nullptr,
+            nullptr,
             (GClassInitFunc) scroll_box_class_init,
-            NULL,
-            NULL,
+            nullptr,
+            nullptr,
             sizeof(ScrollBox),
             0,
             (GInstanceInitFunc) scroll_box_init
@@ -82,7 +82,7 @@ GtkType scroll_box_get_type ()
 
 GtkWidget* scroll_box_new ()
 {
-    ScrollBox *w = (ScrollBox *) g_object_new (scroll_box_get_type (), NULL);
+    auto w = static_cast<ScrollBox*> (g_object_new (scroll_box_get_type (), nullptr));
 
     return GTK_WIDGET (w);
 }
@@ -106,18 +106,18 @@ static void scroll_box_init (ScrollBox *w)
     gtk_table_resize (GTK_TABLE (w), 2, 2);
     gtk_table_set_homogeneous (GTK_TABLE (w), FALSE);
 
-    w->priv->vscroll = gtk_vscrollbar_new (NULL);
+    w->priv->vscroll = gtk_vscrollbar_new (nullptr);
     gtk_widget_show (w->priv->vscroll);
     gtk_table_attach (GTK_TABLE (w), w->priv->vscroll, 1, 2, 0, 1,
         (GtkAttachOptions) (GTK_FILL),
         (GtkAttachOptions) (GTK_FILL), 0, 0);
 
-    w->priv->hscroll = gtk_hscrollbar_new (NULL);
+    w->priv->hscroll = gtk_hscrollbar_new (nullptr);
     gtk_widget_show (w->priv->hscroll);
     gtk_table_attach (GTK_TABLE (w), w->priv->hscroll, 0, 1, 1, 2,
             (GtkAttachOptions) (GTK_FILL),
             (GtkAttachOptions) (GTK_FILL), 0, 0);
-    w->priv->client = NULL;
+    w->priv->client = nullptr;
 
     g_signal_connect (w, "button-press-event", G_CALLBACK (scroll_box_button_press), w);
     g_signal_connect (w, "destroy-event", G_CALLBACK (scroll_box_destroy), w);
@@ -134,10 +134,10 @@ static void scroll_box_destroy (GtkObject *widget)
     {
         if (w->priv->client)
             g_object_unref (w->priv->client);
-        w->priv->client=NULL;
+        w->priv->client = nullptr;
 
         g_free(w->priv);
-        w->priv = NULL;
+        w->priv = nullptr;
     }
 
     if (GTK_OBJECT_CLASS (parent_class)->destroy)
@@ -156,7 +156,7 @@ GtkRange *scroll_box_get_v_range(ScrollBox *obj)
 static gboolean scroll_box_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
 {
     g_return_val_if_fail (IS_SCROLL_BOX (widget), FALSE);
-    g_return_val_if_fail (event != NULL, FALSE);
+    g_return_val_if_fail (event != nullptr, FALSE);
 
     // ScrollBox *w = SCROLL_BOX (widget);
 
@@ -167,13 +167,13 @@ static gboolean scroll_box_button_press(GtkWidget *widget, GdkEventButton *event
 void scroll_box_set_client (ScrollBox *obj, GtkWidget *client)
 {
     g_return_if_fail (IS_SCROLL_BOX (obj));
-    g_return_if_fail (client!=NULL);
+    g_return_if_fail (client != nullptr);
 
     if (obj->priv->client)
     {
         if (obj->priv->client)
             g_object_unref (obj->priv->client);
-        obj->priv->client = NULL;
+        obj->priv->client = nullptr;
     }
 
     g_object_ref (client);
@@ -187,7 +187,7 @@ void scroll_box_set_client (ScrollBox *obj, GtkWidget *client)
 
 GtkWidget *scroll_box_get_client (ScrollBox *obj)
 {
-    g_return_val_if_fail (IS_SCROLL_BOX (obj), NULL);
+    g_return_val_if_fail (IS_SCROLL_BOX (obj), nullptr);
 
     return obj->priv->client;
 }
@@ -211,7 +211,7 @@ void scroll_box_set_v_adjustment (ScrollBox *obj, GtkAdjustment *adjustment)
 
 GtkAdjustment *scroll_box_get_h_adjustment (ScrollBox *obj)
 {
-    g_return_val_if_fail (IS_SCROLL_BOX (obj), NULL);
+    g_return_val_if_fail (IS_SCROLL_BOX (obj), nullptr);
 
     return gtk_range_get_adjustment (GTK_RANGE (obj->priv->hscroll));
 }
@@ -219,7 +219,7 @@ GtkAdjustment *scroll_box_get_h_adjustment (ScrollBox *obj)
 
 GtkAdjustment *scroll_box_get_v_adjustment (ScrollBox *obj)
 {
-    g_return_val_if_fail (IS_SCROLL_BOX (obj), NULL);
+    g_return_val_if_fail (IS_SCROLL_BOX (obj), nullptr);
 
     return gtk_range_get_adjustment (GTK_RANGE (obj->priv->vscroll));
 }
diff --git a/src/intviewer/search-progress-dlg.cc b/src/intviewer/search-progress-dlg.cc
index 664fd93e..daf58a34 100644
--- a/src/intviewer/search-progress-dlg.cc
+++ b/src/intviewer/search-progress-dlg.cc
@@ -29,7 +29,7 @@
 using namespace std;
 
 
-static GtkDialogClass *parent_class = NULL;
+static GtkDialogClass *parent_class = nullptr;
 
 static void search_progress_dlg_destroy (GtkObject *object);
 static void search_progress_dlg_action_response(GtkDialog *dlg, gint arg1, GViewerSearchProgressDlg *sdlg);
@@ -47,9 +47,9 @@ struct GViewerSearchProgressDlgPrivate
 
 static void search_progress_dlg_action_response(GtkDialog *dlg, gint arg1, GViewerSearchProgressDlg *sdlg)
 {
-    g_return_if_fail (sdlg!=NULL);
-    g_return_if_fail (sdlg->priv!=NULL);
-    g_return_if_fail (sdlg->priv->abort_indicator!=NULL);
+    g_return_if_fail (sdlg != nullptr);
+    g_return_if_fail (sdlg->priv != nullptr);
+    g_return_if_fail (sdlg->priv->abort_indicator != nullptr);
 
     g_atomic_int_add(sdlg->priv->abort_indicator, 1);
 }
@@ -103,7 +103,7 @@ static void search_progress_dlg_destroy (GtkObject *object)
     GViewerSearchProgressDlg *w = GVIEWER_SEARCH_PROGRESS_DLG (object);
 
     g_free (w->priv);
-    w->priv = NULL;
+    w->priv = nullptr;
 
     if (GTK_OBJECT_CLASS (parent_class)->destroy)
         (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@@ -118,11 +118,11 @@ GType gviewer_search_progress_dlg_get_type ()
         static const GTypeInfo ttt_info =
         {
             sizeof (GViewerSearchProgressDlgClass),
-            NULL, // base_init
-            NULL, // base_finalize
+            nullptr, // base_init
+            nullptr, // base_finalize
             (GClassInitFunc) search_progress_dlg_class_init,
-            NULL, // class_finalize
-            NULL, // class_data
+            nullptr, // class_finalize
+            nullptr, // class_data
             sizeof (GViewerSearchProgressDlg),
             0, // n_preallocs
             (GInstanceInitFunc) search_progress_dlg_init,
@@ -137,7 +137,7 @@ GType gviewer_search_progress_dlg_get_type ()
 
 static GtkWidget *gviewer_search_progress_dlg_new (GtkWindow *parent)
 {
-    GViewerSearchProgressDlg *dlg = (GViewerSearchProgressDlg *) g_object_new 
(gviewer_search_progress_dlg_get_type(), NULL);
+    auto dlg = static_cast<GViewerSearchProgressDlg*> (g_object_new (gviewer_search_progress_dlg_get_type(), 
NULL));
 
     return GTK_WIDGET (dlg);
 }
@@ -171,10 +171,10 @@ static gboolean search_progress_dlg_timeout(gpointer data)
 void gviewer_show_search_progress_dlg(GtkWindow *parent, const gchar *searching_text,
                                       gint *abort, gint *complete, gint *progress)
 {
-    g_return_if_fail (abort!=NULL);
-    g_return_if_fail (complete!=NULL);
-    g_return_if_fail (progress!=NULL);
-    g_return_if_fail (searching_text!=NULL);
+    g_return_if_fail (abort != nullptr);
+    g_return_if_fail (complete != nullptr);
+    g_return_if_fail (progress != nullptr);
+    g_return_if_fail (searching_text != nullptr);
 
     gdouble dprogress;
     gchar text[20];
@@ -198,7 +198,7 @@ void gviewer_show_search_progress_dlg(GtkWindow *parent, const gchar *searching_
 
     gtk_dialog_run(GTK_DIALOG(dlg));
 
-    GSource *src = g_main_context_find_source_by_id(NULL, timeout_source_id);
+    GSource *src = g_main_context_find_source_by_id(nullptr, timeout_source_id);
     if (src)
         g_source_destroy(src);
 


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