[Spice-devel] [PATCH 2/2] Move marshalling code from dcc-encoders to dcc-send
Frediano Ziglio
fziglio at redhat.com
Fri Jun 3 15:40:23 UTC 2016
No reasons why dcc-encoders should know about marshalling.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/dcc-encoders.c | 20 --------------------
server/dcc-encoders.h | 5 -----
server/dcc-send.c | 20 ++++++++++++++++++++
3 files changed, 20 insertions(+), 25 deletions(-)
diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
index 5570798..a657887 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -429,26 +429,6 @@ void dcc_encoders_free(DisplayChannelClient *dcc)
dcc->zlib = NULL;
}
-static void marshaller_compress_buf_free(uint8_t *data, void *opaque)
-{
- g_free(opaque);
-}
-
-void marshaller_add_compressed(SpiceMarshaller *m,
- RedCompressBuf *comp_buf, size_t size)
-{
- size_t max = size;
- size_t now;
- do {
- spice_return_if_fail(comp_buf);
- now = MIN(sizeof(comp_buf->buf), max);
- max -= now;
- spice_marshaller_add_ref_full(m, comp_buf->buf.bytes, now,
- marshaller_compress_buf_free, comp_buf);
- comp_buf = comp_buf->send_next;
- } while (max);
-}
-
/* Remove from the to_free list and the instances_list.
When no instance is left - the RedGlzDrawable is released too. (and the qxl drawable too, if
it is not used by Drawable).
diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h
index 88351dc..8c3f22f 100644
--- a/server/dcc-encoders.h
+++ b/server/dcc-encoders.h
@@ -19,7 +19,6 @@
#define DCC_ENCODERS_H_
#include <setjmp.h>
-#include <common/marshaller.h>
#include <common/quic.h>
#include "red-channel.h"
@@ -46,10 +45,6 @@ void dcc_free_glz_drawables_to_free (DisplayChannelClie
void dcc_freeze_glz (DisplayChannelClient *dcc);
void dcc_release_glz (DisplayChannelClient *dcc);
-void marshaller_add_compressed (SpiceMarshaller *m,
- RedCompressBuf *comp_buf,
- size_t size);
-
#define RED_COMPRESS_BUF_SIZE (1024 * 64)
struct RedCompressBuf {
/* This buffer provide space for compression algorithms.
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 5171f9a..6c10565 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -335,6 +335,26 @@ static void fill_base(SpiceMarshaller *base_marshaller, Drawable *drawable)
spice_marshall_DisplayBase(base_marshaller, &base);
}
+static void marshaller_compress_buf_free(uint8_t *data, void *opaque)
+{
+ compress_buf_free(opaque);
+}
+
+static void marshaller_add_compressed(SpiceMarshaller *m,
+ RedCompressBuf *comp_buf, size_t size)
+{
+ size_t max = size;
+ size_t now;
+ do {
+ spice_return_if_fail(comp_buf);
+ now = MIN(sizeof(comp_buf->buf), max);
+ max -= now;
+ spice_marshaller_add_ref_full(m, comp_buf->buf.bytes, now,
+ marshaller_compress_buf_free, comp_buf);
+ comp_buf = comp_buf->send_next;
+ } while (max);
+}
+
/* if the number of times fill_bits can be called per one qxl_drawable increases -
MAX_LZ_DRAWABLE_INSTANCES must be increased as well */
static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
--
2.7.4
More information about the Spice-devel
mailing list