[gtkmm/gtkmm-3-18] Gdk: Use nullptr instead of 0



commit 8efedb8765851cd4c7bad9ad5268b4505c8167b2
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Thu Dec 10 10:53:23 2015 +0100

    Gdk: Use nullptr instead of 0

 gdk/gdkmm/general.cc            |    5 +----
 gdk/src/cursor.hg               |    2 +-
 gdk/src/device.ccg              |    8 ++++----
 gdk/src/display.ccg             |    2 +-
 gdk/src/dragcontext.hg          |    2 +-
 gdk/src/pixbuf.ccg              |    8 ++++----
 gdk/src/pixbufanimationiter.ccg |    2 +-
 gdk/src/pixbufformat.ccg        |    2 +-
 gdk/src/pixbufloader.ccg        |    2 +-
 gdk/src/rectangle.ccg           |    2 +-
 gdk/src/window.ccg              |   12 ++++++------
 tools/m4/convert_gdk.m4         |    6 +++---
 12 files changed, 25 insertions(+), 28 deletions(-)
---
diff --git a/gdk/gdkmm/general.cc b/gdk/gdkmm/general.cc
index 8c05928..8c7704f 100644
--- a/gdk/gdkmm/general.cc
+++ b/gdk/gdkmm/general.cc
@@ -1,6 +1,3 @@
-// -*- c++ -*-
-/* $Id$ */
-
 /* Copyright 2002      The gtkmm Development Team
  *
  * This library is free software; you can redistribute it and/or
@@ -87,7 +84,7 @@ void add_rectangle_to_path(const ::Cairo::RefPtr< ::Cairo::Context >& context, c
 
 void add_region_to_path(const ::Cairo::RefPtr< ::Cairo::Context >& context, const ::Cairo::RefPtr< 
::Cairo::Region>& region)
 {
-  gdk_cairo_region(context->cobj(), (region ? region->cobj() : 0));
+  gdk_cairo_region(context->cobj(), (region ? region->cobj() : nullptr));
 }
 
 } //namespace Cairo
diff --git a/gdk/src/cursor.hg b/gdk/src/cursor.hg
index 81c7b3e..ab6ab4c 100644
--- a/gdk/src/cursor.hg
+++ b/gdk/src/cursor.hg
@@ -52,7 +52,7 @@ public:
   _WRAP_METHOD(static Glib::RefPtr<Cursor> create(const Glib::RefPtr<Display>& display, CursorType 
cursor_type), gdk_cursor_new_for_display)
   _WRAP_METHOD(static Glib::RefPtr<Cursor> create(const Glib::RefPtr<Display>& display, const 
Glib::RefPtr<Pixbuf>& pixbuf, int x, int y), gdk_cursor_new_from_pixbuf)
 
-#m4 _CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Surface>&',`cairo_surface_t*',`($3) ? 
const_cast<cairo_surface_t*>(($3)->cobj()) : 0')
+#m4 _CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Surface>&',`cairo_surface_t*',`($3) ? 
const_cast<cairo_surface_t*>(($3)->cobj()) : nullptr')
   _WRAP_METHOD(static Glib::RefPtr<Cursor> create(const Glib::RefPtr<Display>& display, const 
::Cairo::RefPtr< ::Cairo::Surface>& surface, double x, double y), gdk_cursor_new_from_surface)
 
   _WRAP_METHOD(static Glib::RefPtr<Cursor> create(const Glib::RefPtr<Display>& display, const Glib::ustring& 
name), gdk_cursor_new_from_name)
diff --git a/gdk/src/device.ccg b/gdk/src/device.ccg
index 0ff05aa..90eab66 100644
--- a/gdk/src/device.ccg
+++ b/gdk/src/device.ccg
@@ -36,7 +36,7 @@ std::vector<TimeCoord> Device::get_history(const Glib::RefPtr<Window>& window, g
 
 void Device::get_position(int& x, int& y) const
 {
-  gdk_device_get_position(const_cast<GdkDevice*>(gobj()), 0, &x, &y);
+  gdk_device_get_position(const_cast<GdkDevice*>(gobj()), nullptr, &x, &y);
 }
 
 void Device::get_position(Glib::RefPtr<Screen>& screen, int& x, int& y) const
@@ -48,7 +48,7 @@ void Device::get_position(Glib::RefPtr<Screen>& screen, int& x, int& y) const
 
 void Device::get_position(double& x, double& y) const
 {
-  gdk_device_get_position_double(const_cast<GdkDevice*>(gobj()), 0, &x, &y);
+  gdk_device_get_position_double(const_cast<GdkDevice*>(gobj()), nullptr, &x, &y);
 }
 
 void Device::get_position(Glib::RefPtr<Screen>& screen, double& x, double& y) const
@@ -60,7 +60,7 @@ void Device::get_position(Glib::RefPtr<Screen>& screen, double& x, double& y) co
 
 Glib::RefPtr<Window> Device::get_window_at_position()
 {
-  auto retvalue = Glib::wrap(gdk_device_get_window_at_position(gobj(), 0, 0));
+  auto retvalue = Glib::wrap(gdk_device_get_window_at_position(gobj(), nullptr, nullptr));
   if(retvalue)
     retvalue->reference(); //The function does not do a ref for us.
   return retvalue;
@@ -73,7 +73,7 @@ Glib::RefPtr<const Window> Device::get_window_at_position() const
 
 GrabStatus Device::grab(const Glib::RefPtr<Window>& window, GrabOwnership grab_ownership, bool owner_events, 
EventMask event_mask, guint32 time_)
 {
-  return static_cast<GrabStatus>(gdk_device_grab(gobj(), Glib::unwrap(window), 
static_cast<GdkGrabOwnership>(grab_ownership), static_cast<int>(owner_events), 
static_cast<GdkEventMask>(event_mask), 0, time_));
+  return static_cast<GrabStatus>(gdk_device_grab(gobj(), Glib::unwrap(window), 
static_cast<GdkGrabOwnership>(grab_ownership), static_cast<int>(owner_events), 
static_cast<GdkEventMask>(event_mask), nullptr, time_));
 }
 
 std::vector<std::string> Device::list_axes() const
diff --git a/gdk/src/display.ccg b/gdk/src/display.ccg
index c6cf5a2..6cebffd 100644
--- a/gdk/src/display.ccg
+++ b/gdk/src/display.ccg
@@ -43,7 +43,7 @@ void Display::selection_send_notify(const Glib::RefPtr<Window>& requestor, Glib:
 
 void Display::store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_)
 {
-  gdk_display_store_clipboard(gobj(), clipboard_window->gobj(), time_, 0 /* see the C docs */, 0);
+  gdk_display_store_clipboard(gobj(), clipboard_window->gobj(), time_, nullptr /* see the C docs */, 0);
 }
 
 void Display::store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_, const 
