dovecot: Fixed message_header_decode_utf8() to return FALSE also...

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


details:   http://hg.dovecot.org/dovecot/rev/d3299ed1332a
changeset: 6123:d3299ed1332a
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jul 20 16:45:03 2007 +0300
description:
Fixed message_header_decode_utf8() to return FALSE also for single
ASCII/UTF-8 encoded-words.

diffstat:

1 file changed, 3 insertions(+), 3 deletions(-)
src/lib-mail/message-header-decode.c |    6 +++---

diffs (33 lines):

diff -r d86581f4a0c6 -r d3299ed1332a src/lib-mail/message-header-decode.c
--- a/src/lib-mail/message-header-decode.c	Fri Jul 20 16:22:59 2007 +0300
+++ b/src/lib-mail/message-header-decode.c	Fri Jul 20 16:45:03 2007 +0300
@@ -131,7 +131,7 @@ decode_utf8_callback(const unsigned char
 	bool unknown_charset;
 
 	/* one call with charset=NULL means nothing changed */
-	if (!ctx->called)
+	if (!ctx->called && charset == NULL)
 		ctx->called = TRUE;
 	else
 		ctx->changed = TRUE;
@@ -146,7 +146,6 @@ decode_utf8_callback(const unsigned char
 		}
 		return TRUE;
 	}
-	ctx->changed = TRUE;
 
 	t = charset_to_utf8_begin(charset, ctx->ucase, &unknown_charset);
 	if (unknown_charset) {
@@ -164,10 +163,11 @@ bool message_header_decode_utf8(const un
 				buffer_t *dest, bool ucase)
 {
 	struct decode_utf8_context ctx;
+	size_t used = dest->used;
 
 	memset(&ctx, 0, sizeof(ctx));
 	ctx.dest = dest;
 	ctx.ucase = ucase;
 	message_header_decode(data, size, decode_utf8_callback, &ctx);
-	return ctx.changed;
+	return ctx.changed || (dest->used - used != size);
 }


More information about the dovecot-cvs mailing list