From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O8xXE-0006o7-U9 for qemu-devel@nongnu.org; Mon, 03 May 2010 11:26:17 -0400 Received: from [140.186.70.92] (port=38858 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O8xXD-0006nT-I1 for qemu-devel@nongnu.org; Mon, 03 May 2010 11:26:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O8xXB-0008W6-8E for qemu-devel@nongnu.org; Mon, 03 May 2010 11:26:15 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:60602) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O8xXB-0008Vo-0a for qemu-devel@nongnu.org; Mon, 03 May 2010 11:26:13 -0400 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e35.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o43FKI3n021936 for ; Mon, 3 May 2010 09:20:18 -0600 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o43FPwRe132160 for ; Mon, 3 May 2010 09:25:59 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o43FPufB009253 for ; Mon, 3 May 2010 09:25:56 -0600 Message-ID: <4BDEEB03.9070009@linux.vnet.ibm.com> Date: Mon, 03 May 2010 10:25:55 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1272889879-17563-1-git-send-email-corentincj@iksaif.net> <1272889879-17563-2-git-send-email-corentincj@iksaif.net> In-Reply-To: <1272889879-17563-2-git-send-email-corentincj@iksaif.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 2/2] vnc: set the right prefered encoding List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Corentin Chary Cc: qemu-devel@nongnu.org On 05/03/2010 07:31 AM, Corentin Chary wrote: > > From RFB specs: "The order of the encoding types given in this > message is a hint bby the client as to its preference (the first > encoding specified being most preferred)" > > Signed-off-by: Corentin Chary > --- > vnc.c | 11 +++++++---- > 1 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/vnc.c b/vnc.c > index d332099..ad5b5af 100644 > --- a/vnc.c > +++ b/vnc.c > @@ -1767,7 +1767,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) > > vnc_zlib_init(vs); > vs->features = 0; > - vs->vnc_encoding = 0; > + vs->vnc_encoding = -1; > vs->tight_compression = 9; > vs->tight_quality = 9; > vs->absolute = -1; > @@ -1776,18 +1776,21 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) > enc = encodings[i]; > switch (enc) { > case VNC_ENCODING_RAW: > - vs->vnc_encoding = enc; > + if (vs->vnc_encoding != -1) > + vs->vnc_encoding = enc; > Need braces on the if statement (see CODING_STYLE) but otherwise, this patch makes sense. Regards, Anthony Liguori > break; > case VNC_ENCODING_COPYRECT: > vs->features |= VNC_FEATURE_COPYRECT_MASK; > break; > case VNC_ENCODING_HEXTILE: > vs->features |= VNC_FEATURE_HEXTILE_MASK; > - vs->vnc_encoding = enc; > + if (vs->vnc_encoding != -1) > + vs->vnc_encoding = enc; > break; > case VNC_ENCODING_ZLIB: > vs->features |= VNC_FEATURE_ZLIB_MASK; > - vs->vnc_encoding = enc; > + if (vs->vnc_encoding != -1) > + vs->vnc_encoding = enc; > break; > case VNC_ENCODING_DESKTOPRESIZE: > vs->features |= VNC_FEATURE_RESIZE_MASK; >