dovecot-2.2: lib-mail: Replaced MAX_TRANSLATION_BUF_SIZE with th...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jan 14 23:23:30 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/e49a2e800650
changeset: 18151:e49a2e800650
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jan 15 01:08:00 2015 +0200
description:
lib-mail: Replaced MAX_TRANSLATION_BUF_SIZE with the new CHARSET_MAX_PENDING_BUF_SIZE

diffstat:

 src/lib-mail/message-decoder.c |  10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diffs (41 lines):

diff -r 3d9ec121dc81 -r e49a2e800650 src/lib-mail/message-decoder.c
--- a/src/lib-mail/message-decoder.c	Thu Jan 15 01:05:36 2015 +0200
+++ b/src/lib-mail/message-decoder.c	Thu Jan 15 01:08:00 2015 +0200
@@ -16,10 +16,6 @@
 /* base64 takes max 4 bytes per character, q-p takes max 3. */
 #define MAX_ENCODING_BUF_SIZE 3
 
-/* UTF-8 takes max 5 bytes per character. Not sure about others, but I'd think
-   10 is more than enough for everyone.. */
-#define MAX_TRANSLATION_BUF_SIZE 10
-
 struct message_decoder_context {
 	enum message_decoder_flags flags;
 	normalizer_func_t *normalizer;
@@ -30,7 +26,7 @@
 
 	char *charset_trans_charset;
 	struct charset_translation *charset_trans;
-	char translation_buf[MAX_TRANSLATION_BUF_SIZE];
+	char translation_buf[CHARSET_MAX_PENDING_BUF_SIZE];
 	unsigned int translation_size;
 
 	buffer_t *encoding_buf;
@@ -197,7 +193,7 @@
 static void translation_buf_decode(struct message_decoder_context *ctx,
 				   const unsigned char **data, size_t *size)
 {
-	unsigned char trans_buf[MAX_TRANSLATION_BUF_SIZE+1];
+	unsigned char trans_buf[CHARSET_MAX_PENDING_BUF_SIZE+1];
 	unsigned int data_wanted, skip;
 	size_t trans_size, orig_size;
 
@@ -216,7 +212,7 @@
 
 	if (trans_size <= ctx->translation_size) {
 		/* need more data to finish the translation. */
-		i_assert(orig_size < MAX_TRANSLATION_BUF_SIZE);
+		i_assert(orig_size < CHARSET_MAX_PENDING_BUF_SIZE);
 		memcpy(ctx->translation_buf, trans_buf, orig_size);
 		ctx->translation_size = orig_size;
 		*data += *size;


More information about the dovecot-cvs mailing list