dovecot: _charset_utf8_ucase() -> charset_utf8_ucase_write(),

dovecot at dovecot.org dovecot at dovecot.org
Fri Jul 20 06:15:23 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/325667778ae3
changeset: 6114:325667778ae3
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jul 20 06:15:20 2007 +0300
description:
_charset_utf8_ucase() -> charset_utf8_ucase_write(),
_charset_utf8_ucase_strdup() -> charset_utf8_ucase_strdup()

diffstat:

4 files changed, 23 insertions(+), 21 deletions(-)
src/lib-charset/charset-iconv.c |    9 +++++----
src/lib-charset/charset-utf8.c  |   16 ++++++++--------
src/lib-charset/charset-utf8.h  |    8 ++++----
src/lib-mail/message-decoder.c  |   11 ++++++-----

diffs (143 lines):

diff -r adbfce5bf7d9 -r 325667778ae3 src/lib-charset/charset-iconv.c
--- a/src/lib-charset/charset-iconv.c	Fri Jul 20 06:11:03 2007 +0300
+++ b/src/lib-charset/charset-iconv.c	Fri Jul 20 06:15:20 2007 +0300
@@ -74,7 +74,7 @@ charset_to_utf8(struct charset_translati
 		if (*src_size > destleft)
 			*src_size = destleft;
 		if (t->ucase)
-			_charset_utf8_ucase(src, *src_size, dest, destpos);
+			charset_utf8_ucase_write(dest, destpos, src, *src_size);
 		else
 			buffer_write(dest, destpos, src, *src_size);
 		return CHARSET_RET_OK;
@@ -103,8 +103,9 @@ charset_to_utf8(struct charset_translati
 
 	*src_size -= srcleft;
 	if (t->ucase) {
-		_charset_utf8_ucase((unsigned char *) ic_destbuf - size, size,
-				    dest, destpos);
+		charset_utf8_ucase_write(dest, destpos,
+					 (unsigned char *)ic_destbuf - size,
+					 size);
 	} else {
 		buffer_write(dest, destpos, ic_destbuf - size, size);
 	}
@@ -157,7 +158,7 @@ charset_to_utf8_string_int(const char *c
 			return t_strndup(data, size);
 		}
 
-		return _charset_utf8_ucase_strdup(data, size, utf8_size_r);
+		return charset_utf8_ucase_strdup(data, size, utf8_size_r);
 	}
 
 	cd = iconv_open("UTF-8", charset);
diff -r adbfce5bf7d9 -r 325667778ae3 src/lib-charset/charset-utf8.c
--- a/src/lib-charset/charset-utf8.c	Fri Jul 20 06:11:03 2007 +0300
+++ b/src/lib-charset/charset-utf8.c	Fri Jul 20 06:15:20 2007 +0300
@@ -14,8 +14,8 @@ bool charset_is_utf8(const char *charset
 		strcasecmp(charset, "UTF8") == 0;
 }
 
-void _charset_utf8_ucase(const unsigned char *src, size_t src_size,
-			 buffer_t *dest, size_t destpos)
+void charset_utf8_ucase_write(buffer_t *dest, size_t destpos,
+			      const unsigned char *src, size_t src_size)
 {
 	char *destbuf;
 	size_t i;
@@ -25,13 +25,13 @@ void _charset_utf8_ucase(const unsigned 
 		destbuf[i] = i_toupper(src[i]); /* FIXME: utf8 */
 }
 
-const char *_charset_utf8_ucase_strdup(const unsigned char *data, size_t size,
-				       size_t *utf8_size_r)
+const char *charset_utf8_ucase_strdup(const unsigned char *data, size_t size,
+				      size_t *utf8_size_r)
 {
 	buffer_t *dest;
 
 	dest = buffer_create_dynamic(pool_datastack_create(), size);
-	_charset_utf8_ucase(data, size, dest, 0);
+	charset_utf8_ucase_write(dest, 0, data, size);
 	if (utf8_size_r != NULL)
 		*utf8_size_r = buffer_get_used_size(dest);
 	buffer_append_c(dest, '\0');
@@ -90,7 +90,7 @@ charset_to_utf8(struct charset_translati
 
 	/* no translation needed - just copy it to outbuf uppercased */
 	if (t == &utf8_translation_uc || t == &ascii_translation_uc)
-		_charset_utf8_ucase(src, *src_size, dest, destpos);
+		charset_utf8_ucase_write(dest, destpos, src, *src_size);
 	else
 		buffer_write(dest, destpos, src, *src_size);
 	return CHARSET_RET_OK;
@@ -102,7 +102,7 @@ charset_to_utf8_full(struct charset_tran
 		     buffer_t *dest)
 {
 	if (t == &utf8_translation_uc || t == &ascii_translation_uc)
-		_charset_utf8_ucase(src, *src_size, dest, dest->used);
+		charset_utf8_ucase_write(dest, dest->used, src, *src_size);
 	else
 		buffer_append(dest, src, *src_size);
 	return CHARSET_RET_OK;
@@ -137,7 +137,7 @@ charset_to_ucase_utf8_string(const char 
 	if (charset == NULL || charset_is_utf8(charset)) {
 		if (unknown_charset != NULL)
 			*unknown_charset = FALSE;
-		return _charset_utf8_ucase_strdup(data, size, utf8_size_r);
+		return charset_utf8_ucase_strdup(data, size, utf8_size_r);
 	} else {
 		if (unknown_charset != NULL)
 			*unknown_charset = TRUE;
diff -r adbfce5bf7d9 -r 325667778ae3 src/lib-charset/charset-utf8.h
--- a/src/lib-charset/charset-utf8.h	Fri Jul 20 06:11:03 2007 +0300
+++ b/src/lib-charset/charset-utf8.h	Fri Jul 20 06:15:20 2007 +0300
@@ -42,9 +42,9 @@ charset_to_ucase_utf8_string(const char 
 			     const unsigned char *data, size_t size,
 			     size_t *utf8_size_r);
 
-void _charset_utf8_ucase(const unsigned char *src, size_t src_size,
-			 buffer_t *dest, size_t destpos);
-const char *_charset_utf8_ucase_strdup(const unsigned char *data, size_t size,
-				       size_t *utf8_size_r);
+void charset_utf8_ucase_write(buffer_t *dest, size_t destpos,
+			      const unsigned char *src, size_t src_size);
+const char *charset_utf8_ucase_strdup(const unsigned char *data, size_t size,
+				      size_t *utf8_size_r);
 
 #endif
diff -r adbfce5bf7d9 -r 325667778ae3 src/lib-mail/message-decoder.c
--- a/src/lib-mail/message-decoder.c	Fri Jul 20 06:11:03 2007 +0300
+++ b/src/lib-mail/message-decoder.c	Fri Jul 20 06:15:20 2007 +0300
@@ -82,8 +82,8 @@ message_decode_header_callback(const uns
 	if (charset == NULL || charset_is_utf8(charset)) {
 		/* ASCII / UTF-8 */
 		if (ctx->ucase) {
-			_charset_utf8_ucase(data, size, ctx->buf,
-					    ctx->buf->used);
+			charset_utf8_ucase_write(ctx->buf, ctx->buf->used,
+						 data, size);
 		} else {
 			buffer_append(ctx->buf, data, size);
 		}
@@ -177,8 +177,9 @@ static bool message_decode_header(struct
 	value_len = ctx->buf->used;
 
 	if (ctx->ucase) {
-		_charset_utf8_ucase((const unsigned char *)hdr->name,
-				    hdr->name_len, ctx->buf, ctx->buf->used);
+		charset_utf8_ucase_write(ctx->buf, ctx->buf->used,
+					 (const unsigned char *)hdr->name,
+					 hdr->name_len);
 		buffer_append_c(ctx->buf, '\0');
 	}
 
@@ -318,7 +319,7 @@ static bool message_decode_body(struct m
 	if (ctx->charset_utf8) {
 		if (ctx->ucase) {
 			buffer_set_used_size(ctx->buf2, 0);
-			_charset_utf8_ucase(data, size, ctx->buf2, 0);
+			charset_utf8_ucase_write(ctx->buf2, 0, data, size);
 			output->data = ctx->buf2->data;
 			output->size = ctx->buf2->used;
 		} else {


More information about the dovecot-cvs mailing list