std::vector<Glib::ustring>& targets)
diff --git a/gdk/src/dragcontext.hg b/gdk/src/dragcontext.hg
index 74abecd..558d3a9 100644
--- a/gdk/src/dragcontext.hg
+++ b/gdk/src/dragcontext.hg
@@ -69,7 +69,7 @@ public:
 
   // void set_icon(Gtk::Widget* widget, int hot_x, int hot_y) - see Gtk::Widget::set_as_icon().
 
-  #m4 _CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Surface>&',`cairo_surface_t*',`($3) ? 
const_cast<cairo_surface_t*>(($3)->cobj()) : 0')
+  #m4 _CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Surface>&',`cairo_surface_t*',`($3) ? 
const_cast<cairo_surface_t*>(($3)->cobj()) : nullptr')
   _WRAP_METHOD(void set_icon(const ::Cairo::RefPtr< ::Cairo::Surface>& surface), gtk_drag_set_icon_surface)
 
   _WRAP_METHOD(void set_icon(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, int hot_x, int hot_y), 
gtk_drag_set_icon_pixbuf)
diff --git a/gdk/src/pixbuf.ccg b/gdk/src/pixbuf.ccg
index 1c9e19c..ef37fbb 100644
--- a/gdk/src/pixbuf.ccg
+++ b/gdk/src/pixbuf.ccg
@@ -69,7 +69,7 @@ Glib::RefPtr<Pixbuf> Pixbuf::create_from_data(const guint8* data, Colorspace col
 {
   const auto pixbuf = gdk_pixbuf_new_from_data(
       data, (GdkColorspace) colorspace, has_alpha, bits_per_sample, width, height, rowstride,
-      0, 0);
+      nullptr, nullptr);
 
   return Glib::wrap(pixbuf);
 }
