mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-09 05:51:00 +00:00
reduce casts to RedPipeItem and RingItem
Make code more type safe. This allow to move or delete structure fields more safely Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
e8a9d3f2b9
commit
fb655ff481
@ -78,7 +78,7 @@ int dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surface
|
||||
rcc = RED_CHANNEL_CLIENT(dcc);
|
||||
ring = &rcc->pipe;
|
||||
item = (RedPipeItem *) ring;
|
||||
while ((item = (RedPipeItem *)ring_next(ring, (RingItem *)item))) {
|
||||
while ((item = (RedPipeItem *)ring_next(ring, &item->link))) {
|
||||
Drawable *drawable;
|
||||
RedDrawablePipeItem *dpi = NULL;
|
||||
int depend_found = FALSE;
|
||||
@ -94,7 +94,7 @@ int dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surface
|
||||
|
||||
if (drawable->surface_id == surface_id) {
|
||||
RedPipeItem *tmp_item = item;
|
||||
item = (RedPipeItem *)ring_prev(ring, (RingItem *)item);
|
||||
item = (RedPipeItem *)ring_prev(ring, &item->link);
|
||||
red_channel_client_pipe_remove_and_release(rcc, tmp_item);
|
||||
if (!item) {
|
||||
item = (RedPipeItem *)ring;
|
||||
@ -514,7 +514,7 @@ void dcc_stream_agent_clip(DisplayChannelClient* dcc, StreamAgent *agent)
|
||||
item->rects->num_rects = n_rects;
|
||||
region_ret_rects(&agent->clip, item->rects->rects, n_rects);
|
||||
|
||||
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), (RedPipeItem *)item);
|
||||
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &item->base);
|
||||
}
|
||||
|
||||
static void red_monitors_config_item_free(RedPipeItem *base)
|
||||
|
||||
@ -888,7 +888,7 @@ static RedPipeItem *vdi_port_read_one_msg_from_device(SpiceCharDeviceInstance *s
|
||||
dev->priv->read_state = VDI_PORT_READ_STATE_GET_BUFF;
|
||||
}
|
||||
if (vdi_port_read_buf_process(reds->agent_dev, dispatch_buf, &error)) {
|
||||
return (RedPipeItem *)dispatch_buf;
|
||||
return &dispatch_buf->base;
|
||||
} else {
|
||||
if (error) {
|
||||
reds_agent_remove(reds);
|
||||
|
||||
@ -160,7 +160,7 @@ static RedPipeItem *smartcard_read_msg_from_device(SpiceCharDeviceInstance *sin,
|
||||
dev->priv->buf_pos = dev->priv->buf;
|
||||
dev->priv->buf_used = remaining;
|
||||
if (msg_to_client) {
|
||||
return (RedPipeItem *)msg_to_client;
|
||||
return &msg_to_client->base;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@ -172,7 +172,7 @@ static void smartcard_send_msg_to_client(RedPipeItem *msg,
|
||||
{
|
||||
RedCharDeviceSmartcard *dev = opaque;
|
||||
spice_assert(dev->priv->scc && dev->priv->scc->base.client == client);
|
||||
smartcard_channel_client_pipe_add_push(&dev->priv->scc->base, (RedPipeItem *)msg);
|
||||
smartcard_channel_client_pipe_add_push(&dev->priv->scc->base, msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ static RedPipeItem *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *
|
||||
if (n > 0) {
|
||||
spice_debug("read from dev %d", n);
|
||||
msg_item->buf_used = n;
|
||||
return (RedPipeItem *)msg_item;
|
||||
return &msg_item->base;
|
||||
} else {
|
||||
state->pipe_item = msg_item;
|
||||
return NULL;
|
||||
@ -145,11 +145,10 @@ static void spicevmc_chardev_send_msg_to_client(RedPipeItem *msg,
|
||||
void *opaque)
|
||||
{
|
||||
SpiceVmcState *state = opaque;
|
||||
RedVmcPipeItem *vmc_msg = SPICE_CONTAINEROF(msg, RedVmcPipeItem, base);
|
||||
|
||||
spice_assert(state->rcc->client == client);
|
||||
red_pipe_item_ref(msg);
|
||||
red_channel_client_pipe_add_push(state->rcc, (RedPipeItem *)vmc_msg);
|
||||
red_channel_client_pipe_add_push(state->rcc, msg);
|
||||
}
|
||||
|
||||
static SpiceVmcState *spicevmc_red_channel_client_get_state(RedChannelClient *rcc)
|
||||
|
||||
@ -177,7 +177,7 @@ void red_stream_clip_item_free(RedPipeItem *base)
|
||||
RedStreamClipItem *red_stream_clip_item_new(StreamAgent *agent)
|
||||
{
|
||||
RedStreamClipItem *item = spice_new(RedStreamClipItem, 1);
|
||||
red_pipe_item_init_full((RedPipeItem *)item, RED_PIPE_ITEM_TYPE_STREAM_CLIP,
|
||||
red_pipe_item_init_full(&item->base, RED_PIPE_ITEM_TYPE_STREAM_CLIP,
|
||||
red_stream_clip_item_free);
|
||||
|
||||
item->stream_agent = agent;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user