aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/UTF8.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-10-10 21:17:40 +0200
committerMax Kellermann <max@duempel.org>2014-10-10 22:11:38 +0200
commitb70bf938c230bb5e8aafe95094975a8e10109876 (patch)
tree5513db2f04a57a7f51dedc43bfbbc702a10a17f6 /src/util/UTF8.hxx
parentd5cf41e0431db4fd7d28848899015d8b9225eb45 (diff)
downloadmpd-b70bf938c230bb5e8aafe95094975a8e10109876.tar.gz
mpd-b70bf938c230bb5e8aafe95094975a8e10109876.tar.xz
mpd-b70bf938c230bb5e8aafe95094975a8e10109876.zip
util/UTF8: add SequenceLengthUTF8()
Diffstat (limited to 'src/util/UTF8.hxx')
-rw-r--r--src/util/UTF8.hxx16
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