dovecot: Renamed ucase parameters to dtcase which is more correct.

dovecot at dovecot.org dovecot at dovecot.org
Fri Jul 20 17:39:17 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/fd9f6b4d846e
changeset: 6133:fd9f6b4d846e
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jul 20 17:39:08 2007 +0300
description:
Renamed ucase parameters to dtcase which is more correct.

diffstat:

4 files changed, 20 insertions(+), 19 deletions(-)
src/lib-mail/message-decoder.c       |   16 ++++++++--------
src/lib-mail/message-decoder.h       |    5 +++--
src/lib-mail/message-header-decode.c |   10 +++++-----
src/lib-mail/message-header-decode.h |    8 ++++----

diffs (143 lines):

diff -r d01522d276f6 -r fd9f6b4d846e src/lib-mail/message-decoder.c
--- a/src/lib-mail/message-decoder.c	Fri Jul 20 17:37:05 2007 +0300
+++ b/src/lib-mail/message-decoder.c	Fri Jul 20 17:39:08 2007 +0300
@@ -42,16 +42,16 @@ struct message_decoder_context {
 	char *content_charset;
 	enum content_type content_type;
 
-	unsigned int ucase:1;
+	unsigned int dtcase:1;
 	unsigned int charset_utf8:1;
 };
 
