[pangomm] C++11: Use of nullptr.



commit f3337965f5e4201ff26c5784aae667eba95f359d
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Dec 9 13:43:55 2016 +0100

    C++11: Use of nullptr.

 pango/src/attributes.ccg |    8 ++++----
 pango/src/attriter.ccg   |   14 +++++++-------
 pango/src/attrlist.ccg   |   12 ++++++------
 pango/src/color.ccg      |    4 ++--
 pango/src/context.ccg    |    2 +-
 pango/src/coverage.ccg   |    2 +-
 pango/src/fontface.ccg   |    2 +-
 pango/src/fontfamily.ccg |    2 +-
 pango/src/fontmap.ccg    |    2 +-
 pango/src/fontset.ccg    |    4 ++--
 pango/src/item.ccg       |    6 +++---
 pango/src/layout.ccg     |    2 +-
 pango/src/layoutline.ccg |    2 +-
 pango/src/tabarray.ccg   |    6 +++---
 14 files changed, 34 insertions(+), 34 deletions(-)
---
diff --git a/pango/src/attributes.ccg b/pango/src/attributes.ccg
index f7ecc64..d457f07 100644
--- a/pango/src/attributes.ccg
+++ b/pango/src/attributes.ccg
@@ -27,7 +27,7 @@ Attribute::Attribute()
 
 Attribute::Attribute(const Attribute& src)
 :
-  gobject_(src.gobject_ ? pango_attribute_copy(src.gobject_) : 0)
+  gobject_(src.gobject_ ? pango_attribute_copy(src.gobject_) : nullptr)
 {}
 
 Attribute::Attribute(PangoAttribute* castitem, bool take_copy)
@@ -37,7 +37,7 @@ Attribute::Attribute(PangoAttribute* castitem, bool take_copy)
     if(castitem)
       gobject_ = pango_attribute_copy(castitem);
     else
