diff options
author | Max Kellermann <max@duempel.org> | 2014-10-10 21:17:40 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-10-10 22:11:38 +0200 |
commit | b70bf938c230bb5e8aafe95094975a8e10109876 (patch) | |
tree | 5513db2f04a57a7f51dedc43bfbbc702a10a17f6 /src/util/UTF8.hxx | |
parent | d5cf41e0431db4fd7d28848899015d8b9225eb45 (diff) | |
download | mpd-b70bf938c230bb5e8aafe95094975a8e10109876.tar.gz mpd-b70bf938c230bb5e8aafe95094975a8e10109876.tar.xz mpd-b70bf938c230bb5e8aafe95094975a8e10109876.zip |
util/UTF8: add SequenceLengthUTF8()
Diffstat (limited to '')
-rw-r--r-- | src/util/UTF8.hxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/util/UTF8.hxx b/src/util/UTF8.hxx index d3d694f6b..82d324f3e 100644 --- a/src/util/UTF8.hxx +++ b/src/util/UTF8.hxx @@ -43,6 +43,22 @@ bool ValidateUTF8(const char *p); /** + * @return the number of the sequence beginning with the given + * character, or 0 if the character is not a valid start byte + */ +gcc_const +size_t +SequenceLengthUTF8(char ch); + +/** + * @return the number of the first sequence in the given string, or 0 + * if the sequence is malformed + */ +gcc_pure +size_t +SequenceLengthUTF8(const char *p); + +/** * Convert the specified string from ISO-8859-1 to UTF-8. * * @return the UTF-8 version of the source string; may return #src if |