X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fwidechar%2Flib_inwstr.c;h=a4f5b8ea2040b45b756550d3530a125075af47cb;hp=91b1e0f1d2b1b509efe1b7ef9505f60e9cac279a;hb=def73dda3feef55f48cc205a763c06ba1ea70e78;hpb=46722468f47c2b77b3987729b4bcf2321cccfd01 diff --git a/ncurses/widechar/lib_inwstr.c b/ncurses/widechar/lib_inwstr.c index 91b1e0f1..a4f5b8ea 100644 --- a/ncurses/widechar/lib_inwstr.c +++ b/ncurses/widechar/lib_inwstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002 Free Software Foundation, Inc. * + * Copyright (c) 2002-2009,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas Dickey 2002 * + * Author: Thomas Dickey * ****************************************************************************/ /* @@ -39,10 +39,10 @@ #include -MODULE_ID("$Id: lib_inwstr.c,v 1.3 2002/10/06 00:56:36 tom Exp $") +MODULE_ID("$Id: lib_inwstr.c,v 1.6 2011/05/28 22:49:49 tom Exp $") NCURSES_EXPORT(int) -winnwstr(WINDOW *win, wchar_t * wstr, int n) +winnwstr(WINDOW *win, wchar_t *wstr, int n) { int row, col, inx; int count = 0; @@ -50,14 +50,14 @@ winnwstr(WINDOW *win, wchar_t * wstr, int n) cchar_t *text; wchar_t wch; - T((T_CALLED("winnwstr(%p,%p,%d)"), win, wstr, n)); + T((T_CALLED("winnwstr(%p,%p,%d)"), (void *) win, (void *) wstr, n)); if (wstr != 0) { if (win) { getyx(win, row, col); text = win->_line[row].text; while (count < n && count != ERR) { - if (!isnac(text[col])) { + if (!isWidecExt(text[col])) { for (inx = 0; (inx < CCHARW_MAX) && ((wch = text[col].chars[inx]) != 0); ++inx) { @@ -90,11 +90,16 @@ winnwstr(WINDOW *win, wchar_t * wstr, int n) * it does not define what happens for a negative count with winnwstr(). */ NCURSES_EXPORT(int) -winwstr(WINDOW *win, wchar_t * wstr) +winwstr(WINDOW *win, wchar_t *wstr) { int result = OK; - T((T_CALLED("winwstr(%p,%p)"), win, wstr)); - if (winnwstr(win, wstr, CCHARW_MAX * (win->_maxx - win->_curx + 1)) == ERR) + + T((T_CALLED("winwstr(%p,%p)"), (void *) win, (void *) wstr)); + if (win == 0) { + result = ERR; + } else if (winnwstr(win, wstr, + CCHARW_MAX * (win->_maxx - win->_curx + 1)) == ERR) { result = ERR; + } returnCode(result); }