mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
gvariant: Avoid anonymous struct and union members
C++ does not like them for various reasons. https://bugzilla.gnome.org/show_bug.cgi?id=766370
This commit is contained in:
parent
b9934f16b6
commit
d5a16fbd2d
@ -3187,17 +3187,17 @@ ensure_valid_builder (GVariantBuilder *builder)
|
|||||||
{
|
{
|
||||||
if (is_valid_builder (builder))
|
if (is_valid_builder (builder))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (builder->partial_magic == GVSB_MAGIC_PARTIAL)
|
if (builder->u.s.partial_magic == GVSB_MAGIC_PARTIAL)
|
||||||
{
|
{
|
||||||
static GVariantBuilder cleared_builder;
|
static GVariantBuilder cleared_builder;
|
||||||
|
|
||||||
/* Make sure that only first two fields were set and the rest is
|
/* Make sure that only first two fields were set and the rest is
|
||||||
* zeroed to avoid messing up the builder that had parent
|
* zeroed to avoid messing up the builder that had parent
|
||||||
* address equal to GVSB_MAGIC_PARTIAL. */
|
* address equal to GVSB_MAGIC_PARTIAL. */
|
||||||
if (memcmp (cleared_builder.y, builder->y, sizeof cleared_builder.y))
|
if (memcmp (cleared_builder.u.s.y, builder->u.s.y, sizeof cleared_builder.u.s.y))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
g_variant_builder_init (builder, builder->type);
|
g_variant_builder_init (builder, builder->u.s.type);
|
||||||
}
|
}
|
||||||
return is_valid_builder (builder);
|
return is_valid_builder (builder);
|
||||||
}
|
}
|
||||||
@ -3814,17 +3814,17 @@ ensure_valid_dict (GVariantDict *dict)
|
|||||||
{
|
{
|
||||||
if (is_valid_dict (dict))
|
if (is_valid_dict (dict))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (dict->partial_magic == GVSD_MAGIC_PARTIAL)
|
if (dict->u.s.partial_magic == GVSD_MAGIC_PARTIAL)
|
||||||
{
|
{
|
||||||
static GVariantDict cleared_dict;
|
static GVariantDict cleared_dict;
|
||||||
|
|
||||||
/* Make sure that only first two fields were set and the rest is
|
/* Make sure that only first two fields were set and the rest is
|
||||||
* zeroed to avoid messing up the builder that had parent
|
* zeroed to avoid messing up the builder that had parent
|
||||||
* address equal to GVSB_MAGIC_PARTIAL. */
|
* address equal to GVSB_MAGIC_PARTIAL. */
|
||||||
if (memcmp (cleared_dict.y, dict->y, sizeof cleared_dict.y))
|
if (memcmp (cleared_dict.u.s.y, dict->u.s.y, sizeof cleared_dict.u.s.y))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
g_variant_dict_init (dict, dict->asv);
|
g_variant_dict_init (dict, dict->u.s.asv);
|
||||||
}
|
}
|
||||||
return is_valid_dict (dict);
|
return is_valid_dict (dict);
|
||||||
}
|
}
|
||||||
|
@ -303,9 +303,9 @@ struct _GVariantBuilder {
|
|||||||
gsize partial_magic;
|
gsize partial_magic;
|
||||||
const GVariantType *type;
|
const GVariantType *type;
|
||||||
gsize y[14];
|
gsize y[14];
|
||||||
};
|
} s;
|
||||||
gsize x[16];
|
gsize x[16];
|
||||||
};
|
} u;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@ -442,9 +442,9 @@ struct _GVariantDict {
|
|||||||
GVariant *asv;
|
GVariant *asv;
|
||||||
gsize partial_magic;
|
gsize partial_magic;
|
||||||
gsize y[14];
|
gsize y[14];
|
||||||
};
|
} s;
|
||||||
gsize x[16];
|
gsize x[16];
|
||||||
};
|
} u;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user