Commit 38fff3b6 authored by Ell's avatar Ell

Issue #4172 - Gimp doesn't store negative values between sessions (Text Tool)

In gimp_config_deserialize_fundamental(), cast integer token values
to the target value type *before* negating them, to avoid
performing unsigned negation, which can result in a positive value
when cast to the target value type (in particular, when the target
value type is float/double).
parent 236d68c4
Pipeline #128204 failed with stages
in 9 minutes and 52 seconds
......@@ -478,8 +478,8 @@ gimp_config_deserialize_fundamental (GValue *value,
case G_TYPE_INT:
g_value_set_int (value, (negate ?
- scanner->value.v_int64 :
scanner->value.v_int64));
- (gint) scanner->value.v_int64 :
(gint) scanner->value.v_int64));
break;
case G_TYPE_UINT:
g_value_set_uint (value, scanner->value.v_int64);
......@@ -487,8 +487,8 @@ gimp_config_deserialize_fundamental (GValue *value,
case G_TYPE_LONG:
g_value_set_long (value, (negate ?
- scanner->value.v_int64 :
scanner->value.v_int64));
- (glong) scanner->value.v_int64 :
(glong) scanner->value.v_int64));
break;
case G_TYPE_ULONG:
g_value_set_ulong (value, scanner->value.v_int64);
......@@ -496,8 +496,8 @@ gimp_config_deserialize_fundamental (GValue *value,
case G_TYPE_INT64:
g_value_set_int64 (value, (negate ?
- scanner->value.v_int64 :
scanner->value.v_int64));
- (gint64) scanner->value.v_int64 :
(gint64) scanner->value.v_int64));
break;
case G_TYPE_UINT64:
g_value_set_uint64 (value, scanner->value.v_int64);
......@@ -506,19 +506,23 @@ gimp_config_deserialize_fundamental (GValue *value,
case G_TYPE_FLOAT:
if (next_token == G_TOKEN_FLOAT)
g_value_set_float (value, negate ?
- scanner->value.v_float : scanner->value.v_float);
- scanner->value.v_float :
scanner->value.v_float);
else
g_value_set_float (value, negate ?
- scanner->value.v_int : scanner->value.v_int);
- (gfloat) scanner->value.v_int :
(gfloat) scanner->value.v_int);
break;
case G_TYPE_DOUBLE:
if (next_token == G_TOKEN_FLOAT)
g_value_set_double (value, negate ?
- scanner->value.v_float: scanner->value.v_float);
- scanner->value.v_float:
scanner->value.v_float);
else
g_value_set_double (value, negate ?
- scanner->value.v_int: scanner->value.v_int);
- (gdouble) scanner->value.v_int:
(gdouble) scanner->value.v_int);
break;
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment