[glibmm] class.cc: Avoid compiler warnings when using -std=c++0x with g++.



commit 926909ed02a27173dda0a608a85c3200df6d864e
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Nov 23 12:39:34 2011 +0100

    class.cc: Avoid compiler warnings when using -std=c++0x with g++.
    
    	* glib/glibmm/class.cc: Add casts because GTypeQuery::class_size
    	and instance_size are guint but GTypeInfo::class_size and
    	instance_size are guint16.

 ChangeLog            |    8 ++++++++
 glib/glibmm/class.cc |   24 ++++++++++++++++++++----
 2 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0f6e517..bfbcf44 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-11-23  Murray Cumming  <murrayc murrayc com>
+
+	class.cc: Avoid compiler warnings when using -std=c++0x with g++.
+
+	* glib/glibmm/class.cc: Add casts because GTypeQuery::class_size 
+	and instance_size are guint but GTypeInfo::class_size and 
+	instance_size are guint16.
+
 2011-11-18  Murray Cumming  <murrayc murrayc com>
 
 	Require glibmm 2.2.10 so that make check works.
diff --git a/glib/glibmm/class.cc b/glib/glibmm/class.cc
index 4176aa4..8aed786 100644
--- a/glib/glibmm/class.cc
+++ b/glib/glibmm/class.cc
@@ -46,15 +46,23 @@ void Class::register_derived_type(GType base_type, GTypeModule* module)
   GTypeQuery base_query = { 0, 0, 0, 0, };
   g_type_query(base_type, &base_query);
 
+  //GTypeQuery::class_size is guint but GTypeInfo::class_size is guint16.
+  const guint16 class_size =
+   (guint16)base_query.class_size;
+
+  //GTypeQuery::instance_size is guint but GTypeInfo::instance_size is guint16.
+  const guint16 instance_size =
+   (guint16)base_query.instance_size;
+ 
   const GTypeInfo derived_info =
   {
-    base_query.class_size,
+    class_size,
     0, // base_init
     0, // base_finalize
     class_init_func_,
     0, // class_finalize
     0, // class_data
-    base_query.instance_size,
+    instance_size,
     0, // n_preallocs
     0, // instance_init
     0, // value_table
@@ -94,15 +102,23 @@ GType Class::clone_custom_type(const char* custom_type_name) const
     GTypeQuery base_query = { 0, 0, 0, 0, };
     g_type_query(base_type, &base_query);
 
+    //GTypeQuery::class_size is guint but GTypeInfo::class_size is guint16.
+    const guint16 class_size =
+      (guint16)base_query.class_size;
+
+    //GTypeQuery::instance_size is guint but GTypeInfo::instance_size is guint16.
+    const guint16 instance_size =
+      (guint16)base_query.instance_size;
+
     const GTypeInfo derived_info =
     {
-      base_query.class_size,
+      class_size,
       0, // base_init
       0, // base_finalize
       &Class::custom_class_init_function,
       0, // class_finalize
       this, // class_data
-      base_query.instance_size,
+      instance_size,
       0, // n_preallocs
       0, // instance_init
       0, // value_table



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