aboutsummaryrefslogtreecommitdiff
path: root/vnc-encoding-zlib.c
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2010-05-19 09:24:05 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-06-01 12:53:09 -0500
commit9f643ec0f81c1836ce55319709dd387e27c55d3b (patch)
treef6ca69f720011fb0215794f19faf265ae4a6ab29 /vnc-encoding-zlib.c
parentb05ad290e2a5d9074179fede31d54371e1a09a6a (diff)
vnc: adjust compression zstream level
Adjust zlib compression level if needed by calling deflateParams. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vnc-encoding-zlib.c')
-rw-r--r--vnc-encoding-zlib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/vnc-encoding-zlib.c b/vnc-encoding-zlib.c
index 6a16a79947..29dd1b7aee 100644
--- a/vnc-encoding-zlib.c
+++ b/vnc-encoding-zlib.c
@@ -83,10 +83,17 @@ static int vnc_zlib_stop(VncState *vs)
return -1;
}
+ vs->zlib_level = vs->tight_compression;
zstream->opaque = vs;
}
- // XXX what to do if tight_compression changed in between?
+ 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;
+ }
// reserve memory in output buffer
buffer_reserve(&vs->output, vs->zlib.offset + 64);