- The input loop control that I changed yesterday to:
while (mbslength >= 0) {
There are circumstances where this causes an extra \000 to
be added at the end of some tests. This error was showing
in my own tests here, but I did not notice it yesterday.
(I really need to add my tests to the test suite, catching
every error by eye is hard.) To fix, I've now changed the
code to increment mbslength only if mbslength == 1 to start
with. (Note that this check for "== 1" is why the arg to
strvisx() in vis(1) must be 1, not mbilen.)
- The cast sequence when manually inserting bytes after a
multibyte conversion error:
*src = (wint_t)(u_char)*mbsrc;
is wrong. This is causing problems in the case when an
8859-1 input string is processed in the UTF-8 locale.
It needs to be:
*src = (wint_t)*mbsrc;
Without the (u_char) all the locale mismatch combinations
then work.
- The code:
if (mblength < len)
len = mblength;
needs to be there. It resets len for the single character
input case after we've actually processed two input
characters (c and nextc) because we incremented mbslength
at the start of the loop. Without this code, single
character conversions end up with a \000 or other byte
appended.