[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] fix curses update
From: |
Bernhard Kauer |
Subject: |
[Qemu-devel] [PATCH] fix curses update |
Date: |
Tue, 20 Apr 2010 11:38:35 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
If a terminal is resized or the VGA model issues a full refresh, curses_update()
is called, which uses mvwaddchnstr() to draw a full line of characters.
Unfortunatelly
this routine expects a null-terminated string and early aborts if a null is
present
in the line.
When booting an OS that zeros the VGA text buffer and later pokes single
characters,
the console output can become unreadable. The attached patch corrects this bug.
Bernhard Kauer
Signed-off-by: Bernhard Kauer <address@hidden>
diff --git a/curses.c b/curses.c
index ed3165e..9bf9265 100644
--- a/curses.c
+++ b/curses.c
@@ -48,10 +48,12 @@ static int px, py, sminx, sminy, smaxx, smaxy;
static void curses_update(DisplayState *ds, int x, int y, int w, int h)
{
chtype *line;
+ int i;
line = ((chtype *) screen) + y * width;
for (h += y; y < h; y ++, line += width)
- mvwaddchnstr(screenpad, y, 0, line, width);
+ for (i = 0; i < width; i++)
+ mvwaddch(screenpad, y, i, (line[i] & 0xff) ? line[i] : ' ');
pnoutrefresh(screenpad, py, px, sminy, sminx, smaxy - 1, smaxx - 1);
refresh();
- [Qemu-devel] [PATCH] fix curses update,
Bernhard Kauer <=