gparamspecs: Fix loss of precision when validating a double-typed pspec

As spotted by `-Wfloat-conversion`. Doubles which could not be
accurately represented as floats may have erroneously failed bounds
validation.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3405
This commit is contained in:
Philip Withnall
2024-06-28 14:07:48 +01:00
parent 616749c1e2
commit ad5948bbf5
2 changed files with 15 additions and 1 deletions

View File

@@ -691,7 +691,7 @@ param_double_is_valid (GParamSpec *pspec,
const GValue *value)
{
GParamSpecDouble *dspec = G_PARAM_SPEC_DOUBLE (pspec);
gfloat oval = value->data[0].v_double;
gdouble oval = value->data[0].v_double;
return dspec->minimum <= oval && oval <= dspec->maximum;
}