[glib] gparamspecs: GTypes are stored in v_pointer, not v_long



commit 4e3cd88c2b9c55b4fd2f93abe7795c4f7b9bf292
Author: Sebastian DrĂśge <sebastian centricular com>
Date:   Thu Apr 14 14:40:04 2016 +0300

    gparamspecs: GTypes are stored in v_pointer, not v_long
    
    v_long is 32 bits on Win64, v_pointer is 64 bits. On most other platforms the
    size of long and pointer is the same, so it's usually not a problem.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758738

 gobject/gparamspecs.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c
index 16c1f55..43fc383 100644
--- a/gobject/gparamspecs.c
+++ b/gobject/gparamspecs.c
@@ -1067,7 +1067,7 @@ param_gtype_set_default (GParamSpec *pspec,
 {
   GParamSpecGType *tspec = G_PARAM_SPEC_GTYPE (pspec);
 
-  value->data[0].v_long = tspec->is_a_type;
+  value->data[0].v_pointer = GSIZE_TO_POINTER (tspec->is_a_type);
 }
 
 static gboolean
@@ -1075,12 +1075,12 @@ param_gtype_validate (GParamSpec *pspec,
                      GValue     *value)
 {
   GParamSpecGType *tspec = G_PARAM_SPEC_GTYPE (pspec);
-  GType gtype = value->data[0].v_long;
+  GType gtype = GPOINTER_TO_SIZE (value->data[0].v_pointer);
   guint changed = 0;
   
   if (tspec->is_a_type != G_TYPE_NONE && !g_type_is_a (gtype, tspec->is_a_type))
     {
-      value->data[0].v_long = tspec->is_a_type;
+      value->data[0].v_pointer = GSIZE_TO_POINTER (tspec->is_a_type);
       changed++;
     }
   
@@ -1092,8 +1092,8 @@ param_gtype_values_cmp (GParamSpec   *pspec,
                        const GValue *value1,
                        const GValue *value2)
 {
-  GType p1 = value1->data[0].v_long;
-  GType p2 = value2->data[0].v_long;
+  GType p1 = GPOINTER_TO_SIZE (value1->data[0].v_pointer);
+  GType p2 = GPOINTER_TO_SIZE (value2->data[0].v_pointer);
 
   /* not much to compare here, try to at least provide stable lesser/greater result */
 


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