Avoid lines with more than 100 characters Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/common-graphics-channel.c | 3 +- server/common-graphics-channel.h | 15 +++-- server/cursor-channel.c | 3 +- server/cursor-channel.h | 6 +- server/display-channel.c | 3 +- server/display-channel.h | 9 ++- server/dummy-channel.c | 3 +- server/dummy-channel.h | 6 +- server/inputs-channel.c | 27 +++++--- server/inputs-channel.h | 6 +- server/main-channel-client.c | 3 +- server/main-channel.c | 21 ++++-- server/main-channel.h | 6 +- server/red-channel.c | 140 ++++++++++++++++++++------------------- server/red-channel.h | 9 ++- server/smartcard.c | 25 ++++--- server/sound.c | 3 +- server/spicevmc.c | 33 ++++++--- 18 files changed, 192 insertions(+), 129 deletions(-) diff --git a/server/common-graphics-channel.c b/server/common-graphics-channel.c index d8ee9dd..3f00b05 100644 --- a/server/common-graphics-channel.c +++ b/server/common-graphics-channel.c @@ -31,7 +31,8 @@ G_DEFINE_ABSTRACT_TYPE(CommonGraphicsChannel, common_graphics_channel, RED_TYPE_CHANNEL) -#define GRAPHICS_CHANNEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannelPrivate)) +#define GRAPHICS_CHANNEL_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannelPrivate)) struct CommonGraphicsChannelPrivate { diff --git a/server/common-graphics-channel.h b/server/common-graphics-channel.h index 6961375..a8c3f3d 100644 --- a/server/common-graphics-channel.h +++ b/server/common-graphics-channel.h @@ -31,11 +31,16 @@ int common_channel_config_socket(RedChannelClient *rcc); #define TYPE_COMMON_GRAPHICS_CHANNEL common_graphics_channel_get_type() -#define COMMON_GRAPHICS_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannel)) -#define COMMON_GRAPHICS_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannelClass)) -#define COMMON_IS_GRAPHICS_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_COMMON_GRAPHICS_CHANNEL)) -#define COMMON_IS_GRAPHICS_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_COMMON_GRAPHICS_CHANNEL)) -#define COMMON_GRAPHICS_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannelClass)) +#define COMMON_GRAPHICS_CHANNEL(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannel)) +#define COMMON_GRAPHICS_CHANNEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannelClass)) +#define COMMON_IS_GRAPHICS_CHANNEL(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_COMMON_GRAPHICS_CHANNEL)) +#define COMMON_IS_GRAPHICS_CHANNEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_COMMON_GRAPHICS_CHANNEL)) +#define COMMON_GRAPHICS_CHANNEL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannelClass)) typedef struct CommonGraphicsChannel CommonGraphicsChannel; typedef struct CommonGraphicsChannelClass CommonGraphicsChannelClass; diff --git a/server/cursor-channel.c b/server/cursor-channel.c index cf19c7f..4640e5f 100644 --- a/server/cursor-channel.c +++ b/server/cursor-channel.c @@ -51,7 +51,8 @@ typedef struct RedCursorPipeItem { G_DEFINE_TYPE(CursorChannel, cursor_channel, TYPE_COMMON_GRAPHICS_CHANNEL) -#define CURSOR_CHANNEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_CURSOR_CHANNEL, CursorChannelPrivate)) +#define CURSOR_CHANNEL_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_CURSOR_CHANNEL, CursorChannelPrivate)) struct CursorChannelPrivate { diff --git a/server/cursor-channel.h b/server/cursor-channel.h index 8b3bc17..73c3773 100644 --- a/server/cursor-channel.h +++ b/server/cursor-channel.h @@ -26,10 +26,12 @@ G_BEGIN_DECLS #define TYPE_CURSOR_CHANNEL cursor_channel_get_type() #define CURSOR_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_CURSOR_CHANNEL, CursorChannel)) -#define CURSOR_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_CURSOR_CHANNEL, CursorChannelClass)) +#define CURSOR_CHANNEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_CURSOR_CHANNEL, CursorChannelClass)) #define IS_CURSOR_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_CURSOR_CHANNEL)) #define IS_CURSOR_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_CURSOR_CHANNEL)) -#define CURSOR_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_CURSOR_CHANNEL, CursorChannelClass)) +#define CURSOR_CHANNEL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_CURSOR_CHANNEL, CursorChannelClass)) /** * This type it's a RedChannel class which implement cursor (mouse) diff --git a/server/display-channel.c b/server/display-channel.c index 19f0aca..c2fc915 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -2041,7 +2041,8 @@ DisplayChannel* display_channel_new(RedsState *reds, "spice-server", reds, "core-interface", core, "channel-type", SPICE_CHANNEL_DISPLAY, - "migration-flags", (SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER), + "migration-flags", + (SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER), "qxl", qxl, "n-surfaces", n_surfaces, "video-codecs", video_codecs, diff --git a/server/display-channel.h b/server/display-channel.h index 9ac9046..76b035f 100644 --- a/server/display-channel.h +++ b/server/display-channel.h @@ -50,11 +50,14 @@ G_BEGIN_DECLS #define TYPE_DISPLAY_CHANNEL display_channel_get_type() -#define DISPLAY_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_DISPLAY_CHANNEL, DisplayChannel)) -#define DISPLAY_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_DISPLAY_CHANNEL, DisplayChannelClass)) +#define DISPLAY_CHANNEL(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_DISPLAY_CHANNEL, DisplayChannel)) +#define DISPLAY_CHANNEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_DISPLAY_CHANNEL, DisplayChannelClass)) #define IS_DISPLAY_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_DISPLAY_CHANNEL)) #define IS_DISPLAY_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_DISPLAY_CHANNEL)) -#define DISPLAY_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_DISPLAY_CHANNEL, DisplayChannelClass)) +#define DISPLAY_CHANNEL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_DISPLAY_CHANNEL, DisplayChannelClass)) typedef struct DisplayChannel DisplayChannel; typedef struct DisplayChannelClass DisplayChannelClass; diff --git a/server/dummy-channel.c b/server/dummy-channel.c index 6ec7842..3ba9db7 100644 --- a/server/dummy-channel.c +++ b/server/dummy-channel.c @@ -7,7 +7,8 @@ G_DEFINE_TYPE(DummyChannel, dummy_channel, RED_TYPE_CHANNEL) -#define DUMMY_CHANNEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_DUMMY_CHANNEL, DummyChannelPrivate)) +#define DUMMY_CHANNEL_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_DUMMY_CHANNEL, DummyChannelPrivate)) struct DummyChannelPrivate { diff --git a/server/dummy-channel.h b/server/dummy-channel.h index dd2f005..a576c16 100644 --- a/server/dummy-channel.h +++ b/server/dummy-channel.h @@ -31,10 +31,12 @@ G_BEGIN_DECLS #define TYPE_DUMMY_CHANNEL dummy_channel_get_type() #define DUMMY_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_DUMMY_CHANNEL, DummyChannel)) -#define DUMMY_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_DUMMY_CHANNEL, DummyChannelClass)) +#define DUMMY_CHANNEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_DUMMY_CHANNEL, DummyChannelClass)) #define _IS_DUMMY_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_DUMMY_CHANNEL)) #define _IS_DUMMY_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_DUMMY_CHANNEL)) -#define DUMMY_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_DUMMY_CHANNEL, DummyChannelClass)) +#define DUMMY_CHANNEL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_DUMMY_CHANNEL, DummyChannelClass)) typedef struct DummyChannel DummyChannel; typedef struct DummyChannelClass DummyChannelClass; diff --git a/server/inputs-channel.c b/server/inputs-channel.c index c351dad..ecc1e2e 100644 --- a/server/inputs-channel.c +++ b/server/inputs-channel.c @@ -59,7 +59,8 @@ G_DEFINE_TYPE(InputsChannel, inputs_channel, RED_TYPE_CHANNEL) -#define CHANNEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_INPUTS_CHANNEL, InputsChannelPrivate)) +#define CHANNEL_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_INPUTS_CHANNEL, InputsChannelPrivate)) struct InputsChannelPrivate { @@ -123,7 +124,8 @@ inputs_channel_constructed(GObject *object) red_channel_set_cap(RED_CHANNEL(self), SPICE_INPUTS_CAP_KEY_SCANCODE); reds_register_channel(reds, RED_CHANNEL(self)); - if (!(self->priv->key_modifiers_timer = reds_core_timer_add(reds, key_modifiers_sender, self))) { + self->priv->key_modifiers_timer = reds_core_timer_add(reds, key_modifiers_sender, self); + if (!self->priv->key_modifiers_timer) { spice_error("key modifiers timer create failed"); } } @@ -423,12 +425,15 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui reds_handle_agent_mouse_event(reds, &inputs->priv->mouse_state); } else if (inputs_channel_get_tablet(inputs)) { SpiceTabletInterface *sif; - sif = SPICE_CONTAINEROF(inputs_channel_get_tablet(inputs)->base.sif, SpiceTabletInterface, base); - sif->wheel(inputs_channel_get_tablet(inputs), dz, RED_MOUSE_STATE_TO_LOCAL(mouse_press->buttons_state)); + sif = SPICE_CONTAINEROF(inputs_channel_get_tablet(inputs)->base.sif, + SpiceTabletInterface, base); + sif->wheel(inputs_channel_get_tablet(inputs), dz, + RED_MOUSE_STATE_TO_LOCAL(mouse_press->buttons_state)); } } else if (inputs_channel_get_mouse(inputs)) { SpiceMouseInterface *sif; - sif = SPICE_CONTAINEROF(inputs_channel_get_mouse(inputs)->base.sif, SpiceMouseInterface, base); + sif = SPICE_CONTAINEROF(inputs_channel_get_mouse(inputs)->base.sif, + SpiceMouseInterface, base); sif->motion(inputs_channel_get_mouse(inputs), 0, 0, dz, RED_MOUSE_STATE_TO_LOCAL(mouse_press->buttons_state)); } @@ -443,12 +448,15 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui reds_handle_agent_mouse_event(reds, &inputs->priv->mouse_state); } else if (inputs_channel_get_tablet(inputs)) { SpiceTabletInterface *sif; - sif = SPICE_CONTAINEROF(inputs_channel_get_tablet(inputs)->base.sif, SpiceTabletInterface, base); - sif->buttons(inputs_channel_get_tablet(inputs), RED_MOUSE_STATE_TO_LOCAL(mouse_release->buttons_state)); + sif = SPICE_CONTAINEROF(inputs_channel_get_tablet(inputs)->base.sif, + SpiceTabletInterface, base); + sif->buttons(inputs_channel_get_tablet(inputs), + RED_MOUSE_STATE_TO_LOCAL(mouse_release->buttons_state)); } } else if (inputs_channel_get_mouse(inputs)) { SpiceMouseInterface *sif; - sif = SPICE_CONTAINEROF(inputs_channel_get_mouse(inputs)->base.sif, SpiceMouseInterface, base); + sif = SPICE_CONTAINEROF(inputs_channel_get_mouse(inputs)->base.sif, + SpiceMouseInterface, base); sif->buttons(inputs_channel_get_mouse(inputs), RED_MOUSE_STATE_TO_LOCAL(mouse_release->buttons_state)); } @@ -664,7 +672,8 @@ InputsChannel* inputs_channel_new(RedsState *reds) "channel-type", (int)SPICE_CHANNEL_INPUTS, "id", 0, "handle-acks", FALSE, - "migration-flags", (guint)(SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER), + "migration-flags", + (guint)(SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER), NULL); } diff --git a/server/inputs-channel.h b/server/inputs-channel.h index a1ce85f..48bedf1 100644 --- a/server/inputs-channel.h +++ b/server/inputs-channel.h @@ -32,10 +32,12 @@ G_BEGIN_DECLS #define TYPE_INPUTS_CHANNEL inputs_channel_get_type() #define INPUTS_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_INPUTS_CHANNEL, InputsChannel)) -#define INPUTS_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_INPUTS_CHANNEL, InputsChannelClass)) +#define INPUTS_CHANNEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_INPUTS_CHANNEL, InputsChannelClass)) #define INPUTS_IS_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_INPUTS_CHANNEL)) #define INPUTS_IS_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_INPUTS_CHANNEL)) -#define INPUTS_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_INPUTS_CHANNEL, InputsChannelClass)) +#define INPUTS_CHANNEL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_INPUTS_CHANNEL, InputsChannelClass)) typedef struct InputsChannel InputsChannel; typedef struct InputsChannelClass InputsChannelClass; diff --git a/server/main-channel-client.c b/server/main-channel-client.c index eb9256d..dc5e1d1 100644 --- a/server/main-channel-client.c +++ b/server/main-channel-client.c @@ -834,7 +834,8 @@ static void main_channel_marshall_migrate_data_item(RedChannelClient *rcc, { RedChannel *channel = red_channel_client_get_channel(rcc); red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, item); - reds_marshall_migrate_data(red_channel_get_server(channel), m); // TODO: from reds split. ugly separation. + // TODO: from reds split. ugly separation. + reds_marshall_migrate_data(red_channel_get_server(channel), m); } static void main_channel_marshall_init(RedChannelClient *rcc, diff --git a/server/main-channel.c b/server/main-channel.c index d206550..698547e 100644 --- a/server/main-channel.c +++ b/server/main-channel.c @@ -32,12 +32,14 @@ G_DEFINE_TYPE(MainChannel, main_channel, RED_TYPE_CHANNEL) -#define MAIN_CHANNEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_MAIN_CHANNEL, MainChannelPrivate)) +#define MAIN_CHANNEL_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_MAIN_CHANNEL, MainChannelPrivate)) struct MainChannelPrivate { uint8_t recv_buf[MAIN_CHANNEL_RECEIVE_BUF_SIZE]; - RedsMigSpice mig_target; // TODO: add refs and release (afrer all clients completed migration in one way or the other?) + // TODO: add refs and release (afrer all clients completed migration in one way or the other?) + RedsMigSpice mig_target; int num_clients_mig_wait; }; @@ -117,8 +119,10 @@ void main_channel_push_mouse_mode(MainChannel *main_chan, int current_mode, void main_channel_push_agent_connected(MainChannel *main_chan) { - if (red_channel_test_remote_cap(RED_CHANNEL(main_chan), SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS)) { - red_channel_pipes_add_type(RED_CHANNEL(main_chan), RED_PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS); + if (red_channel_test_remote_cap(RED_CHANNEL(main_chan), + SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS)) { + red_channel_pipes_add_type(RED_CHANNEL(main_chan), + RED_PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS); } else { red_channel_pipes_add_empty_msg(RED_CHANNEL(main_chan), SPICE_MSG_MAIN_AGENT_CONNECTED); } @@ -319,12 +323,14 @@ MainChannelClient *main_channel_link(MainChannel *channel, RedClient *client, int main_channel_getsockname(MainChannel *main_chan, struct sockaddr *sa, socklen_t *salen) { - return main_chan ? getsockname(red_channel_get_first_socket(RED_CHANNEL(main_chan)), sa, salen) : -1; + return main_chan ? + getsockname(red_channel_get_first_socket(RED_CHANNEL(main_chan)), sa, salen) : -1; } int main_channel_getpeername(MainChannel *main_chan, struct sockaddr *sa, socklen_t *salen) { - return main_chan ? getpeername(red_channel_get_first_socket(RED_CHANNEL(main_chan)), sa, salen) : -1; + return main_chan ? + getpeername(red_channel_get_first_socket(RED_CHANNEL(main_chan)), sa, salen) : -1; } // TODO: ? shouldn't it disonnect all clients? or shutdown all main_channels? @@ -346,7 +352,8 @@ MainChannel* main_channel_new(RedsState *reds) "channel-type", (gint)SPICE_CHANNEL_MAIN, "id", 0, "handle-acks", FALSE, /* handle_acks */ - "migration-flags", (SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER), + "migration-flags", + (SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER), NULL); } diff --git a/server/main-channel.h b/server/main-channel.h index 09adb18..7819284 100644 --- a/server/main-channel.h +++ b/server/main-channel.h @@ -31,10 +31,12 @@ G_BEGIN_DECLS #define TYPE_MAIN_CHANNEL main_channel_get_type() #define MAIN_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_MAIN_CHANNEL, MainChannel)) -#define MAIN_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_MAIN_CHANNEL, MainChannelClass)) +#define MAIN_CHANNEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_MAIN_CHANNEL, MainChannelClass)) #define IS_MAIN_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_MAIN_CHANNEL)) #define IS_MAIN_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_MAIN_CHANNEL)) -#define MAIN_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_MAIN_CHANNEL, MainChannelClass)) +#define MAIN_CHANNEL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_MAIN_CHANNEL, MainChannelClass)) typedef struct MainChannel MainChannel; typedef struct MainChannelClass MainChannelClass; diff --git a/server/red-channel.c b/server/red-channel.c index 6269a80..4281414 100644 --- a/server/red-channel.c +++ b/server/red-channel.c @@ -81,7 +81,8 @@ struct RedChannelPrivate SpiceCoreInterfaceInternal *core; gboolean handle_acks; - // RedChannel will hold only connected channel clients (logic - when pushing pipe item to all channel clients, there + // RedChannel will hold only connected channel clients + // (logic - when pushing pipe item to all channel clients, there // is no need to go over disconnect clients) // . While client will hold the channel clients till it is destroyed // and then it will destroy them as well. @@ -99,7 +100,8 @@ struct RedChannelPrivate IncomingHandlerInterface incoming_cb; ClientCbs client_cbs; - // TODO: when different channel_clients are in different threads from Channel -> need to protect! + // TODO: when different channel_clients are in different threads + // from Channel -> need to protect! pthread_t thread_id; RedsState *reds; #ifdef RED_STATISTICS @@ -251,6 +253,7 @@ static void red_channel_client_default_disconnect(RedChannelClient *base) static void red_channel_class_init(RedChannelClass *klass) { + GParamSpec *spec; GObjectClass *object_class = G_OBJECT_CLASS(klass); g_type_class_add_private(klass, sizeof (RedChannelPrivate)); @@ -260,70 +263,64 @@ red_channel_class_init(RedChannelClass *klass) object_class->finalize = red_channel_finalize; object_class->constructed = red_channel_constructed; - g_object_class_install_property(object_class, - PROP_SPICE_SERVER, - g_param_spec_pointer("spice-server", - "spice-server", - "The spice server associated with this channel", - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property(object_class, - PROP_CORE_INTERFACE, - g_param_spec_pointer("core-interface", - "core-interface", - "The SpiceCoreInterface server associated with this channel", - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); + spec = g_param_spec_pointer("spice-server", + "spice-server", + "The spice server associated with this channel", + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(object_class, PROP_SPICE_SERVER, spec); + + spec = g_param_spec_pointer("core-interface", + "core-interface", + "The SpiceCoreInterface server associated with this channel", + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(object_class, PROP_CORE_INTERFACE, spec); /* FIXME: generate enums for this in spice-common? */ - g_object_class_install_property(object_class, - PROP_TYPE, - g_param_spec_int("channel-type", - "channel type", - "Type of this channel", - 0, - SPICE_END_CHANNEL, - 0, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property(object_class, - PROP_ID, - g_param_spec_uint("id", - "id", - "ID of this channel", - 0, - G_MAXUINT, - 0, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property(object_class, - PROP_HANDLE_ACKS, - g_param_spec_boolean("handle-acks", - "Handle ACKs", - "Whether this channel handles ACKs", - FALSE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property(object_class, - PROP_MIGRATION_FLAGS, - g_param_spec_uint("migration-flags", - "migration flags", - "Migration flags for this channel", - 0, - G_MAXUINT, - 0, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); + spec = g_param_spec_int("channel-type", + "channel type", + "Type of this channel", + 0, + SPICE_END_CHANNEL, + 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(object_class, PROP_TYPE, spec); + + spec = g_param_spec_uint("id", + "id", + "ID of this channel", + 0, + G_MAXUINT, + 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(object_class, PROP_ID, spec); + + spec = g_param_spec_boolean("handle-acks", + "Handle ACKs", + "Whether this channel handles ACKs", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(object_class, PROP_HANDLE_ACKS, spec); + + spec = g_param_spec_uint("migration-flags", + "migration flags", + "Migration flags for this channel", + 0, + G_MAXUINT, + 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(object_class, PROP_MIGRATION_FLAGS, spec); } static void @@ -437,7 +434,8 @@ void red_channel_set_stat_node(RedChannel *channel, StatNodeRef stat) #ifdef RED_STATISTICS channel->priv->stat = stat; - channel->priv->out_bytes_counter = stat_add_counter(channel->priv->reds, stat, "out_bytes", TRUE); + channel->priv->out_bytes_counter = + stat_add_counter(channel->priv->reds, stat, "out_bytes", TRUE); #endif } @@ -449,7 +447,8 @@ StatNodeRef red_channel_get_stat_node(RedChannel *channel) return 0; } -void red_channel_register_client_cbs(RedChannel *channel, const ClientCbs *client_cbs, gpointer cbs_data) +void red_channel_register_client_cbs(RedChannel *channel, const ClientCbs *client_cbs, + gpointer cbs_data) { spice_assert(client_cbs->connect || channel->priv->type == SPICE_CHANNEL_MAIN); channel->priv->client_cbs.connect = client_cbs->connect; @@ -478,7 +477,8 @@ static void add_capability(uint32_t **caps, int *num_caps, uint32_t cap) void red_channel_set_common_cap(RedChannel *channel, uint32_t cap) { - add_capability(&channel->priv->local_caps.common_caps, &channel->priv->local_caps.num_common_caps, cap); + add_capability(&channel->priv->local_caps.common_caps, + &channel->priv->local_caps.num_common_caps, cap); } void red_channel_set_cap(RedChannel *channel, uint32_t cap) @@ -514,7 +514,8 @@ void red_channel_push(RedChannel *channel) // specific void red_channel_init_outgoing_messages_window(RedChannel *channel) { - g_list_foreach(channel->priv->clients, (GFunc)red_channel_client_init_outgoing_messages_window, NULL); + g_list_foreach(channel->priv->clients, + (GFunc)red_channel_client_init_outgoing_messages_window, NULL); } static void red_channel_client_pipe_add_type_proxy(gpointer data, gpointer user_data) @@ -537,7 +538,8 @@ static void red_channel_client_pipe_add_empty_msg_proxy(gpointer data, gpointer void red_channel_pipes_add_empty_msg(RedChannel *channel, int msg_type) { - g_list_foreach(channel->priv->clients, red_channel_client_pipe_add_empty_msg_proxy, GINT_TO_POINTER(msg_type)); + g_list_foreach(channel->priv->clients, red_channel_client_pipe_add_empty_msg_proxy, + GINT_TO_POINTER(msg_type)); } int red_channel_is_connected(RedChannel *channel) diff --git a/server/red-channel.h b/server/red-channel.h index bd0751c..97202df 100644 --- a/server/red-channel.h +++ b/server/red-channel.h @@ -147,10 +147,12 @@ static inline gboolean test_capability(const uint32_t *caps, int num_caps, uint3 #define RED_TYPE_CHANNEL red_channel_get_type() #define RED_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHANNEL, RedChannel)) -#define RED_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHANNEL, RedChannelClass)) +#define RED_CHANNEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHANNEL, RedChannelClass)) #define RED_IS_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHANNEL)) #define RED_IS_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHANNEL)) -#define RED_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHANNEL, RedChannelClass)) +#define RED_CHANNEL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHANNEL, RedChannelClass)) typedef struct RedChannel RedChannel; typedef struct RedChannelClass RedChannelClass; @@ -303,7 +305,8 @@ uint32_t red_channel_sum_pipes_size(RedChannel *channel); typedef void (*channel_client_callback)(RedChannelClient *rcc); typedef void (*channel_client_callback_data)(RedChannelClient *rcc, void *data); void red_channel_apply_clients(RedChannel *channel, channel_client_callback v); -void red_channel_apply_clients_data(RedChannel *channel, channel_client_callback_data v, void *data); +void red_channel_apply_clients_data(RedChannel *channel, channel_client_callback_data v, + void *data); GList *red_channel_get_clients(RedChannel *channel); guint red_channel_get_n_clients(RedChannel *channel); struct RedsState* red_channel_get_server(RedChannel *channel); diff --git a/server/smartcard.c b/server/smartcard.c index 40048a9..6974cb1 100644 --- a/server/smartcard.c +++ b/server/smartcard.c @@ -51,11 +51,16 @@ #define RED_TYPE_SMARTCARD_CHANNEL red_smartcard_channel_get_type() -#define RED_SMARTCARD_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannel)) -#define RED_SMARTCARD_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannelClass)) -#define RED_IS_SMARTCARD_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_SMARTCARD_CHANNEL)) -#define RED_IS_SMARTCARD_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_SMARTCARD_CHANNEL)) -#define RED_SMARTCARD_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannelClass)) +#define RED_SMARTCARD_CHANNEL(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannel)) +#define RED_SMARTCARD_CHANNEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannelClass)) +#define RED_IS_SMARTCARD_CHANNEL(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_SMARTCARD_CHANNEL)) +#define RED_IS_SMARTCARD_CHANNEL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_SMARTCARD_CHANNEL)) +#define RED_SMARTCARD_CHANNEL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannelClass)) typedef struct RedSmartcardChannel RedSmartcardChannel; typedef struct RedSmartcardChannelClass RedSmartcardChannelClass; @@ -77,7 +82,8 @@ GType red_smartcard_channel_get_type(void) G_GNUC_CONST; G_DEFINE_TYPE(RedSmartcardChannel, red_smartcard_channel, RED_TYPE_CHANNEL) -#define SMARTCARD_CHANNEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannelPrivate)) +#define SMARTCARD_CHANNEL_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE((o), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannelPrivate)) struct RedSmartcardChannelPrivate { @@ -99,14 +105,17 @@ red_smartcard_channel_new(RedsState *reds) "channel-type", SPICE_CHANNEL_SMARTCARD, "id", 0, "handle-acks", FALSE /* handle_acks */, - "migration-flags", (SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER), + "migration-flags", + (SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER), NULL); } G_DEFINE_TYPE(RedCharDeviceSmartcard, red_char_device_smartcard, RED_TYPE_CHAR_DEVICE) -#define RED_CHAR_DEVICE_SMARTCARD_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RED_TYPE_CHAR_DEVICE_SMARTCARD, RedCharDeviceSmartcardPrivate)) +#define RED_CHAR_DEVICE_SMARTCARD_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((o), RED_TYPE_CHAR_DEVICE_SMARTCARD, \ + RedCharDeviceSmartcardPrivate)) struct RedCharDeviceSmartcardPrivate { uint32_t reader_id; diff --git a/server/sound.c b/server/sound.c index 7f2246c..868e28f 100644 --- a/server/sound.c +++ b/server/sound.c @@ -1250,7 +1250,8 @@ static void snd_set_playback_peer(RedChannel *channel, RedClient *client, RedsSt SPICE_PLAYBACK_CAP_CELT_0_5_1); int client_can_opus = red_channel_client_test_remote_cap(playback_channel->base.channel_client, SPICE_PLAYBACK_CAP_OPUS); - int playback_compression = reds_config_get_playback_compression(red_channel_get_server(channel)); + int playback_compression = + reds_config_get_playback_compression(red_channel_get_server(channel)); int desired_mode = snd_desired_audio_mode(playback_compression, st->frequency, client_can_celt, client_can_opus); playback_channel->mode = SPICE_AUDIO_DATA_MODE_RAW; diff --git a/server/spicevmc.c b/server/spicevmc.c index 92c7a6b..d92a0fe 100644 --- a/server/spicevmc.c +++ b/server/spicevmc.c @@ -59,11 +59,16 @@ typedef struct RedVmcPipeItem { #define RED_TYPE_CHAR_DEVICE_SPICEVMC red_char_device_spicevmc_get_type() -#define RED_CHAR_DEVICE_SPICEVMC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmc)) -#define RED_CHAR_DEVICE_SPICEVMC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmcClass)) -#define RED_IS_CHAR_DEVICE_SPICEVMC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHAR_DEVICE_SPICEVMC)) -#define RED_IS_CHAR_DEVICE_SPICEVMC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHAR_DEVICE_SPICEVMC)) -#define RED_CHAR_DEVICE_SPICEVMC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmcClass)) +#define RED_CHAR_DEVICE_SPICEVMC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmc)) +#define RED_CHAR_DEVICE_SPICEVMC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmcClass)) +#define RED_IS_CHAR_DEVICE_SPICEVMC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHAR_DEVICE_SPICEVMC)) +#define RED_IS_CHAR_DEVICE_SPICEVMC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHAR_DEVICE_SPICEVMC)) +#define RED_CHAR_DEVICE_SPICEVMC_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmcClass)) typedef struct RedCharDeviceSpiceVmc RedCharDeviceSpiceVmc; typedef struct RedCharDeviceSpiceVmcClass RedCharDeviceSpiceVmcClass; @@ -84,15 +89,19 @@ static RedCharDevice *red_char_device_spicevmc_new(SpiceCharDeviceInstance *sin, G_DEFINE_TYPE(RedCharDeviceSpiceVmc, red_char_device_spicevmc, RED_TYPE_CHAR_DEVICE) -#define RED_CHAR_DEVICE_SPICEVMC_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmcPrivate)) +#define RED_CHAR_DEVICE_SPICEVMC_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((o), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmcPrivate)) #define SPICE_TYPE_VMC_STATE spice_vmc_state_get_type() -#define SPICE_VMC_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SPICE_TYPE_VMC_STATE, SpiceVmcState)) -#define SPICE_VMC_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPICE_TYPE_VMC_STATE, SpiceVmcStateClass)) +#define SPICE_VMC_STATE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), SPICE_TYPE_VMC_STATE, SpiceVmcState)) +#define SPICE_VMC_STATE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), SPICE_TYPE_VMC_STATE, SpiceVmcStateClass)) #define SPICE_IS_VMC_STATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SPICE_TYPE_VMC_STATE)) #define SPICE_IS_VMC_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SPICE_TYPE_VMC_STATE)) -#define SPICE_VMC_STATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SPICE_TYPE_VMC_STATE, SpiceVmcStateClass)) +#define SPICE_VMC_STATE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), SPICE_TYPE_VMC_STATE, SpiceVmcStateClass)) typedef struct SpiceVmcState SpiceVmcState; typedef struct SpiceVmcStateClass SpiceVmcStateClass; @@ -168,7 +177,8 @@ static void spice_vmc_state_port_init(SpiceVmcStatePort *self) } G_DEFINE_TYPE(SpiceVmcStatePort, spice_vmc_state_port, SPICE_TYPE_VMC_STATE) -#define VMC_STATE_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), SPICE_TYPE_VMC_STATE, SpiceVmcStatePrivate)) +#define VMC_STATE_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE((o), SPICE_TYPE_VMC_STATE, SpiceVmcStatePrivate)) struct SpiceVmcStatePrivate { @@ -280,7 +290,8 @@ static SpiceVmcState *spice_vmc_state_new(RedsState *reds, uint8_t channel_type, "channel-type", channel_type, "id", id[channel_type]++, "handle-acks", FALSE, - "migration-flags", (SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER), + "migration-flags", + (SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER), "device-instance", sin, NULL); } -- 2.7.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel