]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_insnstr.c
ncurses 6.4 - patch 20240420
[ncurses.git] / ncurses / base / lib_insnstr.c
index 338a96b322ff1d1063b0a4f94a94ab9be7ac9f97..caec48e8eb700825e2c61f3e569a075e28af5fa8 100644 (file)
@@ -41,7 +41,7 @@
 #include <curses.priv.h>
 #include <ctype.h>
 
-MODULE_ID("$Id: lib_insnstr.c,v 1.9 2023/11/18 23:47:19 tom Exp $")
+MODULE_ID("$Id: lib_insnstr.c,v 1.10 2023/11/21 21:58:03 tom Exp $")
 
 NCURSES_EXPORT(int)
 winsnstr(WINDOW *win, const char *s, int n)
@@ -62,7 +62,7 @@ winsnstr(WINDOW *win, const char *s, int n)
         * call to the wins_nwstr() function.
         */
        if (sp->_screen_unicode) {
-           size_t nn = (n >= 0) ? (size_t) n : strlen(s);
+           size_t nn = (n > 0) ? (size_t) n : strlen(s);
            wchar_t *buffer = typeMalloc(wchar_t, nn + 1);
            if (buffer != 0) {
                mbstate_t state;