* [Qemu-devel] [PATCH] curses: fix garbling when chtype != long
@ 2011-09-07 19:44 Devin J. Pohly
2011-09-09 18:34 ` Anthony Liguori
0 siblings, 1 reply; 2+ messages in thread
From: Devin J. Pohly @ 2011-09-07 19:44 UTC (permalink / raw)
To: qemu-devel; +Cc: Devin J. Pohly
From: "Devin J. Pohly" <djpohly+launchpad@gmail.com>
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 <djpohly+launchpad@gmail.com>
---
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 <curses.h>
+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))
--
1.7.6.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] curses: fix garbling when chtype != long
2011-09-07 19:44 [Qemu-devel] [PATCH] curses: fix garbling when chtype != long Devin J. Pohly
@ 2011-09-09 18:34 ` Anthony Liguori
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2011-09-09 18:34 UTC (permalink / raw)
To: Devin J. Pohly; +Cc: qemu-devel
On 09/07/2011 02:44 PM, Devin J. Pohly wrote:
> From: "Devin J. Pohly"<djpohly+launchpad@gmail.com>
>
> 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<djpohly+launchpad@gmail.com>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
> 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<curses.h>
> +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))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-09 18:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-07 19:44 [Qemu-devel] [PATCH] curses: fix garbling when chtype != long Devin J. Pohly
2011-09-09 18:34 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).