[glom] C++11: Use of nullptr for returns.



commit 4baa9095d319f48b4339ab839edaca104fcb82bf
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Nov 3 21:36:51 2015 +0100

    C++11: Use of nullptr for returns.

 glom/box_withbuttons.cc                            |    4 ++--
 glom/dialog_existing_or_new.cc                     |    2 +-
 glom/frame_glom.cc                                 |    2 +-
 glom/libglom/connectionpool.cc                     |    6 +++---
 glom/libglom/data_structure/field.cc               |    2 +-
 glom/mode_data/datawidget/cellcreation.cc          |    6 +++---
 glom/mode_data/flowtablewithfields.cc              |    8 ++++----
 .../report_layout/dialog_layout_report.cc          |    2 +-
 glom/utility_widgets/flowtable.cc                  |    4 ++--
 glom/utility_widgets/layoutwidgetbase.cc           |    2 +-
 10 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/glom/box_withbuttons.cc b/glom/box_withbuttons.cc
index cb4ed5a..a9bf7a3 100644
--- a/glom/box_withbuttons.cc
+++ b/glom/box_withbuttons.cc
@@ -103,7 +103,7 @@ Gtk::Window* Box_WithButtons::get_app_window()
     }
   }
 
-  return 0; //not found.
+  return nullptr; //not found.
 */
 }
 
@@ -121,7 +121,7 @@ void Box_WithButtons::set_button_cancel(Gtk::Button& button)
 
 Gtk::Widget* Box_WithButtons::get_default_button()
 {
-  return 0; //Override this if the box has a default button.
+  return nullptr; //Override this if the box has a default button.
 }
 
 
diff --git a/glom/dialog_existing_or_new.cc b/glom/dialog_existing_or_new.cc
index 9aa9bfa..06f06b4 100644
--- a/glom/dialog_existing_or_new.cc
+++ b/glom/dialog_existing_or_new.cc
@@ -415,7 +415,7 @@ EpcServiceInfo* Dialog_ExistingOrNew::get_service_info() const
   else
     throw std::logic_error("Dialog_ExistingOrNew::get_service_info: action is not OPEN_REMOTE");
 
-  return 0;
+  return nullptr;
 }
 
 Glib::ustring Dialog_ExistingOrNew::get_service_name() const
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index eb79739..d7805d5 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -1293,7 +1293,7 @@ Gtk::Window* Frame_Glom::get_app_window()
     }
   }
 
-  return 0; //not found.
+  return nullptr; //not found.
 
 }
 
diff --git a/glom/libglom/connectionpool.cc b/glom/libglom/connectionpool.cc
index 9dd704a..9c7d0f4 100644
--- a/glom/libglom/connectionpool.cc
+++ b/glom/libglom/connectionpool.cc
@@ -820,7 +820,7 @@ Document* ConnectionPool::get_document()
     //Don't bother warning because all the code that calls get_document() checks 
     //for 0 and responds reasonably.
     //std::cerr << G_STRFUNC << ": m_slot_get_document is null." << std::endl;
-    return 0;
+    return nullptr;
   }
 
   return m_slot_get_document();
