aboutsummaryrefslogtreecommitdiffstats
path: root/jnlib/utf8conv.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2007-06-14 17:05:07 +0000
committerWerner Koch <[email protected]>2007-06-14 17:05:07 +0000
commit0cfbfd6186c7b28a355069ebb89b9739908318c6 (patch)
treea1e2990f266ca151fc47f06d41f40bca743eea76 /jnlib/utf8conv.c
parentSyntax fix - should build now - however not tested. (diff)
downloadgnupg-0cfbfd6186c7b28a355069ebb89b9739908318c6.tar.gz
gnupg-0cfbfd6186c7b28a355069ebb89b9739908318c6.zip
A whole bunch of changes to allow building for Windows.
See the ChangeLogs for details.
Diffstat (limited to '')
-rw-r--r--jnlib/utf8conv.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/jnlib/utf8conv.c b/jnlib/utf8conv.c
index 90a319984..ac0f2e2e1 100644
--- a/jnlib/utf8conv.c
+++ b/jnlib/utf8conv.c
@@ -150,6 +150,7 @@ handle_iconv_error (const char *to, const char *from, int use_fallback)
}
+
int
set_native_charset (const char *newset)
{
@@ -694,3 +695,49 @@ utf8_to_native (const char *string, size_t length, int delim)
{
return do_utf8_to_native (string, length, delim, use_iconv);
}
+
+
+
+
+/* Wrapper function for iconv_open, required for W32 as we dlopen that
+ library on that system. */
+jnlib_iconv_t
+jnlib_iconv_open (const char *tocode, const char *fromcode)
+{
+#ifdef HAVE_W32_SYSTEM
+ if (load_libiconv ())
+ return (jnlib_iconv_t)(-1);
+#endif /*HAVE_W32_SYSTEM*/
+
+ return (jnlib_iconv_t)iconv_open (tocode, fromcode);
+}
+
+
+/* Wrapper function for iconv, required for W32 as we dlopen that
+ library on that system. */
+size_t
+jnlib_iconv (jnlib_iconv_t cd,
+ const char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft)
+{
+
+#ifdef HAVE_W32_SYSTEM
+ if (load_libiconv ())
+ return 0;
+#endif /*HAVE_W32_SYSTEM*/
+
+ return iconv ((iconv_t)cd, inbuf, inbytesleft, outbuf, outbytesleft);
+}
+
+/* Wrapper function for iconv_close, required for W32 as we dlopen that
+ library on that system. */
+int
+jnlib_iconv_close (jnlib_iconv_t cd)
+{
+#ifdef HAVE_W32_SYSTEM
+ if (load_libiconv ())
+ return 0;
+#endif /*HAVE_W32_SYSTEM*/
+
+ return iconv_close ((iconv_t)cd);
+}