From patchwork Wed Sep 7 19:44:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Devin J. Pohly" X-Patchwork-Id: 113816 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 54C3FB6F64 for ; Thu, 8 Sep 2011 05:45:13 +1000 (EST) Received: from localhost ([::1]:54820 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1O3a-0007Ae-Hz for incoming@patchwork.ozlabs.org; Wed, 07 Sep 2011 15:45:10 -0400 Received: from eggs.gnu.org ([140.186.70.92]:58875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1O3Q-00079K-9S for qemu-devel@nongnu.org; Wed, 07 Sep 2011 15:45:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R1O3K-0005BG-Gf for qemu-devel@nongnu.org; Wed, 07 Sep 2011 15:45:00 -0400 Received: from mail-vx0-f173.google.com ([209.85.220.173]:41667) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1O3K-0005B9-BT for qemu-devel@nongnu.org; Wed, 07 Sep 2011 15:44:54 -0400 Received: by vxi32 with SMTP id 32so10107vxi.4 for ; Wed, 07 Sep 2011 12:44:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=9rfWDJODRhlNhNXSIRX9kZ1Nx2Rcby+sISP7VAN3chE=; b=U+LoV8q42D+oNUbbon0ZzSLzb87hMr6/zTeS4nQNo+EdfxpiftP0xqOI342LTq4LHx e/UuGxkVZskh6TssRiVDbL189Nc2NSFGCDX7nC45TET1RsMRseUWDF5vZqH1AJQ8p9hJ 0ANagSP1Qx0zo9N2j1OldanBeyicuYpapDwtg= Received: by 10.52.35.112 with SMTP id g16mr1962183vdj.24.1315424692775; Wed, 07 Sep 2011 12:44:52 -0700 (PDT) Received: from localhost.localdomain (petronella.cse.psu.edu [130.203.32.247]) by mx.google.com with ESMTPS id kf5sm892874vdb.10.2011.09.07.12.44.51 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 07 Sep 2011 12:44:51 -0700 (PDT) From: "Devin J. Pohly" To: qemu-devel@nongnu.org Date: Wed, 7 Sep 2011 15:44:36 -0400 Message-Id: <1315424676-11172-1-git-send-email-djpohly+launchpad@gmail.com> X-Mailer: git-send-email 1.7.6.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.220.173 Cc: "Devin J. Pohly" Subject: [Qemu-devel] [PATCH] curses: fix garbling when chtype != long X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Devin J. Pohly" Qemu currently assumes that chtype is typedef'd to unsigned long, but this is not necessarily the case (ncurses, for instance, can configure this at build-time). This patch uses the predefined chtype if qemu is configured for curses support and falls back to unsigned long otherwise. Fixes bug 568614. Signed-off-by: Devin J. Pohly --- console.c | 2 ++ console.h | 5 +++++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/console.c b/console.c index 500b3fb..5c7a93b 100644 --- a/console.c +++ b/console.c @@ -343,6 +343,7 @@ static const uint32_t dmask4[4] = { static uint32_t color_table[2][8]; +#ifndef CONFIG_CURSES enum color_names { COLOR_BLACK = 0, COLOR_RED = 1, @@ -353,6 +354,7 @@ enum color_names { COLOR_CYAN = 6, COLOR_WHITE = 7 }; +#endif static const uint32_t color_table_rgb[2][8] = { { /* dark */ diff --git a/console.h b/console.h index 67d1373..9c1487e 100644 --- a/console.h +++ b/console.h @@ -328,7 +328,12 @@ static inline int ds_get_bytes_per_pixel(DisplayState *ds) return ds->surface->pf.bytes_per_pixel; } +#ifdef CONFIG_CURSES +#include +typedef chtype console_ch_t; +#else typedef unsigned long console_ch_t; +#endif static inline void console_write_ch(console_ch_t *dest, uint32_t ch) { if (!(ch & 0xff))