aboutsummaryrefslogtreecommitdiff
path: root/ui/vnc-enc-zlib.c
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2010-07-07 20:57:59 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-07-26 17:36:14 -0500
commitd1af0e056a5a3681dc82a2e715bb292c6d300def (patch)
treeb03d5a92a61694920d527bcd1763bbd3574ff28f /ui/vnc-enc-zlib.c
parent5136a0526989fdfd8799ae4e29ff43d5b80ee37e (diff)
vnc: encapsulate encoding members
This will allow to implement the threaded VNC server in a more cleaner way. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'ui/vnc-enc-zlib.c')
-rw-r--r--ui/vnc-enc-zlib.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/ui/vnc-enc-zlib.c b/ui/vnc-enc-zlib.c
index a99bc387dc..3c6e6abf94 100644
--- a/ui/vnc-enc-zlib.c
+++ b/ui/vnc-enc-zlib.c
@@ -47,21 +47,21 @@ void vnc_zlib_zfree(void *x, void *addr)
static void vnc_zlib_start(VncState *vs)
{
- buffer_reset(&vs->zlib);
+ buffer_reset(&vs->zlib.zlib);
// make the output buffer be the zlib buffer, so we can compress it later
- vs->zlib_tmp = vs->output;
- vs->output = vs->zlib;
+ vs->zlib.tmp = vs->output;
+ vs->output = vs->zlib.zlib;
}
static int vnc_zlib_stop(VncState *vs)
{
- z_streamp zstream = &vs->zlib_stream;
+ z_streamp zstream = &vs->zlib.stream;
int previous_out;
// switch back to normal output/zlib buffers
- vs->zlib = vs->output;
- vs->output = vs->zlib_tmp;
+ vs->zlib.zlib = vs->output;
+ vs->output = vs->zlib.tmp;
// compress the zlib buffer
@@ -75,7 +75,7 @@ static int vnc_zlib_stop(VncState *vs)
zstream->zalloc = vnc_zlib_zalloc;
zstream->zfree = vnc_zlib_zfree;
- err = deflateInit2(zstream, vs->tight_compression, Z_DEFLATED, MAX_WBITS,
+ err = deflateInit2(zstream, vs->tight.compression, Z_DEFLATED, MAX_WBITS,
MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);
if (err != Z_OK) {
@@ -83,24 +83,24 @@ static int vnc_zlib_stop(VncState *vs)
return -1;
}
- vs->zlib_level = vs->tight_compression;
+ vs->zlib.level = vs->tight.compression;
zstream->opaque = vs;
}
- if (vs->tight_compression != vs->zlib_level) {
- if (deflateParams(zstream, vs->tight_compression,
+ if (vs->tight.compression != vs->zlib.level) {
+ if (deflateParams(zstream, vs->tight.compression,
Z_DEFAULT_STRATEGY) != Z_OK) {
return -1;
}
- vs->zlib_level = vs->tight_compression;
+ vs->zlib.level = vs->tight.compression;
}
// reserve memory in output buffer
- buffer_reserve(&vs->output, vs->zlib.offset + 64);
+ buffer_reserve(&vs->output, vs->zlib.zlib.offset + 64);
// set pointers
- zstream->next_in = vs->zlib.buffer;
- zstream->avail_in = vs->zlib.offset;
+ zstream->next_in = vs->zlib.zlib.buffer;
+ zstream->avail_in = vs->zlib.zlib.offset;
zstream->next_out = vs->output.buffer + vs->output.offset;
zstream->avail_out = vs->output.capacity - vs->output.offset;
zstream->data_type = Z_BINARY;
@@ -145,8 +145,8 @@ int vnc_zlib_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
void vnc_zlib_clear(VncState *vs)
{
- if (vs->zlib_stream.opaque) {
- deflateEnd(&vs->zlib_stream);
+ if (vs->zlib.stream.opaque) {
+ deflateEnd(&vs->zlib.stream);
}
- buffer_free(&vs->zlib);
+ buffer_free(&vs->zlib.zlib);
}