From ccd2af366de927a0e255eecd2dcbc2158159868d Mon Sep 17 00:00:00 2001 From: William McBrine Date: Tue, 11 Jul 2006 17:21:23 +0000 Subject: [PATCH] One more change to getcchar(): Add the trailing zero only if the text of the cchar_t isn't already zero (i.e., write at most one zero to the destination wchar_t string). --- pdcurses/util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pdcurses/util.c b/pdcurses/util.c index 7820cd63..7202aefb 100644 --- a/pdcurses/util.c +++ b/pdcurses/util.c @@ -27,7 +27,7 @@ #undef delay_output #undef flushinp -RCSID("$Id: util.c,v 1.39 2006/07/10 21:20:51 wmcbrine Exp $"); +RCSID("$Id: util.c,v 1.40 2006/07/11 17:21:23 wmcbrine Exp $"); /*man-start************************************************************** @@ -255,7 +255,8 @@ int getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs, *attrs = (*wcval & (A_ATTRIBUTES & ~A_COLOR)); *color_pair = PAIR_NUMBER(*wcval & A_COLOR); - *++wch = L'\0'; + if (*wch != L'\0') + *++wch = L'\0'; return OK; }