From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=32771 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJYqX-0007a3-1x for qemu-devel@nongnu.org; Tue, 01 Jun 2010 17:18:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJYqV-0008K5-04 for qemu-devel@nongnu.org; Tue, 01 Jun 2010 17:18:00 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:34305) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJYqU-0008Jz-U6 for qemu-devel@nongnu.org; Tue, 01 Jun 2010 17:17:58 -0400 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by e9.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id o51L3nJd003517 for ; Tue, 1 Jun 2010 17:03:49 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o51LHvK5130256 for ; Tue, 1 Jun 2010 17:17:57 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o51LHuPf018019 for ; Tue, 1 Jun 2010 17:17:56 -0400 Message-ID: <4C0578FB.90304@linux.vnet.ibm.com> Date: Tue, 01 Jun 2010 16:17:47 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect References: <1275426344-26549-1-git-send-email-corentincj@iksaif.net> <1275426344-26549-2-git-send-email-corentincj@iksaif.net> In-Reply-To: <1275426344-26549-2-git-send-email-corentincj@iksaif.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Corentin Chary Cc: Adam Litke , qemu-devel@nongnu.org, Alexander Graf On 06/01/2010 04:05 PM, Corentin Chary wrote: > A simple patch would have been to just remove count -= 1, but this > one also replace the while (count--) with a for(i = 0; i< count; i++) > which I believe is more easy to understand. > > Signed-off-by: Corentin Chary > Applied all. Thanks. Regards, Anthony Liguori > --- > vnc-encoding-tight.c | 9 ++++----- > 1 files changed, 4 insertions(+), 5 deletions(-) > > diff --git a/vnc-encoding-tight.c b/vnc-encoding-tight.c > index 50be44e..c8effe6 100644 > --- a/vnc-encoding-tight.c > +++ b/vnc-encoding-tight.c > @@ -249,18 +249,16 @@ static void print_palette(const char *key, QObject *obj, void *opaque) > uint##bpp##_t *src; \ > uint##bpp##_t rgb; \ > uint8_t key[6]; \ > - int rep = 0; \ > + int i, rep; \ > uint8_t idx; \ > \ > src = (uint##bpp##_t *) buf; \ > \ > - count -= 1; \ > - while (count--) { \ > + for (i = 0; i< count; i++) { \ > rgb = *src++; \ > rep = 0; \ > - while (count&& *src == rgb) { \ > - rep++, src++, count--; \ > + while (i< count&& *src == rgb) { \ > + rep++, src++, i++; \ > } \ > tight_palette_rgb2buf(rgb, bpp, key); \ > if (!qdict_haskey(palette, (char *)key)) { \ >