-      gobject_ = 0;
+      gobject_ = nullptr;
   }
   else
   {
@@ -50,12 +50,12 @@ Attribute::~Attribute()
 {
   if(gobject_)
     pango_attribute_destroy(gobject_);
-  gobject_ = 0;
+  gobject_ = nullptr;
 }
 
 Attribute& Attribute::operator=(const Attribute& src)
 {
-  PangoAttribute *const new_gobject = (src.gobject_ ? pango_attribute_copy(src.gobject_) : 0);
+  PangoAttribute *const new_gobject = (src.gobject_ ? pango_attribute_copy(src.gobject_) : nullptr);
 
   if(gobject_)
     pango_attribute_destroy(gobject_);
diff --git a/pango/src/attriter.ccg b/pango/src/attriter.ccg
index 78d103a..7f32874 100644
--- a/pango/src/attriter.ccg
+++ b/pango/src/attriter.ccg
@@ -28,7 +28,7 @@ AttrIter::AttrIter()
 
 AttrIter::AttrIter(const AttrIter& src)
 :
-  gobject_(src.gobject_ ? pango_attr_iterator_copy(src.gobject_) : 0)
+  gobject_(src.gobject_ ? pango_attr_iterator_copy(src.gobject_) : nullptr)
 {}
 
 AttrIter::AttrIter(PangoAttrIterator* castitem, bool take_copy)
@@ -38,7 +38,7 @@ AttrIter::AttrIter(PangoAttrIterator* castitem, bool take_copy)
     if(castitem)
       gobject_ = pango_attr_iterator_copy(castitem);
     else
-      gobject_ = 0;
+      gobject_ = nullptr;
   }
   else
   {
@@ -54,7 +54,7 @@ AttrIter::~AttrIter()
 
 AttrIter& AttrIter::operator=(const AttrIter& src)
 {
-  PangoAttrIterator *const new_gobject = (src.gobject_ ? pango_attr_iterator_copy(src.gobject_) : 0);
+  PangoAttrIterator *const new_gobject = (src.gobject_ ? pango_attr_iterator_copy(src.gobject_) : nullptr);
 
   if(gobject_)
      pango_attr_iterator_destroy(gobject_);
@@ -83,7 +83,7 @@ const AttrIter AttrIter::operator++(int)
  */
 AttrIter::operator bool() const
 {
-  return (gobject_ != 0);
+  return (gobject_ != nullptr);
 }
 
 bool AttrIter::next()
@@ -91,7 +91,7 @@ bool AttrIter::next()
   if(!pango_attr_iterator_next(gobj()))
   {
     pango_attr_iterator_destroy(gobject_);
-    gobject_ = 0; // Mark as invalid. There is no other way to determine whether the iterator is valid later.
+    gobject_ = nullptr; // Mark as invalid. There is no other way to determine whether the iterator is valid 
later.
     return false;
   }
   else
@@ -112,7 +112,7 @@ FontDescription AttrIter::get_font_desc() const
 Language AttrIter::get_language() const
 {
   FontDescription desc;
-  PangoLanguage* language = 0;
+  PangoLanguage* language = nullptr;
 
   pango_attr_iterator_get_font(const_cast<PangoAttrIterator*>(gobj()), desc.gobj(), &language, 0);
 
@@ -122,7 +122,7 @@ Language AttrIter::get_language() const
 SListHandle_Attribute AttrIter::get_extra_attrs() const
 {
   FontDescription desc;
-  GSList* extra_attrs = 0;
+  GSList* extra_attrs = nullptr;
 
   pango_attr_iterator_get_font(const_cast<PangoAttrIterator*>(gobj()), desc.gobj(), 0, &extra_attrs);
 
diff --git a/pango/src/attrlist.ccg b/pango/src/attrlist.ccg
index 193b39c..0cfda89 100644
--- a/pango/src/attrlist.ccg
+++ b/pango/src/attrlist.ccg
@@ -29,33 +29,33 @@ AttrList::AttrList(const Glib::ustring& markup_text, gunichar accel_marker)
   gboolean bTest = pango_parse_markup(markup_text.c_str(), -1 /* means null-terminated */, accel_marker,
                                          &gobject_, 0, 0, 0);
   if(bTest == FALSE)
-    gobject_ = 0;
+    gobject_ = nullptr;
 }
 
 _DEPRECATE_IFDEF_START
 AttrList::operator bool()
 {
-  return gobj() != 0;
+  return gobj() != nullptr;
 }
 _DEPRECATE_IFDEF_END
 
 AttrList::operator bool() const
 {
-  return gobj() != 0;
+  return gobj() != nullptr;
 }
 
 AttrList::AttrList(const Glib::ustring& markup_text, gunichar accel_marker, Glib::ustring& text, gunichar& 
accel_char)
 {
   //initialize output parameters:
   text.erase();
-  accel_char = 0;
+  accel_char = nullptr;
 
-  gchar* pchText = 0;
+  gchar* pchText = nullptr;
   gboolean bTest = pango_parse_markup(markup_text.c_str(), -1 /* means null-terminated */, accel_marker,
                                          &gobject_, &pchText, &accel_char, 0);
   if(bTest == FALSE)
   {
-    gobject_ = 0;
+    gobject_ = nullptr;
   }
   else
   {
diff --git a/pango/src/color.ccg b/pango/src/color.ccg
index e8e894b..c382311 100644
--- a/pango/src/color.ccg
+++ b/pango/src/color.ccg
@@ -28,13 +28,13 @@ PangoColor* _pango_color_new()
  _DEPRECATE_IFDEF_START
 Color::operator bool()
 {
-  return gobj() != 0;
+  return gobj() != nullptr;
 }
  _DEPRECATE_IFDEF_END
 
 Color::operator bool() const
 {
-  return gobj() != 0;
+  return gobj() != nullptr;
 }
 
 } /* namespace Pango */
diff --git a/pango/src/context.ccg b/pango/src/context.ccg
index a026572..3297d00 100644
--- a/pango/src/context.ccg
+++ b/pango/src/context.ccg
@@ -30,7 +30,7 @@ namespace Pango
 Glib::ArrayHandle< Glib::RefPtr<FontFamily> > Context::list_families() const
 {
   //Get array:
-  PangoFontFamily** pFamilies = 0;
+  PangoFontFamily** pFamilies = nullptr;
   int n_families = 0;
   pango_context_list_families(const_cast<PangoContext*>(gobj()), &pFamilies, &n_families);
   
diff --git a/pango/src/coverage.ccg b/pango/src/coverage.ccg
index 1734653..bd42fbe 100644
--- a/pango/src/coverage.ccg
+++ b/pango/src/coverage.ccg
@@ -26,7 +26,7 @@ namespace Pango
 
 Glib::ArrayHandle<unsigned char> Coverage::to_bytes() const
 {
-  guchar* bytes = 0;
+  guchar* bytes = nullptr;
   int n_bytes = 0;
   pango_coverage_to_bytes(const_cast<PangoCoverage*>(gobj()), &bytes, &n_bytes);
   return Glib::ArrayHandle<unsigned char>(bytes, n_bytes, Glib::OWNERSHIP_SHALLOW);
diff --git a/pango/src/fontface.ccg b/pango/src/fontface.ccg
index e35b42f..fd5c436 100644
--- a/pango/src/fontface.ccg
+++ b/pango/src/fontface.ccg
@@ -25,7 +25,7 @@ namespace Pango
 
 Glib::ArrayHandle<int> FontFace::list_sizes() const
 {
-  int* sizes = 0;
+  int* sizes = nullptr;
   int n_sizes = 0;
   pango_font_face_list_sizes(const_cast<PangoFontFace*>(gobj()), &sizes, &n_sizes);
 
diff --git a/pango/src/fontfamily.ccg b/pango/src/fontfamily.ccg
index 152cd65..4bb7b06 100644
--- a/pango/src/fontfamily.ccg
+++ b/pango/src/fontfamily.ccg
@@ -26,7 +26,7 @@ namespace Pango
 Glib::ArrayHandle< Glib::RefPtr<FontFace> > FontFamily::list_faces() const
 {
   //Get the array:
-  PangoFontFace** pFontFaces = 0;
+  PangoFontFace** pFontFaces = nullptr;
   int n_fonts = 0;
   pango_font_family_list_faces(const_cast<PangoFontFamily*>(gobj()), &pFontFaces, &n_fonts);
 
diff --git a/pango/src/fontmap.ccg b/pango/src/fontmap.ccg
index 559ad05..0fedf36 100644
--- a/pango/src/fontmap.ccg
+++ b/pango/src/fontmap.ccg
@@ -29,7 +29,7 @@ namespace Pango
 Glib::ArrayHandle< Glib::RefPtr<FontFamily> > FontMap::list_families() const
 {
   //Get the array:
-  PangoFontFamily** pFamilies = 0;
+  PangoFontFamily** pFamilies = nullptr;
   int n_families = 0;
   pango_font_map_list_families(const_cast<PangoFontMap*>(gobj()), &pFamilies, &n_families);
 
diff --git a/pango/src/fontset.ccg b/pango/src/fontset.ccg
index a4a1ab2..befb77d 100644
--- a/pango/src/fontset.ccg
+++ b/pango/src/fontset.ccg
@@ -26,8 +26,8 @@ static gboolean fontset_foreach_callback(PangoFontset* /* fontset */, PangoFont*
   try
   {
   #endif //GLIBMM_EXCEPTIONS_ENABLED
-    Pango::Fontset::ForeachSlot& slot = *static_cast<Pango::Fontset::ForeachSlot*>(data);
-    Glib::RefPtr<Pango::Font> cppFont = Glib::wrap(font, true /* take_copy */);
+    auto& slot = *static_cast<Pango::Fontset::ForeachSlot*>(data);
+    auto cppFont = Glib::wrap(font, true /* take_copy */);
 
     return slot(cppFont);
   #ifdef GLIBMM_EXCEPTIONS_ENABLED
diff --git a/pango/src/item.ccg b/pango/src/item.ccg
index f948a56..40dba74 100644
--- a/pango/src/item.ccg
+++ b/pango/src/item.ccg
@@ -38,7 +38,7 @@ SListHandle_Attribute Analysis::get_extra_attrs() const
 
 Item::Item(const Item& src)
 :
-  gobject_ ((src.gobject_) ? pango_item_copy(src.gobject_) : 0)
+  gobject_ ((src.gobject_) ? pango_item_copy(src.gobject_) : nullptr)
 {}
 
 Item::Item(PangoItem* castitem, bool make_a_copy)
@@ -52,7 +52,7 @@ Item::Item(PangoItem* castitem, bool make_a_copy)
     if(castitem)
       gobject_ = pango_item_copy(castitem);
     else
-      gobject_ = 0;
+      gobject_ = nullptr;
   }
   else
   {
@@ -63,7 +63,7 @@ Item::Item(PangoItem* castitem, bool make_a_copy)
 
 Item& Item::operator=(const Item& src)
 {
-  PangoItem *const new_gobject = (src.gobject_) ? pango_item_copy(src.gobject_) : 0;
+  PangoItem *const new_gobject = (src.gobject_) ? pango_item_copy(src.gobject_) : nullptr;
 
   if(gobject_)
     pango_item_free(gobject_);
diff --git a/pango/src/layout.ccg b/pango/src/layout.ccg
index 9f4cd27..70a5465 100644
--- a/pango/src/layout.ccg
+++ b/pango/src/layout.ccg
@@ -58,7 +58,7 @@ void Layout::set_markup(const Glib::ustring& markup, gunichar accel_marker, guni
 Glib::ArrayHandle<PangoLogAttr> Layout::get_log_attrs() const
 {
   //Get array:
-  PangoLogAttr* pAttrs = 0;
+  PangoLogAttr* pAttrs = nullptr;
   int n_attrs = 0;
   pango_layout_get_log_attrs(const_cast<PangoLayout*>(gobj()), &pAttrs, &n_attrs);
 
diff --git a/pango/src/layoutline.ccg b/pango/src/layoutline.ccg
index d1d4fec..1ed387b 100644
--- a/pango/src/layoutline.ccg
+++ b/pango/src/layoutline.ccg
@@ -62,7 +62,7 @@ int LayoutLine::index_to_x(int index, bool trailing) const
 
 Glib::ArrayHandle<std::pair<int,int> > LayoutLine::get_x_ranges(int start_index, int end_index) const
 {
-  int* ranges = 0;
+  int* ranges = nullptr;
   int n_ranges = 0;
   pango_layout_line_get_x_ranges(const_cast<PangoLayoutLine*>(gobj()), start_index, end_index, &ranges, 
&n_ranges);
   return Glib::ArrayHandle<std::pair<int,int> >(reinterpret_cast<std::pair<int,int>*>(ranges), n_ranges, 
Glib::OWNERSHIP_SHALLOW);
diff --git a/pango/src/tabarray.ccg b/pango/src/tabarray.ccg
index ff102dc..bf22aa0 100644
--- a/pango/src/tabarray.ccg
+++ b/pango/src/tabarray.ccg
@@ -42,14 +42,14 @@ Glib::ArrayHandle< std::pair<TabAlign,int> > TabArray::get_tabs() const
 {
   typedef std::pair<TabAlign,int> PairType;
 
-  PairType* pair_buffer = 0;
+  PairType* pair_buffer = nullptr;
   const int size = pango_tab_array_get_size(const_cast<PangoTabArray*>(gobj()));
 
   if(size > 0)
   {
     // Get arrays
-    PangoTabAlign* pAlignments = 0;
-    int*           pLocations  = 0;
+    PangoTabAlign* pAlignments = nullptr;
+    int*           pLocations  = nullptr;
     pango_tab_array_get_tabs(const_cast<PangoTabArray*>(gobj()), &pAlignments, &pLocations);
 
     if(pAlignments && pLocations)


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