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
This commit is contained in:
Sebastian Dröge 2016-04-14 14:40:04 +03:00
parent f8f344923e
commit 4e3cd88c2b

View File

@ -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 */