Commit afd88f0b authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

replace the value union by a GValue.

2006-03-30  Michael Natterer  <mitch@gimp.org>

	* app/pdb/procedural_db.[ch] (struct Argument): replace the value
	union by a GValue.

	(procedural_db_argument_init)
	(procedural_db_compat_arg_init): new functions to initialize
	an Argument. They call g_value_init() on the Argument's value.

	(procedural_db_arguments)
	(procedural_db_return_values): initialize the returned Argument
	arrays so their GValues are ready to use. Allow to get the
	(unsuccessful) return values of a NULL ProcRecord.

	(procedural_db_destroy_args): g_value_unset() the values. Added a
	"gboolean full_destroy" parameter. Its only effect is to destroy
	PDB arrays, everything else is nicely memory managed by GValue.

	(procedural_db_execute)
	(procedural_db_run_proc): do GValue stuff. Added n_args and
	n_return_vals parameters to execute().

	(procedural_db_execute_proc): private function to execute a
	procedure. Validates the passed in arguments using the registered
	GParamSpecs before passing them to the resp. exec method.

	* app/plug-in/plug-in-params.[ch] (plug_in_params_to_args): needs
	an array of ProcArgs now in order to initialize the Arguments'
	GValues correctly. Passing NULL ProcArgs uses
	procedural_db_compat_arg_init(), so procedures (plug-ins)
	returning more values than expected work.

	(plug_in_args_to_params): do GValue stuff here too.

	(plug_in_args_destroy): removed this function,
	procedural_db_destroy_args() does the same now.

	* app/plug-in/plug-in-message.c (plug_in_handle_proc_run):
	simplified quite a bit because everything returns n_return_values
	now. Call plug_in_params_to_args() only of the procedure was found.

	(plug_in_handle_proc_return_priv): pass ProcRecs to
	plug_in_params_to_args().

	* app/batch.c
	* app/actions/plug-in-commands.c
	* app/actions/vectors-commands.c
	* app/core/gimppdbprogress.c
	* app/dialogs/about-dialog.c
	* app/file/file-open.c
	* app/file/file-save.c
	* app/plug-in/plug-ins.c
	* app/plug-in/plug-in-progress.c
	* app/plug-in/plug-in-run.[ch]
	* app/widgets/gimphelp.c
	* app/widgets/gimppdbdialog.c
	* app/xcf/xcf.c
	* tools/pdbgen/pdb/fileops.pdb: changed accordingly: don't
	g_new/g_free Argument arrays, always use procedural_db_foo()
	functions. Use GValue functions to get/set Arguments.

	* tools/pdbgen/pdb.pl: added get_value_func and set_value_func to
	all PDB types. Removed id_func, id_ret_func and check_func. Added
	flags which indicated that a type is an ID. Removed unused utility
	functions.

	* tools/pdbgen/lib.pl: use the flag instead of looking at
	functions and value types.

	* tools/pdbgen/app.pl: use the get_value_func and set_value_func
	to marshal inargs and outargs. Removed all checks performed on
	inargs because that's done by GParamSpec validation now. Added the
	missing bits to register excluded values with GimpParamSpecEnum.

	* app/pdb/*_cmds.c: regenerated.
parent d69e93ce
2006-03-30 Michael Natterer <mitch@gimp.org>
* app/pdb/procedural_db.[ch] (struct Argument): replace the value
union by a GValue.
(procedural_db_argument_init)
(procedural_db_compat_arg_init): new functions to initialize
an Argument. They call g_value_init() on the Argument's value.
(procedural_db_arguments)
(procedural_db_return_values): initialize the returned Argument
arrays so their GValues are ready to use. Allow to get the
(unsuccessful) return values of a NULL ProcRecord.
(procedural_db_destroy_args): g_value_unset() the values. Added a
"gboolean full_destroy" parameter. Its only effect is to destroy
PDB arrays, everything else is nicely memory managed by GValue.
(procedural_db_execute)
(procedural_db_run_proc): do GValue stuff. Added n_args and
n_return_vals parameters to execute().
(procedural_db_execute_proc): private function to execute a
procedure. Validates the passed in arguments using the registered
GParamSpecs before passing them to the resp. exec method.
* app/plug-in/plug-in-params.[ch] (plug_in_params_to_args): needs
an array of ProcArgs now in order to initialize the Arguments'
GValues correctly. Passing NULL ProcArgs uses
procedural_db_compat_arg_init(), so procedures (plug-ins)
returning more values than expected work.
(plug_in_args_to_params): do GValue stuff here too.
(plug_in_args_destroy): removed this function,
procedural_db_destroy_args() does the same now.
* app/plug-in/plug-in-message.c (plug_in_handle_proc_run):
simplified quite a bit because everything returns n_return_values
now. Call plug_in_params_to_args() only of the procedure was found.
(plug_in_handle_proc_return_priv): pass ProcRecs to
plug_in_params_to_args().
* app/batch.c
* app/actions/plug-in-commands.c
* app/actions/vectors-commands.c
* app/core/gimppdbprogress.c
* app/dialogs/about-dialog.c
* app/file/file-open.c
* app/file/file-save.c
* app/plug-in/plug-ins.c
* app/plug-in/plug-in-progress.c
* app/plug-in/plug-in-run.[ch]
* app/widgets/gimphelp.c
* app/widgets/gimppdbdialog.c
* app/xcf/xcf.c
* tools/pdbgen/pdb/fileops.pdb: changed accordingly: don't
g_new/g_free Argument arrays, always use procedural_db_foo()
functions. Use GValue functions to get/set Arguments.
* tools/pdbgen/pdb.pl: added get_value_func and set_value_func to
all PDB types. Removed id_func, id_ret_func and check_func. Added
flags which indicated that a type is an ID. Removed unused utility
functions.
* tools/pdbgen/lib.pl: use the flag instead of looking at
functions and value types.
* tools/pdbgen/app.pl: use the get_value_func and set_value_func
to marshal inargs and outargs. Removed all checks performed on
inargs because that's done by GParamSpec validation now. Added the
missing bits to register excluded values with GimpParamSpecEnum.
* app/pdb/*_cmds.c: regenerated.
2006-03-30 Michael Natterer <mitch@gimp.org>
* app/plug-in/plug-in-params.c (plug_in_param_defs_check): can't
......
......@@ -30,6 +30,7 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpitem.h"
#include "core/gimpparamspecs.h"
#include "core/gimpprogress.h"
#include "plug-in/plug-in-data.h"
......@@ -77,7 +78,7 @@ plug_in_run_cmd_callback (GtkAction *action,
args = procedural_db_arguments (proc_rec);
/* initialize the first argument */
args[n_args].value.pdb_int = GIMP_RUN_INTERACTIVE;
g_value_set_int (&args[n_args].value, GIMP_RUN_INTERACTIVE);
n_args++;
switch (proc_rec->proc_type)
......@@ -94,7 +95,7 @@ plug_in_run_cmd_callback (GtkAction *action,
if (display)
{
args[n_args].value.pdb_int = gimp_image_get_ID (display->image);
gimp_value_set_image (&args[n_args].value, display->image);
n_args++;
if (proc_rec->num_args > n_args &&
......@@ -106,15 +107,14 @@ plug_in_run_cmd_callback (GtkAction *action,
if (drawable)
{
args[n_args].value.pdb_int =
gimp_item_get_ID (GIMP_ITEM (drawable));
gimp_value_set_item (&args[n_args].value,
GIMP_ITEM (drawable));
n_args++;
}
else
{
g_warning ("Uh-oh, no active drawable for the plug-in!");
g_free (args);
return;
goto error;
}
}
}
......@@ -123,8 +123,7 @@ plug_in_run_cmd_callback (GtkAction *action,
default:
g_error ("Unknown procedure type.");
g_free (args);
return;
goto error;
}
/* run the plug-in procedure */
......@@ -142,7 +141,8 @@ plug_in_run_cmd_callback (GtkAction *action,
gimp_set_last_plug_in (gimp, proc_def);
}
g_free (args);
error:
procedural_db_destroy_args (args, proc_rec->num_args, TRUE);
}
void
......
......@@ -35,6 +35,7 @@
#include "core/gimpimage-merge.h"
#include "core/gimpimage-undo.h"
#include "core/gimpitemundo.h"
#include "core/gimpparamspecs.h"
#include "core/gimpprogress.h"
#include "core/gimpstrokedesc.h"
#include "core/gimptoolinfo.h"
......@@ -332,16 +333,16 @@ vectors_selection_to_vectors_cmd_callback (GtkAction *action,
/* plug-in arguments as if called by <Image>/Filters/... */
args = procedural_db_arguments (proc_rec);
args[0].value.pdb_int = GIMP_RUN_INTERACTIVE;
args[1].value.pdb_int = (gint32) gimp_image_get_ID (image);
args[2].value.pdb_int = -1; /* unused */
g_value_set_enum (&args[0].value, GIMP_RUN_INTERACTIVE);
gimp_value_set_image (&args[1].value, image);
gimp_value_set_item (&args[2].value, NULL /* unused */);
plug_in_run (image->gimp, action_data_get_context (data),
GIMP_PROGRESS (display),
proc_rec, args, 3 /* not proc_rec->num_args */,
FALSE, TRUE, display ? gimp_display_get_ID (display) : 0);
g_free (args);
procedural_db_destroy_args (args, proc_rec->num_args, TRUE);
}
void
......
......@@ -129,23 +129,23 @@ batch_run_cmd (Gimp *gimp,
const gchar *cmd)
{
Argument *args;
Argument *vals;
gint i;
Argument *return_vals;
gint n_return_vals;
args = g_new0 (Argument, proc->num_args);
for (i = 0; i < proc->num_args; i++)
args[i].arg_type = proc->args[i].arg_type;
args = procedural_db_arguments (proc);
args[0].value.pdb_int = run_mode;
g_value_set_int (&args[0].value, run_mode);
if (proc->num_args > 1)
args[1].value.pdb_pointer = (gpointer) cmd;
g_value_set_static_string (&args[1].value, cmd);
vals = procedural_db_execute (gimp,
gimp_get_user_context (gimp), NULL,
proc_name, args);
return_vals = procedural_db_execute (gimp,
gimp_get_user_context (gimp), NULL,
proc_name,
args, proc->num_args,
&n_return_vals);
switch (vals[0].value.pdb_int)
switch (g_value_get_enum (&return_vals[0].value))
{
case GIMP_PDB_EXECUTION_ERROR:
g_printerr ("batch command: experienced an execution error.\n");
......@@ -160,8 +160,8 @@ batch_run_cmd (Gimp *gimp,
break;
}
procedural_db_destroy_args (vals, proc->num_values);
g_free (args);
procedural_db_destroy_args (return_vals, n_return_vals, TRUE);
procedural_db_destroy_args (args, proc->num_args, TRUE);
return;
}
......@@ -259,7 +259,8 @@ gimp_pdb_progress_run_callback (GimpPdbProgress *progress,
GIMP_PDB_FLOAT, value,
GIMP_PDB_END);
if (! return_vals || return_vals[0].value.pdb_int != GIMP_PDB_SUCCESS)
if (! return_vals ||
g_value_get_enum (&return_vals[0].value) != GIMP_PDB_SUCCESS)
{
g_message (_("Unable to run %s callback. "
"The corresponding plug-in may have crashed."),
......@@ -267,11 +268,11 @@ gimp_pdb_progress_run_callback (GimpPdbProgress *progress,
}
else if (n_return_vals >= 2 && return_vals[1].arg_type == GIMP_PDB_FLOAT)
{
retval = return_vals[1].value.pdb_float;
retval = g_value_get_double (&return_vals[1].value);
}
if (return_vals)
procedural_db_destroy_args (return_vals, n_return_vals);
procedural_db_destroy_args (return_vals, n_return_vals, TRUE);
progress->callback_busy = FALSE;
}
......
......@@ -223,7 +223,7 @@ about_dialog_load_url (GtkAboutDialog *dialog,
&nreturn_vals,
GIMP_PDB_STRING, url,
GIMP_PDB_END);
procedural_db_destroy_args (return_vals, nreturn_vals);
procedural_db_destroy_args (return_vals, nreturn_vals, TRUE);
}
......
......@@ -53,6 +53,7 @@
#include "core/gimpimage-undo.h"
#include "core/gimpimagefile.h"
#include "core/gimplayer.h"
#include "core/gimpparamspecs.h"
#include "core/gimpprogress.h"
#include "pdb/procedural_db.h"
......@@ -88,7 +89,7 @@ file_open_image (Gimp *gimp,
Argument *return_vals;
gint n_return_vals;
gchar *filename;
gint image_id;
GimpImage *image;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
......@@ -149,17 +150,15 @@ file_open_image (Gimp *gimp,
g_free (filename);
*status = return_vals[0].value.pdb_int;
image_id = return_vals[1].value.pdb_int;
*status = g_value_get_enum (&return_vals[0].value);
image = gimp_value_get_image (&return_vals[1].value, gimp);
procedural_db_destroy_args (return_vals, n_return_vals);
procedural_db_destroy_args (return_vals, n_return_vals, TRUE);
if (*status == GIMP_PDB_SUCCESS)
{
if (image_id != -1)
if (image)
{
GimpImage *image = gimp_image_get_by_ID (gimp, image_id);
file_open_sanitize_image (image);
if (mime_type)
......@@ -221,7 +220,7 @@ file_open_thumbnail (Gimp *gimp,
Argument *return_vals;
gint n_return_vals;
gchar *filename;
gint image_id;
GimpImage *image;
filename = file_utils_filename_from_uri (uri);
......@@ -237,21 +236,19 @@ file_open_thumbnail (Gimp *gimp,
g_free (filename);
status = return_vals[0].value.pdb_int;
image_id = return_vals[1].value.pdb_int;
status = g_value_get_enum (&return_vals[0].value);
image = gimp_value_get_image (&return_vals[1].value, gimp);
if (proc->num_values >= 3)
{
*image_width = MAX (0, return_vals[2].value.pdb_int);
*image_height = MAX (0, return_vals[3].value.pdb_int);
*image_width = MAX (0, g_value_get_int (&return_vals[2].value));
*image_height = MAX (0, g_value_get_int (&return_vals[3].value));
}
procedural_db_destroy_args (return_vals, n_return_vals);
procedural_db_destroy_args (return_vals, n_return_vals, TRUE);
if (status == GIMP_PDB_SUCCESS && image_id != -1)
if (status == GIMP_PDB_SUCCESS && image != NULL)
{
GimpImage *image = gimp_image_get_by_ID (gimp, image_id);
file_open_sanitize_image (image);
*mime_type = file_proc->mime_type;
......
......@@ -140,9 +140,9 @@ file_save (GimpImage *image,
GIMP_PDB_STRING, uri,
GIMP_PDB_END);
status = return_vals[0].value.pdb_int;
status = g_value_get_enum (&return_vals[0].value);
procedural_db_destroy_args (return_vals, n_return_vals);
procedural_db_destroy_args (return_vals, n_return_vals, TRUE);
if (status == GIMP_PDB_SUCCESS)
{
......
......@@ -657,9 +657,7 @@ brush_new_invoker (ProcRecord *proc_record,
gchar *name;
gchar *actual_name = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -679,7 +677,7 @@ brush_new_invoker (ProcRecord *proc_record,
return_vals = procedural_db_return_values (proc_record, success);
if (success)
return_vals[1].value.pdb_pointer = actual_name;
g_value_take_string (&return_vals[1].value, actual_name);
return return_vals;
}
......@@ -711,9 +709,7 @@ brush_duplicate_invoker (ProcRecord *proc_record,
gchar *name;
gchar *copy_name = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -738,7 +734,7 @@ brush_duplicate_invoker (ProcRecord *proc_record,
return_vals = procedural_db_return_values (proc_record, success);
if (success)
return_vals[1].value.pdb_pointer = copy_name;
g_value_take_string (&return_vals[1].value, copy_name);
return return_vals;
}
......@@ -770,9 +766,7 @@ brush_is_generated_invoker (ProcRecord *proc_record,
gchar *name;
gboolean generated = FALSE;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -788,7 +782,7 @@ brush_is_generated_invoker (ProcRecord *proc_record,
return_vals = procedural_db_return_values (proc_record, success);
if (success)
return_vals[1].value.pdb_int = generated;
g_value_set_boolean (&return_vals[1].value, generated);
return return_vals;
}
......@@ -821,13 +815,8 @@ brush_rename_invoker (ProcRecord *proc_record,
gchar *new_name;
gchar *actual_name = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
new_name = (gchar *) args[1].value.pdb_pointer;
if (new_name == NULL || !g_utf8_validate (new_name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
new_name = (gchar *) g_value_get_string (&args[1].value);
if (success)
{
......@@ -846,7 +835,7 @@ brush_rename_invoker (ProcRecord *proc_record,
return_vals = procedural_db_return_values (proc_record, success);
if (success)
return_vals[1].value.pdb_pointer = actual_name;
g_value_take_string (&return_vals[1].value, actual_name);
return return_vals;
}
......@@ -876,9 +865,7 @@ brush_delete_invoker (ProcRecord *proc_record,
gboolean success = TRUE;
gchar *name;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -933,9 +920,7 @@ brush_is_editable_invoker (ProcRecord *proc_record,
gchar *name;
gboolean editable = FALSE;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -951,7 +936,7 @@ brush_is_editable_invoker (ProcRecord *proc_record,
return_vals = procedural_db_return_values (proc_record, success);
if (success)
return_vals[1].value.pdb_int = editable;
g_value_set_boolean (&return_vals[1].value, editable);
return return_vals;
}
......@@ -986,9 +971,7 @@ brush_get_info_invoker (ProcRecord *proc_record,
gint32 mask_bpp = 0;
gint32 color_bpp = 0;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -1010,10 +993,10 @@ brush_get_info_invoker (ProcRecord *proc_record,
if (success)
{
return_vals[1].value.pdb_int = width;
return_vals[2].value.pdb_int = height;
return_vals[3].value.pdb_int = mask_bpp;
return_vals[4].value.pdb_int = color_bpp;
g_value_set_int (&return_vals[1].value, width);
g_value_set_int (&return_vals[2].value, height);
g_value_set_int (&return_vals[3].value, mask_bpp);
g_value_set_int (&return_vals[4].value, color_bpp);
}
return return_vals;
......@@ -1053,9 +1036,7 @@ brush_get_pixels_invoker (ProcRecord *proc_record,
gint32 num_color_bytes = 0;
guint8 *color_bytes = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -1086,14 +1067,14 @@ brush_get_pixels_invoker (ProcRecord *proc_record,
if (success)
{
return_vals[1].value.pdb_int = width;
return_vals[2].value.pdb_int = height;
return_vals[3].value.pdb_int = mask_bpp;
return_vals[4].value.pdb_int = num_mask_bytes;
return_vals[5].value.pdb_pointer = mask_bytes;
return_vals[6].value.pdb_int = color_bpp;
return_vals[7].value.pdb_int = num_color_bytes;
return_vals[8].value.pdb_pointer = color_bytes;
g_value_set_int (&return_vals[1].value, width);
g_value_set_int (&return_vals[2].value, height);
g_value_set_int (&return_vals[3].value, mask_bpp);
g_value_set_int (&return_vals[4].value, num_mask_bytes);
g_value_set_pointer (&return_vals[5].value, mask_bytes);
g_value_set_int (&return_vals[6].value, color_bpp);
g_value_set_int (&return_vals[7].value, num_color_bytes);
g_value_set_pointer (&return_vals[8].value, color_bytes);
}
return return_vals;
......@@ -1126,9 +1107,7 @@ brush_get_spacing_invoker (ProcRecord *proc_record,
gchar *name;
gint32 spacing = 0;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -1144,7 +1123,7 @@ brush_get_spacing_invoker (ProcRecord *proc_record,
return_vals = procedural_db_return_values (proc_record, success);
if (success)
return_vals[1].value.pdb_int = spacing;
g_value_set_int (&return_vals[1].value, spacing);
return return_vals;
}
......@@ -1175,13 +1154,8 @@ brush_set_spacing_invoker (ProcRecord *proc_record,
gchar *name;
gint32 spacing;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
spacing = args[1].value.pdb_int;
if (spacing < 0 || spacing > 1000)
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
spacing = g_value_get_int (&args[1].value);
if (success)
{
......@@ -1224,9 +1198,7 @@ brush_get_shape_invoker (ProcRecord *proc_record,
gchar *name;
gint32 shape = 0;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -1242,7 +1214,7 @@ brush_get_shape_invoker (ProcRecord *proc_record,
return_vals = procedural_db_return_values (proc_record, success);
if (success)
return_vals[1].value.pdb_int = shape;
g_value_set_enum (&return_vals[1].value, shape);
return return_vals;
}
......@@ -1274,9 +1246,7 @@ brush_get_radius_invoker (ProcRecord *proc_record,
gchar *name;
gdouble radius = 0.0;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -1292,7 +1262,7 @@ brush_get_radius_invoker (ProcRecord *proc_record,
return_vals = procedural_db_return_values (proc_record, success);
if (success)
return_vals[1].value.pdb_float = radius;
g_value_set_double (&return_vals[1].value, radius);
return return_vals;
}
......@@ -1324,9 +1294,7 @@ brush_get_spikes_invoker (ProcRecord *proc_record,
gchar *name;
gint32 spikes = 0;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -1342,7 +1310,7 @@ brush_get_spikes_invoker (ProcRecord *proc_record,
return_vals = procedural_db_return_values (proc_record, success);
if (success)
return_vals[1].value.pdb_int = spikes;
g_value_set_int (&return_vals[1].value, spikes);
return return_vals;
}
......@@ -1374,9 +1342,7 @@ brush_get_hardness_invoker (ProcRecord *proc_record,
gchar *name;
gdouble hardness = 0.0;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -1392,7 +1358,7 @@ brush_get_hardness_invoker (ProcRecord *proc_record,
return_vals = procedural_db_return_values (proc_record, success);
if (success)
return_vals[1].value.pdb_float = hardness;
g_value_set_double (&return_vals[1].value, hardness);
return return_vals;
}
......@@ -1424,9 +1390,7 @@ brush_get_aspect_ratio_invoker (ProcRecord *proc_record,
gchar *name;
gdouble aspect_ratio = 0.0;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -1442,7 +1406,7 @@ brush_get_aspect_ratio_invoker (ProcRecord *proc_record,
return_vals = procedural_db_return_values (proc_record, success);
if (success)
return_vals[1].value.pdb_float = aspect_ratio;
g_value_set_double (&return_vals[1].value, aspect_ratio);
return return_vals;
}
......@@ -1474,9 +1438,7 @@ brush_get_angle_invoker (ProcRecord *proc_record,
gchar *name;
gdouble angle = 0.0;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
......@@ -1492,7 +1454,7 @@ brush_get_angle_invoker (ProcRecord *proc_record,
return_vals = procedural_db_return_values (proc_record, success);
if (success)
return_vals[1].value.pdb_float = angle;
g_value_set_double (&return_vals[1].value, angle);
return return_vals;
}
......@@ -1525,13 +1487,8 @@ brush_set_shape_invoker (ProcRecord *proc_record,
gint32 shape_in;
gint32 shape_out = 0;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
shape_in = args[1].value.pdb_int;
if (shape_in < GIMP_BRUSH_GENERATED_CIRCLE || shape_in > GIMP_BRUSH_GENERATED_DIAMOND)
success = FALSE;
name = (gchar *) g_value_get_string (&args[0].value);
shape_in = g_value_get_enum (&args[1].value);
if (success)
{
......@@ -1551,7 +1508,7 @@ brush_set_shape_invoker (ProcRecord *proc_record,
return_vals = procedural_db_return_values (proc_record, success);
if (success)
return_vals[1].value.pdb_int = shape_out;
g_value_set_enum (&return_vals[1].value, shape_out);
return return_vals;
}
......@@ -1584,11 +1541,8 @@ brush_set_radius_invoker (ProcRecord *proc_record,
gdouble radius_in;
gdouble radius_out = 0.0;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;