Rename all "nparams" and "nreturn_vals" members in the wire protocol

to "n_params" and "n_return_vals".
This commit is contained in:
Michael Natterer 2019-09-09 01:00:54 +02:00
parent 64572b00f5
commit 41fa670434
7 changed files with 83 additions and 83 deletions

View File

@ -573,7 +573,7 @@ gimp_plug_in_handle_proc_run (GimpPlugIn *plug_in,
procedure ? procedure->args : NULL,
procedure ? procedure->num_args : 0,
proc_run->params,
proc_run->nparams,
proc_run->n_params,
FALSE);
/* Execute the procedure even if gimp_pdb_lookup_procedure()
@ -614,7 +614,7 @@ gimp_plug_in_handle_proc_run (GimpPlugIn *plug_in,
* and canonical may be different too.
*/
proc_return.name = proc_run->name;
proc_return.nparams = gimp_value_array_length (return_vals);
proc_return.n_params = gimp_value_array_length (return_vals);
proc_return.params = _gimp_value_array_to_gp_params (return_vals, FALSE);
if (! gp_proc_return_write (plug_in->my_write, &proc_return, plug_in))
@ -624,7 +624,7 @@ gimp_plug_in_handle_proc_run (GimpPlugIn *plug_in,
gimp_plug_in_close (plug_in, TRUE);
}
_gimp_gp_params_free (proc_return.params, proc_return.nparams, FALSE);
_gimp_gp_params_free (proc_return.params, proc_return.n_params, FALSE);
}
gimp_value_array_unref (return_vals);
@ -643,7 +643,7 @@ gimp_plug_in_handle_proc_return (GimpPlugIn *plug_in,
proc_frame->procedure->values,
proc_frame->procedure->num_values,
proc_return->params,
proc_return->nparams,
proc_return->n_params,
TRUE);
if (proc_frame->main_loop)
@ -679,7 +679,7 @@ gimp_plug_in_handle_temp_proc_return (GimpPlugIn *plug_in,
proc_frame->procedure->values,
proc_frame->procedure->num_values,
proc_return->params,
proc_return->nparams,
proc_return->n_params,
TRUE);
gimp_plug_in_main_loop_quit (plug_in);
@ -724,7 +724,7 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in,
/* Sanity check for array arguments */
for (i = 1; i < proc_install->nparams; i++)
for (i = 1; i < proc_install->n_params; i++)
{
GPParamDef *param_def = &proc_install->params[i];
GPParamDef *prev_param_def = &proc_install->params[i - 1];
@ -754,7 +754,7 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in,
#define VALIDATE(str) ((str) == NULL || g_utf8_validate ((str), -1, NULL))
for (i = 0; i < proc_install->nparams && valid_utf8 && ! null_name; i++)
for (i = 0; i < proc_install->n_params && valid_utf8 && ! null_name; i++)
{
if (! proc_install->params[i].name)
{
@ -768,7 +768,7 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in,
}
}
for (i = 0; i < proc_install->nreturn_vals && valid_utf8 && !null_name; i++)
for (i = 0; i < proc_install->n_return_vals && valid_utf8 && !null_name; i++)
{
if (! proc_install->return_vals[i].name)
{
@ -830,7 +830,7 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in,
gimp_object_set_name (GIMP_OBJECT (procedure), proc_install->name);
for (i = 0; i < proc_install->nparams; i++)
for (i = 0; i < proc_install->n_params; i++)
{
GParamSpec *pspec =
_gimp_gp_param_def_to_param_spec (&proc_install->params[i]);
@ -839,7 +839,7 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in,
gimp_procedure_add_argument (procedure, pspec);
}
for (i = 0; i < proc_install->nreturn_vals; i++)
for (i = 0; i < proc_install->n_return_vals; i++)
{
GParamSpec *pspec =
_gimp_gp_param_def_to_param_spec (&proc_install->return_vals[i]);

View File

@ -230,7 +230,7 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
config.num_processors = gegl_config->num_processors;
proc_run.name = (gchar *) gimp_object_get_name (procedure);
proc_run.nparams = gimp_value_array_length (args);
proc_run.n_params = gimp_value_array_length (args);
proc_run.params = _gimp_value_array_to_gp_params (args, FALSE);
if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
@ -246,7 +246,7 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
g_free (config.display_name);
g_free (config.icon_theme_dir);
_gimp_gp_params_free (proc_run.params, proc_run.nparams, FALSE);
_gimp_gp_params_free (proc_run.params, proc_run.n_params, FALSE);
g_object_unref (plug_in);
@ -260,7 +260,7 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
g_free (config.display_name);
g_free (config.icon_theme_dir);
_gimp_gp_params_free (proc_run.params, proc_run.nparams, FALSE);
_gimp_gp_params_free (proc_run.params, proc_run.n_params, FALSE);
/* If this is an extension,
* wait for an installation-confirmation message
@ -327,7 +327,7 @@ gimp_plug_in_manager_call_run_temp (GimpPlugInManager *manager,
procedure);
proc_run.name = (gchar *) gimp_object_get_name (procedure);
proc_run.nparams = gimp_value_array_length (args);
proc_run.n_params = gimp_value_array_length (args);
proc_run.params = _gimp_value_array_to_gp_params (args, FALSE);
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
@ -340,7 +340,7 @@ gimp_plug_in_manager_call_run_temp (GimpPlugInManager *manager,
name);
_gimp_gp_params_free (proc_run.params, proc_run.nparams, FALSE);
_gimp_gp_params_free (proc_run.params, proc_run.n_params, FALSE);
gimp_plug_in_proc_frame_pop (plug_in);
return_vals = gimp_procedure_get_return_values (GIMP_PROCEDURE (procedure),
@ -352,7 +352,7 @@ gimp_plug_in_manager_call_run_temp (GimpPlugInManager *manager,
gimp_allow_set_foreground_window (plug_in);
_gimp_gp_params_free (proc_run.params, proc_run.nparams, FALSE);
_gimp_gp_params_free (proc_run.params, proc_run.n_params, FALSE);
g_object_ref (plug_in);
gimp_plug_in_proc_frame_ref (proc_frame);

View File

@ -295,14 +295,14 @@ gimp_pdb_run_procedure_array (GimpPDB *pdb,
g_return_val_if_fail (arguments != NULL, NULL);
proc_run.name = (gchar *) procedure_name;
proc_run.nparams = gimp_value_array_length (arguments);
proc_run.n_params = gimp_value_array_length (arguments);
proc_run.params = _gimp_value_array_to_gp_params (arguments, FALSE);
if (! gp_proc_run_write (_gimp_plug_in_get_write_channel (pdb->priv->plug_in),
&proc_run, pdb->priv->plug_in))
gimp_quit ();
_gimp_gp_params_free (proc_run.params, proc_run.nparams, FALSE);
_gimp_gp_params_free (proc_run.params, proc_run.n_params, FALSE);
_gimp_plug_in_read_expect_msg (pdb->priv->plug_in, &msg, GP_PROC_RETURN);
@ -311,7 +311,7 @@ gimp_pdb_run_procedure_array (GimpPDB *pdb,
return_values = _gimp_gp_params_to_value_array (NULL,
NULL, 0,
proc_return->params,
proc_return->nparams,
proc_return->n_params,
TRUE);
gimp_wire_destroy (&msg);

View File

@ -1127,7 +1127,7 @@ gimp_plug_in_proc_run (GimpPlugIn *plug_in,
&proc_return, plug_in))
gimp_quit ();
_gimp_gp_params_free (proc_return.params, proc_return.nparams, TRUE);
_gimp_gp_params_free (proc_return.params, proc_return.n_params, TRUE);
}
static void
@ -1150,7 +1150,7 @@ gimp_plug_in_temp_proc_run (GimpPlugIn *plug_in,
&proc_return, plug_in))
gimp_quit ();
_gimp_gp_params_free (proc_return.params, proc_return.nparams, TRUE);
_gimp_gp_params_free (proc_return.params, proc_return.n_params, TRUE);
}
static void
@ -1167,7 +1167,7 @@ gimp_plug_in_proc_run_internal (GimpPlugIn *plug_in,
arguments = _gimp_gp_params_to_value_array (NULL,
NULL, 0,
proc_run->params,
proc_run->nparams,
proc_run->n_params,
FALSE);
return_values = gimp_procedure_run (procedure, arguments);
@ -1175,7 +1175,7 @@ gimp_plug_in_proc_run_internal (GimpPlugIn *plug_in,
gimp_value_array_unref (arguments);
proc_return->name = proc_run->name;
proc_return->nparams = gimp_value_array_length (return_values);
proc_return->n_params = gimp_value_array_length (return_values);
proc_return->params = _gimp_value_array_to_gp_params (return_values, TRUE);
gimp_value_array_unref (return_values);

View File

@ -366,8 +366,8 @@ gimp_procedure_real_install (GimpProcedure *procedure)
proc_install.name = (gchar *) gimp_procedure_get_name (procedure);
proc_install.type = gimp_procedure_get_proc_type (procedure);
proc_install.nparams = n_args;
proc_install.nreturn_vals = n_return_vals;
proc_install.n_params = n_args;
proc_install.n_return_vals = n_return_vals;
proc_install.params = g_new0 (GPParamDef, n_args);
proc_install.return_vals = g_new0 (GPParamDef, n_return_vals);

View File

@ -126,14 +126,14 @@ static void _gp_extension_ack_destroy (GimpWireMessage *msg);
static void _gp_params_read (GIOChannel *channel,
GPParam **params,
guint *nparams,
guint *n_params,
gpointer user_data);
static void _gp_params_write (GIOChannel *channel,
GPParam *params,
gint nparams,
gint n_params,
gpointer user_data);
static void _gp_params_destroy (GPParam *params,
gint nparams);
gint n_params);
static void _gp_has_init_read (GIOChannel *channel,
@ -873,7 +873,7 @@ _gp_proc_run_read (GIOChannel *channel,
goto cleanup;
_gp_params_read (channel,
&proc_run->params, (guint *) &proc_run->nparams,
&proc_run->params, (guint *) &proc_run->n_params,
user_data);
msg->data = proc_run;
@ -894,7 +894,7 @@ _gp_proc_run_write (GIOChannel *channel,
if (! _gimp_wire_write_string (channel, &proc_run->name, 1, user_data))
return;
_gp_params_write (channel, proc_run->params, proc_run->nparams, user_data);
_gp_params_write (channel, proc_run->params, proc_run->n_params, user_data);
}
static void
@ -904,7 +904,7 @@ _gp_proc_run_destroy (GimpWireMessage *msg)
if (proc_run)
{
_gp_params_destroy (proc_run->params, proc_run->nparams);
_gp_params_destroy (proc_run->params, proc_run->n_params);
g_free (proc_run->name);
g_slice_free (GPProcRun, proc_run);
@ -924,7 +924,7 @@ _gp_proc_return_read (GIOChannel *channel,
goto cleanup;
_gp_params_read (channel,
&proc_return->params, (guint *) &proc_return->nparams,
&proc_return->params, (guint *) &proc_return->n_params,
user_data);
msg->data = proc_return;
@ -946,7 +946,7 @@ _gp_proc_return_write (GIOChannel *channel,
return;
_gp_params_write (channel,
proc_return->params, proc_return->nparams, user_data);
proc_return->params, proc_return->n_params, user_data);
}
static void
@ -956,7 +956,7 @@ _gp_proc_return_destroy (GimpWireMessage *msg)
if (proc_return)
{
_gp_params_destroy (proc_return->params, proc_return->nparams);
_gp_params_destroy (proc_return->params, proc_return->n_params);
g_free (proc_return->name);
g_slice_free (GPProcReturn, proc_return);
@ -1205,14 +1205,14 @@ _gp_proc_install_read (GIOChannel *channel,
! _gimp_wire_read_int32 (channel,
&proc_install->type, 1, user_data) ||
! _gimp_wire_read_int32 (channel,
&proc_install->nparams, 1, user_data) ||
&proc_install->n_params, 1, user_data) ||
! _gimp_wire_read_int32 (channel,
&proc_install->nreturn_vals, 1, user_data))
&proc_install->n_return_vals, 1, user_data))
goto cleanup;
proc_install->params = g_new0 (GPParamDef, proc_install->nparams);
proc_install->params = g_new0 (GPParamDef, proc_install->n_params);
for (i = 0; i < proc_install->nparams; i++)
for (i = 0; i < proc_install->n_params; i++)
{
if (! _gp_param_def_read (channel,
&proc_install->params[i],
@ -1220,9 +1220,9 @@ _gp_proc_install_read (GIOChannel *channel,
goto cleanup;
}
proc_install->return_vals = g_new0 (GPParamDef, proc_install->nreturn_vals);
proc_install->return_vals = g_new0 (GPParamDef, proc_install->n_return_vals);
for (i = 0; i < proc_install->nreturn_vals; i++)
for (i = 0; i < proc_install->n_return_vals; i++)
{
if (! _gp_param_def_read (channel,
&proc_install->return_vals[i],
@ -1238,7 +1238,7 @@ _gp_proc_install_read (GIOChannel *channel,
if (proc_install->params)
{
for (i = 0; i < proc_install->nparams; i++)
for (i = 0; i < proc_install->n_params; i++)
{
if (! proc_install->params[i].name)
break;
@ -1251,7 +1251,7 @@ _gp_proc_install_read (GIOChannel *channel,
if (proc_install->return_vals)
{
for (i = 0; i < proc_install->nreturn_vals; i++)
for (i = 0; i < proc_install->n_return_vals; i++)
{
if (! proc_install->return_vals[i].name)
break;
@ -1417,12 +1417,12 @@ _gp_proc_install_write (GIOChannel *channel,
! _gimp_wire_write_int32 (channel,
&proc_install->type, 1, user_data) ||
! _gimp_wire_write_int32 (channel,
&proc_install->nparams, 1, user_data) ||
&proc_install->n_params, 1, user_data) ||
! _gimp_wire_write_int32 (channel,
&proc_install->nreturn_vals, 1, user_data))
&proc_install->n_return_vals, 1, user_data))
return;
for (i = 0; i < proc_install->nparams; i++)
for (i = 0; i < proc_install->n_params; i++)
{
if (! _gp_param_def_write (channel,
&proc_install->params[i],
@ -1430,7 +1430,7 @@ _gp_proc_install_write (GIOChannel *channel,
return;
}
for (i = 0; i < proc_install->nreturn_vals; i++)
for (i = 0; i < proc_install->n_return_vals; i++)
{
if (! _gp_param_def_write (channel,
&proc_install->return_vals[i],
@ -1450,12 +1450,12 @@ _gp_proc_install_destroy (GimpWireMessage *msg)
g_free (proc_install->name);
for (i = 0; i < proc_install->nparams; i++)
for (i = 0; i < proc_install->n_params; i++)
{
_gp_param_def_destroy (&proc_install->params[i]);
}
for (i = 0; i < proc_install->nreturn_vals; i++)
for (i = 0; i < proc_install->n_return_vals; i++)
{
_gp_param_def_destroy (&proc_install->return_vals[i]);
}
@ -1534,21 +1534,21 @@ _gp_extension_ack_destroy (GimpWireMessage *msg)
static void
_gp_params_read (GIOChannel *channel,
GPParam **params,
guint *nparams,
guint *n_params,
gpointer user_data)
{
gint i;
if (! _gimp_wire_read_int32 (channel, (guint32 *) nparams, 1, user_data))
if (! _gimp_wire_read_int32 (channel, (guint32 *) n_params, 1, user_data))
return;
if (*nparams == 0)
if (*n_params == 0)
{
*params = NULL;
return;
}
*params = g_try_new0 (GPParam, *nparams);
*params = g_try_new0 (GPParam, *n_params);
/* We may read crap on the wire (and as a consequence try to allocate
* far too much), which would be a plug-in error.
@ -1559,12 +1559,12 @@ _gp_params_read (GIOChannel *channel,
* plug-in bug sending bogus data, not a core bug.
*/
g_printerr ("%s: failed to allocate %u parameters\n",
G_STRFUNC, *nparams);
*nparams = 0;
G_STRFUNC, *n_params);
*n_params = 0;
return;
}
for (i = 0; i < *nparams; i++)
for (i = 0; i < *n_params; i++)
{
if (! _gimp_wire_read_int32 (channel,
(guint32 *) &(*params)[i].param_type, 1,
@ -1723,7 +1723,7 @@ _gp_params_read (GIOChannel *channel,
return;
cleanup:
*nparams = 0;
*n_params = 0;
g_free (*params);
*params = NULL;
}
@ -1731,16 +1731,16 @@ _gp_params_read (GIOChannel *channel,
static void
_gp_params_write (GIOChannel *channel,
GPParam *params,
gint nparams,
gint n_params,
gpointer user_data)
{
gint i;
if (! _gimp_wire_write_int32 (channel,
(const guint32 *) &nparams, 1, user_data))
(const guint32 *) &n_params, 1, user_data))
return;
for (i = 0; i < nparams; i++)
for (i = 0; i < n_params; i++)
{
if (! _gimp_wire_write_int32 (channel,
(const guint32 *) &params[i].param_type, 1,
@ -1856,11 +1856,11 @@ _gp_params_write (GIOChannel *channel,
static void
_gp_params_destroy (GPParam *params,
gint nparams)
gint n_params)
{
gint i;
for (i = 0; i < nparams; i++)
for (i = 0; i < n_params; i++)
{
g_free (params[i].type_name);

View File

@ -268,14 +268,14 @@ struct _GPParam
struct _GPProcRun
{
gchar *name;
guint32 nparams;
guint32 n_params;
GPParam *params;
};
struct _GPProcReturn
{
gchar *name;
guint32 nparams;
guint32 n_params;
GPParam *params;
};
@ -283,8 +283,8 @@ struct _GPProcInstall
{
gchar *name;
guint32 type;
guint32 nparams;
guint32 nreturn_vals;
guint32 n_params;
guint32 n_return_vals;
GPParamDef *params;
GPParamDef *return_vals;
};