From patchwork Thu May 20 20:53:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Kauer X-Patchwork-Id: 53106 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 18340B7D2F for ; Fri, 21 May 2010 06:54:32 +1000 (EST) Received: from localhost ([127.0.0.1]:35491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFClB-0006SS-85 for incoming@patchwork.ozlabs.org; Thu, 20 May 2010 16:54:29 -0400 Received: from [140.186.70.92] (port=58100 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFCkT-0006OK-CT for qemu-devel@nongnu.org; Thu, 20 May 2010 16:53:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFCkO-0002E7-Tg for qemu-devel@nongnu.org; Thu, 20 May 2010 16:53:45 -0400 Received: from os.inf.tu-dresden.de ([141.76.48.99]:34931) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFCkO-0002Dr-OU for qemu-devel@nongnu.org; Thu, 20 May 2010 16:53:40 -0400 Received: from erwin.inf.tu-dresden.de ([141.76.48.80] helo=chrom.inf.tu-dresden.de) by os.inf.tu-dresden.de with esmtps (TLSv1:AES256-SHA:256) (Exim 4.71) id 1OFCkL-0000GW-WB; Thu, 20 May 2010 22:53:38 +0200 Received: from kauer by chrom.inf.tu-dresden.de with local (Exim 4.71) (envelope-from ) id 1OFCkL-0005Yy-3f; Thu, 20 May 2010 22:53:37 +0200 Date: Thu, 20 May 2010 22:53:37 +0200 From: Bernhard Kauer To: Anthony Liguori Subject: [Qemu-devel] [PATCH] fix curses update - v2 Message-ID: <20100520205337.GC2938@chrom.inf.tu-dresden.de> References: <20100420093835.GC9079@chrom.inf.tu-dresden.de> <20100422140811.GA27272@chrom.inf.tu-dresden.de> <4BDF10B6.80709@codemonkey.ws> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4BDF10B6.80709@codemonkey.ws> User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: qemu-devel@nongnu.org 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 On Mon, May 03, 2010 at 01:06:46PM -0500, Anthony Liguori wrote: > On 04/22/2010 09:08 AM, Bernhard Kauer wrote: > >Hi, > > > >>I believe this issue has come up before with a similar patch but > >well i've submitted such a patch more than two years ago. Unfortunatelly > >it got never applied, so that I have to patch my Qemu on every update... > > > > > >>someone checked their ncurses and they didn't see the same issue. > >>I just checked and here mvwaddchnstr() does not expect a null-terminated > >>string either, but it skips the \0 characters. > >This is not conforming to the Single UNIX Specification, which states > >that the string is shown "until a null chtype is encountered". See for > >example: > > http://www.opengroup.org/onlinepubs/007908775/xcurses/addchstr.html > > > > > >> So probably we should > >>replace them with spaces or something else, I wouldn't like to > >>replace a single library call with 80 calls, it's better to go through > >>the string and replace them, maybe in console_write_ch or somewhere > >>else. > >That would be a one-liner. Should I send such a patch? > > Yes. Replace the \0 character with a space to allow to use mvwaddchnstr for full-screen updates in curses mode. Signed-off-by: Bernhard Kauer diff --git a/console.h b/console.h index 6def115..42ff822 100644 --- a/console.h +++ b/console.h @@ -306,6 +306,7 @@ static inline int ds_get_bytes_per_pixel(DisplayState *ds) typedef unsigned long console_ch_t; static inline void console_write_ch(console_ch_t *dest, uint32_t ch) { + if (!(ch & 0xff)) ch = 0x20; cpu_to_le32wu((uint32_t *) dest, ch); }