[gmime] Another iconv flush fix
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Another iconv flush fix
- Date: Fri, 16 Dec 2011 03:37:55 +0000 (UTC)
commit b90340ef2069e18d704f6dec4285bac15ddd58f7
Author: Jeffrey Stedfast <fejj gnome org>
Date: Thu Dec 15 22:37:34 2011 -0500
Another iconv flush fix
2011-12-15 Jeffrey Stedfast <fejj gnome org>
* gmime/gmime-iconv-utils.c (g_mime_iconv_strndup): Same.
ChangeLog | 2 ++
gmime/gmime-iconv-utils.c | 11 ++++++++++-
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7f6891d..404eb48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2011-12-15 Jeffrey Stedfast <fejj gnome org>
+ * gmime/gmime-iconv-utils.c (g_mime_iconv_strndup): Same.
+
* gmime/gmime-filter-charset.c (flter_complete): Same as
charset_convert().
diff --git a/gmime/gmime-iconv-utils.c b/gmime/gmime-iconv-utils.c
index baca567..618cd15 100644
--- a/gmime/gmime-iconv-utils.c
+++ b/gmime/gmime-iconv-utils.c
@@ -162,7 +162,16 @@ g_mime_iconv_strndup (iconv_t cd, const char *str, size_t n)
} while (TRUE);
/* flush the iconv conversion */
- iconv (cd, NULL, NULL, &outbuf, &outleft);
+ while (iconv (cd, NULL, NULL, &outbuf, &outleft) == (size_t) -1) {
+ if (errno != E2BIG)
+ break;
+
+ outlen += 16;
+ converted = outbuf - out;
+ out = g_realloc (out, outlen + 4);
+ outleft = outlen - converted;
+ outbuf = out + converted;
+ }
/* Note: not all charsets can be nul-terminated with a single
nul byte. UCS2, for example, needs 2 nul bytes and UCS4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]