[evolution-data-server] ...And another iconv flush fix



commit c316bc87ececfb664840fe5e2cb8bb5260bbd0b8
Author: Jeffrey Stedfast <jeff xamarin com>
Date:   Tue Dec 20 11:07:42 2011 -0500

    ...And another iconv flush fix

 camel/camel-mime-utils.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index de9d2ec..55393e2 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -1056,7 +1056,17 @@ decode_8bit (const gchar *text,
 		}
 	} while (inleft > 0);
 
-	iconv (cd, NULL, NULL, &outbuf, &outleft);
+	while ((rc = iconv (cd, NULL, NULL, &outbuf, &outleft)) == (gsize) -1) {
+		if (errno != E2BIG)
+			break;
+		
+		outlen += 16;
+		rc = (gsize) (outbuf - out);
+		out = g_realloc (out, outlen + 1);
+		outleft = outlen - rc;
+		outbuf = out + rc;
+	}
+
 	*outbuf = '\0';
 
 	camel_iconv_close (cd);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]