mirror of https://git.tukaani.org/xz.git
tuklib_mbstr_width: Update a comment about shift states
This commit is contained in:
parent
7ff1b0ac53
commit
51081efae4
|
@ -62,9 +62,14 @@ tuklib_mbstr_width(const char *str, size_t *bytes)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Require that the string ends in the initial shift state.
|
// It's good to check that the string ended in the initial state.
|
||||||
// This way the caller can be combine the string with other
|
// However, in practice this is redundant:
|
||||||
// strings without needing to worry about the shift states.
|
//
|
||||||
|
// - No one will use this code with character sets that have
|
||||||
|
// locking shift states.
|
||||||
|
//
|
||||||
|
// - We already checked that mbrtowc() didn't return (size_t)-2
|
||||||
|
// which would indicate a partial multibyte character.
|
||||||
if (!mbsinit(&state))
|
if (!mbsinit(&state))
|
||||||
return (size_t)-1;
|
return (size_t)-1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue