From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=38486 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OESPJ-0005IC-Q2 for qemu-devel@nongnu.org; Tue, 18 May 2010 15:24:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OESOY-000312-QV for qemu-devel@nongnu.org; Tue, 18 May 2010 15:24:06 -0400 Received: from mail-fx0-f45.google.com ([209.85.161.45]:33354) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OESOY-00030w-Lb for qemu-devel@nongnu.org; Tue, 18 May 2010 15:24:02 -0400 Received: by fxm15 with SMTP id 15so358021fxm.4 for ; Tue, 18 May 2010 12:24:01 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <753D999A-120B-4FC9-963B-B958DDFFD0D9@suse.de> References: <1274186986-26878-1-git-send-email-corentincj@iksaif.net> <1274186986-26878-2-git-send-email-corentincj@iksaif.net> <4BF28DFB.5020405@suse.de> <753D999A-120B-4FC9-963B-B958DDFFD0D9@suse.de> Date: Tue, 18 May 2010 21:23:17 +0200 Message-ID: From: Corentin Chary Content-Type: text/plain; charset=ISO-8859-1 Subject: [Qemu-devel] Re: [PATCH v2 01/10] vnc: refactor set_encodings List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Anthony Liguori , qemu-devel@nongnu.org, Adam Litke > I don't see your patch reversing the logic? > > Alex > > Before my patch (not this one, but http://git.qemu.org/qemu.git/commit/?id=14eb8b6829ad9dee7035de729e083844a425f274 ), we looped from the last encoding to the first (for (i = n_encodings - 1; i >= 0; i--)), so the code was ok. Commit 14eb8b6829ad9dee7035de729e083844a425f274 was wrong because I wanted `if (encoding == -1) encoding = enc`, not `if (encoding != -1) encoding = enc`. With the current code the encoding will never be set and will always be -1. And this patch (refactor set_encoding) is also wrong, because it will only set the first encoding (which is in fact the last, because we start from the end of the array). I believe that the right thing to do is to revert 14eb8b6829ad9dee7035de729e083844a425f274 and add some comments to explain why we loop in reverse order. -- Corentin Chary http://xf.iksaif.net