[evolution-data-server] Fixed another iconv() flush case.



commit 79a2b2e9ae3a249287a04ed8e985f045c0560bf7
Author: Jeffrey Stedfast <jeff xamarin com>
Date:   Tue Dec 20 10:41:05 2011 -0500

    Fixed another iconv() flush case.

 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 86de327..de9d2ec 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -979,7 +979,17 @@ decode_8bit (const gchar *text,
 			}
 		} while (inleft > 0);
 
-		rc = 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]