2005-08-08 Matthias Clasen <mclasen@redhat.com>
+ * tests/convert-test.c: Enable the endianness test.
+
+ * glib/gconvert.c: Make the caching of iconv descriptors
+ optional.
+
+ * configure.in: Add an --enable-iconv-cache option, and
+ default to disabling iconv caching on new enough glibc.
+ Somebody with access to Solaris systems will need to test
+ if opening/closing of iconv descriptors is enough of
+ a performance problem to warrant the caching on that
+ platform. Note that the caching is causing correctness
+ problems in some corner cases, thus turning it off
+ is desirable unless it has severe performance implications.
+
* tests/convert-test.c: Add a test for
endianness handling.
2005-08-08 Matthias Clasen <mclasen@redhat.com>
+ * tests/convert-test.c: Enable the endianness test.
+
+ * glib/gconvert.c: Make the caching of iconv descriptors
+ optional.
+
+ * configure.in: Add an --enable-iconv-cache option, and
+ default to disabling iconv caching on new enough glibc.
+ Somebody with access to Solaris systems will need to test
+ if opening/closing of iconv descriptors is enough of
+ a performance problem to warrant the caching on that
+ platform. Note that the caching is causing correctness
+ problems in some corner cases, thus turning it off
+ is desirable unless it has severe performance implications.
+
* tests/convert-test.c: Add a test for
endianness handling.
2005-08-08 Matthias Clasen <mclasen@redhat.com>
+ * tests/convert-test.c: Enable the endianness test.
+
+ * glib/gconvert.c: Make the caching of iconv descriptors
+ optional.
+
+ * configure.in: Add an --enable-iconv-cache option, and
+ default to disabling iconv caching on new enough glibc.
+ Somebody with access to Solaris systems will need to test
+ if opening/closing of iconv descriptors is enough of
+ a performance problem to warrant the caching on that
+ platform. Note that the caching is causing correctness
+ problems in some corner cases, thus turning it off
+ is desirable unless it has severe performance implications.
+
* tests/convert-test.c: Add a test for
endianness handling.
2005-08-08 Matthias Clasen <mclasen@redhat.com>
+ * tests/convert-test.c: Enable the endianness test.
+
+ * glib/gconvert.c: Make the caching of iconv descriptors
+ optional.
+
+ * configure.in: Add an --enable-iconv-cache option, and
+ default to disabling iconv caching on new enough glibc.
+ Somebody with access to Solaris systems will need to test
+ if opening/closing of iconv descriptors is enough of
+ a performance problem to warrant the caching on that
+ platform. Note that the caching is causing correctness
+ problems in some corner cases, thus turning it off
+ is desirable unless it has severe performance implications.
+
* tests/convert-test.c: Add a test for
endianness handling.
AC_MSG_ERROR([*** No iconv() implementation found in C library or libiconv])
fi
+jm_GLIBC21
+AC_ARG_ENABLE(iconv-cache,
+ [AC_HELP_STRING([--enable-iconv-cache=@<:@yes/no/auto@:>@],
+ [cache iconv descriptors [default=auto]])],,
+ [enable_iconv_cache=auto])
+
+AC_MSG_CHECKING([Whether to cache iconv descriptors])
+case $enable_iconv_cache in
+ auto)
+ if test $ac_cv_gnu_library_2_1 = yes; then
+ enable_iconv_cache=no
+ else
+ enable_iconv_cache=yes
+ fi
+ ;;
+ yes|no)
+ ;;
+ *) AC_MSG_ERROR([Value given to --enable-iconv-cache must be one of yes, no or auto])
+ ;;
+esac
+
+if test $enable_iconv_cache = yes; then
+ AC_DEFINE(NEED_ICONV_CACHE,1,[Do we cache iconv descriptors])
+fi
+
+AC_MSG_RESULT($enable_iconv_cache)
+
+
dnl
dnl gettext support
dnl
}
+#ifdef NEED_ICONV_CACHE
+
#define ICONV_CACHE_SIZE (16)
struct _iconv_cache_bucket {
return 0;
}
+#else /* !NEED_ICONV_CACHE */
+
+static GIConv
+open_converter (const gchar *to_codeset,
+ const gchar *from_codeset,
+ GError **error)
+{
+ GIConv cd;
+
+ cd = g_iconv_open (to_codeset, from_codeset);
+
+ if (cd == (GIConv) -1)
+ {
+ /* Something went wrong. */
+ if (error)
+ {
+ if (errno == EINVAL)
+ g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_NO_CONVERSION,
+ _("Conversion from character set '%s' to '%s' is not supported"),
+ from_codeset, to_codeset);
+ else
+ g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
+ _("Could not open converter from '%s' to '%s'"),
+ from_codeset, to_codeset);
+ }
+ }
+
+ return cd;
+}
+
+static int
+close_converter (GIConv cd)
+{
+ if (cd == (GIConv) -1)
+ return 0;
+
+ return g_iconv_close (cd);
+}
+
+#endif /* NEED_ICONV_CACHE */
+
/**
* g_convert_with_iconv:
* @str: the string to convert
gsize bytes_read = 0;
gsize bytes_written = 0;
GError *error = NULL;
- int i;
out = g_convert (in_be, sizeof (in_be),
"UTF-8", "UTF-16",
&error);
g_assert (error == NULL);
- g_assert (bytes_read == 2);
+ g_assert (bytes_read == 4);
g_assert (bytes_written == 2);
g_assert (strcmp (out, expected) == 0);
g_free (out);
{
test_iconv_state ();
test_one_half ();
-
-#if 0
- /* this one currently fails due to
- * https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=165368
- */
test_byte_order ();
-#endif
return 0;
}