pass proper type to SPICE_CONTAINEROF

In some case the member specified to SPICE_CONTAINEROF was not
exactly the same type of the pointer passed.
This can cause issues if structure changes so use proper member.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Frediano Ziglio 2015-12-03 08:36:25 +00:00
parent 89fda203bc
commit ed1ef89ca8
3 changed files with 3 additions and 3 deletions

View File

@ -429,7 +429,7 @@ static void current_remove(DisplayChannel *display, TreeItem *item)
RingItem *ring_item;
if (now->type == TREE_ITEM_TYPE_DRAWABLE) {
Drawable *drawable = SPICE_CONTAINEROF(now, Drawable, tree_item);
Drawable *drawable = SPICE_CONTAINEROF(now, Drawable, tree_item.base);
ring_item = now->siblings_link.prev;
drawable_remove_from_pipes(drawable);
current_remove_drawable(display, drawable);

View File

@ -1102,7 +1102,7 @@ SPICE_GNUC_VISIBLE void spice_server_playback_put_samples(SpicePlaybackInstance
PlaybackChannel *playback_channel;
AudioFrame *frame;
frame = SPICE_CONTAINEROF(samples, AudioFrame, samples);
frame = SPICE_CONTAINEROF(samples, AudioFrame, samples[0]);
playback_channel = frame->channel;
spice_assert(playback_channel);
if (!snd_channel_put(&playback_channel->base) ||

View File

@ -129,7 +129,7 @@ static void dump_item(TreeItem *item, void *data)
switch (item->type) {
case TREE_ITEM_TYPE_DRAWABLE: {
Drawable *drawable = SPICE_CONTAINEROF(item, Drawable, tree_item);
Drawable *drawable = SPICE_CONTAINEROF(item, Drawable, tree_item.base);
const int max_indent = 200;
char indent_str[max_indent + 1];
int indent_str_len;