formatting.

2005-01-15  Sven Neumann  <sven@gimp.org>

	* libgimpbase/gimpprotocol.c: formatting.
This commit is contained in:
Sven Neumann 2005-01-15 11:55:34 +00:00 committed by Sven Neumann
parent 09a190f132
commit c40f654fb9
2 changed files with 169 additions and 138 deletions

View File

@ -1,3 +1,7 @@
2005-01-15 Sven Neumann <sven@gimp.org>
* libgimpbase/gimpprotocol.c: formatting.
2005-01-15 Sven Neumann <sven@gimp.org> 2005-01-15 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/script-fu-scripts.c (script_fu_free_script) * plug-ins/script-fu/script-fu-scripts.c (script_fu_free_script)

View File

@ -17,8 +17,6 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include <stdio.h>
#include <glib-object.h> #include <glib-object.h>
#include "gimpbasetypes.h" #include "gimpbasetypes.h"
@ -215,8 +213,10 @@ gp_quit_write (GIOChannel *channel,
if (! wire_write_msg (channel, &msg, user_data)) if (! wire_write_msg (channel, &msg, user_data))
return FALSE; return FALSE;
if (! wire_flush (channel, user_data)) if (! wire_flush (channel, user_data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -232,8 +232,10 @@ gp_config_write (GIOChannel *channel,
if (! wire_write_msg (channel, &msg, user_data)) if (! wire_write_msg (channel, &msg, user_data))
return FALSE; return FALSE;
if (! wire_flush (channel, user_data)) if (! wire_flush (channel, user_data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -249,8 +251,10 @@ gp_tile_req_write (GIOChannel *channel,
if (! wire_write_msg (channel, &msg, user_data)) if (! wire_write_msg (channel, &msg, user_data))
return FALSE; return FALSE;
if (! wire_flush (channel, user_data)) if (! wire_flush (channel, user_data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -265,8 +269,10 @@ gp_tile_ack_write (GIOChannel *channel,
if (! wire_write_msg (channel, &msg, user_data)) if (! wire_write_msg (channel, &msg, user_data))
return FALSE; return FALSE;
if (! wire_flush (channel, user_data)) if (! wire_flush (channel, user_data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -282,8 +288,10 @@ gp_tile_data_write (GIOChannel *channel,
if (! wire_write_msg (channel, &msg, user_data)) if (! wire_write_msg (channel, &msg, user_data))
return FALSE; return FALSE;
if (! wire_flush (channel, user_data)) if (! wire_flush (channel, user_data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -299,8 +307,10 @@ gp_proc_run_write (GIOChannel *channel,
if (! wire_write_msg (channel, &msg, user_data)) if (! wire_write_msg (channel, &msg, user_data))
return FALSE; return FALSE;
if (! wire_flush (channel, user_data)) if (! wire_flush (channel, user_data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -316,8 +326,10 @@ gp_proc_return_write (GIOChannel *channel,
if (! wire_write_msg (channel, &msg, user_data)) if (! wire_write_msg (channel, &msg, user_data))
return FALSE; return FALSE;
if (! wire_flush (channel, user_data)) if (! wire_flush (channel, user_data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -333,8 +345,10 @@ gp_temp_proc_run_write (GIOChannel *channel,
if (! wire_write_msg (channel, &msg, user_data)) if (! wire_write_msg (channel, &msg, user_data))
return FALSE; return FALSE;
if (! wire_flush (channel, user_data)) if (! wire_flush (channel, user_data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -350,8 +364,10 @@ gp_temp_proc_return_write (GIOChannel *channel,
if (! wire_write_msg (channel, &msg, user_data)) if (! wire_write_msg (channel, &msg, user_data))
return FALSE; return FALSE;
if (! wire_flush (channel, user_data)) if (! wire_flush (channel, user_data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -367,8 +383,10 @@ gp_proc_install_write (GIOChannel *channel,
if (! wire_write_msg (channel, &msg, user_data)) if (! wire_write_msg (channel, &msg, user_data))
return FALSE; return FALSE;
if (! wire_flush (channel, user_data)) if (! wire_flush (channel, user_data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -384,8 +402,10 @@ gp_proc_uninstall_write (GIOChannel *channel,
if (! wire_write_msg (channel, &msg, user_data)) if (! wire_write_msg (channel, &msg, user_data))
return FALSE; return FALSE;
if (! wire_flush (channel, user_data)) if (! wire_flush (channel, user_data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -400,8 +420,10 @@ gp_extension_ack_write (GIOChannel *channel,
if (! wire_write_msg (channel, &msg, user_data)) if (! wire_write_msg (channel, &msg, user_data))
return FALSE; return FALSE;
if (! wire_flush (channel, user_data)) if (! wire_flush (channel, user_data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -416,8 +438,10 @@ gp_has_init_write (GIOChannel *channel,
if (! wire_write_msg (channel, &msg, user_data)) if (! wire_write_msg (channel, &msg, user_data))
return FALSE; return FALSE;
if (! wire_flush (channel, user_data)) if (! wire_flush (channel, user_data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -530,57 +554,74 @@ _gp_config_write (GIOChannel *channel,
WireMessage *msg, WireMessage *msg,
gpointer user_data) gpointer user_data)
{ {
GPConfig *config; GPConfig *config = msg->data;
config = msg->data; if (! wire_write_int32 (channel,
if (! wire_write_int32 (channel, &config->version, 1, user_data)) &config->version, 1, user_data))
return; return;
if (! wire_write_int32 (channel, &config->tile_width, 1, user_data)) if (! wire_write_int32 (channel,
&config->tile_width, 1, user_data))
return; return;
if (! wire_write_int32 (channel, &config->tile_height, 1, user_data)) if (! wire_write_int32 (channel,
&config->tile_height, 1, user_data))
return; return;
if (! wire_write_int32 (channel, (guint32*) &config->shm_ID, 1, user_data)) if (! wire_write_int32 (channel,
(guint32 *) &config->shm_ID, 1, user_data))
return; return;
if (! wire_write_int8 (channel, (guint8*) &config->check_size, 1, user_data)) if (! wire_write_int8 (channel,
(guint8 *) &config->check_size, 1, user_data))
return; return;
if (! wire_write_int8 (channel, (guint8*) &config->check_type, 1, user_data)) if (! wire_write_int8 (channel,
(guint8 *) &config->check_type, 1, user_data))
return; return;
if (! wire_write_int8 (channel, (guint8*) &config->show_help_button, 1, user_data)) if (! wire_write_int8 (channel,
(guint8 *) &config->show_help_button, 1, user_data))
return; return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_4, 1, user_data)) if (! wire_write_int8 (channel,
(guint8 *) &config->gimp_reserved_4, 1, user_data))
return; return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_5, 1, user_data)) if (! wire_write_int8 (channel,
(guint8 *) &config->gimp_reserved_5, 1, user_data))
return; return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_6, 1, user_data)) if (! wire_write_int8 (channel,
(guint8 *) &config->gimp_reserved_6, 1, user_data))
return; return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_7, 1, user_data)) if (! wire_write_int8 (channel,
(guint8 *) &config->gimp_reserved_7, 1, user_data))
return; return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_8, 1, user_data)) if (! wire_write_int8 (channel,
(guint8 *) &config->gimp_reserved_8, 1, user_data))
return; return;
if (! wire_write_int8 (channel, (guint8*) &config->install_cmap, 1, user_data)) if (! wire_write_int8 (channel,
(guint8 *) &config->install_cmap, 1, user_data))
return; return;
if (! wire_write_int8 (channel, (guint8*) &config->show_tool_tips, 1, user_data)) if (! wire_write_int8 (channel,
(guint8 *) &config->show_tool_tips, 1, user_data))
return; return;
if (! wire_write_int32 (channel, (guint32*) &config->min_colors, 1, user_data)) if (! wire_write_int32 (channel,
(guint32 *) &config->min_colors, 1, user_data))
return; return;
if (! wire_write_int32 (channel, (guint32*) &config->gdisp_ID, 1, user_data)) if (! wire_write_int32 (channel,
(guint32 *) &config->gdisp_ID, 1, user_data))
return; return;
if (! wire_write_string (channel, &config->app_name, 1, user_data)) if (! wire_write_string (channel,
&config->app_name, 1, user_data))
return; return;
if (! wire_write_string (channel, &config->wm_class, 1, user_data)) if (! wire_write_string (channel,
&config->wm_class, 1, user_data))
return; return;
if (! wire_write_string (channel, &config->display_name, 1, user_data)) if (! wire_write_string (channel,
&config->display_name, 1, user_data))
return; return;
if (! wire_write_int32 (channel, (guint32*) &config->monitor_number, 1, user_data)) if (! wire_write_int32 (channel,
(guint32 *) &config->monitor_number, 1, user_data))
return; return;
} }
static void static void
_gp_config_destroy (WireMessage *msg) _gp_config_destroy (WireMessage *msg)
{ {
GPConfig *config; GPConfig *config = msg->data;
config = msg->data;
g_free (config->app_name); g_free (config->app_name);
g_free (config->wm_class); g_free (config->wm_class);
@ -599,12 +640,14 @@ _gp_tile_req_read (GIOChannel *channel,
tile_req = g_new0 (GPTileReq, 1); tile_req = g_new0 (GPTileReq, 1);
if (! wire_read_int32 (channel, (guint32*) &tile_req->drawable_ID, 1, if (! wire_read_int32 (channel,
user_data)) (guint32 *) &tile_req->drawable_ID, 1, user_data))
goto cleanup; goto cleanup;
if (! wire_read_int32 (channel, &tile_req->tile_num, 1, user_data)) if (! wire_read_int32 (channel,
&tile_req->tile_num, 1, user_data))
goto cleanup; goto cleanup;
if (! wire_read_int32 (channel, &tile_req->shadow, 1, user_data)) if (! wire_read_int32 (channel,
&tile_req->shadow, 1, user_data))
goto cleanup; goto cleanup;
msg->data = tile_req; msg->data = tile_req;
@ -619,15 +662,16 @@ _gp_tile_req_write (GIOChannel *channel,
WireMessage *msg, WireMessage *msg,
gpointer user_data) gpointer user_data)
{ {
GPTileReq *tile_req; GPTileReq *tile_req = msg->data;
tile_req = msg->data; if (! wire_write_int32 (channel,
if (! wire_write_int32 (channel, (guint32*) &tile_req->drawable_ID, 1, (guint32 *) &tile_req->drawable_ID, 1, user_data))
user_data))
return; return;
if (! wire_write_int32 (channel, &tile_req->tile_num, 1, user_data)) if (! wire_write_int32 (channel,
&tile_req->tile_num, 1, user_data))
return; return;
if (! wire_write_int32 (channel, &tile_req->shadow, 1, user_data)) if (! wire_write_int32 (channel,
&tile_req->shadow, 1, user_data))
return; return;
} }
@ -666,12 +710,11 @@ _gp_tile_data_read (GIOChannel *channel,
gpointer user_data) gpointer user_data)
{ {
GPTileData *tile_data; GPTileData *tile_data;
guint length;
tile_data = g_new0 (GPTileData, 1); tile_data = g_new0 (GPTileData, 1);
if (! wire_read_int32 (channel, (guint32*) &tile_data->drawable_ID, 1, if (! wire_read_int32 (channel,
user_data)) (guint32 *) &tile_data->drawable_ID, 1, user_data))
goto cleanup; goto cleanup;
if (! wire_read_int32 (channel, &tile_data->tile_num, 1, user_data)) if (! wire_read_int32 (channel, &tile_data->tile_num, 1, user_data))
goto cleanup; goto cleanup;
@ -688,11 +731,12 @@ _gp_tile_data_read (GIOChannel *channel,
if (!tile_data->use_shm) if (!tile_data->use_shm)
{ {
length = tile_data->width * tile_data->height * tile_data->bpp; guint length = tile_data->width * tile_data->height * tile_data->bpp;
tile_data->data = g_new (guchar, length); tile_data->data = g_new (guchar, length);
if (! wire_read_int8 (channel, (guint8*) tile_data->data, length, if (! wire_read_int8 (channel,
user_data)) (guint8 *) tile_data->data, length, user_data))
goto cleanup; goto cleanup;
} }
@ -709,12 +753,10 @@ _gp_tile_data_write (GIOChannel *channel,
WireMessage *msg, WireMessage *msg,
gpointer user_data) gpointer user_data)
{ {
GPTileData *tile_data; GPTileData *tile_data = msg->data;
guint length;
tile_data = msg->data; if (! wire_write_int32 (channel,
if (! wire_write_int32 (channel, (guint32*) &tile_data->drawable_ID, 1, (guint32 *) &tile_data->drawable_ID, 1, user_data))
user_data))
return; return;
if (! wire_write_int32 (channel, &tile_data->tile_num, 1, user_data)) if (! wire_write_int32 (channel, &tile_data->tile_num, 1, user_data))
return; return;
@ -731,9 +773,10 @@ _gp_tile_data_write (GIOChannel *channel,
if (!tile_data->use_shm) if (!tile_data->use_shm)
{ {
length = tile_data->width * tile_data->height * tile_data->bpp; guint length = tile_data->width * tile_data->height * tile_data->bpp;
if (! wire_write_int8 (channel, (guint8*) tile_data->data, length,
user_data)) if (! wire_write_int8 (channel,
(guint8 *) tile_data->data, length, user_data))
return; return;
} }
} }
@ -741,9 +784,7 @@ _gp_tile_data_write (GIOChannel *channel,
static void static void
_gp_tile_data_destroy (WireMessage *msg) _gp_tile_data_destroy (WireMessage *msg)
{ {
GPTileData *tile_data; GPTileData *tile_data = msg->data;
tile_data = msg->data;
g_free (tile_data->data); g_free (tile_data->data);
g_free (tile_data); g_free (tile_data);
@ -779,9 +820,7 @@ _gp_proc_run_write (GIOChannel *channel,
WireMessage *msg, WireMessage *msg,
gpointer user_data) gpointer user_data)
{ {
GPProcRun *proc_run; GPProcRun *proc_run = msg->data;
proc_run = msg->data;
if (! wire_write_string (channel, &proc_run->name, 1, user_data)) if (! wire_write_string (channel, &proc_run->name, 1, user_data))
return; return;
@ -792,9 +831,8 @@ _gp_proc_run_write (GIOChannel *channel,
static void static void
_gp_proc_run_destroy (WireMessage *msg) _gp_proc_run_destroy (WireMessage *msg)
{ {
GPProcRun *proc_run; GPProcRun *proc_run = msg->data;
proc_run = msg->data;
_gp_params_destroy (proc_run->params, proc_run->nparams); _gp_params_destroy (proc_run->params, proc_run->nparams);
g_free (proc_run->name); g_free (proc_run->name);
@ -831,23 +869,20 @@ _gp_proc_return_write (GIOChannel *channel,
WireMessage *msg, WireMessage *msg,
gpointer user_data) gpointer user_data)
{ {
GPProcReturn *proc_return; GPProcReturn *proc_return = msg->data;
proc_return = msg->data;
if (! wire_write_string (channel, &proc_return->name, 1, user_data)) if (! wire_write_string (channel, &proc_return->name, 1, user_data))
return; return;
_gp_params_write (channel, proc_return->params, proc_return->nparams, _gp_params_write (channel,
user_data); proc_return->params, proc_return->nparams, user_data);
} }
static void static void
_gp_proc_return_destroy (WireMessage *msg) _gp_proc_return_destroy (WireMessage *msg)
{ {
GPProcReturn *proc_return; GPProcReturn *proc_return = msg->data;
proc_return = msg->data;
_gp_params_destroy (proc_return->params, proc_return->nparams); _gp_params_destroy (proc_return->params, proc_return->nparams);
g_free (proc_return->name); g_free (proc_return->name);
@ -1023,11 +1058,9 @@ _gp_proc_install_write (GIOChannel *channel,
WireMessage *msg, WireMessage *msg,
gpointer user_data) gpointer user_data)
{ {
GPProcInstall *proc_install; GPProcInstall *proc_install = msg->data;
gint i; gint i;
proc_install = msg->data;
if (! wire_write_string (channel, &proc_install->name, 1, user_data)) if (! wire_write_string (channel, &proc_install->name, 1, user_data))
return; return;
if (! wire_write_string (channel, &proc_install->blurb, 1, user_data)) if (! wire_write_string (channel, &proc_install->blurb, 1, user_data))
@ -1088,11 +1121,9 @@ _gp_proc_install_write (GIOChannel *channel,
static void static void
_gp_proc_install_destroy (WireMessage *msg) _gp_proc_install_destroy (WireMessage *msg)
{ {
GPProcInstall *proc_install; GPProcInstall *proc_install = msg->data;
gint i; gint i;
proc_install = msg->data;
g_free (proc_install->name); g_free (proc_install->name);
g_free (proc_install->blurb); g_free (proc_install->blurb);
g_free (proc_install->help); g_free (proc_install->help);
@ -1145,9 +1176,7 @@ _gp_proc_uninstall_write (GIOChannel *channel,
WireMessage *msg, WireMessage *msg,
gpointer user_data) gpointer user_data)
{ {
GPProcUninstall *proc_uninstall; GPProcUninstall *proc_uninstall = msg->data;
proc_uninstall = msg->data;
if (! wire_write_string (channel, &proc_uninstall->name, 1, user_data)) if (! wire_write_string (channel, &proc_uninstall->name, 1, user_data))
return; return;
@ -1156,9 +1185,7 @@ _gp_proc_uninstall_write (GIOChannel *channel,
static void static void
_gp_proc_uninstall_destroy (WireMessage *msg) _gp_proc_uninstall_destroy (WireMessage *msg)
{ {
GPProcUninstall *proc_uninstall; GPProcUninstall *proc_uninstall = msg->data;
proc_uninstall = msg->data;
g_free (proc_uninstall->name); g_free (proc_uninstall->name);
g_free (proc_uninstall); g_free (proc_uninstall);
@ -1209,8 +1236,7 @@ _gp_params_read (GIOChannel *channel,
for (i = 0; i < *nparams; i++) for (i = 0; i < *nparams; i++)
{ {
if (! wire_read_int32 (channel, if (! wire_read_int32 (channel,
(guint32*) &(*params)[i].type, 1, (guint32 *) &(*params)[i].type, 1, user_data))
user_data))
goto cleanup; goto cleanup;
switch ((*params)[i].type) switch ((*params)[i].type)
@ -1252,8 +1278,9 @@ _gp_params_read (GIOChannel *channel,
case GIMP_PDB_INT32ARRAY: case GIMP_PDB_INT32ARRAY:
(*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32); (*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32);
(*params)[i].data.d_int32array = (*params)[i].data.d_int32array = g_new (gint32,
g_new (gint32, (*params)[i-1].data.d_int32); (*params)[i-1].data.d_int32);
if (! wire_read_int32 (channel, if (! wire_read_int32 (channel,
(guint32 *) (*params)[i].data.d_int32array, (guint32 *) (*params)[i].data.d_int32array,
(*params)[i-1].data.d_int32, (*params)[i-1].data.d_int32,
@ -1266,8 +1293,8 @@ _gp_params_read (GIOChannel *channel,
case GIMP_PDB_INT16ARRAY: case GIMP_PDB_INT16ARRAY:
(*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32); (*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32);
(*params)[i].data.d_int16array = (*params)[i].data.d_int16array = g_new (gint16,
g_new (gint16, (*params)[i-1].data.d_int32); (*params)[i-1].data.d_int32);
if (! wire_read_int16 (channel, if (! wire_read_int16 (channel,
(guint16 *) (*params)[i].data.d_int16array, (guint16 *) (*params)[i].data.d_int16array,
(*params)[i-1].data.d_int32, (*params)[i-1].data.d_int32,
@ -1280,8 +1307,8 @@ _gp_params_read (GIOChannel *channel,
case GIMP_PDB_INT8ARRAY: case GIMP_PDB_INT8ARRAY:
(*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32); (*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32);
(*params)[i].data.d_int8array = (*params)[i].data.d_int8array = g_new (gint8,
g_new (gint8, (*params)[i-1].data.d_int32); (*params)[i-1].data.d_int32);
if (! wire_read_int8 (channel, if (! wire_read_int8 (channel,
(guint8 *) (*params)[i].data.d_int8array, (guint8 *) (*params)[i].data.d_int8array,
(*params)[i-1].data.d_int32, (*params)[i-1].data.d_int32,
@ -1294,8 +1321,8 @@ _gp_params_read (GIOChannel *channel,
case GIMP_PDB_FLOATARRAY: case GIMP_PDB_FLOATARRAY:
(*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32); (*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32);
(*params)[i].data.d_floatarray = (*params)[i].data.d_floatarray = g_new (gdouble,
g_new (gdouble, (*params)[i-1].data.d_int32); (*params)[i-1].data.d_int32);
if (! wire_read_double (channel, if (! wire_read_double (channel,
(*params)[i].data.d_floatarray, (*params)[i].data.d_floatarray,
(*params)[i-1].data.d_int32, (*params)[i-1].data.d_int32,
@ -1308,8 +1335,8 @@ _gp_params_read (GIOChannel *channel,
case GIMP_PDB_STRINGARRAY: case GIMP_PDB_STRINGARRAY:
(*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32); (*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32);
(*params)[i].data.d_stringarray = (*params)[i].data.d_stringarray = g_new0 (gchar *,
g_new0 (gchar*, (*params)[i-1].data.d_int32); (*params)[i-1].data.d_int32);
if (! wire_read_string (channel, if (! wire_read_string (channel,
(*params)[i].data.d_stringarray, (*params)[i].data.d_stringarray,
(*params)[i-1].data.d_int32, (*params)[i-1].data.d_int32,
@ -1421,7 +1448,8 @@ _gp_params_read (GIOChannel *channel,
goto cleanup; goto cleanup;
if ((*params)[i].data.d_parasite.size > 0) if ((*params)[i].data.d_parasite.size > 0)
{ {
(*params)[i].data.d_parasite.data = g_malloc ((*params)[i].data.d_parasite.size); (*params)[i].data.d_parasite.data =
g_malloc ((*params)[i].data.d_parasite.size);
if (! wire_read_int8 (channel, if (! wire_read_int8 (channel,
(*params)[i].data.d_parasite.data, (*params)[i].data.d_parasite.data,
(*params)[i].data.d_parasite.size, (*params)[i].data.d_parasite.size,
@ -1752,4 +1780,3 @@ static void
_gp_has_init_destroy (WireMessage *msg) _gp_has_init_destroy (WireMessage *msg)
{ {
} }