gutf8: Fix documentation for g_utf8_get_char_validated() length limits
commit3e89b19c44d353edfafde876e12b56ddd29ef8a4
authorPhilip Withnall <withnall@endlessm.com>
Fri, 17 Mar 2017 12:15:15 +0000 (17 12:15 +0000)
committerPhilip Withnall <withnall@endlessm.com>
Wed, 21 Jun 2017 10:38:46 +0000 (21 11:38 +0100)
treee0647909558fae9f51baf63cb28fdf92e69aa37d
parent428acd9b1486beba186c073577ea659eee44ae0a
gutf8: Fix documentation for g_utf8_get_char_validated() length limits

If g_utf8_get_char_validated() encounters a nul byte in the middle of a
string of given longer length, it returns -2, indicating a partial
gunichar. That is not the obvious behaviour, but since
g_utf8_get_char_validated() has been API for a long time, the behaviour
cannot be changed.

Document it, and add some unit tests (for this behaviour and the other
behaviour of g_utf8_get_char_validated()).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://bugzilla.gnome.org/show_bug.cgi?id=780095
glib/gutf8.c
glib/tests/utf8-validate.c