diff options
author | Michael Adam <obnox@samba.org> | 2010-10-31 02:18:46 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2010-11-03 22:45:20 +0000 |
commit | 72f83368653832a7630e9fbda02e516e1aa7faff (patch) | |
tree | e639300fcbf04fede9b138dc37c633c2a9f5fc66 /lib/util | |
parent | 7a2b03964cdd12733e7ae812d463351b968d16ac (diff) | |
download | samba-72f83368653832a7630e9fbda02e516e1aa7faff.tar.gz samba-72f83368653832a7630e9fbda02e516e1aa7faff.tar.bz2 samba-72f83368653832a7630e9fbda02e516e1aa7faff.zip |
lib/charcnv/util_unistr: add next_codepoint_ext() that accepts input charset.
next_codepoint() takes as string in CH_UNIX encoding and returns the
unicode codepoint of the next (possibly multibyte) character of the
input string.
The new next_codepoint_ext() function adds the encoding of the input
string as a parameter. next_codepoint() now only calls next_codepoint_ext()
with CH_UNIX als src_charset argument.
Diffstat (limited to 'lib/util')
-rw-r--r-- | lib/util/charset/charset.h | 2 | ||||
-rw-r--r-- | lib/util/charset/util_unistr.c | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h index 7960631484..283212dbff 100644 --- a/lib/util/charset/charset.h +++ b/lib/util/charset/charset.h @@ -168,6 +168,8 @@ ssize_t iconv_talloc(TALLOC_CTX *mem_ctx, extern struct smb_iconv_convenience *global_iconv_convenience; +codepoint_t next_codepoint_ext(const char *str, charset_t src_charset, + size_t *size); codepoint_t next_codepoint(const char *str, size_t *size); ssize_t push_codepoint(char *str, codepoint_t c); diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c index 520ce05468..79a9ffe3df 100644 --- a/lib/util/charset/util_unistr.c +++ b/lib/util/charset/util_unistr.c @@ -992,6 +992,12 @@ _PUBLIC_ bool convert_string_talloc(TALLOC_CTX *ctx, allow_badcharcnv); } +_PUBLIC_ codepoint_t next_codepoint_ext(const char *str, charset_t src_charset, + size_t *size) +{ + return next_codepoint_convenience_ext(get_iconv_convenience(), str, + src_charset, size); +} _PUBLIC_ codepoint_t next_codepoint(const char *str, size_t *size) { |