dovecot-2.2: lib-charset: Added charset_utf8_to_utf8_begin() wra...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jan 14 23:23:20 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/0e74934072e0
changeset: 18149:0e74934072e0
user: Timo Sirainen <tss at iki.fi>
date: Thu Jan 15 01:05:13 2015 +0200
description:
lib-charset: Added charset_utf8_to_utf8_begin() wrapper function.
It's never supposed to fail, so it makes it nicer for the callers who need
to use it.
diffstat:
src/lib-charset/charset-utf8.c | 10 ++++++++++
src/lib-charset/charset-utf8.h | 3 +++
2 files changed, 13 insertions(+), 0 deletions(-)
diffs (33 lines):
diff -r e645ee117fa9 -r 0e74934072e0 src/lib-charset/charset-utf8.c
--- a/src/lib-charset/charset-utf8.c Thu Jan 15 01:03:58 2015 +0200
+++ b/src/lib-charset/charset-utf8.c Thu Jan 15 01:05:13 2015 +0200
@@ -32,6 +32,16 @@
return 0;
}
+struct charset_translation *
+charset_utf8_to_utf8_begin(normalizer_func_t *normalizer)
+{
+ struct charset_translation *trans;
+
+ if (charset_to_utf8_begin("UTF-8", normalizer, &trans) < 0)
+ i_unreached();
+ return trans;
+}
+
#ifndef HAVE_ICONV
struct charset_translation {
diff -r e645ee117fa9 -r 0e74934072e0 src/lib-charset/charset-utf8.h
--- a/src/lib-charset/charset-utf8.h Thu Jan 15 01:03:58 2015 +0200
+++ b/src/lib-charset/charset-utf8.h Thu Jan 15 01:05:13 2015 +0200
@@ -15,6 +15,9 @@
int charset_to_utf8_begin(const char *charset, normalizer_func_t *normalizer,
struct charset_translation **t_r)
ATTR_NULL(2);
+/* Translate UTF-8 to UTF-8 while validating the input. */
+struct charset_translation *
+charset_utf8_to_utf8_begin(normalizer_func_t *normalizer);
void charset_to_utf8_end(struct charset_translation **t);
void charset_to_utf8_reset(struct charset_translation *t);
More information about the dovecot-cvs
mailing list