From 72f83368653832a7630e9fbda02e516e1aa7faff Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 31 Oct 2010 02:18:46 +0100 Subject: 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. --- lib/util/charset/charset.h | 2 ++ lib/util/charset/util_unistr.c | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'lib') 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) { -- cgit