gutf8: Clarify position of end returned from g_utf8_validate()

It wasn’t previously clear (to me) whether `end` was returned pointing
to the nul terminator, or to the byte immediately preceding it. Try and
clarify that.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2024-09-25 12:57:18 +01:00
parent 7302c04e32
commit f8ba505dc1
No known key found for this signature in database
GPG Key ID: DCDF5885B1F3ED73

View File

@ -1747,9 +1747,10 @@ fast_validate_len (const char *str,
* @str is the text to validate; if @str is nul-terminated, then @max_len can be
* `-1`, otherwise @max_len should be the number of bytes to validate.
*
* If @end is non-`NULL`, then the end of the valid range will be stored there
* (i.e. the start of the first invalid character if some bytes were invalid,
* or the end of the text being validated otherwise).
* If @end is non-`NULL`, then the end of the valid range will be stored there.
* This is the first byte of the first invalid character if some bytes were
* invalid, or the end of the text being validated otherwise either the
* trailing nul byte, or the first byte beyond @max_len (if its positive).
*
* Note that `g_utf8_validate()` returns `FALSE` if @max_len is positive and
* any of the @max_len bytes are nul.