Commit daf60f25 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

handle negative integers.

2003-02-03  Sven Neumann  <sven@gimp.org>

	* app/config/gimpconfig-deserialize.c
	(gimp_config_deserialize_fundamental): handle negative integers.

	* app/core/gimp.c (gimp_edit_config_notify): commented out
	debugging output.
parent 52e9d75d
2003-02-03 Sven Neumann <sven@gimp.org>
* app/config/gimpconfig-deserialize.c
(gimp_config_deserialize_fundamental): handle negative integers.
* app/core/gimp.c (gimp_edit_config_notify): commented out
debugging output.
2003-02-03 Sven Neumann <sven@gimp.org>
 
* plug-ins/ifscompose/ifscompose.c: applied another patch from
......@@ -98,8 +106,8 @@
 
2003-02-01 Maurits Rijk <lpeek.mrijk@consunet.nl>
 
* libgimp/gimpmiscui.[ch]: factored out more preview stuff from several
plug-ins.
* libgimp/gimpmiscui.[ch]: factored out more preview stuff from
several plug-ins.
 
* plug-ins/common/waves.c
* plug-ins/common/sharpen.c
......
......@@ -343,8 +343,12 @@ gimp_config_deserialize_fundamental (GValue *value,
GScanner *scanner)
{
GTokenType token;
GType value_type;
gboolean negate = FALSE;
switch (G_TYPE_FUNDAMENTAL (prop_spec->value_type))
value_type = G_TYPE_FUNDAMENTAL (prop_spec->value_type);
switch (value_type)
{
case G_TYPE_STRING:
token = G_TOKEN_STRING;
......@@ -355,8 +359,14 @@ gimp_config_deserialize_fundamental (GValue *value,
break;
case G_TYPE_INT:
case G_TYPE_UINT:
case G_TYPE_LONG:
if (g_scanner_peek_next_token (scanner) == '-')
{
negate = TRUE;
g_scanner_get_next_token (scanner);
}
/* fallthrough */
case G_TYPE_UINT:
case G_TYPE_ULONG:
token = G_TOKEN_INT;
break;
......@@ -373,11 +383,13 @@ gimp_config_deserialize_fundamental (GValue *value,
}
if (g_scanner_peek_next_token (scanner) != token)
return token;
{
return token;
}
g_scanner_get_next_token (scanner);
switch (G_TYPE_FUNDAMENTAL (prop_spec->value_type))
switch (value_type)
{
case G_TYPE_STRING:
if (scanner_string_utf8_valid (scanner, prop_spec->name))
......@@ -405,16 +417,18 @@ gimp_config_deserialize_fundamental (GValue *value,
break;
case G_TYPE_INT:
g_value_set_int (value, scanner->value.v_int);
g_value_set_int (value, (negate ?
- scanner->value.v_int : scanner->value.v_int));
break;
case G_TYPE_UINT:
g_value_set_uint (value, scanner->value.v_int);
break;
case G_TYPE_LONG:
g_value_set_int (value, scanner->value.v_int);
g_value_set_long (value, (negate ?
- scanner->value.v_int : scanner->value.v_int));
break;
case G_TYPE_ULONG:
g_value_set_uint (value, scanner->value.v_int);
g_value_set_ulong (value, scanner->value.v_int);
break;
case G_TYPE_FLOAT:
g_value_set_float (value, scanner->value.v_float);
......
......@@ -548,15 +548,18 @@ gimp_edit_config_notify (GObject *edit_config,
{
if (param_spec->flags & GIMP_PARAM_RESTART)
{
#ifdef GIMP_CONFIG_DEBUG
g_print ("NOT Applying edit_config change of '%s' to global_config "
"because it needs restart\n",
param_spec->name);
#endif
}
else
{
#ifdef GIMP_CONFIG_DEBUG
g_print ("Applying edit_config change of '%s' to global_config\n",
param_spec->name);
#endif
g_signal_handlers_block_by_func (global_config,
gimp_global_config_notify,
edit_config);
......
......@@ -343,8 +343,12 @@ gimp_config_deserialize_fundamental (GValue *value,
GScanner *scanner)
{
GTokenType token;
GType value_type;
gboolean negate = FALSE;
switch (G_TYPE_FUNDAMENTAL (prop_spec->value_type))
value_type = G_TYPE_FUNDAMENTAL (prop_spec->value_type);
switch (value_type)
{
case G_TYPE_STRING:
token = G_TOKEN_STRING;
......@@ -355,8 +359,14 @@ gimp_config_deserialize_fundamental (GValue *value,
break;
case G_TYPE_INT:
case G_TYPE_UINT:
case G_TYPE_LONG:
if (g_scanner_peek_next_token (scanner) == '-')
{
negate = TRUE;
g_scanner_get_next_token (scanner);
}
/* fallthrough */
case G_TYPE_UINT:
case G_TYPE_ULONG:
token = G_TOKEN_INT;
break;
......@@ -373,11 +383,13 @@ gimp_config_deserialize_fundamental (GValue *value,
}
if (g_scanner_peek_next_token (scanner) != token)
return token;
{
return token;
}
g_scanner_get_next_token (scanner);
switch (G_TYPE_FUNDAMENTAL (prop_spec->value_type))
switch (value_type)
{
case G_TYPE_STRING:
if (scanner_string_utf8_valid (scanner, prop_spec->name))
......@@ -405,16 +417,18 @@ gimp_config_deserialize_fundamental (GValue *value,
break;
case G_TYPE_INT:
g_value_set_int (value, scanner->value.v_int);
g_value_set_int (value, (negate ?
- scanner->value.v_int : scanner->value.v_int));
break;
case G_TYPE_UINT:
g_value_set_uint (value, scanner->value.v_int);
break;
case G_TYPE_LONG:
g_value_set_int (value, scanner->value.v_int);
g_value_set_long (value, (negate ?
- scanner->value.v_int : scanner->value.v_int));
break;
case G_TYPE_ULONG:
g_value_set_uint (value, scanner->value.v_int);
g_value_set_ulong (value, scanner->value.v_int);
break;
case G_TYPE_FLOAT:
g_value_set_float (value, scanner->value.v_float);
......
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