]> Sergey Matveev's repositories - nnn.git/commitdiff
mbstowcs() returns the codepoints
authorArun Prakash Jana <engineerarun@gmail.com>
Fri, 25 Aug 2017 12:57:06 +0000 (18:27 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Fri, 25 Aug 2017 12:57:06 +0000 (18:27 +0530)
nnn.c

diff --git a/nnn.c b/nnn.c
index 5397be1a4b6d63f441d71309ae39795ecb7884b8..02b2bd65327ce9f1669a0a2322c76d8821b99caf 100644 (file)
--- a/nnn.c
+++ b/nnn.c
@@ -1013,10 +1013,9 @@ xreadline(char *fname)
        size_t buflen = NAME_MAX - 1;
 
        DPRINTF_S(fname)
-       mbstowcs(buf, fname, NAME_MAX);
-       len = pos = wcslen(buf);
+       len = pos = mbstowcs(buf, fname, NAME_MAX);
        /* For future: handle NULL, say for a new name */
-       if (len <= 0) {
+       if (len == (size_t)-1) {
                buf[0] = '\0';
                len = pos = 0;
        }