@@ -89,7 +89,7 @@ Glib::RefPtr<Pixbuf> Pixbuf::create_from_data(const guint8* data, Colorspace col
 Glib::RefPtr<Pixbuf> Pixbuf::create_from_stream(const Glib::RefPtr<Gio::InputStream>& stream)
 {
   GError* gerror = nullptr;
-  auto retvalue = Glib::wrap(gdk_pixbuf_new_from_stream(const_cast<GInputStream*>(Glib::unwrap(stream)), 0, 
&(gerror)));
+  auto retvalue = Glib::wrap(gdk_pixbuf_new_from_stream(const_cast<GInputStream*>(Glib::unwrap(stream)), 
nullptr, &(gerror)));
 
   if(gerror)
     ::Glib::Error::throw_exception(gerror);
@@ -100,7 +100,7 @@ Glib::RefPtr<Pixbuf> Pixbuf::create_from_stream(const Glib::RefPtr<Gio::InputStr
 Glib::RefPtr<Pixbuf> Pixbuf::create_from_stream_at_scale(const Glib::RefPtr<Gio::InputStream>& stream, int 
width, int height, bool preserve_aspect_ratio)
 {
   GError* gerror = nullptr;
-  auto retvalue = 
Glib::wrap(gdk_pixbuf_new_from_stream_at_scale(const_cast<GInputStream*>(Glib::unwrap(stream)), width, 
height, static_cast<int>(preserve_aspect_ratio), 0, &(gerror)));
+  auto retvalue = 
Glib::wrap(gdk_pixbuf_new_from_stream_at_scale(const_cast<GInputStream*>(Glib::unwrap(stream)), width, 
height, static_cast<int>(preserve_aspect_ratio), nullptr, &(gerror)));
 
   if(gerror)
     ::Glib::Error::throw_exception(gerror);
@@ -112,7 +112,7 @@ void Pixbuf::save(const std::string& filename, const Glib::ustring& type) const
 {
   GError* gerror = nullptr;
   gdk_pixbuf_savev(const_cast<GdkPixbuf*>(gobj()),
-                   filename.c_str(), type.c_str(), 0, 0, &gerror);
+                   filename.c_str(), type.c_str(), nullptr, nullptr, &gerror);
 
   if(gerror)
     ::Glib::Error::throw_exception(gerror);
diff --git a/gdk/src/pixbufanimationiter.ccg b/gdk/src/pixbufanimationiter.ccg
index 410ecae..90559ea 100644
--- a/gdk/src/pixbufanimationiter.ccg
+++ b/gdk/src/pixbufanimationiter.ccg
@@ -21,7 +21,7 @@ namespace Gdk
 
 bool PixbufAnimationIter::advance()
 {
-  return gdk_pixbuf_animation_iter_advance(gobj(), NULL);
+  return gdk_pixbuf_animation_iter_advance(gobj(), nullptr);
 }
 
 } //namespace Gdk
diff --git a/gdk/src/pixbufformat.ccg b/gdk/src/pixbufformat.ccg
index 0473286..22358d6 100644
--- a/gdk/src/pixbufformat.ccg
+++ b/gdk/src/pixbufformat.ccg
@@ -21,7 +21,7 @@ namespace Gdk
 {
 
 PixbufFormat::PixbufFormat()
-: gobject_(0) //because only a gdk-pixbuf backend can create them.
+: gobject_(nullptr) //because only a gdk-pixbuf backend can create them.
 {
 }
 
diff --git a/gdk/src/pixbufloader.ccg b/gdk/src/pixbufloader.ccg
index ec5a92d..bbd2136 100644
--- a/gdk/src/pixbufloader.ccg
+++ b/gdk/src/pixbufloader.ccg
@@ -48,7 +48,7 @@ namespace Gdk
 
 PixbufLoader::PixbufLoader(const Glib::ustring& image_type, bool mime_type)
 :
-  Glib::ObjectBase(0),
+  Glib::ObjectBase(nullptr),
   Glib::Object((GObject*) pixbuf_loader_create_with_type(image_type, mime_type))
 {}
 
diff --git a/gdk/src/rectangle.ccg b/gdk/src/rectangle.ccg
index 599e80c..3805be3 100644
--- a/gdk/src/rectangle.ccg
+++ b/gdk/src/rectangle.ccg
@@ -54,7 +54,7 @@ Rectangle& Rectangle::intersect(const Rectangle& src2, bool& rectangles_intersec
 
 bool Rectangle::intersects(const Rectangle& src2) const
 {
-  return gdk_rectangle_intersect(&gobject_, &src2.gobject_, 0);
+  return gdk_rectangle_intersect(&gobject_, &src2.gobject_, nullptr);
 }
 
 bool Rectangle::has_zero_area() const
diff --git a/gdk/src/window.ccg b/gdk/src/window.ccg
index 15b4196..d789d78 100644
--- a/gdk/src/window.ccg
+++ b/gdk/src/window.ccg
@@ -33,27 +33,27 @@ Window::Window(const Glib::RefPtr<Window>& parent, GdkWindowAttr* attributes, in
 
 void Window::set_cursor()
 {
-  gdk_window_set_cursor(gobj(), 0);
+  gdk_window_set_cursor(gobj(), nullptr);
 }
 
 void Window::set_device_cursor(const Glib::RefPtr<Gdk::Device>& device)
 {
-  gdk_window_set_device_cursor(gobj(), Glib::unwrap(device), 0);
+  gdk_window_set_device_cursor(gobj(), Glib::unwrap(device), nullptr);
 }
 
 void Window::unset_icon()
 {
-  gdk_window_set_icon_name(gobj(), 0); /* See GDK docs */
+  gdk_window_set_icon_name(gobj(), nullptr); /* See GDK docs */
 }
 
 void Window::invalidate(bool invalidate_children)
 {
-  gdk_window_invalidate_rect(gobj(), NULL, invalidate_children);
+  gdk_window_invalidate_rect(gobj(), nullptr, invalidate_children);
 }
 
 void Window::restack(bool above)
 {
-  gdk_window_restack(gobj(), NULL, above);
+  gdk_window_restack(gobj(), nullptr, above);
 }
 
 Glib::RefPtr<DragContext> Window::drag_begin (const std::vector<Glib::ustring>& targets)
@@ -76,7 +76,7 @@ DragProtocol Window::get_drag_protocol() const
 {
   return (DragProtocol)gdk_window_get_drag_protocol(
     const_cast<GdkWindow*>(gobj()),
-    0);
+    nullptr);
 }
 
 } // namespace Gdk
diff --git a/tools/m4/convert_gdk.m4 b/tools/m4/convert_gdk.m4
index a0ef8b4..f1f35ba 100644
--- a/tools/m4/convert_gdk.m4
+++ b/tools/m4/convert_gdk.m4
@@ -105,9 +105,9 @@ _CONVERSION(`Gdk::Rectangle&',`GdkRectangle*',($3).gobj())
 _CONVERSION(`const Rectangle&',`const GdkRectangle*',($3).gobj())
 _CONVERSION(`const Gdk::Rectangle&',`const GdkRectangle*',($3).gobj())
 _CONVERSION(`Font&',`GdkFont*',($3).gobj())
-_CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Region>&',`const cairo_region_t*',`(($3) ? ($3)->cobj() : 0)')
-_CONVERSION(`const ::Cairo::RefPtr<const 
::Cairo::Region>&',`cairo_region_t*',`const_cast<cairo_region_t*>(($3) ? ($3)->cobj() : 0)')
-_CONVERSION(`const ::Cairo::RefPtr<const ::Cairo::Region>&',`const cairo_region_t*',`(($3) ? ($3)->cobj() : 
0)')
+_CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Region>&',`const cairo_region_t*',`(($3) ? ($3)->cobj() : 
nullptr)')
+_CONVERSION(`const ::Cairo::RefPtr<const 
::Cairo::Region>&',`cairo_region_t*',`const_cast<cairo_region_t*>(($3) ? ($3)->cobj() : nullptr)')
+_CONVERSION(`const ::Cairo::RefPtr<const ::Cairo::Region>&',`const cairo_region_t*',`(($3) ? ($3)->cobj() : 
nullptr)')
 
 _CONVERSION(`const Glib::RefPtr<Cursor>&',`GdkCursor*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<const Cursor>&',`GdkCursor*',__CONVERT_CONST_REFPTR_TO_P)


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