-struct message_decoder_context *message_decoder_init(bool ucase)
+struct message_decoder_context *message_decoder_init(bool dtcase)
 {
 	struct message_decoder_context *ctx;
 
 	ctx = i_new(struct message_decoder_context, 1);
-	ctx->ucase = ucase;
+	ctx->dtcase = dtcase;
 	ctx->buf = buffer_create_dynamic(default_pool, 8192);
 	ctx->buf2 = buffer_create_dynamic(default_pool, 8192);
 	return ctx;
@@ -156,10 +156,10 @@ static bool message_decode_header(struct
 
 	buffer_set_used_size(ctx->buf, 0);
 	message_header_decode_utf8(hdr->full_value, hdr->full_value_len,
-				   ctx->buf, ctx->ucase);
+				   ctx->buf, ctx->dtcase);
 	value_len = ctx->buf->used;
 
-	if (ctx->ucase) {
+	if (ctx->dtcase) {
 		(void)uni_utf8_to_decomposed_titlecase(hdr->name, hdr->name_len,
 						       ctx->buf);
 		buffer_append_c(ctx->buf, '\0');
@@ -169,7 +169,7 @@ static bool message_decode_header(struct
 	ctx->hdr.full_value = ctx->buf->data;
 	ctx->hdr.full_value_len = value_len;
 	ctx->hdr.value_len = 0;
-	if (ctx->ucase) {
+	if (ctx->dtcase) {
 		ctx->hdr.name = CONST_PTR_OFFSET(ctx->buf->data,
 						 ctx->hdr.full_value_len);
 		ctx->hdr.name_len = ctx->buf->used - 1 - value_len;
@@ -217,7 +217,7 @@ static bool message_decode_body(struct m
 	if (ctx->charset_trans == NULL && !ctx->charset_utf8) {
 		if (charset_to_utf8_begin(ctx->content_charset != NULL ?
 					  ctx->content_charset : "UTF-8",
-					  ctx->ucase, &ctx->charset_trans) < 0)
+					  ctx->dtcase, &ctx->charset_trans) < 0)
 			ctx->charset_trans = NULL;
 	}
 
@@ -296,7 +296,7 @@ static bool message_decode_body(struct m
 	}
 
 	if (ctx->charset_utf8) {
-		if (ctx->ucase) {
+		if (ctx->dtcase) {
 			buffer_set_used_size(ctx->buf2, 0);
 			(void)uni_utf8_to_decomposed_titlecase(data, size,
 							       ctx->buf);
diff -r d01522d276f6 -r fd9f6b4d846e src/lib-mail/message-decoder.h
--- a/src/lib-mail/message-decoder.h	Fri Jul 20 17:37:05 2007 +0300
+++ b/src/lib-mail/message-decoder.h	Fri Jul 20 17:39:08 2007 +0300
@@ -5,8 +5,9 @@ struct message_block;
 
 /* Decode message's contents as UTF-8, both the headers and the MIME bodies.
    The bodies are decoded from quoted-printable and base64 formats if needed.
-   If ucase=TRUE, the data is returned uppercased. */
-struct message_decoder_context *message_decoder_init(bool ucase);
+   If dtcase=TRUE, the data is returned through
+   uni_utf8_to_decomposed_titlecase(). */
+struct message_decoder_context *message_decoder_init(bool dtcase);
 void message_decoder_deinit(struct message_decoder_context **ctx);
 
 /* Decode input and return decoded output. Headers are returned only in their
diff -r d01522d276f6 -r fd9f6b4d846e src/lib-mail/message-header-decode.c
--- a/src/lib-mail/message-header-decode.c	Fri Jul 20 17:37:05 2007 +0300
+++ b/src/lib-mail/message-header-decode.c	Fri Jul 20 17:39:08 2007 +0300
@@ -120,7 +120,7 @@ struct decode_utf8_context {
 	buffer_t *dest;
 	unsigned int changed:1;
 	unsigned int called:1;
-	unsigned int ucase:1;
+	unsigned int dtcase:1;
 };
 
 static bool
@@ -138,7 +138,7 @@ decode_utf8_callback(const unsigned char
 
 	if (charset == NULL || charset_is_utf8(charset)) {
 		/* ASCII / UTF-8 */
-		if (ctx->ucase) {
+		if (ctx->dtcase) {
 			(void)uni_utf8_to_decomposed_titlecase(data, size,
 							       ctx->dest);
 		} else {
@@ -147,7 +147,7 @@ decode_utf8_callback(const unsigned char
 		return TRUE;
 	}
 
-	if (charset_to_utf8_begin(charset, ctx->ucase, &t) < 0) {
+	if (charset_to_utf8_begin(charset, ctx->dtcase, &t) < 0) {
 		/* let's just ignore this part */
 		return TRUE;
 	}
@@ -159,14 +159,14 @@ decode_utf8_callback(const unsigned char
 }
 
 bool message_header_decode_utf8(const unsigned char *data, size_t size,
-				buffer_t *dest, bool ucase)
+				buffer_t *dest, bool dtcase)
 {
 	struct decode_utf8_context ctx;
 	size_t used = dest->used;
 
 	memset(&ctx, 0, sizeof(ctx));
 	ctx.dest = dest;
-	ctx.ucase = ucase;
+	ctx.dtcase = dtcase;
 	message_header_decode(data, size, decode_utf8_callback, &ctx);
 	return ctx.changed || (dest->used - used != size);
 }
diff -r d01522d276f6 -r fd9f6b4d846e src/lib-mail/message-header-decode.h
--- a/src/lib-mail/message-header-decode.h	Fri Jul 20 17:37:05 2007 +0300
+++ b/src/lib-mail/message-header-decode.h	Fri Jul 20 17:39:08 2007 +0300
@@ -13,10 +13,10 @@ void message_header_decode(const unsigne
 			   message_header_decode_callback_t *callback,
 			   void *context);
 
-/* Append decoded RFC2047 header as UTF-8 to given buffer. If ucase=TRUE,
-   the header is appended uppercased. Returns TRUE if output changed in any
-   way from input. */
+/* Append decoded RFC2047 header as UTF-8 to given buffer. If dtcase=TRUE,
+   the header is appended through uni_utf8_to_decomposed_titlecase().
+   Returns TRUE if output changed in any way from input. */
 bool message_header_decode_utf8(const unsigned char *data, size_t size,
-				buffer_t *dest, bool ucase);
+				buffer_t *dest, bool dtcase);
 
 #endif


More information about the dovecot-cvs mailing list