[Spice-commits] server/display-channel.c server/sound.c server/tree.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Fri Dec 4 05:35:53 PST 2015


 server/display-channel.c |    2 +-
 server/sound.c           |    2 +-
 server/tree.c            |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit ed1ef89ca820d1c4e490ec7f51a96ad425d2e642
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Thu Dec 3 08:36:25 2015 +0000

    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 at redhat.com>
    Acked-by: Fabiano FidĂȘncio <fidencio at redhat.com>

diff --git a/server/display-channel.c b/server/display-channel.c
index 2ef1c88..f0ff2bd 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -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);
diff --git a/server/sound.c b/server/sound.c
index 2d3f393..0c94964 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -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) ||
diff --git a/server/tree.c b/server/tree.c
index e5e3c76..9e5a281 100644
--- a/server/tree.c
+++ b/server/tree.c
@@ -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;


More information about the Spice-commits mailing list