[Spice-devel] [PATCH v2 10/10] Use RED_CHANNEL_CLIENT() macro for casting
Frediano Ziglio
fziglio at redhat.com
Thu Sep 8 10:43:22 UTC 2016
>
> Also remove (main|inputs)_channel_client_get_base() function to prepare
> for porting to GObject.
> ---
> Changes in v2:
> -
>
> server/cache-item.tmpl.c | 2 +-
> server/dcc.c | 10 ++---
> server/inputs-channel-client.c | 10 +++--
> server/main-channel-client.c | 86
> +++++++++++++++++++++---------------------
> server/main-channel-client.h | 2 -
> server/main-channel.c | 4 +-
> server/reds.c | 15 ++++----
> server/smartcard.c | 17 +++++----
> 8 files changed, 74 insertions(+), 72 deletions(-)
>
> diff --git a/server/cache-item.tmpl.c b/server/cache-item.tmpl.c
> index ce38a2a..034f2ea 100644
> --- a/server/cache-item.tmpl.c
> +++ b/server/cache-item.tmpl.c
> @@ -78,7 +78,7 @@ static void FUNC_NAME(remove)(CHANNELCLIENT
> *channel_client, RedCacheItem *item)
> channel_client->priv->VAR_NAME(available) += item->u.cache_data.size;
>
> red_pipe_item_init(&item->u.pipe_data, RED_PIPE_ITEM_TYPE_INVAL_ONE);
> - red_channel_client_pipe_add_tail_and_push(&channel_client->base,
> &item->u.pipe_data); // for now
> +
> red_channel_client_pipe_add_tail_and_push(RED_CHANNEL_CLIENT(channel_client),
> &item->u.pipe_data); // for now
> }
>
> static int FUNC_NAME(add)(CHANNELCLIENT *channel_client, uint64_t id, size_t
> size)
> diff --git a/server/dcc.c b/server/dcc.c
> index 5eca7f5..36c9c1d 100644
> --- a/server/dcc.c
> +++ b/server/dcc.c
> @@ -546,15 +546,15 @@ void dcc_push_monitors_config(DisplayChannelClient
> *dcc)
> return;
> }
>
> - if (!red_channel_client_test_remote_cap(&dcc->base,
> + if (!red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(dcc),
> SPICE_DISPLAY_CAP_MONITORS_CONFIG))
> {
> return;
> }
>
> - mci =
> red_monitors_config_item_new(red_channel_client_get_channel(&dcc->base),
> + mci =
> red_monitors_config_item_new(red_channel_client_get_channel(RED_CHANNEL_CLIENT(dcc)),
> monitors_config_ref(dc->monitors_config));
> - red_channel_client_pipe_add(&dcc->base, &mci->pipe_item);
> - red_channel_client_push(&dcc->base);
> + red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &mci->pipe_item);
> + red_channel_client_push(RED_CHANNEL_CLIENT(dcc));
> }
>
> static RedSurfaceDestroyItem *red_surface_destroy_item_new(RedChannel
> *channel,
> @@ -749,7 +749,7 @@ int dcc_compress_image(DisplayChannelClient *dcc,
> goto lz_compress;
> #ifdef USE_LZ4
> case SPICE_IMAGE_COMPRESSION_LZ4:
> - if (red_channel_client_test_remote_cap(&dcc->base,
> + if (red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(dcc),
> SPICE_DISPLAY_CAP_LZ4_COMPRESSION))
> {
> success = image_encoders_compress_lz4(&dcc->priv->encoders,
> dest, src, o_comp_data);
> break;
> diff --git a/server/inputs-channel-client.c b/server/inputs-channel-client.c
> index 6e352dc..a07008b 100644
> --- a/server/inputs-channel-client.c
> +++ b/server/inputs-channel-client.c
> @@ -56,7 +56,7 @@ RedChannelClient* inputs_channel_client_create(RedChannel
> *channel,
> if (icc) {
> icc->priv->motion_count = 0;
> }
> - return &icc->base;
> + return RED_CHANNEL_CLIENT(icc);
> }
>
> void inputs_channel_client_send_migrate_data(RedChannelClient *rcc,
> @@ -79,17 +79,19 @@ void
> inputs_channel_client_handle_migrate_data(InputsChannelClient *icc,
>
> for (; icc->priv->motion_count >= SPICE_INPUT_MOTION_ACK_BUNCH;
> icc->priv->motion_count -= SPICE_INPUT_MOTION_ACK_BUNCH) {
> - red_channel_client_pipe_add_type(&icc->base,
> RED_PIPE_ITEM_MOUSE_MOTION_ACK);
> + red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(icc),
> + RED_PIPE_ITEM_MOUSE_MOTION_ACK);
> }
> }
>
> void inputs_channel_client_on_mouse_motion(InputsChannelClient *icc)
> {
> - InputsChannel *inputs_channel = (InputsChannel
> *)red_channel_client_get_channel(&icc->base);
> + InputsChannel *inputs_channel = (InputsChannel
> *)red_channel_client_get_channel(RED_CHANNEL_CLIENT(icc));
>
> if (++icc->priv->motion_count % SPICE_INPUT_MOTION_ACK_BUNCH == 0 &&
> !inputs_channel_is_src_during_migrate(inputs_channel)) {
> - red_channel_client_pipe_add_type(&icc->base,
> RED_PIPE_ITEM_MOUSE_MOTION_ACK);
> + red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(icc),
> + RED_PIPE_ITEM_MOUSE_MOTION_ACK);
> icc->priv->motion_count = 0;
> }
> }
> diff --git a/server/main-channel-client.c b/server/main-channel-client.c
> index 75aae9f..d9315e1 100644
> --- a/server/main-channel-client.c
> +++ b/server/main-channel-client.c
> @@ -158,7 +158,8 @@ void main_channel_client_start_net_test(MainChannelClient
> *mcc, int test_rate)
> mcc->priv->net_test_stage = NET_TEST_STAGE_WARMUP;
> }
> } else {
> - red_channel_client_start_connectivity_monitoring(&mcc->base,
> CLIENT_CONNECTIVITY_TIMEOUT);
> +
> red_channel_client_start_connectivity_monitoring(RED_CHANNEL_CLIENT(mcc),
> +
> CLIENT_CONNECTIVITY_TIMEOUT);
> }
> }
>
...
Acked-by: Frediano Ziglio <fziglio at redhat.com>
Frediano
More information about the Spice-devel
mailing list