From patchwork Wed May 19 07:24:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Chary X-Patchwork-Id: 52955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BD19DB7D68 for ; Wed, 19 May 2010 17:27:22 +1000 (EST) Received: from localhost ([127.0.0.1]:43071 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OEdgU-00071a-9Y for incoming@patchwork.ozlabs.org; Wed, 19 May 2010 03:27:18 -0400 Received: from [140.186.70.92] (port=54547 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OEdZz-0004AG-Cx for qemu-devel@nongnu.org; Wed, 19 May 2010 03:20:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OEdZu-0008Mx-9P for qemu-devel@nongnu.org; Wed, 19 May 2010 03:20:35 -0400 Received: from iksaif.net ([88.191.73.63]:39103) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OEdZt-0008MB-NV for qemu-devel@nongnu.org; Wed, 19 May 2010 03:20:29 -0400 Received: from localhost.localdomain (localhost [127.0.0.1]) (Authenticated sender: corentincj@iksaif.net) by iksaif.net (Postfix) with ESMTPA id AA02DC9001B; Wed, 19 May 2010 09:24:13 +0200 (CEST) From: Corentin Chary To: qemu-devel@nongnu.org Date: Wed, 19 May 2010 09:24:02 +0200 Message-Id: <1274253852-16068-3-git-send-email-corentincj@iksaif.net> X-Mailer: git-send-email 1.7.0.2 In-Reply-To: <1274253852-16068-1-git-send-email-corentincj@iksaif.net> References: <1274253852-16068-1-git-send-email-corentincj@iksaif.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Corentin Chary , Anthony Liguori , Alexander Graf , Adam Litke Subject: [Qemu-devel] [PATCH v3 02/12] vnc: explain why set_encodings loop is reversed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add a small comment to explain why we need to start from the end of the array to set the right prefered encoding. Signed-off-by: Corentin Chary --- vnc.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/vnc.c b/vnc.c index b1a3fdb..d0402b9 100644 --- a/vnc.c +++ b/vnc.c @@ -1599,6 +1599,11 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) vs->tight_quality = 9; vs->absolute = -1; + /* + * Start from the end because the encodings are sent in order of preference. + * This way the prefered encoding (first encoding defined in the array) + * will be set at the end of the loop. + */ for (i = n_encodings - 1; i >= 0; i--) { enc = encodings[i]; switch (enc) {