From eac940bea92e8a9a1276c9b4b59656f6760eb14a Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Thu, 12 Oct 2006 17:24:01 +0000 Subject: [PATCH] 2006-10-12 [colin] 2.5.5cvs5 * src/codeconv.c Revert part of 2.5.2cvs21: Don't optimise by reusing the last iconv converter if possible: it seems slightly broken in a very hard way to reproduce --- ChangeLog | 9 +++++++++ PATCHSETS | 1 + configure.ac | 2 +- src/codeconv.c | 28 +++++----------------------- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4041e5c7b..f5243d500 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-10-12 [colin] 2.5.5cvs5 + + * src/codeconv.c + Revert part of 2.5.2cvs21: + Don't optimise by reusing the + last iconv converter if possible: + it seems slightly broken in a + very hard way to reproduce + 2006-10-12 [colin] 2.5.5cvs4 * src/prefs_common.c diff --git a/PATCHSETS b/PATCHSETS index 07a5dd50d..3f2f3a284 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -1990,3 +1990,4 @@ ( cvs diff -u -r 1.382.2.314 -r 1.382.2.315 src/compose.c; ) > 2.5.5cvs2.patchset ( cvs diff -u -r 1.53.2.19 -r 1.53.2.20 po/POTFILES.in; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/plugins/pgpcore/pgp_viewer.c; cvs diff -u -r 1.1.2.30 -r 1.1.2.31 src/plugins/pgpcore/sgpgme.c; ) > 2.5.5cvs3.patchset ( cvs diff -u -r 1.204.2.104 -r 1.204.2.105 src/prefs_common.c; cvs diff -u -r 1.103.2.62 -r 1.103.2.63 src/prefs_common.h; cvs diff -u -r 1.1.2.17 -r 1.1.2.18 src/prefs_message.c; cvs diff -u -r 1.49.2.81 -r 1.49.2.82 src/procmime.c; ) > 2.5.5cvs4.patchset +( cvs diff -u -r 1.65.2.50 -r 1.65.2.51 src/codeconv.c; ) > 2.5.5cvs5.patchset diff --git a/configure.ac b/configure.ac index adf3ec800..fc24047f3 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=5 MICRO_VERSION=5 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=4 +EXTRA_VERSION=5 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/codeconv.c b/src/codeconv.c index 0bd296aaf..a12632c85 100644 --- a/src/codeconv.c +++ b/src/codeconv.c @@ -807,9 +807,8 @@ CodeConvFunc conv_get_code_conv_func(const gchar *src_charset_str, gchar *conv_iconv_strdup(const gchar *inbuf, const gchar *src_code, const gchar *dest_code) { - static iconv_t cd = (iconv_t)-1; + iconv_t cd; gchar *outbuf; - static const gchar *last_src_code = NULL, *last_dest_code = NULL; if (!src_code && !dest_code && g_utf8_validate(inbuf, -1, NULL)) @@ -832,31 +831,14 @@ gchar *conv_iconv_strdup(const gchar *inbuf, if (!strcasecmp(dest_code, CS_US_ASCII)) return g_strdup(inbuf); - if (last_src_code == NULL || last_dest_code == NULL) { - cd = iconv_open(dest_code, src_code); - last_src_code = src_code; - last_dest_code = dest_code; - } else if (last_src_code != src_code || last_dest_code != dest_code) { - if (cd != (iconv_t)-1) - iconv_close(cd); - cd = iconv_open(dest_code, src_code); - last_src_code = src_code; - last_dest_code = dest_code; - } else if (cd == (iconv_t)-1) { - cd = iconv_open(dest_code, src_code); - last_src_code = src_code; - last_dest_code = dest_code; - } else { - /* that's the same converter */ - } - - if (cd == (iconv_t)-1) { - last_src_code = last_dest_code = NULL; + cd = iconv_open(dest_code, src_code); + if (cd == (iconv_t)-1) return NULL; - } outbuf = conv_iconv_strdup_with_cd(inbuf, cd); + iconv_close(cd); + return outbuf; } -- 2.25.1