diff --git a/ChangeLog b/ChangeLog index 616bbeb95f..0559b9f0ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-12-13 Sven Neumann + + * libgimpbase/gimpwire.[ch]: let the private wire methods live in + the GIMP namespace. Declare internal functions as such and prefix + them with an underscore. + + * libgimp/gimp.c + * libgimp/gimptile.c + * libgimpbase/gimpbase.def + * libgimpbase/gimpprotocol.c + * app/plug-in/plug-in-message.[ch] + * app/plug-in/plug-in-run.c + * app/plug-in/plug-in.c: changed accordingly. + 2005-12-13 Michael Natterer * app/tools/*.c: port to G_DEFINE_TYPE() and friends. Some related diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index c50523eab7..a854bea68b 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -83,8 +83,8 @@ static GSList *blocked_plug_ins = NULL; /* public functions */ void -plug_in_handle_message (PlugIn *plug_in, - WireMessage *msg) +plug_in_handle_message (PlugIn *plug_in, + GimpWireMessage *msg) { switch (msg->type) { @@ -171,13 +171,13 @@ static void plug_in_handle_tile_req (PlugIn *plug_in, GPTileReq *tile_req) { - GPTileData tile_data; - GPTileData *tile_info; - WireMessage msg; - GimpDrawable *drawable; - TileManager *tm; - Tile *tile; - gint shm_ID; + GPTileData tile_data; + GPTileData *tile_info; + GimpWireMessage msg; + GimpDrawable *drawable; + TileManager *tm; + Tile *tile; + gint shm_ID; shm_ID = plug_in_shm_get_ID (plug_in->gimp); @@ -201,7 +201,7 @@ plug_in_handle_tile_req (PlugIn *plug_in, return; } - if (! wire_read_msg (plug_in->my_read, &msg, plug_in)) + if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in)) { g_warning ("plug_in_handle_tile_req: ERROR"); plug_in_close (plug_in, TRUE); @@ -257,8 +257,8 @@ plug_in_handle_tile_req (PlugIn *plug_in, tile_size (tile)); tile_release (tile, TRUE); + gimp_wire_destroy (&msg); - wire_destroy (&msg); if (! gp_tile_ack_write (plug_in->my_write, plug_in)) { g_warning ("plug_in_handle_tile_req: ERROR"); @@ -324,7 +324,7 @@ plug_in_handle_tile_req (PlugIn *plug_in, tile_release (tile, FALSE); - if (! wire_read_msg (plug_in->my_read, &msg, plug_in)) + if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in)) { g_message ("plug_in_handle_tile_req: ERROR"); plug_in_close (plug_in, TRUE); @@ -338,7 +338,7 @@ plug_in_handle_tile_req (PlugIn *plug_in, return; } - wire_destroy (&msg); + gimp_wire_destroy (&msg); } } diff --git a/app/plug-in/gimpplugin-message.h b/app/plug-in/gimpplugin-message.h index d16f93cae8..7273c19246 100644 --- a/app/plug-in/gimpplugin-message.h +++ b/app/plug-in/gimpplugin-message.h @@ -22,8 +22,8 @@ #define __PLUG_IN_MESSAGE_H__ -void plug_in_handle_message (PlugIn *plug_in, - WireMessage *msg); +void plug_in_handle_message (PlugIn *plug_in, + GimpWireMessage *msg); #endif /* __PLUG_IN_MESSAGE_H__ */ diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index 0541f142b3..49d457ac73 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -115,8 +115,9 @@ plug_in_init (Gimp *gimp) * write handlers. */ gp_init (); - wire_set_writer (plug_in_write); - wire_set_flusher (plug_in_flush); + + gimp_wire_set_writer (plug_in_write); + gimp_wire_set_flusher (plug_in_flush); /* allocate a piece of shared memory for use in transporting tiles * to plug-ins. if we can't allocate a piece of shared memory then @@ -179,16 +180,16 @@ plug_in_call_query (Gimp *gimp, { while (plug_in->open) { - WireMessage msg; + GimpWireMessage msg; - if (! wire_read_msg (plug_in->my_read, &msg, plug_in)) + if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in)) { plug_in_close (plug_in, TRUE); } else { plug_in_handle_message (plug_in, &msg); - wire_destroy (&msg); + gimp_wire_destroy (&msg); } } } @@ -220,16 +221,16 @@ plug_in_call_init (Gimp *gimp, { while (plug_in->open) { - WireMessage msg; + GimpWireMessage msg; - if (! wire_read_msg (plug_in->my_read, &msg, plug_in)) + if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in)) { plug_in_close (plug_in, TRUE); } else { plug_in_handle_message (plug_in, &msg); - wire_destroy (&msg); + gimp_wire_destroy (&msg); } } } @@ -679,7 +680,7 @@ plug_in_close (PlugIn *plug_in, plug_in->his_write = NULL; } - wire_clear_error (); + gimp_wire_clear_error (); for (list = plug_in->temp_proc_frames; list; list = g_list_next (list)) { @@ -747,11 +748,9 @@ plug_in_recv_message (GIOChannel *channel, GIOCondition cond, gpointer data) { - PlugIn *plug_in; + PlugIn *plug_in = data; gboolean got_message = FALSE; - plug_in = (PlugIn *) data; - #ifdef G_OS_WIN32 /* Workaround for GLib bug #137968: sometimes we are called for no * reason... @@ -765,18 +764,18 @@ plug_in_recv_message (GIOChannel *channel, if (cond & (G_IO_IN | G_IO_PRI)) { - WireMessage msg; + GimpWireMessage msg; - memset (&msg, 0, sizeof (WireMessage)); + memset (&msg, 0, sizeof (GimpWireMessage)); - if (! wire_read_msg (plug_in->my_read, &msg, plug_in)) + if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in)) { plug_in_close (plug_in, TRUE); } else { plug_in_handle_message (plug_in, &msg); - wire_destroy (&msg); + gimp_wire_destroy (&msg); got_message = TRUE; } } @@ -805,15 +804,13 @@ plug_in_recv_message (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel, - guint8 *buf, - gulong count, - gpointer user_data) + guint8 *buf, + gulong count, + gpointer user_data) { - PlugIn *plug_in; + PlugIn *plug_in = user_data; gulong bytes; - plug_in = (PlugIn *) user_data; - while (count > 0) { if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE) @@ -822,7 +819,7 @@ plug_in_write (GIOChannel *channel, memcpy (&plug_in->write_buffer[plug_in->write_buffer_index], buf, bytes); plug_in->write_buffer_index += bytes; - if (! wire_flush (channel, plug_in)) + if (! gimp_wire_flush (channel, plug_in)) return FALSE; } else @@ -844,9 +841,7 @@ static gboolean plug_in_flush (GIOChannel *channel, gpointer user_data) { - PlugIn *plug_in; - - plug_in = (PlugIn *) user_data; + PlugIn *plug_in = user_data; if (plug_in->write_buffer_index > 0) { diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index bc64a16952..4096559172 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -133,7 +133,7 @@ plug_in_run (Gimp *gimp, if (! gp_config_write (plug_in->my_write, &config, plug_in) || ! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) || - ! wire_flush (plug_in->my_write, plug_in)) + ! gimp_wire_flush (plug_in->my_write, plug_in)) { return_vals = procedural_db_return_args (proc_rec, FALSE); @@ -261,7 +261,7 @@ plug_in_temp_run (ProcRecord *proc_rec, proc_run.params = plug_in_args_to_params (args, argc, FALSE); if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) || - ! wire_flush (plug_in->my_write, plug_in)) + ! gimp_wire_flush (plug_in->my_write, plug_in)) { return_vals = procedural_db_return_args (proc_rec, FALSE); diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index bc64a16952..4096559172 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -133,7 +133,7 @@ plug_in_run (Gimp *gimp, if (! gp_config_write (plug_in->my_write, &config, plug_in) || ! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) || - ! wire_flush (plug_in->my_write, plug_in)) + ! gimp_wire_flush (plug_in->my_write, plug_in)) { return_vals = procedural_db_return_args (proc_rec, FALSE); @@ -261,7 +261,7 @@ plug_in_temp_run (ProcRecord *proc_rec, proc_run.params = plug_in_args_to_params (args, argc, FALSE); if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) || - ! wire_flush (plug_in->my_write, plug_in)) + ! gimp_wire_flush (plug_in->my_write, plug_in)) { return_vals = procedural_db_return_args (proc_rec, FALSE); diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index c50523eab7..a854bea68b 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -83,8 +83,8 @@ static GSList *blocked_plug_ins = NULL; /* public functions */ void -plug_in_handle_message (PlugIn *plug_in, - WireMessage *msg) +plug_in_handle_message (PlugIn *plug_in, + GimpWireMessage *msg) { switch (msg->type) { @@ -171,13 +171,13 @@ static void plug_in_handle_tile_req (PlugIn *plug_in, GPTileReq *tile_req) { - GPTileData tile_data; - GPTileData *tile_info; - WireMessage msg; - GimpDrawable *drawable; - TileManager *tm; - Tile *tile; - gint shm_ID; + GPTileData tile_data; + GPTileData *tile_info; + GimpWireMessage msg; + GimpDrawable *drawable; + TileManager *tm; + Tile *tile; + gint shm_ID; shm_ID = plug_in_shm_get_ID (plug_in->gimp); @@ -201,7 +201,7 @@ plug_in_handle_tile_req (PlugIn *plug_in, return; } - if (! wire_read_msg (plug_in->my_read, &msg, plug_in)) + if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in)) { g_warning ("plug_in_handle_tile_req: ERROR"); plug_in_close (plug_in, TRUE); @@ -257,8 +257,8 @@ plug_in_handle_tile_req (PlugIn *plug_in, tile_size (tile)); tile_release (tile, TRUE); + gimp_wire_destroy (&msg); - wire_destroy (&msg); if (! gp_tile_ack_write (plug_in->my_write, plug_in)) { g_warning ("plug_in_handle_tile_req: ERROR"); @@ -324,7 +324,7 @@ plug_in_handle_tile_req (PlugIn *plug_in, tile_release (tile, FALSE); - if (! wire_read_msg (plug_in->my_read, &msg, plug_in)) + if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in)) { g_message ("plug_in_handle_tile_req: ERROR"); plug_in_close (plug_in, TRUE); @@ -338,7 +338,7 @@ plug_in_handle_tile_req (PlugIn *plug_in, return; } - wire_destroy (&msg); + gimp_wire_destroy (&msg); } } diff --git a/app/plug-in/plug-in-message.h b/app/plug-in/plug-in-message.h index d16f93cae8..7273c19246 100644 --- a/app/plug-in/plug-in-message.h +++ b/app/plug-in/plug-in-message.h @@ -22,8 +22,8 @@ #define __PLUG_IN_MESSAGE_H__ -void plug_in_handle_message (PlugIn *plug_in, - WireMessage *msg); +void plug_in_handle_message (PlugIn *plug_in, + GimpWireMessage *msg); #endif /* __PLUG_IN_MESSAGE_H__ */ diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index bc64a16952..4096559172 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -133,7 +133,7 @@ plug_in_run (Gimp *gimp, if (! gp_config_write (plug_in->my_write, &config, plug_in) || ! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) || - ! wire_flush (plug_in->my_write, plug_in)) + ! gimp_wire_flush (plug_in->my_write, plug_in)) { return_vals = procedural_db_return_args (proc_rec, FALSE); @@ -261,7 +261,7 @@ plug_in_temp_run (ProcRecord *proc_rec, proc_run.params = plug_in_args_to_params (args, argc, FALSE); if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) || - ! wire_flush (plug_in->my_write, plug_in)) + ! gimp_wire_flush (plug_in->my_write, plug_in)) { return_vals = procedural_db_return_args (proc_rec, FALSE); diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index 0541f142b3..49d457ac73 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -115,8 +115,9 @@ plug_in_init (Gimp *gimp) * write handlers. */ gp_init (); - wire_set_writer (plug_in_write); - wire_set_flusher (plug_in_flush); + + gimp_wire_set_writer (plug_in_write); + gimp_wire_set_flusher (plug_in_flush); /* allocate a piece of shared memory for use in transporting tiles * to plug-ins. if we can't allocate a piece of shared memory then @@ -179,16 +180,16 @@ plug_in_call_query (Gimp *gimp, { while (plug_in->open) { - WireMessage msg; + GimpWireMessage msg; - if (! wire_read_msg (plug_in->my_read, &msg, plug_in)) + if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in)) { plug_in_close (plug_in, TRUE); } else { plug_in_handle_message (plug_in, &msg); - wire_destroy (&msg); + gimp_wire_destroy (&msg); } } } @@ -220,16 +221,16 @@ plug_in_call_init (Gimp *gimp, { while (plug_in->open) { - WireMessage msg; + GimpWireMessage msg; - if (! wire_read_msg (plug_in->my_read, &msg, plug_in)) + if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in)) { plug_in_close (plug_in, TRUE); } else { plug_in_handle_message (plug_in, &msg); - wire_destroy (&msg); + gimp_wire_destroy (&msg); } } } @@ -679,7 +680,7 @@ plug_in_close (PlugIn *plug_in, plug_in->his_write = NULL; } - wire_clear_error (); + gimp_wire_clear_error (); for (list = plug_in->temp_proc_frames; list; list = g_list_next (list)) { @@ -747,11 +748,9 @@ plug_in_recv_message (GIOChannel *channel, GIOCondition cond, gpointer data) { - PlugIn *plug_in; + PlugIn *plug_in = data; gboolean got_message = FALSE; - plug_in = (PlugIn *) data; - #ifdef G_OS_WIN32 /* Workaround for GLib bug #137968: sometimes we are called for no * reason... @@ -765,18 +764,18 @@ plug_in_recv_message (GIOChannel *channel, if (cond & (G_IO_IN | G_IO_PRI)) { - WireMessage msg; + GimpWireMessage msg; - memset (&msg, 0, sizeof (WireMessage)); + memset (&msg, 0, sizeof (GimpWireMessage)); - if (! wire_read_msg (plug_in->my_read, &msg, plug_in)) + if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in)) { plug_in_close (plug_in, TRUE); } else { plug_in_handle_message (plug_in, &msg); - wire_destroy (&msg); + gimp_wire_destroy (&msg); got_message = TRUE; } } @@ -805,15 +804,13 @@ plug_in_recv_message (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel, - guint8 *buf, - gulong count, - gpointer user_data) + guint8 *buf, + gulong count, + gpointer user_data) { - PlugIn *plug_in; + PlugIn *plug_in = user_data; gulong bytes; - plug_in = (PlugIn *) user_data; - while (count > 0) { if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE) @@ -822,7 +819,7 @@ plug_in_write (GIOChannel *channel, memcpy (&plug_in->write_buffer[plug_in->write_buffer_index], buf, bytes); plug_in->write_buffer_index += bytes; - if (! wire_flush (channel, plug_in)) + if (! gimp_wire_flush (channel, plug_in)) return FALSE; } else @@ -844,9 +841,7 @@ static gboolean plug_in_flush (GIOChannel *channel, gpointer user_data) { - PlugIn *plug_in; - - plug_in = (PlugIn *) user_data; + PlugIn *plug_in = user_data; if (plug_in->write_buffer_index > 0) { diff --git a/libgimp/gimp.c b/libgimp/gimp.c index 63e752eb3c..84a4cde716 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -125,8 +125,8 @@ typedef enum #define WRITE_BUFFER_SIZE 1024 -void gimp_read_expect_msg (WireMessage *msg, - gint type); +void gimp_read_expect_msg (GimpWireMessage *msg, + gint type); static void gimp_close (void); @@ -138,24 +138,24 @@ static void gimp_message_func (const gchar *log_domain, #ifndef G_OS_WIN32 static void gimp_plugin_sigfatal_handler (gint sig_num); #endif -static gboolean gimp_plugin_io_error_handler (GIOChannel *channel, - GIOCondition cond, - gpointer data); -static gboolean gimp_write (GIOChannel *channel, - guint8 *buf, - gulong count, - gpointer user_data); -static gboolean gimp_flush (GIOChannel *channel, - gpointer user_data); +static gboolean gimp_plugin_io_error_handler (GIOChannel *channel, + GIOCondition cond, + gpointer data); +static gboolean gimp_write (GIOChannel *channel, + guint8 *buf, + gulong count, + gpointer user_data); +static gboolean gimp_flush (GIOChannel *channel, + gpointer user_data); static void gimp_loop (void); -static void gimp_config (GPConfig *config); -static void gimp_proc_run (GPProcRun *proc_run); -static void gimp_temp_proc_run (GPProcRun *proc_run); -static void gimp_process_message (WireMessage *msg); +static void gimp_config (GPConfig *config); +static void gimp_proc_run (GPProcRun *proc_run); +static void gimp_temp_proc_run (GPProcRun *proc_run); +static void gimp_process_message (GimpWireMessage *msg); static void gimp_single_message (void); -static gboolean gimp_extension_read (GIOChannel *channel, - GIOCondition condition, - gpointer data); +static gboolean gimp_extension_read (GIOChannel *channel, + GIOCondition condition, + gpointer data); static GIOChannel *_readchannel = NULL; @@ -359,8 +359,9 @@ gimp_main (const GimpPlugInInfo *info, g_io_channel_set_close_on_unref (_writechannel, TRUE); gp_init (); - wire_set_writer (gimp_write); - wire_set_flusher (gimp_flush); + + gimp_wire_set_writer (gimp_write); + gimp_wire_set_flusher (gimp_flush); g_type_init (); gimp_enums_init (); @@ -885,12 +886,12 @@ gimp_run_procedure (const gchar *name, } void -gimp_read_expect_msg (WireMessage *msg, - gint type) +gimp_read_expect_msg (GimpWireMessage *msg, + gint type) { while (TRUE) { - if (! wire_read_msg (_readchannel, msg, NULL)) + if (! gimp_wire_read_msg (_readchannel, msg, NULL)) gimp_quit (); if (msg->type == type) @@ -905,7 +906,7 @@ gimp_read_expect_msg (WireMessage *msg, g_error ("unexpected message: %d", msg->type); } - wire_destroy (msg); + gimp_wire_destroy (msg); } } @@ -932,10 +933,10 @@ gimp_run_procedure2 (const gchar *name, gint n_params, const GimpParam *params) { - GPProcRun proc_run; - GPProcReturn *proc_return; - WireMessage msg; - GimpParam *return_vals; + GPProcRun proc_run; + GPProcReturn *proc_return; + GimpWireMessage msg; + GimpParam *return_vals; g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (n_return_vals != NULL, NULL); @@ -985,9 +986,9 @@ void gimp_destroy_params (GimpParam *params, gint n_params) { - extern void _gp_params_destroy (GPParam *params, gint n_params); + extern void gp_params_destroy (GPParam *params, gint n_params); - _gp_params_destroy ((GPParam*) params, n_params); + gp_params_destroy ((GPParam *) params, n_params); } /** @@ -1535,7 +1536,7 @@ gimp_write (GIOChannel *channel, bytes = WRITE_BUFFER_SIZE - write_buffer_index; memcpy (&write_buffer[write_buffer_index], buf, bytes); write_buffer_index += bytes; - if (! wire_flush (channel, NULL)) + if (! gimp_wire_flush (channel, NULL)) return FALSE; } else @@ -1605,11 +1606,11 @@ gimp_flush (GIOChannel *channel, static void gimp_loop (void) { - WireMessage msg; + GimpWireMessage msg; while (TRUE) { - if (! wire_read_msg (_readchannel, &msg, NULL)) + if (! gimp_wire_read_msg (_readchannel, &msg, NULL)) { gimp_close (); return; @@ -1618,7 +1619,7 @@ gimp_loop (void) switch (msg.type) { case GP_QUIT: - wire_destroy (&msg); + gimp_wire_destroy (&msg); gimp_close (); return; @@ -1634,7 +1635,7 @@ gimp_loop (void) case GP_PROC_RUN: gimp_proc_run (msg.data); - wire_destroy (&msg); + gimp_wire_destroy (&msg); gimp_close (); return; @@ -1659,7 +1660,7 @@ gimp_loop (void) break; } - wire_destroy (&msg); + gimp_wire_destroy (&msg); } } @@ -1798,7 +1799,7 @@ gimp_proc_run (GPProcRun *proc_run) (* PLUG_IN_INFO.run_proc) (proc_run->name, proc_run->nparams, - (GimpParam*) proc_run->params, + (GimpParam *) proc_run->params, &n_return_vals, &return_vals); @@ -1842,7 +1843,7 @@ gimp_temp_proc_run (GPProcRun *proc_run) } static void -gimp_process_message (WireMessage *msg) +gimp_process_message (GimpWireMessage *msg) { switch (msg->type) { @@ -1881,15 +1882,15 @@ gimp_process_message (WireMessage *msg) static void gimp_single_message (void) { - WireMessage msg; + GimpWireMessage msg; /* Run a temp function */ - if (! wire_read_msg (_readchannel, &msg, NULL)) + if (! gimp_wire_read_msg (_readchannel, &msg, NULL)) gimp_quit (); gimp_process_message (&msg); - wire_destroy (&msg); + gimp_wire_destroy (&msg); } static gboolean diff --git a/libgimp/gimptile.c b/libgimp/gimptile.c index 59892bf4ce..5d1965a66c 100644 --- a/libgimp/gimptile.c +++ b/libgimp/gimptile.c @@ -39,13 +39,13 @@ #define FREE_QUANTUM 0.1 -void gimp_read_expect_msg (WireMessage *msg, - gint type); +void gimp_read_expect_msg (GimpWireMessage *msg, + gint type); -static void gimp_tile_get (GimpTile *tile); -static void gimp_tile_put (GimpTile *tile); -static void gimp_tile_cache_insert (GimpTile *tile); -static void gimp_tile_cache_flush (GimpTile *tile); +static void gimp_tile_get (GimpTile *tile); +static void gimp_tile_put (GimpTile *tile); +static void gimp_tile_cache_insert (GimpTile *tile); +static void gimp_tile_cache_flush (GimpTile *tile); /* private variables */ @@ -182,9 +182,9 @@ gimp_tile_get (GimpTile *tile) { extern GIOChannel *_writechannel; - GPTileReq tile_req; - GPTileData *tile_data; - WireMessage msg; + GPTileReq tile_req; + GPTileData *tile_data; + GimpWireMessage msg; tile_req.drawable_ID = tile->drawable->drawable_id; tile_req.tile_num = tile->tile_num; @@ -221,7 +221,7 @@ gimp_tile_get (GimpTile *tile) if (! gp_tile_ack_write (_writechannel, NULL)) gimp_quit (); - wire_destroy (&msg); + gimp_wire_destroy (&msg); } static void @@ -229,10 +229,10 @@ gimp_tile_put (GimpTile *tile) { extern GIOChannel *_writechannel; - GPTileReq tile_req; - GPTileData tile_data; - GPTileData *tile_info; - WireMessage msg; + GPTileReq tile_req; + GPTileData tile_data; + GPTileData *tile_info; + GimpWireMessage msg; tile_req.drawable_ID = -1; tile_req.tile_num = 0; @@ -264,10 +264,10 @@ gimp_tile_put (GimpTile *tile) if (! gp_tile_data_write (_writechannel, &tile_data, NULL)) gimp_quit (); - wire_destroy (&msg); + gimp_wire_destroy (&msg); gimp_read_expect_msg (&msg, GP_TILE_ACK); - wire_destroy (&msg); + gimp_wire_destroy (&msg); } /* This function is nearly identical to the function 'tile_cache_insert' diff --git a/libgimpbase/gimpbase.def b/libgimpbase/gimpbase.def index 7e3c54a241..5a79ba1c10 100644 --- a/libgimpbase/gimpbase.def +++ b/libgimpbase/gimpbase.def @@ -1,5 +1,4 @@ EXPORTS - _gp_params_destroy gimp_add_mask_type_get_type gimp_any_to_utf8 gimp_base_init @@ -101,10 +100,23 @@ EXPORTS gimp_unit_new gimp_unit_set_deletion_flag gimp_utf8_strtrim + gimp_wire_clear_error + gimp_wire_destroy + gimp_wire_error + gimp_wire_flush + gimp_wire_read + gimp_wire_read_msg + gimp_wire_register + gimp_wire_set_flusher + gimp_wire_set_reader + gimp_wire_set_writer + gimp_wire_write + gimp_wire_write_msg gp_config_write gp_extension_ack_write gp_has_init_write gp_init + gp_params_destroy gp_proc_install_write gp_proc_return_write gp_proc_run_write @@ -115,25 +127,3 @@ EXPORTS gp_tile_ack_write gp_tile_data_write gp_tile_req_write - wire_clear_error - wire_destroy - wire_error - wire_flush - wire_read - wire_read_double - wire_read_int16 - wire_read_int32 - wire_read_int8 - wire_read_msg - wire_read_string - wire_register - wire_set_flusher - wire_set_reader - wire_set_writer - wire_write - wire_write_double - wire_write_int16 - wire_write_int32 - wire_write_int8 - wire_write_msg - wire_write_string diff --git a/libgimpbase/gimpprotocol.c b/libgimpbase/gimpprotocol.c index 88a952c13e..2fcfcf604b 100644 --- a/libgimpbase/gimpprotocol.c +++ b/libgimpbase/gimpprotocol.c @@ -17,6 +17,8 @@ * Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include "gimpbasetypes.h" @@ -26,195 +28,195 @@ #include "gimpwire.h" -static void _gp_quit_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_quit_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_quit_destroy (WireMessage *msg); +static void _gp_quit_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_quit_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_quit_destroy (GimpWireMessage *msg); -static void _gp_config_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_config_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_config_destroy (WireMessage *msg); +static void _gp_config_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_config_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_config_destroy (GimpWireMessage *msg); -static void _gp_tile_req_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_tile_req_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_tile_req_destroy (WireMessage *msg); +static void _gp_tile_req_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_tile_req_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_tile_req_destroy (GimpWireMessage *msg); -static void _gp_tile_ack_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_tile_ack_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_tile_ack_destroy (WireMessage *msg); +static void _gp_tile_ack_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_tile_ack_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_tile_ack_destroy (GimpWireMessage *msg); -static void _gp_tile_data_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_tile_data_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_tile_data_destroy (WireMessage *msg); +static void _gp_tile_data_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_tile_data_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_tile_data_destroy (GimpWireMessage *msg); -static void _gp_proc_run_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_proc_run_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_proc_run_destroy (WireMessage *msg); +static void _gp_proc_run_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_proc_run_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_proc_run_destroy (GimpWireMessage *msg); -static void _gp_proc_return_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_proc_return_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_proc_return_destroy (WireMessage *msg); +static void _gp_proc_return_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_proc_return_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_proc_return_destroy (GimpWireMessage *msg); -static void _gp_temp_proc_run_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_temp_proc_run_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_temp_proc_run_destroy (WireMessage *msg); +static void _gp_temp_proc_run_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_temp_proc_run_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_temp_proc_run_destroy (GimpWireMessage *msg); -static void _gp_temp_proc_return_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_temp_proc_return_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_temp_proc_return_destroy (WireMessage *msg); +static void _gp_temp_proc_return_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_temp_proc_return_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_temp_proc_return_destroy (GimpWireMessage *msg); -static void _gp_proc_install_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_proc_install_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_proc_install_destroy (WireMessage *msg); +static void _gp_proc_install_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_proc_install_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_proc_install_destroy (GimpWireMessage *msg); -static void _gp_proc_uninstall_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_proc_uninstall_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_proc_uninstall_destroy (WireMessage *msg); +static void _gp_proc_uninstall_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_proc_uninstall_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_proc_uninstall_destroy (GimpWireMessage *msg); -static void _gp_extension_ack_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_extension_ack_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_extension_ack_destroy (WireMessage *msg); +static void _gp_extension_ack_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_extension_ack_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_extension_ack_destroy (GimpWireMessage *msg); -static void _gp_params_read (GIOChannel *channel, - GPParam **params, - guint *nparams, - gpointer user_data); -static void _gp_params_write (GIOChannel *channel, - GPParam *params, - gint nparams, - gpointer user_data); +static void _gp_params_read (GIOChannel *channel, + GPParam **params, + guint *nparams, + gpointer user_data); +static void _gp_params_write (GIOChannel *channel, + GPParam *params, + gint nparams, + gpointer user_data); /* used by gimp.c:gimp_destroy_params() */ -void _gp_params_destroy (GPParam *params, - gint nparams); +void gp_params_destroy (GPParam *params, + gint nparams); -static void _gp_has_init_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_has_init_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -static void _gp_has_init_destroy (WireMessage *msg); +static void _gp_has_init_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_has_init_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +static void _gp_has_init_destroy (GimpWireMessage *msg); void gp_init (void) { - wire_register (GP_QUIT, - _gp_quit_read, - _gp_quit_write, - _gp_quit_destroy); - wire_register (GP_CONFIG, - _gp_config_read, - _gp_config_write, - _gp_config_destroy); - wire_register (GP_TILE_REQ, - _gp_tile_req_read, - _gp_tile_req_write, - _gp_tile_req_destroy); - wire_register (GP_TILE_ACK, - _gp_tile_ack_read, - _gp_tile_ack_write, - _gp_tile_ack_destroy); - wire_register (GP_TILE_DATA, - _gp_tile_data_read, - _gp_tile_data_write, - _gp_tile_data_destroy); - wire_register (GP_PROC_RUN, - _gp_proc_run_read, - _gp_proc_run_write, - _gp_proc_run_destroy); - wire_register (GP_PROC_RETURN, - _gp_proc_return_read, - _gp_proc_return_write, - _gp_proc_return_destroy); - wire_register (GP_TEMP_PROC_RUN, - _gp_temp_proc_run_read, - _gp_temp_proc_run_write, - _gp_temp_proc_run_destroy); - wire_register (GP_TEMP_PROC_RETURN, - _gp_temp_proc_return_read, - _gp_temp_proc_return_write, - _gp_temp_proc_return_destroy); - wire_register (GP_PROC_INSTALL, - _gp_proc_install_read, - _gp_proc_install_write, - _gp_proc_install_destroy); - wire_register (GP_PROC_UNINSTALL, - _gp_proc_uninstall_read, - _gp_proc_uninstall_write, - _gp_proc_uninstall_destroy); - wire_register (GP_EXTENSION_ACK, - _gp_extension_ack_read, - _gp_extension_ack_write, - _gp_extension_ack_destroy); - wire_register (GP_HAS_INIT, - _gp_has_init_read, - _gp_has_init_write, - _gp_has_init_destroy); + gimp_wire_register (GP_QUIT, + _gp_quit_read, + _gp_quit_write, + _gp_quit_destroy); + gimp_wire_register (GP_CONFIG, + _gp_config_read, + _gp_config_write, + _gp_config_destroy); + gimp_wire_register (GP_TILE_REQ, + _gp_tile_req_read, + _gp_tile_req_write, + _gp_tile_req_destroy); + gimp_wire_register (GP_TILE_ACK, + _gp_tile_ack_read, + _gp_tile_ack_write, + _gp_tile_ack_destroy); + gimp_wire_register (GP_TILE_DATA, + _gp_tile_data_read, + _gp_tile_data_write, + _gp_tile_data_destroy); + gimp_wire_register (GP_PROC_RUN, + _gp_proc_run_read, + _gp_proc_run_write, + _gp_proc_run_destroy); + gimp_wire_register (GP_PROC_RETURN, + _gp_proc_return_read, + _gp_proc_return_write, + _gp_proc_return_destroy); + gimp_wire_register (GP_TEMP_PROC_RUN, + _gp_temp_proc_run_read, + _gp_temp_proc_run_write, + _gp_temp_proc_run_destroy); + gimp_wire_register (GP_TEMP_PROC_RETURN, + _gp_temp_proc_return_read, + _gp_temp_proc_return_write, + _gp_temp_proc_return_destroy); + gimp_wire_register (GP_PROC_INSTALL, + _gp_proc_install_read, + _gp_proc_install_write, + _gp_proc_install_destroy); + gimp_wire_register (GP_PROC_UNINSTALL, + _gp_proc_uninstall_read, + _gp_proc_uninstall_write, + _gp_proc_uninstall_destroy); + gimp_wire_register (GP_EXTENSION_ACK, + _gp_extension_ack_read, + _gp_extension_ack_write, + _gp_extension_ack_destroy); + gimp_wire_register (GP_HAS_INIT, + _gp_has_init_read, + _gp_has_init_write, + _gp_has_init_destroy); } gboolean gp_quit_write (GIOChannel *channel, gpointer user_data) { - WireMessage msg; + GimpWireMessage msg; msg.type = GP_QUIT; msg.data = NULL; - if (! wire_write_msg (channel, &msg, user_data)) + if (! gimp_wire_write_msg (channel, &msg, user_data)) return FALSE; - if (! wire_flush (channel, user_data)) + if (! gimp_wire_flush (channel, user_data)) return FALSE; return TRUE; @@ -225,15 +227,15 @@ gp_config_write (GIOChannel *channel, GPConfig *config, gpointer user_data) { - WireMessage msg; + GimpWireMessage msg; msg.type = GP_CONFIG; msg.data = config; - if (! wire_write_msg (channel, &msg, user_data)) + if (! gimp_wire_write_msg (channel, &msg, user_data)) return FALSE; - if (! wire_flush (channel, user_data)) + if (! gimp_wire_flush (channel, user_data)) return FALSE; return TRUE; @@ -244,15 +246,15 @@ gp_tile_req_write (GIOChannel *channel, GPTileReq *tile_req, gpointer user_data) { - WireMessage msg; + GimpWireMessage msg; msg.type = GP_TILE_REQ; msg.data = tile_req; - if (! wire_write_msg (channel, &msg, user_data)) + if (! gimp_wire_write_msg (channel, &msg, user_data)) return FALSE; - if (! wire_flush (channel, user_data)) + if (! gimp_wire_flush (channel, user_data)) return FALSE; return TRUE; @@ -262,15 +264,15 @@ gboolean gp_tile_ack_write (GIOChannel *channel, gpointer user_data) { - WireMessage msg; + GimpWireMessage msg; msg.type = GP_TILE_ACK; msg.data = NULL; - if (! wire_write_msg (channel, &msg, user_data)) + if (! gimp_wire_write_msg (channel, &msg, user_data)) return FALSE; - if (! wire_flush (channel, user_data)) + if (! gimp_wire_flush (channel, user_data)) return FALSE; return TRUE; @@ -281,15 +283,15 @@ gp_tile_data_write (GIOChannel *channel, GPTileData *tile_data, gpointer user_data) { - WireMessage msg; + GimpWireMessage msg; msg.type = GP_TILE_DATA; msg.data = tile_data; - if (! wire_write_msg (channel, &msg, user_data)) + if (! gimp_wire_write_msg (channel, &msg, user_data)) return FALSE; - if (! wire_flush (channel, user_data)) + if (! gimp_wire_flush (channel, user_data)) return FALSE; return TRUE; @@ -300,15 +302,15 @@ gp_proc_run_write (GIOChannel *channel, GPProcRun *proc_run, gpointer user_data) { - WireMessage msg; + GimpWireMessage msg; msg.type = GP_PROC_RUN; msg.data = proc_run; - if (! wire_write_msg (channel, &msg, user_data)) + if (! gimp_wire_write_msg (channel, &msg, user_data)) return FALSE; - if (! wire_flush (channel, user_data)) + if (! gimp_wire_flush (channel, user_data)) return FALSE; return TRUE; @@ -319,15 +321,15 @@ gp_proc_return_write (GIOChannel *channel, GPProcReturn *proc_return, gpointer user_data) { - WireMessage msg; + GimpWireMessage msg; msg.type = GP_PROC_RETURN; msg.data = proc_return; - if (! wire_write_msg (channel, &msg, user_data)) + if (! gimp_wire_write_msg (channel, &msg, user_data)) return FALSE; - if (! wire_flush (channel, user_data)) + if (! gimp_wire_flush (channel, user_data)) return FALSE; return TRUE; @@ -338,15 +340,15 @@ gp_temp_proc_run_write (GIOChannel *channel, GPProcRun *proc_run, gpointer user_data) { - WireMessage msg; + GimpWireMessage msg; msg.type = GP_TEMP_PROC_RUN; msg.data = proc_run; - if (! wire_write_msg (channel, &msg, user_data)) + if (! gimp_wire_write_msg (channel, &msg, user_data)) return FALSE; - if (! wire_flush (channel, user_data)) + if (! gimp_wire_flush (channel, user_data)) return FALSE; return TRUE; @@ -357,15 +359,15 @@ gp_temp_proc_return_write (GIOChannel *channel, GPProcReturn *proc_return, gpointer user_data) { - WireMessage msg; + GimpWireMessage msg; msg.type = GP_TEMP_PROC_RETURN; msg.data = proc_return; - if (! wire_write_msg (channel, &msg, user_data)) + if (! gimp_wire_write_msg (channel, &msg, user_data)) return FALSE; - if (! wire_flush (channel, user_data)) + if (! gimp_wire_flush (channel, user_data)) return FALSE; return TRUE; @@ -376,15 +378,15 @@ gp_proc_install_write (GIOChannel *channel, GPProcInstall *proc_install, gpointer user_data) { - WireMessage msg; + GimpWireMessage msg; msg.type = GP_PROC_INSTALL; msg.data = proc_install; - if (! wire_write_msg (channel, &msg, user_data)) + if (! gimp_wire_write_msg (channel, &msg, user_data)) return FALSE; - if (! wire_flush (channel, user_data)) + if (! gimp_wire_flush (channel, user_data)) return FALSE; return TRUE; @@ -395,15 +397,15 @@ gp_proc_uninstall_write (GIOChannel *channel, GPProcUninstall *proc_uninstall, gpointer user_data) { - WireMessage msg; + GimpWireMessage msg; msg.type = GP_PROC_UNINSTALL; msg.data = proc_uninstall; - if (! wire_write_msg (channel, &msg, user_data)) + if (! gimp_wire_write_msg (channel, &msg, user_data)) return FALSE; - if (! wire_flush (channel, user_data)) + if (! gimp_wire_flush (channel, user_data)) return FALSE; return TRUE; @@ -413,15 +415,15 @@ gboolean gp_extension_ack_write (GIOChannel *channel, gpointer user_data) { - WireMessage msg; + GimpWireMessage msg; msg.type = GP_EXTENSION_ACK; msg.data = NULL; - if (! wire_write_msg (channel, &msg, user_data)) + if (! gimp_wire_write_msg (channel, &msg, user_data)) return FALSE; - if (! wire_flush (channel, user_data)) + if (! gimp_wire_flush (channel, user_data)) return FALSE; return TRUE; @@ -431,15 +433,15 @@ gboolean gp_has_init_write (GIOChannel *channel, gpointer user_data) { - WireMessage msg; + GimpWireMessage msg; msg.type = GP_HAS_INIT; msg.data = NULL; - if (! wire_write_msg (channel, &msg, user_data)) + if (! gimp_wire_write_msg (channel, &msg, user_data)) return FALSE; - if (! wire_flush (channel, user_data)) + if (! gimp_wire_flush (channel, user_data)) return FALSE; return TRUE; @@ -448,95 +450,100 @@ gp_has_init_write (GIOChannel *channel, /* quit */ static void -_gp_quit_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_quit_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { } static void -_gp_quit_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_quit_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { } static void -_gp_quit_destroy (WireMessage *msg) +_gp_quit_destroy (GimpWireMessage *msg) { } /* config */ static void -_gp_config_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_config_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { - GPConfig *config; + GPConfig *config = g_new0 (GPConfig, 1); - config = g_new0 (GPConfig, 1); - - if (! wire_read_int32 (channel, - &config->version, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &config->version, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, - &config->tile_width, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &config->tile_width, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, - &config->tile_height, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &config->tile_height, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, - (guint32 *) &config->shm_ID, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &config->shm_ID, 1, user_data)) goto cleanup; - if (! wire_read_int8 (channel, - (guint8 *) &config->check_size, 1, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) &config->check_size, 1, user_data)) goto cleanup; - if (! wire_read_int8 (channel, - (guint8 *) &config->check_type, 1, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) &config->check_type, 1, user_data)) goto cleanup; - if (! wire_read_int8 (channel, - (guint8 *) &config->show_help_button, 1, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) &config->show_help_button, 1, + user_data)) goto cleanup; - if (! wire_read_int8 (channel, - (guint8 *) &config->gimp_reserved_4, 1, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) &config->gimp_reserved_4, 1, + user_data)) goto cleanup; - if (! wire_read_int8 (channel, - (guint8 *) &config->gimp_reserved_5, 1, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) &config->gimp_reserved_5, 1, + user_data)) goto cleanup; - if (! wire_read_int8 (channel, - (guint8 *) &config->gimp_reserved_6, 1, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) &config->gimp_reserved_6, 1, + user_data)) goto cleanup; - if (! wire_read_int8 (channel, - (guint8 *) &config->gimp_reserved_7, 1, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) &config->gimp_reserved_7, 1, + user_data)) goto cleanup; - if (! wire_read_int8 (channel, - (guint8 *) &config->gimp_reserved_8, 1, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) &config->gimp_reserved_8, 1, + user_data)) goto cleanup; - if (! wire_read_int8 (channel, - (guint8 *) &config->install_cmap, 1, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) &config->install_cmap, 1, user_data)) goto cleanup; - if (! wire_read_int8 (channel, - (guint8 *) &config->show_tool_tips, 1, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) &config->show_tool_tips, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, - (guint32 *) &config->min_colors, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &config->min_colors, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, - (guint32 *) &config->gdisp_ID, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &config->gdisp_ID, 1, user_data)) goto cleanup; - if (! wire_read_string (channel, - &config->app_name, 1, user_data)) + if (! _gimp_wire_read_string (channel, + &config->app_name, 1, user_data)) goto cleanup; - if (! wire_read_string (channel, - &config->wm_class, 1, user_data)) + if (! _gimp_wire_read_string (channel, + &config->wm_class, 1, user_data)) goto cleanup; - if (! wire_read_string (channel, - &config->display_name, 1, user_data)) + if (! _gimp_wire_read_string (channel, + &config->display_name, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, - (guint32 *) &config->monitor_number, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &config->monitor_number, 1, + user_data)) goto cleanup; msg->data = config; @@ -550,76 +557,90 @@ _gp_config_read (GIOChannel *channel, } static void -_gp_config_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_config_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { GPConfig *config = msg->data; - if (! wire_write_int32 (channel, - &config->version, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &config->version, 1, user_data)) return; - if (! wire_write_int32 (channel, - &config->tile_width, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &config->tile_width, 1, user_data)) return; - if (! wire_write_int32 (channel, - &config->tile_height, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &config->tile_height, 1, user_data)) return; - if (! wire_write_int32 (channel, - (guint32 *) &config->shm_ID, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) &config->shm_ID, 1, + user_data)) return; - if (! wire_write_int8 (channel, - (guint8 *) &config->check_size, 1, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) &config->check_size, 1, + user_data)) return; - if (! wire_write_int8 (channel, - (guint8 *) &config->check_type, 1, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) &config->check_type, 1, + user_data)) return; - if (! wire_write_int8 (channel, - (guint8 *) &config->show_help_button, 1, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) &config->show_help_button, 1, + user_data)) return; - if (! wire_write_int8 (channel, - (guint8 *) &config->gimp_reserved_4, 1, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) &config->gimp_reserved_4, 1, + user_data)) return; - if (! wire_write_int8 (channel, - (guint8 *) &config->gimp_reserved_5, 1, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) &config->gimp_reserved_5, 1, + user_data)) return; - if (! wire_write_int8 (channel, - (guint8 *) &config->gimp_reserved_6, 1, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) &config->gimp_reserved_6, 1, + user_data)) return; - if (! wire_write_int8 (channel, - (guint8 *) &config->gimp_reserved_7, 1, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) &config->gimp_reserved_7, 1, + user_data)) return; - if (! wire_write_int8 (channel, - (guint8 *) &config->gimp_reserved_8, 1, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) &config->gimp_reserved_8, 1, + user_data)) return; - if (! wire_write_int8 (channel, - (guint8 *) &config->install_cmap, 1, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) &config->install_cmap, 1, + user_data)) return; - if (! wire_write_int8 (channel, - (guint8 *) &config->show_tool_tips, 1, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) &config->show_tool_tips, 1, + user_data)) return; - if (! wire_write_int32 (channel, - (guint32 *) &config->min_colors, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) &config->min_colors, 1, + user_data)) return; - if (! wire_write_int32 (channel, - (guint32 *) &config->gdisp_ID, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) &config->gdisp_ID, 1, + user_data)) return; - if (! wire_write_string (channel, - &config->app_name, 1, user_data)) + if (! _gimp_wire_write_string (channel, + &config->app_name, 1, user_data)) return; - if (! wire_write_string (channel, - &config->wm_class, 1, user_data)) + if (! _gimp_wire_write_string (channel, + &config->wm_class, 1, user_data)) return; - if (! wire_write_string (channel, - &config->display_name, 1, user_data)) + if (! _gimp_wire_write_string (channel, + &config->display_name, 1, user_data)) return; - if (! wire_write_int32 (channel, - (guint32 *) &config->monitor_number, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) &config->monitor_number, 1, + user_data)) return; } static void -_gp_config_destroy (WireMessage *msg) +_gp_config_destroy (GimpWireMessage *msg) { GPConfig *config = msg->data; @@ -632,22 +653,21 @@ _gp_config_destroy (WireMessage *msg) /* tile_req */ static void -_gp_tile_req_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_tile_req_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { - GPTileReq *tile_req; + GPTileReq *tile_req = g_new0 (GPTileReq, 1); - tile_req = g_new0 (GPTileReq, 1); - - if (! wire_read_int32 (channel, - (guint32 *) &tile_req->drawable_ID, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &tile_req->drawable_ID, 1, + user_data)) goto cleanup; - if (! wire_read_int32 (channel, - &tile_req->tile_num, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &tile_req->tile_num, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, - &tile_req->shadow, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &tile_req->shadow, 1, user_data)) goto cleanup; msg->data = tile_req; @@ -658,25 +678,26 @@ _gp_tile_req_read (GIOChannel *channel, } static void -_gp_tile_req_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_tile_req_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { GPTileReq *tile_req = msg->data; - if (! wire_write_int32 (channel, - (guint32 *) &tile_req->drawable_ID, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) &tile_req->drawable_ID, 1, + user_data)) return; - if (! wire_write_int32 (channel, - &tile_req->tile_num, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &tile_req->tile_num, 1, user_data)) return; - if (! wire_write_int32 (channel, - &tile_req->shadow, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &tile_req->shadow, 1, user_data)) return; } static void -_gp_tile_req_destroy (WireMessage *msg) +_gp_tile_req_destroy (GimpWireMessage *msg) { g_free (msg->data); } @@ -684,49 +705,54 @@ _gp_tile_req_destroy (WireMessage *msg) /* tile_ack */ static void -_gp_tile_ack_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_tile_ack_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { } static void -_gp_tile_ack_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_tile_ack_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { } static void -_gp_tile_ack_destroy (WireMessage *msg) +_gp_tile_ack_destroy (GimpWireMessage *msg) { } /* tile_data */ static void -_gp_tile_data_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_tile_data_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { - GPTileData *tile_data; + GPTileData *tile_data = g_new0 (GPTileData, 1); - tile_data = g_new0 (GPTileData, 1); - - if (! wire_read_int32 (channel, - (guint32 *) &tile_data->drawable_ID, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &tile_data->drawable_ID, 1, + user_data)) goto cleanup; - if (! wire_read_int32 (channel, &tile_data->tile_num, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &tile_data->tile_num, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, &tile_data->shadow, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &tile_data->shadow, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, &tile_data->bpp, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &tile_data->bpp, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, &tile_data->width, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &tile_data->width, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, &tile_data->height, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &tile_data->height, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, &tile_data->use_shm, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &tile_data->use_shm, 1, user_data)) goto cleanup; if (!tile_data->use_shm) @@ -735,8 +761,9 @@ _gp_tile_data_read (GIOChannel *channel, tile_data->data = g_new (guchar, length); - if (! wire_read_int8 (channel, - (guint8 *) tile_data->data, length, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) tile_data->data, length, + user_data)) goto cleanup; } @@ -749,40 +776,48 @@ _gp_tile_data_read (GIOChannel *channel, } static void -_gp_tile_data_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_tile_data_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { GPTileData *tile_data = msg->data; - if (! wire_write_int32 (channel, - (guint32 *) &tile_data->drawable_ID, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) &tile_data->drawable_ID, 1, + user_data)) return; - if (! wire_write_int32 (channel, &tile_data->tile_num, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &tile_data->tile_num, 1, user_data)) return; - if (! wire_write_int32 (channel, &tile_data->shadow, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &tile_data->shadow, 1, user_data)) return; - if (! wire_write_int32 (channel, &tile_data->bpp, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &tile_data->bpp, 1, user_data)) return; - if (! wire_write_int32 (channel, &tile_data->width, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &tile_data->width, 1, user_data)) return; - if (! wire_write_int32 (channel, &tile_data->height, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &tile_data->height, 1, user_data)) return; - if (! wire_write_int32 (channel, &tile_data->use_shm, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &tile_data->use_shm, 1, user_data)) return; if (!tile_data->use_shm) { guint length = tile_data->width * tile_data->height * tile_data->bpp; - if (! wire_write_int8 (channel, - (guint8 *) tile_data->data, length, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) tile_data->data, length, + user_data)) return; } } static void -_gp_tile_data_destroy (WireMessage *msg) +_gp_tile_data_destroy (GimpWireMessage *msg) { GPTileData *tile_data = msg->data; @@ -793,19 +828,17 @@ _gp_tile_data_destroy (WireMessage *msg) /* proc_run */ static void -_gp_proc_run_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_proc_run_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { - GPProcRun *proc_run; + GPProcRun *proc_run = g_new0 (GPProcRun, 1); - proc_run = g_new0 (GPProcRun, 1); - - if (! wire_read_string (channel, &proc_run->name, 1, user_data)) + if (! _gimp_wire_read_string (channel, &proc_run->name, 1, user_data)) goto cleanup; _gp_params_read (channel, - &proc_run->params, (guint*) &proc_run->nparams, + &proc_run->params, (guint *) &proc_run->nparams, user_data); msg->data = proc_run; @@ -816,24 +849,24 @@ _gp_proc_run_read (GIOChannel *channel, } static void -_gp_proc_run_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_proc_run_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { GPProcRun *proc_run = msg->data; - if (! wire_write_string (channel, &proc_run->name, 1, user_data)) + 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); } static void -_gp_proc_run_destroy (WireMessage *msg) +_gp_proc_run_destroy (GimpWireMessage *msg) { GPProcRun *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); @@ -842,15 +875,13 @@ _gp_proc_run_destroy (WireMessage *msg) /* proc_return */ static void -_gp_proc_return_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_proc_return_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { - GPProcReturn *proc_return; + GPProcReturn *proc_return = g_new0 (GPProcReturn, 1); - proc_return = g_new0 (GPProcReturn, 1); - - if (! wire_read_string (channel, &proc_return->name, 1, user_data)) + if (! _gimp_wire_read_string (channel, &proc_return->name, 1, user_data)) goto cleanup; _gp_params_read (channel, @@ -865,13 +896,13 @@ _gp_proc_return_read (GIOChannel *channel, } static void -_gp_proc_return_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_proc_return_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { GPProcReturn *proc_return = msg->data; - if (! wire_write_string (channel, &proc_return->name, 1, user_data)) + if (! _gimp_wire_write_string (channel, &proc_return->name, 1, user_data)) return; _gp_params_write (channel, @@ -879,11 +910,11 @@ _gp_proc_return_write (GIOChannel *channel, } static void -_gp_proc_return_destroy (WireMessage *msg) +_gp_proc_return_destroy (GimpWireMessage *msg) { GPProcReturn *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); @@ -892,23 +923,23 @@ _gp_proc_return_destroy (WireMessage *msg) /* temp_proc_run */ static void -_gp_temp_proc_run_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_temp_proc_run_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { _gp_proc_run_read (channel, msg, user_data); } static void -_gp_temp_proc_run_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_temp_proc_run_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { _gp_proc_run_write (channel, msg, user_data); } static void -_gp_temp_proc_run_destroy (WireMessage *msg) +_gp_temp_proc_run_destroy (GimpWireMessage *msg) { _gp_proc_run_destroy (msg); } @@ -916,23 +947,23 @@ _gp_temp_proc_run_destroy (WireMessage *msg) /* temp_proc_return */ static void -_gp_temp_proc_return_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_temp_proc_return_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { _gp_proc_return_read (channel, msg, user_data); } static void -_gp_temp_proc_return_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_temp_proc_return_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { _gp_proc_return_write (channel, msg, user_data); } static void -_gp_temp_proc_return_destroy (WireMessage *msg) +_gp_temp_proc_return_destroy (GimpWireMessage *msg) { _gp_proc_return_destroy (msg); } @@ -940,54 +971,63 @@ _gp_temp_proc_return_destroy (WireMessage *msg) /* proc_install */ static void -_gp_proc_install_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_proc_install_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { - GPProcInstall *proc_install; + GPProcInstall *proc_install = g_new0 (GPProcInstall, 1); gint i; - proc_install = g_new0 (GPProcInstall, 1); - - if (! wire_read_string (channel, &proc_install->name, 1, user_data)) + if (! _gimp_wire_read_string (channel, + &proc_install->name, 1, user_data)) goto cleanup; - if (! wire_read_string (channel, &proc_install->blurb, 1, user_data)) + if (! _gimp_wire_read_string (channel, + &proc_install->blurb, 1, user_data)) goto cleanup; - if (! wire_read_string (channel, &proc_install->help, 1, user_data)) + if (! _gimp_wire_read_string (channel, + &proc_install->help, 1, user_data)) goto cleanup; - if (! wire_read_string (channel, &proc_install->author, 1, user_data)) + if (! _gimp_wire_read_string (channel, + &proc_install->author, 1, user_data)) goto cleanup; - if (! wire_read_string (channel, &proc_install->copyright, 1, user_data)) + if (! _gimp_wire_read_string (channel, + &proc_install->copyright, 1, user_data)) goto cleanup; - if (! wire_read_string (channel, &proc_install->date, 1, user_data)) + if (! _gimp_wire_read_string (channel, + &proc_install->date, 1, user_data)) goto cleanup; - if (! wire_read_string (channel, &proc_install->menu_path, 1, user_data)) + if (! _gimp_wire_read_string (channel, + &proc_install->menu_path, 1, user_data)) goto cleanup; - if (! wire_read_string (channel, &proc_install->image_types, 1, user_data)) + if (! _gimp_wire_read_string (channel, + &proc_install->image_types, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, &proc_install->type, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &proc_install->type, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, &proc_install->nparams, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &proc_install->nparams, 1, user_data)) goto cleanup; - if (! wire_read_int32 (channel, &proc_install->nreturn_vals, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + &proc_install->nreturn_vals, 1, user_data)) goto cleanup; proc_install->params = g_new0 (GPParamDef, proc_install->nparams); for (i = 0; i < proc_install->nparams; i++) { - if (! wire_read_int32 (channel, - (guint32 *) &proc_install->params[i].type, 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &proc_install->params[i].type, 1, + user_data)) goto cleanup; - if (! wire_read_string (channel, - &proc_install->params[i].name, 1, - user_data)) + if (! _gimp_wire_read_string (channel, + &proc_install->params[i].name, 1, + user_data)) goto cleanup; - if (! wire_read_string (channel, - &proc_install->params[i].description, 1, - user_data)) + if (! _gimp_wire_read_string (channel, + &proc_install->params[i].description, 1, + user_data)) goto cleanup; } @@ -995,17 +1035,17 @@ _gp_proc_install_read (GIOChannel *channel, for (i = 0; i < proc_install->nreturn_vals; i++) { - if (! wire_read_int32 (channel, - (guint32 *) &proc_install->return_vals[i].type, 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &proc_install->return_vals[i].type, 1, + user_data)) goto cleanup; - if (! wire_read_string (channel, - &proc_install->return_vals[i].name, 1, - user_data)) + if (! _gimp_wire_read_string (channel, + &proc_install->return_vals[i].name, 1, + user_data)) goto cleanup; - if (! wire_read_string (channel, - &proc_install->return_vals[i].description, 1, - user_data)) + if (! _gimp_wire_read_string (channel, + &proc_install->return_vals[i].description, 1, + user_data)) goto cleanup; } @@ -1054,72 +1094,83 @@ _gp_proc_install_read (GIOChannel *channel, } static void -_gp_proc_install_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_proc_install_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { GPProcInstall *proc_install = msg->data; gint i; - if (! wire_write_string (channel, &proc_install->name, 1, user_data)) + if (! _gimp_wire_write_string (channel, + &proc_install->name, 1, user_data)) return; - if (! wire_write_string (channel, &proc_install->blurb, 1, user_data)) + if (! _gimp_wire_write_string (channel, + &proc_install->blurb, 1, user_data)) return; - if (! wire_write_string (channel, &proc_install->help, 1, user_data)) + if (! _gimp_wire_write_string (channel, + &proc_install->help, 1, user_data)) return; - if (! wire_write_string (channel, &proc_install->author, 1, user_data)) + if (! _gimp_wire_write_string (channel, + &proc_install->author, 1, user_data)) return; - if (! wire_write_string (channel, &proc_install->copyright, 1, user_data)) + if (! _gimp_wire_write_string (channel, + &proc_install->copyright, 1, user_data)) return; - if (! wire_write_string (channel, &proc_install->date, 1, user_data)) + if (! _gimp_wire_write_string (channel, + &proc_install->date, 1, user_data)) return; - if (! wire_write_string (channel, &proc_install->menu_path, 1, user_data)) + if (! _gimp_wire_write_string (channel, + &proc_install->menu_path, 1, user_data)) return; - if (! wire_write_string (channel, &proc_install->image_types, 1, user_data)) + if (! _gimp_wire_write_string (channel, + &proc_install->image_types, 1, user_data)) return; - if (! wire_write_int32 (channel, &proc_install->type, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &proc_install->type, 1, user_data)) return; - if (! wire_write_int32 (channel, &proc_install->nparams, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &proc_install->nparams, 1, user_data)) return; - if (! wire_write_int32 (channel, &proc_install->nreturn_vals, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + &proc_install->nreturn_vals, 1, user_data)) return; for (i = 0; i < proc_install->nparams; i++) { - if (! wire_write_int32 (channel, - (guint32 *) &proc_install->params[i].type, 1, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (guint32 *) &proc_install->params[i].type, 1, + user_data)) return; - if (! wire_write_string (channel, - &proc_install->params[i].name, 1, - user_data)) + if (! _gimp_wire_write_string (channel, + &proc_install->params[i].name, 1, + user_data)) return; - if (! wire_write_string (channel, - &proc_install->params[i].description, 1, - user_data)) + if (! _gimp_wire_write_string (channel, + &proc_install->params[i].description, 1, + user_data)) return; } for (i = 0; i < proc_install->nreturn_vals; i++) { - if (! wire_write_int32 (channel, - (guint32 *) &proc_install->return_vals[i].type, 1, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (guint32 *) &proc_install->return_vals[i].type, 1, + user_data)) return; - if (! wire_write_string (channel, - &proc_install->return_vals[i].name, 1, - user_data)) + if (! _gimp_wire_write_string (channel, + &proc_install->return_vals[i].name, 1, + user_data)) return; - if (! wire_write_string (channel, - &proc_install->return_vals[i].description, 1, - user_data)) + if (! _gimp_wire_write_string (channel, + &proc_install->return_vals[i].description, 1, + user_data)) return; } } static void -_gp_proc_install_destroy (WireMessage *msg) +_gp_proc_install_destroy (GimpWireMessage *msg) { GPProcInstall *proc_install = msg->data; gint i; @@ -1153,15 +1204,13 @@ _gp_proc_install_destroy (WireMessage *msg) /* proc_uninstall */ static void -_gp_proc_uninstall_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_proc_uninstall_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { - GPProcUninstall *proc_uninstall; + GPProcUninstall *proc_uninstall = g_new0 (GPProcUninstall, 1); - proc_uninstall = g_new0 (GPProcUninstall, 1); - - if (! wire_read_string (channel, &proc_uninstall->name, 1, user_data)) + if (! _gimp_wire_read_string (channel, &proc_uninstall->name, 1, user_data)) goto cleanup; msg->data = proc_uninstall; @@ -1172,18 +1221,18 @@ _gp_proc_uninstall_read (GIOChannel *channel, } static void -_gp_proc_uninstall_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_proc_uninstall_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { GPProcUninstall *proc_uninstall = msg->data; - if (! wire_write_string (channel, &proc_uninstall->name, 1, user_data)) + if (! _gimp_wire_write_string (channel, &proc_uninstall->name, 1, user_data)) return; } static void -_gp_proc_uninstall_destroy (WireMessage *msg) +_gp_proc_uninstall_destroy (GimpWireMessage *msg) { GPProcUninstall *proc_uninstall = msg->data; @@ -1194,21 +1243,21 @@ _gp_proc_uninstall_destroy (WireMessage *msg) /* extension_ack */ static void -_gp_extension_ack_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_extension_ack_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { } static void -_gp_extension_ack_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_extension_ack_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { } static void -_gp_extension_ack_destroy (WireMessage *msg) +_gp_extension_ack_destroy (GimpWireMessage *msg) { } @@ -1222,7 +1271,7 @@ _gp_params_read (GIOChannel *channel, { gint i, j; - if (! wire_read_int32 (channel, (guint32 *) nparams, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, (guint32 *) nparams, 1, user_data)) return; if (*nparams == 0) @@ -1235,44 +1284,45 @@ _gp_params_read (GIOChannel *channel, for (i = 0; i < *nparams; i++) { - if (! wire_read_int32 (channel, - (guint32 *) &(*params)[i].type, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &(*params)[i].type, 1, + user_data)) goto cleanup; switch ((*params)[i].type) { case GIMP_PDB_INT32: - if (! wire_read_int32 (channel, - (guint32 *) &(*params)[i].data.d_int32, 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &(*params)[i].data.d_int32, 1, + user_data)) goto cleanup; break; case GIMP_PDB_INT16: - if (! wire_read_int16 (channel, - (guint16 *) &(*params)[i].data.d_int16, 1, - user_data)) + if (! _gimp_wire_read_int16 (channel, + (guint16 *) &(*params)[i].data.d_int16, 1, + user_data)) goto cleanup; break; case GIMP_PDB_INT8: - if (! wire_read_int8 (channel, - (guint8 *) &(*params)[i].data.d_int8, 1, - user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) &(*params)[i].data.d_int8, 1, + user_data)) goto cleanup; break; case GIMP_PDB_FLOAT: - if (! wire_read_double (channel, - &(*params)[i].data.d_float, 1, - user_data)) + if (! _gimp_wire_read_double (channel, + &(*params)[i].data.d_float, 1, + user_data)) goto cleanup; break; case GIMP_PDB_STRING: - if (! wire_read_string (channel, - &(*params)[i].data.d_string, 1, - user_data)) + if (! _gimp_wire_read_string (channel, + &(*params)[i].data.d_string, 1, + user_data)) goto cleanup; break; @@ -1281,10 +1331,10 @@ _gp_params_read (GIOChannel *channel, (*params)[i].data.d_int32array = g_new (gint32, (*params)[i-1].data.d_int32); - if (! wire_read_int32 (channel, - (guint32 *) (*params)[i].data.d_int32array, - (*params)[i-1].data.d_int32, - user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) (*params)[i].data.d_int32array, + (*params)[i-1].data.d_int32, + user_data)) { g_free ((*params)[i].data.d_int32array); goto cleanup; @@ -1295,10 +1345,10 @@ _gp_params_read (GIOChannel *channel, (*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32); (*params)[i].data.d_int16array = g_new (gint16, (*params)[i-1].data.d_int32); - if (! wire_read_int16 (channel, - (guint16 *) (*params)[i].data.d_int16array, - (*params)[i-1].data.d_int32, - user_data)) + if (! _gimp_wire_read_int16 (channel, + (guint16 *) (*params)[i].data.d_int16array, + (*params)[i-1].data.d_int32, + user_data)) { g_free ((*params)[i].data.d_int16array); goto cleanup; @@ -1309,10 +1359,10 @@ _gp_params_read (GIOChannel *channel, (*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32); (*params)[i].data.d_int8array = g_new (gint8, (*params)[i-1].data.d_int32); - if (! wire_read_int8 (channel, - (guint8 *) (*params)[i].data.d_int8array, - (*params)[i-1].data.d_int32, - user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) (*params)[i].data.d_int8array, + (*params)[i-1].data.d_int32, + user_data)) { g_free ((*params)[i].data.d_int8array); goto cleanup; @@ -1323,10 +1373,10 @@ _gp_params_read (GIOChannel *channel, (*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32); (*params)[i].data.d_floatarray = g_new (gdouble, (*params)[i-1].data.d_int32); - if (! wire_read_double (channel, - (*params)[i].data.d_floatarray, - (*params)[i-1].data.d_int32, - user_data)) + if (! _gimp_wire_read_double (channel, + (*params)[i].data.d_floatarray, + (*params)[i-1].data.d_int32, + user_data)) { g_free ((*params)[i].data.d_floatarray); goto cleanup; @@ -1337,10 +1387,10 @@ _gp_params_read (GIOChannel *channel, (*params)[i-1].data.d_int32 = MAX (0, (*params)[i-1].data.d_int32); (*params)[i].data.d_stringarray = g_new0 (gchar *, (*params)[i-1].data.d_int32); - if (! wire_read_string (channel, - (*params)[i].data.d_stringarray, - (*params)[i-1].data.d_int32, - user_data)) + if (! _gimp_wire_read_string (channel, + (*params)[i].data.d_stringarray, + (*params)[i-1].data.d_int32, + user_data)) { for (j = 0; j < (*params)[i-1].data.d_int32; j++) g_free (((*params)[i].data.d_stringarray)[j]); @@ -1350,21 +1400,21 @@ _gp_params_read (GIOChannel *channel, break; case GIMP_PDB_COLOR: - if (! wire_read_double (channel, - &(*params)[i].data.d_color.r, 1, - user_data)) + if (! _gimp_wire_read_double (channel, + &(*params)[i].data.d_color.r, 1, + user_data)) goto cleanup; - if (! wire_read_double (channel, - &(*params)[i].data.d_color.g, 1, - user_data)) + if (! _gimp_wire_read_double (channel, + &(*params)[i].data.d_color.g, 1, + user_data)) goto cleanup; - if (! wire_read_double (channel, - &(*params)[i].data.d_color.b, 1, - user_data)) + if (! _gimp_wire_read_double (channel, + &(*params)[i].data.d_color.b, 1, + user_data)) goto cleanup; - if (! wire_read_double (channel, - &(*params)[i].data.d_color.a, 1, - user_data)) + if (! _gimp_wire_read_double (channel, + &(*params)[i].data.d_color.a, 1, + user_data)) goto cleanup; break; @@ -1372,65 +1422,65 @@ _gp_params_read (GIOChannel *channel, break; case GIMP_PDB_DISPLAY: - if (! wire_read_int32 (channel, - (guint32 *) &(*params)[i].data.d_display, 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &(*params)[i].data.d_display, 1, + user_data)) goto cleanup; break; case GIMP_PDB_IMAGE: - if (! wire_read_int32 (channel, - (guint32 *) &(*params)[i].data.d_image, 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &(*params)[i].data.d_image, 1, + user_data)) goto cleanup; break; case GIMP_PDB_LAYER: - if (! wire_read_int32 (channel, - (guint32 *) &(*params)[i].data.d_layer, 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &(*params)[i].data.d_layer, 1, + user_data)) goto cleanup; break; case GIMP_PDB_CHANNEL: - if (! wire_read_int32 (channel, - (guint32 *) &(*params)[i].data.d_channel, 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &(*params)[i].data.d_channel, 1, + user_data)) goto cleanup; break; case GIMP_PDB_DRAWABLE: - if (! wire_read_int32 (channel, - (guint32 *) &(*params)[i].data.d_drawable, 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &(*params)[i].data.d_drawable, 1, + user_data)) goto cleanup; break; case GIMP_PDB_SELECTION: - if (! wire_read_int32 (channel, - (guint32 *) &(*params)[i].data.d_selection, 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &(*params)[i].data.d_selection, 1, + user_data)) goto cleanup; break; case GIMP_PDB_BOUNDARY: - if (! wire_read_int32 (channel, - (guint32 *) &(*params)[i].data.d_boundary, 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &(*params)[i].data.d_boundary, 1, + user_data)) goto cleanup; break; case GIMP_PDB_PATH: - if (! wire_read_int32 (channel, - (guint32 *) &(*params)[i].data.d_path, 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &(*params)[i].data.d_path, 1, + user_data)) goto cleanup; break; case GIMP_PDB_PARASITE: - if (! wire_read_string (channel, - &(*params)[i].data.d_parasite.name, 1, - user_data)) + if (! _gimp_wire_read_string (channel, + &(*params)[i].data.d_parasite.name, 1, + user_data)) goto cleanup; if ((*params)[i].data.d_parasite.name == NULL) { @@ -1438,22 +1488,22 @@ _gp_params_read (GIOChannel *channel, (*params)[i].data.d_parasite.data = NULL; break; } - if (! wire_read_int32 (channel, - &((*params)[i].data.d_parasite.flags), 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + &((*params)[i].data.d_parasite.flags), 1, + user_data)) goto cleanup; - if (! wire_read_int32 (channel, - &((*params)[i].data.d_parasite.size), 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + &((*params)[i].data.d_parasite.size), 1, + user_data)) goto cleanup; if ((*params)[i].data.d_parasite.size > 0) { (*params)[i].data.d_parasite.data = g_malloc ((*params)[i].data.d_parasite.size); - if (! wire_read_int8 (channel, - (*params)[i].data.d_parasite.data, - (*params)[i].data.d_parasite.size, - user_data)) + if (! _gimp_wire_read_int8 (channel, + (*params)[i].data.d_parasite.data, + (*params)[i].data.d_parasite.size, + user_data)) { g_free ((*params)[i].data.d_parasite.data); goto cleanup; @@ -1464,9 +1514,9 @@ _gp_params_read (GIOChannel *channel, break; case GIMP_PDB_STATUS: - if (! wire_read_int32 (channel, - (guint32 *) &(*params)[i].data.d_status, 1, - user_data)) + if (! _gimp_wire_read_int32 (channel, + (guint32 *) &(*params)[i].data.d_status, 1, + user_data)) goto cleanup; break; @@ -1491,103 +1541,105 @@ _gp_params_write (GIOChannel *channel, { gint i; - if (! wire_write_int32 (channel, (guint32 *) &nparams, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) &nparams, 1, user_data)) return; for (i = 0; i < nparams; i++) { - if (! wire_write_int32 (channel, - (guint32 *) ¶ms[i].type, 1, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) ¶ms[i].type, 1, + user_data)) return; switch (params[i].type) { case GIMP_PDB_INT32: - if (! wire_write_int32 (channel, - (guint32 *) ¶ms[i].data.d_int32, 1, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) ¶ms[i].data.d_int32, 1, + user_data)) return; break; case GIMP_PDB_INT16: - if (! wire_write_int16 (channel, - (guint16 *) ¶ms[i].data.d_int16, 1, - user_data)) + if (! _gimp_wire_write_int16 (channel, + (const guint16 *) ¶ms[i].data.d_int16, 1, + user_data)) return; break; case GIMP_PDB_INT8: - if (! wire_write_int8 (channel, - (guint8 *) ¶ms[i].data.d_int8, 1, - user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) ¶ms[i].data.d_int8, 1, + user_data)) return; break; case GIMP_PDB_FLOAT: - if (! wire_write_double (channel, - ¶ms[i].data.d_float, 1, - user_data)) + if (! _gimp_wire_write_double (channel, + ¶ms[i].data.d_float, 1, + user_data)) return; break; case GIMP_PDB_STRING: - if (! wire_write_string (channel, - ¶ms[i].data.d_string, 1, - user_data)) + if (! _gimp_wire_write_string (channel, + ¶ms[i].data.d_string, 1, + user_data)) return; break; case GIMP_PDB_INT32ARRAY: - if (! wire_write_int32 (channel, - (guint32 *) params[i].data.d_int32array, - params[i-1].data.d_int32, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) params[i].data.d_int32array, + params[i-1].data.d_int32, + user_data)) return; break; case GIMP_PDB_INT16ARRAY: - if (! wire_write_int16 (channel, - (guint16 *) params[i].data.d_int16array, - params[i-1].data.d_int32, - user_data)) + if (! _gimp_wire_write_int16 (channel, + (const guint16 *) params[i].data.d_int16array, + params[i-1].data.d_int32, + user_data)) return; break; case GIMP_PDB_INT8ARRAY: - if (! wire_write_int8 (channel, - (guint8 *) params[i].data.d_int8array, - params[i-1].data.d_int32, - user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) params[i].data.d_int8array, + params[i-1].data.d_int32, + user_data)) return; break; case GIMP_PDB_FLOATARRAY: - if (! wire_write_double (channel, - params[i].data.d_floatarray, - params[i-1].data.d_int32, - user_data)) + if (! _gimp_wire_write_double (channel, + params[i].data.d_floatarray, + params[i-1].data.d_int32, + user_data)) return; break; case GIMP_PDB_STRINGARRAY: - if (! wire_write_string (channel, - params[i].data.d_stringarray, - params[i-1].data.d_int32, - user_data)) + if (! _gimp_wire_write_string (channel, + params[i].data.d_stringarray, + params[i-1].data.d_int32, + user_data)) return; break; case GIMP_PDB_COLOR: { GimpRGB *color = (GimpRGB *) ¶ms[i].data.d_color; - if (! wire_write_double (channel, &color->r, 1, user_data)) + + if (! _gimp_wire_write_double (channel, &color->r, 1, user_data)) return; - if (! wire_write_double (channel, &color->g, 1, user_data)) + if (! _gimp_wire_write_double (channel, &color->g, 1, user_data)) return; - if (! wire_write_double (channel, &color->b, 1, user_data)) + if (! _gimp_wire_write_double (channel, &color->b, 1, user_data)) return; - if (! wire_write_double (channel, &color->a, 1, user_data)) + if (! _gimp_wire_write_double (channel, &color->a, 1, user_data)) return; } break; @@ -1596,88 +1648,91 @@ _gp_params_write (GIOChannel *channel, break; case GIMP_PDB_DISPLAY: - if (! wire_write_int32 (channel, - (guint32 *) ¶ms[i].data.d_display, 1, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) ¶ms[i].data.d_display, 1, + user_data)) return; break; case GIMP_PDB_IMAGE: - if (! wire_write_int32 (channel, - (guint32 *) ¶ms[i].data.d_image, 1, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) ¶ms[i].data.d_image, 1, + user_data)) return; break; case GIMP_PDB_LAYER: - if (! wire_write_int32 (channel, - (guint32 *) ¶ms[i].data.d_layer, 1, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) ¶ms[i].data.d_layer, 1, + user_data)) return; break; case GIMP_PDB_CHANNEL: - if (! wire_write_int32 (channel, - (guint32 *) ¶ms[i].data.d_channel, 1, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) ¶ms[i].data.d_channel, 1, + user_data)) return; break; case GIMP_PDB_DRAWABLE: - if (! wire_write_int32 (channel, - (guint32 *) ¶ms[i].data.d_drawable, 1, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) ¶ms[i].data.d_drawable, 1, + user_data)) return; break; case GIMP_PDB_SELECTION: - if (! wire_write_int32 (channel, - (guint32 *) ¶ms[i].data.d_selection, 1, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) ¶ms[i].data.d_selection, 1, + user_data)) return; break; case GIMP_PDB_BOUNDARY: - if (! wire_write_int32 (channel, - (guint32 *) ¶ms[i].data.d_boundary, 1, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) ¶ms[i].data.d_boundary, 1, + user_data)) return; break; case GIMP_PDB_PATH: - if (! wire_write_int32 (channel, - (guint32 *) ¶ms[i].data.d_path, 1, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) ¶ms[i].data.d_path, 1, + user_data)) return; break; case GIMP_PDB_PARASITE: { GimpParasite *p = (GimpParasite *) ¶ms[i].data.d_parasite; + if (p->name == NULL) { - /* write a null string to signifly a null parasite */ - wire_write_string (channel, &p->name, 1, user_data); + /* write a null string to signal a null parasite */ + _gimp_wire_write_string (channel, &p->name, 1, user_data); break; } - if (! wire_write_string (channel, &p->name, 1, user_data)) + + if (! _gimp_wire_write_string (channel, &p->name, 1, user_data)) return; - if (! wire_write_int32 (channel, &p->flags, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, &p->flags, 1, user_data)) return; - if (! wire_write_int32 (channel, &p->size, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, &p->size, 1, user_data)) return; if (p->size > 0) { - if (! wire_write_int8 (channel, p->data, p->size, user_data)) + if (! _gimp_wire_write_int8 (channel, + p->data, p->size, user_data)) return; } } break; case GIMP_PDB_STATUS: - if (! wire_write_int32 (channel, - (guint32 *) ¶ms[i].data.d_status, 1, - user_data)) + if (! _gimp_wire_write_int32 (channel, + (const guint32 *) ¶ms[i].data.d_status, 1, + user_data)) return; break; @@ -1688,8 +1743,8 @@ _gp_params_write (GIOChannel *channel, } void -_gp_params_destroy (GPParam *params, - gint nparams) +gp_params_destroy (GPParam *params, + gint nparams) { gint count; gint i, j; @@ -1763,20 +1818,20 @@ _gp_params_destroy (GPParam *params, /* has_init */ static void -_gp_has_init_read (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_has_init_read (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { } static void -_gp_has_init_write (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +_gp_has_init_write (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { } static void -_gp_has_init_destroy (WireMessage *msg) +_gp_has_init_destroy (GimpWireMessage *msg) { } diff --git a/libgimpbase/gimpwire.c b/libgimpbase/gimpwire.c index 1b729a0361..6d27628d09 100644 --- a/libgimpbase/gimpwire.c +++ b/libgimpbase/gimpwire.c @@ -19,66 +19,49 @@ #include "config.h" -#include -#include -#include #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif -#include -#ifdef HAVE_UNISTD_H -#include -#endif #include -#ifdef G_OS_WIN32 -#include -#include -#endif - #include "gimpwire.h" -typedef struct _WireHandler WireHandler; +typedef struct _GimpWireHandler GimpWireHandler; -struct _WireHandler +struct _GimpWireHandler { - guint32 type; - WireReadFunc read_func; - WireWriteFunc write_func; - WireDestroyFunc destroy_func; + guint32 type; + GimpWireReadFunc read_func; + GimpWireWriteFunc write_func; + GimpWireDestroyFunc destroy_func; }; -static void wire_init (void); -static guint wire_hash (guint32 *key); -static gboolean wire_compare (guint32 *a, - guint32 *b); +static GHashTable *wire_ht = NULL; +static GimpWireIOFunc wire_read_func = NULL; +static GimpWireIOFunc wire_write_func = NULL; +static GimpWireFlushFunc wire_flush_func = NULL; +static gboolean wire_error_val = FALSE; -static GHashTable *wire_ht = NULL; -static WireIOFunc wire_read_func = NULL; -static WireIOFunc wire_write_func = NULL; -static WireFlushFunc wire_flush_func = NULL; -static gboolean wire_error_val = FALSE; +static void gimp_wire_init (void); void -wire_register (guint32 type, - WireReadFunc read_func, - WireWriteFunc write_func, - WireDestroyFunc destroy_func) +gimp_wire_register (guint32 type, + GimpWireReadFunc read_func, + GimpWireWriteFunc write_func, + GimpWireDestroyFunc destroy_func) { - WireHandler *handler; + GimpWireHandler *handler; if (! wire_ht) - wire_init (); + gimp_wire_init (); handler = g_hash_table_lookup (wire_ht, &type); + if (! handler) - handler = g_new0 (WireHandler, 1); + handler = g_new0 (GimpWireHandler, 1); handler->type = type; handler->read_func = read_func; @@ -89,28 +72,28 @@ wire_register (guint32 type, } void -wire_set_reader (WireIOFunc read_func) +gimp_wire_set_reader (GimpWireIOFunc read_func) { wire_read_func = read_func; } void -wire_set_writer (WireIOFunc write_func) +gimp_wire_set_writer (GimpWireIOFunc write_func) { wire_write_func = write_func; } void -wire_set_flusher (WireFlushFunc flush_func) +gimp_wire_set_flusher (GimpWireFlushFunc flush_func) { wire_flush_func = flush_func; } gboolean -wire_read (GIOChannel *channel, - guint8 *buf, - gsize count, - gpointer user_data) +gimp_wire_read (GIOChannel *channel, + guint8 *buf, + gsize count, + gpointer user_data) { g_return_val_if_fail (count >= 0, FALSE); @@ -175,16 +158,16 @@ wire_read (GIOChannel *channel, } gboolean -wire_write (GIOChannel *channel, - guint8 *buf, - gsize count, - gpointer user_data) +gimp_wire_write (GIOChannel *channel, + const guint8 *buf, + gsize count, + gpointer user_data) { g_return_val_if_fail (count >= 0, FALSE); if (wire_write_func) { - if (!(* wire_write_func) (channel, buf, count, user_data)) + if (!(* wire_write_func) (channel, (guint8 *) buf, count, user_data)) { g_warning ("%s: wire_write: error", g_get_prgname ()); wire_error_val = TRUE; @@ -203,7 +186,7 @@ wire_write (GIOChannel *channel, { bytes = 0; status = g_io_channel_write_chars (channel, - (gchar *) buf, count, + (const gchar *) buf, count, &bytes, &error); } @@ -236,8 +219,8 @@ wire_write (GIOChannel *channel, } gboolean -wire_flush (GIOChannel *channel, - gpointer user_data) +gimp_wire_flush (GIOChannel *channel, + gpointer user_data) { if (wire_flush_func) return (* wire_flush_func) (channel, user_data); @@ -246,28 +229,28 @@ wire_flush (GIOChannel *channel, } gboolean -wire_error (void) +gimp_wire_error (void) { return wire_error_val; } void -wire_clear_error (void) +gimp_wire_clear_error (void) { wire_error_val = FALSE; } gboolean -wire_read_msg (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +gimp_wire_read_msg (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { - WireHandler *handler; + GimpWireHandler *handler; if (wire_error_val) return !wire_error_val; - if (! wire_read_int32 (channel, &msg->type, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, &msg->type, 1, user_data)) return FALSE; handler = g_hash_table_lookup (wire_ht, &msg->type); @@ -280,11 +263,11 @@ wire_read_msg (GIOChannel *channel, } gboolean -wire_write_msg (GIOChannel *channel, - WireMessage *msg, - gpointer user_data) +gimp_wire_write_msg (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data) { - WireHandler *handler; + GimpWireHandler *handler; if (wire_error_val) return !wire_error_val; @@ -293,7 +276,7 @@ wire_write_msg (GIOChannel *channel, if (!handler) g_error ("could not find handler for message: %d", msg->type); - if (! wire_write_int32 (channel, &msg->type, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, &msg->type, 1, user_data)) return FALSE; (* handler->write_func) (channel, msg, user_data); @@ -302,9 +285,9 @@ wire_write_msg (GIOChannel *channel, } void -wire_destroy (WireMessage *msg) +gimp_wire_destroy (GimpWireMessage *msg) { - WireHandler *handler; + GimpWireHandler *handler; handler = g_hash_table_lookup (wire_ht, &msg->type); if (!handler) @@ -314,16 +297,17 @@ wire_destroy (WireMessage *msg) } gboolean -wire_read_int32 (GIOChannel *channel, - guint32 *data, - gint count, - gpointer user_data) +_gimp_wire_read_int32 (GIOChannel *channel, + guint32 *data, + gint count, + gpointer user_data) { g_return_val_if_fail (count >= 0, FALSE); if (count > 0) { - if (! wire_read_int8 (channel, (guint8 *) data, count * 4, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) data, count * 4, user_data)) return FALSE; while (count--) @@ -337,16 +321,17 @@ wire_read_int32 (GIOChannel *channel, } gboolean -wire_read_int16 (GIOChannel *channel, - guint16 *data, - gint count, - gpointer user_data) +_gimp_wire_read_int16 (GIOChannel *channel, + guint16 *data, + gint count, + gpointer user_data) { g_return_val_if_fail (count >= 0, FALSE); if (count > 0) { - if (! wire_read_int8 (channel, (guint8 *) data, count * 2, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) data, count * 2, user_data)) return FALSE; while (count--) @@ -360,21 +345,21 @@ wire_read_int16 (GIOChannel *channel, } gboolean -wire_read_int8 (GIOChannel *channel, - guint8 *data, - gint count, - gpointer user_data) +_gimp_wire_read_int8 (GIOChannel *channel, + guint8 *data, + gint count, + gpointer user_data) { g_return_val_if_fail (count >= 0, FALSE); - return wire_read (channel, data, count, user_data); + return gimp_wire_read (channel, data, count, user_data); } gboolean -wire_read_double (GIOChannel *channel, - gdouble *data, - gint count, - gpointer user_data) +_gimp_wire_read_double (GIOChannel *channel, + gdouble *data, + gint count, + gpointer user_data) { gdouble *t; guint8 tmp[8]; @@ -390,7 +375,7 @@ wire_read_double (GIOChannel *channel, for (i = 0; i < count; i++) { - if (! wire_read_int8 (channel, tmp, 8, user_data)) + if (! _gimp_wire_read_int8 (channel, tmp, 8, user_data)) return FALSE; #if (G_BYTE_ORDER == G_LITTLE_ENDIAN) @@ -409,10 +394,10 @@ wire_read_double (GIOChannel *channel, } gboolean -wire_read_string (GIOChannel *channel, - gchar **data, - gint count, - gpointer user_data) +_gimp_wire_read_string (GIOChannel *channel, + gchar **data, + gint count, + gpointer user_data) { guint32 tmp; gint i; @@ -421,13 +406,14 @@ wire_read_string (GIOChannel *channel, for (i = 0; i < count; i++) { - if (!wire_read_int32 (channel, &tmp, 1, user_data)) + if (! _gimp_wire_read_int32 (channel, &tmp, 1, user_data)) return FALSE; if (tmp > 0) { data[i] = g_new (gchar, tmp); - if (! wire_read_int8 (channel, (guint8 *) data[i], tmp, user_data)) + if (! _gimp_wire_read_int8 (channel, + (guint8 *) data[i], tmp, user_data)) { g_free (data[i]); return FALSE; @@ -443,10 +429,10 @@ wire_read_string (GIOChannel *channel, } gboolean -wire_write_int32 (GIOChannel *channel, - guint32 *data, - gint count, - gpointer user_data) +_gimp_wire_write_int32 (GIOChannel *channel, + const guint32 *data, + gint count, + gpointer user_data) { guint32 tmp; gint i; @@ -458,7 +444,8 @@ wire_write_int32 (GIOChannel *channel, for (i = 0; i < count; i++) { tmp = g_htonl (data[i]); - if (! wire_write_int8 (channel, (guint8 *) &tmp, 4, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) &tmp, 4, user_data)) return FALSE; } } @@ -467,10 +454,10 @@ wire_write_int32 (GIOChannel *channel, } gboolean -wire_write_int16 (GIOChannel *channel, - guint16 *data, - gint count, - gpointer user_data) +_gimp_wire_write_int16 (GIOChannel *channel, + const guint16 *data, + gint count, + gpointer user_data) { guint16 tmp; gint i; @@ -482,7 +469,8 @@ wire_write_int16 (GIOChannel *channel, for (i = 0; i < count; i++) { tmp = g_htons (data[i]); - if (! wire_write_int8 (channel, (guint8 *) &tmp, 2, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) &tmp, 2, user_data)) return FALSE; } } @@ -491,21 +479,21 @@ wire_write_int16 (GIOChannel *channel, } gboolean -wire_write_int8 (GIOChannel *channel, - guint8 *data, - gint count, - gpointer user_data) +_gimp_wire_write_int8 (GIOChannel *channel, + const guint8 *data, + gint count, + gpointer user_data) { g_return_val_if_fail (count >= 0, FALSE); - return wire_write (channel, data, count, user_data); + return gimp_wire_write (channel, data, count, user_data); } gboolean -wire_write_double (GIOChannel *channel, - gdouble *data, - gint count, - gpointer user_data) +_gimp_wire_write_double (GIOChannel *channel, + const gdouble *data, + gint count, + gpointer user_data) { gdouble *t; guint8 tmp[8]; @@ -532,7 +520,7 @@ wire_write_double (GIOChannel *channel, } #endif - if (! wire_write_int8 (channel, tmp, 8, user_data)) + if (! _gimp_wire_write_int8 (channel, tmp, 8, user_data)) return FALSE; #if 0 @@ -553,10 +541,10 @@ wire_write_double (GIOChannel *channel, } gboolean -wire_write_string (GIOChannel *channel, - gchar **data, - gint count, - gpointer user_data) +_gimp_wire_write_string (GIOChannel *channel, + gchar **data, + gint count, + gpointer user_data) { guint32 tmp; gint i; @@ -570,33 +558,35 @@ wire_write_string (GIOChannel *channel, else tmp = 0; - if (! wire_write_int32 (channel, &tmp, 1, user_data)) + if (! _gimp_wire_write_int32 (channel, &tmp, 1, user_data)) return FALSE; + if (tmp > 0) - if (! wire_write_int8 (channel, (guint8 *) data[i], tmp, user_data)) + if (! _gimp_wire_write_int8 (channel, + (const guint8 *) data[i], tmp, user_data)) return FALSE; } return TRUE; } -static void -wire_init (void) -{ - if (! wire_ht) - wire_ht = g_hash_table_new ((GHashFunc) wire_hash, - (GCompareFunc) wire_compare); -} - static guint -wire_hash (guint32 *key) +gimp_wire_hash (const guint32 *key) { return *key; } static gboolean -wire_compare (guint32 *a, - guint32 *b) +gimp_wire_compare (const guint32 *a, + const guint32 *b) { return (*a == *b); } + +static void +gimp_wire_init (void) +{ + if (! wire_ht) + wire_ht = g_hash_table_new ((GHashFunc) gimp_wire_hash, + (GCompareFunc) gimp_wire_compare); +} diff --git a/libgimpbase/gimpwire.h b/libgimpbase/gimpwire.h index c26e681585..eb9ff4c1c4 100644 --- a/libgimpbase/gimpwire.h +++ b/libgimpbase/gimpwire.h @@ -25,102 +25,102 @@ G_BEGIN_DECLS /* For information look into the C source or the html documentation */ -typedef struct _WireMessage WireMessage; +typedef struct _GimpWireMessage GimpWireMessage; -typedef void (* WireReadFunc) (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -typedef void (* WireWriteFunc) (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -typedef void (* WireDestroyFunc) (WireMessage *msg); -typedef gboolean (* WireIOFunc) (GIOChannel *channel, - guint8 *buf, - gulong count, - gpointer user_data); -typedef gboolean (* WireFlushFunc) (GIOChannel *channel, - gpointer user_data); +typedef void (* GimpWireReadFunc) (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +typedef void (* GimpWireWriteFunc) (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +typedef void (* GimpWireDestroyFunc) (GimpWireMessage *msg); +typedef gboolean (* GimpWireIOFunc) (GIOChannel *channel, + guint8 *buf, + gulong count, + gpointer user_data); +typedef gboolean (* GimpWireFlushFunc) (GIOChannel *channel, + gpointer user_data); -struct _WireMessage +struct _GimpWireMessage { guint32 type; gpointer data; }; -void wire_register (guint32 type, - WireReadFunc read_func, - WireWriteFunc write_func, - WireDestroyFunc destroy_func); +void gimp_wire_register (guint32 type, + GimpWireReadFunc read_func, + GimpWireWriteFunc write_func, + GimpWireDestroyFunc destroy_func); -void wire_set_reader (WireIOFunc read_func); -void wire_set_writer (WireIOFunc write_func); -void wire_set_flusher (WireFlushFunc flush_func); +void gimp_wire_set_reader (GimpWireIOFunc read_func); +void gimp_wire_set_writer (GimpWireIOFunc write_func); +void gimp_wire_set_flusher (GimpWireFlushFunc flush_func); -gboolean wire_read (GIOChannel *channel, - guint8 *buf, - gsize count, - gpointer user_data); -gboolean wire_write (GIOChannel *channel, - guint8 *buf, - gsize count, - gpointer user_data); -gboolean wire_flush (GIOChannel *channel, - gpointer user_data); +gboolean gimp_wire_read (GIOChannel *channel, + guint8 *buf, + gsize count, + gpointer user_data); +gboolean gimp_wire_write (GIOChannel *channel, + const guint8 *buf, + gsize count, + gpointer user_data); +gboolean gimp_wire_flush (GIOChannel *channel, + gpointer user_data); -gboolean wire_error (void); -void wire_clear_error (void); +gboolean gimp_wire_error (void); +void gimp_wire_clear_error (void); -gboolean wire_read_msg (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); -gboolean wire_write_msg (GIOChannel *channel, - WireMessage *msg, - gpointer user_data); +gboolean gimp_wire_read_msg (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); +gboolean gimp_wire_write_msg (GIOChannel *channel, + GimpWireMessage *msg, + gpointer user_data); -void wire_destroy (WireMessage *msg); +void gimp_wire_destroy (GimpWireMessage *msg); -gboolean wire_read_int32 (GIOChannel *channel, - guint32 *data, - gint count, - gpointer user_data); -gboolean wire_read_int16 (GIOChannel *channel, - guint16 *data, - gint count, - gpointer user_data); -gboolean wire_read_int8 (GIOChannel *channel, - guint8 *data, - gint count, - gpointer user_data); -gboolean wire_read_double (GIOChannel *channel, - gdouble *data, - gint count, - gpointer user_data); -gboolean wire_read_string (GIOChannel *channel, - gchar **data, - gint count, - gpointer user_data); -gboolean wire_write_int32 (GIOChannel *channel, - guint32 *data, - gint count, - gpointer user_data); -gboolean wire_write_int16 (GIOChannel *channel, - guint16 *data, - gint count, - gpointer user_data); -gboolean wire_write_int8 (GIOChannel *channel, - guint8 *data, - gint count, - gpointer user_data); -gboolean wire_write_double (GIOChannel *channel, - gdouble *data, - gint count, - gpointer user_data); -gboolean wire_write_string (GIOChannel *channel, - gchar **data, - gint count, - gpointer user_data); +gboolean _gimp_wire_read_int32 (GIOChannel *channel, + guint32 *data, + gint count, + gpointer user_data) G_GNUC_INTERNAL; +gboolean _gimp_wire_read_int16 (GIOChannel *channel, + guint16 *data, + gint count, + gpointer user_data) G_GNUC_INTERNAL; +gboolean _gimp_wire_read_int8 (GIOChannel *channel, + guint8 *data, + gint count, + gpointer user_data) G_GNUC_INTERNAL; +gboolean _gimp_wire_read_double (GIOChannel *channel, + gdouble *data, + gint count, + gpointer user_data) G_GNUC_INTERNAL; +gboolean _gimp_wire_read_string (GIOChannel *channel, + gchar **data, + gint count, + gpointer user_data) G_GNUC_INTERNAL; +gboolean _gimp_wire_write_int32 (GIOChannel *channel, + const guint32 *data, + gint count, + gpointer user_data) G_GNUC_INTERNAL; +gboolean _gimp_wire_write_int16 (GIOChannel *channel, + const guint16 *data, + gint count, + gpointer user_data) G_GNUC_INTERNAL; +gboolean _gimp_wire_write_int8 (GIOChannel *channel, + const guint8 *data, + gint count, + gpointer user_data) G_GNUC_INTERNAL; +gboolean _gimp_wire_write_double (GIOChannel *channel, + const gdouble *data, + gint count, + gpointer user_data) G_GNUC_INTERNAL; +gboolean _gimp_wire_write_string (GIOChannel *channel, + gchar **data, + gint count, + gpointer user_data) G_GNUC_INTERNAL; G_END_DECLS