[vlc-commits] xcb screen: fix block allocation size

Rémi Denis-Courmont git at videolan.org
Mon Apr 16 17:55:51 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Apr 16 18:42:47 2012 +0300| [868b0869f3f71dc16290279d3e877d7607ac483c] | committer: Rémi Denis-Courmont

xcb screen: fix block allocation size

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=868b0869f3f71dc16290279d3e877d7607ac483c
---

 modules/access/screen/xcb.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/access/screen/xcb.c b/modules/access/screen/xcb.c
index dd3ab99..c31d380 100644
--- a/modules/access/screen/xcb.c
+++ b/modules/access/screen/xcb.c
@@ -299,9 +299,9 @@ static int Control (demux_t *demux, int query, va_list args)
 /**
  * Processing callback
  */
-static void Demux (void *data)
+static void Demux (void *opaque)
 {
-    demux_t *demux = data;
+    demux_t *demux = opaque;
     demux_sys_t *sys = demux->p_sys;
     xcb_connection_t *conn = sys->conn;
 
@@ -411,11 +411,12 @@ discard:
     if (img == NULL)
         return;
 
+    uint8_t *data = xcb_get_image_data (img);
     size_t datalen = xcb_get_image_data_length (img);
-    block_t *block = block_heap_Alloc (img, sizeof (*img) + datalen);
+    block_t *block = block_heap_Alloc (img, data + datalen - (uint8_t *)img);
     if (block == NULL)
         return;
-    block->p_buffer = xcb_get_image_data (img);
+    block->p_buffer = data;
     block->i_buffer = datalen;
 
     /* Send block - zero copy */



More information about the vlc-commits mailing list