From cc4de801c9643b62c5566d4d9dc3439ca801a4e6 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 4 May 2018 10:13:13 +0100 Subject: gobject: Reimplement g_param_values_cmp() for GParamSpecVariant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The existing implementation was completely incorrect (despite the fix in commit 566e64a66) — it always compared GVariants by pointer, rather than by value. Reimplement it to compare them by value where possible, depending on their type. The core of this implementation is g_variant_compare(). See the documentation and tests for further details of the new sort order. This adds documentation and tests. Signed-off-by: Philip Withnall https://bugzilla.gnome.org/show_bug.cgi?id=795735 --- gobject/gparamspecs.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gobject/gparamspecs.h') diff --git a/gobject/gparamspecs.h b/gobject/gparamspecs.h index e2bb62130..26045a368 100644 --- a/gobject/gparamspecs.h +++ b/gobject/gparamspecs.h @@ -962,6 +962,12 @@ struct _GParamSpecGType * * A #GParamSpec derived structure that contains the meta data for #GVariant properties. * + * When comparing values with g_param_values_cmp(), scalar values with the same + * type will be compared with g_variant_compare(). Other non-%NULL variants will + * be checked for equality with g_variant_equal(), and their sort order is + * otherwise undefined. %NULL is ordered before non-%NULL variants. Two %NULL + * values compare equal. + * * Since: 2.26 */ struct _GParamSpecVariant -- cgit v1.2.1