From: Bernhard Kauer <kauer@os.inf.tu-dresden.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] fix curses update
Date: Tue, 20 Apr 2010 11:38:35 +0200 [thread overview]
Message-ID: <20100420093835.GC9079@chrom.inf.tu-dresden.de> (raw)
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 <kauer@tudos.org>
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();
next reply other threads:[~2010-04-20 9:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-20 9:38 Bernhard Kauer [this message]
2010-04-22 1:27 ` [Qemu-devel] [PATCH] fix curses update andrzej zaborowski
2010-04-22 14:08 ` Bernhard Kauer
2010-05-03 18:06 ` Anthony Liguori
2010-05-20 20:53 ` [Qemu-devel] [PATCH] fix curses update - v2 Bernhard Kauer
2010-05-21 12:02 ` andrzej zaborowski
2010-05-21 12:43 ` Bernhard Kauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100420093835.GC9079@chrom.inf.tu-dresden.de \
--to=kauer@os.inf.tu-dresden.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).