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.
This commit is contained in:
Sven Neumann 2003-02-03 14:37:59 +00:00 committed by Sven Neumann
parent 52e9d75d2e
commit daf60f2582
4 changed files with 56 additions and 17 deletions

View File

@ -1,3 +1,11 @@
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

View File

@ -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);

View File

@ -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);

View File

@ -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);