string, set an end-of-line flag and avoid calling mbrtowc() again
for any of the incomplete characters that remain in the string.
- Use "mbs" for the multi-byte state variable name (for consistency).
- Use the new MB_INVALID and MB_INCOMPLETE defines for the size_t
-1 and -2 values (respectively).
string, set an end-of-line flag and avoid calling mbrtowc() again
for any of the incomplete characters that remain in the string.
- Use "mbs" for the multi-byte state variable name (for consistency).
- Use the new MB_INVALID and MB_INCOMPLETE defines for the size_t
-1 and -2 values (respectively).
- When mbrtowc() returns -2 when given all the remaining chars in a
string, set an end-of-line flag and avoid calling mbrtowc() again
for any of the incomplete characters that remain in the string.
- Use "mbs" for the multi-byte state variable name (for consistency).
- Use the new MB_INVALID and MB_INCOMPLETE defines for the size_t
-1 and -2 values (respectively).
assign it to an int and then check for negativity, as that won't
work on a system where an int is larger than a size_t.
- When mbrtowc() returns -2 when given all the remaining chars in a
string, set an end-of-line flag and avoid calling mbrtowc() again
for any of the incomplete characters that remain in the string.
- Use STOUC() when passing a char value to nicechar().
- Use "mbs" for the multi-byte state variable name (for consistency).
- Be sure to reset the mbs state if mbrtowc() returns -1.
- Use the new MB_INVALID and MB_INCOMPLETE defines for the size_t
-1 and -2 values (respectively).
because "ret" is usually used for a variable name to hold the
return value of the function. Also, changed the test when
checking for a \0 to only check if "cnt" is 0, since we must
always change a value of 0 to 1.
because "ret" is usually used for a variable name to hold the
return value of the function. Also, changed the test when
checking for a \0 to one that checks if "cnt" is 0, since we
must always change a value of 0 to 1.
assign it to an int and then check if it's < 0, as that won't
work on a system where an int is larger than a size_t. Also,
the code that handled partial multibyte characters (that were
assembled from multiple bytes of a metafied string) was not
advancing past all the assembled bytes, nor was it handling the
decoding of a '\0' char (it looks like it could have infinite
looped in that case).
assign it to an int and then check if it's > 0, as that won't
work on a system where an int is larger than a size_t. Also,
we needed to use STOUC() on a char value passed to nicechar(),
and we need to clear the mbstate_t object if mbrtowc() returns
an error.
assign it to an int and then check if it's > 0, as that won't
work on a system where an int is larger than a size_t. Also,
we needed to use STOUC() on a char value passed to nicechar().