@@ -832,11 +832,11 @@ EpcContents* ConnectionPool::on_publisher_document_requested(EpcPublisher* /* pu
 {
   auto connection_pool = static_cast<Glom::ConnectionPool*>(user_data);
   if(!connection_pool)
-    return 0;
+    return nullptr;
 
   const auto document = connection_pool->get_document();
   if(!document)
-    return 0;
+    return nullptr;
 
   const auto contents = document->get_contents();
   //std::cout << "debug: " << G_STRFUNC << ": returning: " << std::endl << "  " << contents << std::endl;
diff --git a/glom/libglom/data_structure/field.cc b/glom/libglom/data_structure/field.cc
index 5f7a5bc..db558c3 100644
--- a/glom/libglom/data_structure/field.cc
+++ b/glom/libglom/data_structure/field.cc
@@ -139,7 +139,7 @@ static const FieldTypes* get_field_types()
 {
   auto connection_pool = ConnectionPool::get_instance();
   if(!connection_pool)
-    return 0;
+    return nullptr;
 
   return connection_pool->get_field_types();
 }
diff --git a/glom/mode_data/datawidget/cellcreation.cc b/glom/mode_data/datawidget/cellcreation.cc
index 4c85215..86cc772 100644
--- a/glom/mode_data/datawidget/cellcreation.cc
+++ b/glom/mode_data/datawidget/cellcreation.cc
@@ -73,13 +73,13 @@ Gtk::CellRenderer* create_cell(const std::shared_ptr<const LayoutItem>& layout_i
   std::shared_ptr<const LayoutItem_Field> item_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(layout_item);
   if(item_field)
   {
-    //Ignore hiddent fields.
+    //Ignore hidden fields.
     //For instance, these are generally added to DbTreeModels when they would not otherwise contain the 
primary key,
     //so that the record can still be uniquely identified.
     if(item_field->get_hidden())
     {
       //std::cerr << G_STRFUNC << ": Returning 0 because the layout field is hidden. table_name=" << 
table_name << ", field name=" << item_field->get_name() << std::endl;
-      return 0;
+      return nullptr;
     }
 
     switch(item_field->get_glom_type())
@@ -169,7 +169,7 @@ Gtk::CellRenderer* create_cell(const std::shared_ptr<const LayoutItem>& layout_i
   if(!cell)
   {
     std::cerr << G_STRFUNC << ": Returning 0 because no cell was created." << std::endl;
-    return 0;
+    return nullptr;
   }
 
   //Use formatting:
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 2d3085b..52836e1 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -247,7 +247,7 @@ void FlowTableWithFields::add_layout_group(const std::shared_ptr<LayoutGroup>& g
 Box_Data_List_Related* FlowTableWithFields::create_related(const std::shared_ptr<LayoutItem_Portal>& portal, 
bool show_title)
 {
   if(!portal)
-    return 0;
+    return nullptr;
 
   auto pDocument = static_cast<Document*>(get_document());
   if(pDocument)
@@ -281,13 +281,13 @@ Box_Data_List_Related* FlowTableWithFields::create_related(const std::shared_ptr
     return portal_box;
   }
 
-  return 0;
+  return nullptr;
 }
 
 Box_Data_Calendar_Related* FlowTableWithFields::create_related_calendar(const 
std::shared_ptr<LayoutItem_CalendarPortal>& portal, bool show_title)
 {
   if(!portal)
-    return 0;
+    return nullptr;
 
   auto pDocument = static_cast<Document*>(get_document());
   if(pDocument)
@@ -321,7 +321,7 @@ Box_Data_Calendar_Related* FlowTableWithFields::create_related_calendar(const st
     return portal_box;
   }
 
-  return 0;
+  return nullptr;
 }
 
 void FlowTableWithFields::add_layout_portal(const std::shared_ptr<LayoutItem_Portal>& portal)
diff --git a/glom/mode_design/report_layout/dialog_layout_report.cc 
b/glom/mode_design/report_layout/dialog_layout_report.cc
index d6c2508..161f481 100644
--- a/glom/mode_design/report_layout/dialog_layout_report.cc
+++ b/glom/mode_design/report_layout/dialog_layout_report.cc
@@ -518,7 +518,7 @@ Gtk::TreeView* Dialog_Layout_Report::get_selected_treeview()
     default:
     {
       std::cerr << G_STRFUNC << ": Dialog_Layout_Report::get_selected_treeview(): Unrecognised current 
notebook page:"  << m_notebook_parts->get_current_page() << std::endl;
-      return 0;
+      return nullptr;
     }
   }
 }
diff --git a/glom/utility_widgets/flowtable.cc b/glom/utility_widgets/flowtable.cc
index d25effe..eaff72b 100644
--- a/glom/utility_widgets/flowtable.cc
+++ b/glom/utility_widgets/flowtable.cc
@@ -53,7 +53,7 @@ const Gtk::Box* FlowTable::get_parent_hbox(const Gtk::Widget* first) const
   if(iter_find == m_list_first_widgets.end())
   {
     std::cerr << G_STRFUNC << ": first was not a first widget. first=" << first << std::endl;
-    return 0; //It has no Box parent because it is not even a first widget.
+    return nullptr; //It has no Box parent because it is not even a first widget.
   }
   
   for(const auto& hbox : m_list_hboxes)
@@ -72,7 +72,7 @@ const Gtk::Box* FlowTable::get_parent_hbox(const Gtk::Widget* first) const
       return hbox;
   }
 
-  return 0;
+  return nullptr;
 }
 
 void FlowTable::delete_and_forget_hbox(Gtk::Box* hbox)
diff --git a/glom/utility_widgets/layoutwidgetbase.cc b/glom/utility_widgets/layoutwidgetbase.cc
index ebff05e..739fedc 100644
--- a/glom/utility_widgets/layoutwidgetbase.cc
+++ b/glom/utility_widgets/layoutwidgetbase.cc
@@ -56,7 +56,7 @@ std::shared_ptr<LayoutItem> LayoutWidgetBase::get_layout_item()
 
 AppWindow* LayoutWidgetBase::get_appwindow() const
 {
-  return 0; //override to implement.
+  return nullptr; //override to implement.
 }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY


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