Commit 65658ef5 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

make sure the multibyte string operations operate using multibyte

character counts instead of byte character counts


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2280 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent 18d616f2
Showing with 6 additions and 6 deletions
+6 -6
......@@ -552,12 +552,12 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
ws2 = (unsigned char)*s2_mb;
}
if (s1_mb_len > n || towlower(ws1) != towlower(ws2))
if (n == 0 || towlower(ws1) != towlower(ws2))
break;
s1 += s1_mb_len;
s2 += s2_mb_len;
n -= s1_mb_len;
n--;
}
free(s1_mb);
......@@ -648,16 +648,16 @@ size_t mbstrnlen(const char *s, size_t maxlen)
#endif
, NULL);
if (s_mb_len > maxlen)
if (maxlen == 0)
break;
maxlen -= s_mb_len;
maxlen--;
n += s_mb_len;
}
free(s_mb);
return n;
return strnlenpt(s, n);
} else
#endif
return
......
......@@ -84,7 +84,7 @@ void not_found_msg(const char *str)
assert(str != NULL);
disp = display_string(str, 0, (COLS / 2) + 1, FALSE);
numchars = mbstrnlen(disp, actual_x(disp, COLS / 2));
numchars = actual_x(disp, mbstrnlen(disp, COLS / 2));
statusbar(_("\"%.*s%s\" not found"), numchars, disp,
(disp[numchars] == '\0') ? "" : "...");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment