procedural_db_execute() *must* get the correct number of args, so do like

2003-10-08  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/fileops.pdb (file_load_invoker):
	procedural_db_execute() *must* get the correct number of args, so
	do like file_save_invoker and create a full Argument array with
	the correct number of args and copy our own args into it before
	calling the actual load procedure. Fixes bug #124059.

	* app/pdb/fileops_cmds.c: regenerated.
This commit is contained in:
Michael Natterer 2003-10-08 10:14:17 +00:00 committed by Michael Natterer
parent c3ffc1f25d
commit 0fae4f9c10
3 changed files with 47 additions and 9 deletions

View File

@ -1,3 +1,13 @@
2003-10-08 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/fileops.pdb (file_load_invoker):
procedural_db_execute() *must* get the correct number of args, so
do like file_save_invoker and create a full Argument array with
the correct number of args and copy our own args into it before
calling the actual load procedure. Fixes bug #124059.
* app/pdb/fileops_cmds.c: regenerated.
2003-10-08 Sven Neumann <sven@gimp.org>
* data/images/gimp_splash.png: flatten the splash (bug #124062).

View File

@ -78,9 +78,12 @@ static Argument *
file_load_invoker (Gimp *gimp,
Argument *args)
{
Argument *new_args;
Argument *return_vals;
PlugInProcDef *file_proc;
ProcRecord *proc;
gchar *uri;
gint i;
uri = file_utils_filename_to_uri (gimp->load_procs, (gchar *) args[1].value.pdb_pointer, NULL);
@ -96,7 +99,20 @@ file_load_invoker (Gimp *gimp,
proc = plug_in_proc_def_get_proc (file_proc);
return procedural_db_execute (gimp, proc->name, args);
new_args = g_new0 (Argument, proc->num_args);
memcpy (new_args, args, sizeof (Argument) * 3);
for (i = 3; i < proc->num_args; i++)
{
new_args[i].arg_type = proc->args[i].arg_type;
if (proc->args[i].arg_type == GIMP_PDB_STRING)
new_args[i].value.pdb_pointer = g_strdup ("");
}
return_vals = procedural_db_execute (gimp, proc->name, new_args);
g_free (new_args);
return return_vals;
}
static ProcArg file_load_inargs[] =
@ -168,8 +184,7 @@ file_save_invoker (Gimp *gimp,
proc = plug_in_proc_def_get_proc (file_proc);
new_args = g_new (Argument, proc->num_args);
memset (new_args, 0, sizeof (Argument) * proc->num_args);
new_args = g_new0 (Argument, proc->num_args);
memcpy (new_args, args, sizeof (Argument) * 5);
for (i = 5; i < proc->num_args; i++)

View File

@ -76,9 +76,10 @@ HELP
$outargs[0]->{desc} = 'The output image';
%invoke = (
proc => [ 'proc->name', 'args' ],
vars => [ 'PlugInProcDef *file_proc', 'ProcRecord *proc',
'gchar *uri' ],
proc => [ 'proc->name', 'new_args' ],
args => [ 'new_args', 'return_vals' ],
vars => [ 'PlugInProcDef *file_proc', 'ProcRecord *proc', 'gchar *uri',
'gint i' ],
code => <<'CODE'
{
uri = file_utils_filename_to_uri (gimp->load_procs, %%filename%%, NULL);
@ -95,7 +96,20 @@ HELP
proc = plug_in_proc_def_get_proc (file_proc);
return %%exec%%;
new_args = g_new0 (%%argtype%%, proc->num_args);
memcpy (new_args, args, sizeof (%%argtype%%) * 3);
for (i = 3; i < proc->num_args; i++)
{
new_args[i].arg_type = proc->args[i].arg_type;
if (proc->args[i].arg_type == GIMP_PDB_STRING)
new_args[i].value.pdb_pointer = g_strdup ("");
}
return_vals = %%exec%%;
g_free (new_args);
return return_vals;
}
CODE
);
@ -152,8 +166,7 @@ HELP
proc = plug_in_proc_def_get_proc (file_proc);
new_args = g_new (%%argtype%%, proc->num_args);
memset (new_args, 0, sizeof (%%argtype%%) * proc->num_args);
new_args = g_new0 (%%argtype%%, proc->num_args);
memcpy (new_args, args, sizeof (%%argtype%%) * 5);
for (i = 5; i < proc->num_args; i++)