aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>2000-06-16 01:11:12 +0000
committerTom Tromey <tromey@gcc.gnu.org>2000-06-16 01:11:12 +0000
commitff1c0096a1cb412bed7d62e333dcd4020c90ca7c (patch)
treedcf162256b88b044be7c99f67cd75e2958425eac
parent8bad71361f493d775af6e90757fc8f8c0549d44d (diff)
downloadgcc-ff1c0096a1cb412bed7d62e333dcd4020c90ca7c.zip
gcc-ff1c0096a1cb412bed7d62e333dcd4020c90ca7c.tar.gz
gcc-ff1c0096a1cb412bed7d62e333dcd4020c90ca7c.tar.bz2
natIconv.cc (iconv_adapter): New function.
* gnu/gcj/convert/natIconv.cc (iconv_adapter): New function. (read): Use it. (write): Likewise. From-SVN: r34570
-rw-r--r--libjava/ChangeLog6
-rw-r--r--libjava/gnu/gcj/convert/natIconv.cc26
2 files changed, 24 insertions, 8 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 4ab49c8..70d4430 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,9 @@
+2000-06-15 Tom Tromey <tromey@cygnus.com>
+
+ * gnu/gcj/convert/natIconv.cc (iconv_adapter): New function.
+ (read): Use it.
+ (write): Likewise.
+
2000-06-15 Bryce McKinlay <bryce@albatross.co.nz>
Fix for PR java.lang/258:
diff --git a/libjava/gnu/gcj/convert/natIconv.cc b/libjava/gnu/gcj/convert/natIconv.cc
index b3eead8..7875e9b 100644
--- a/libjava/gnu/gcj/convert/natIconv.cc
+++ b/libjava/gnu/gcj/convert/natIconv.cc
@@ -21,6 +21,16 @@ details. */
#ifdef HAVE_ICONV
#include <iconv.h>
+
+template<typename T>
+static inline size_t
+iconv_adapter (size_t (*iconv_f) (iconv_t, T, size_t *, char **, size_t *),
+ iconv_t handle, char **inbuf, size_t *inavail,
+ char **outbuf, size_t *outavail)
+{
+ return (*iconv_f) (handle, (T) inbuf, inavail, outbuf, outavail);
+}
+
#endif
void
@@ -69,12 +79,12 @@ gnu::gcj::convert::Input_iconv::read (jcharArray outbuffer,
size_t outavail = count;
size_t old_out = outavail;
- const char *inbuf = (const char *) &bytes[inpos];
+ char *inbuf = (char *) &bytes[inpos];
char *outbuf = (char *) &out[outpos];
- size_t r = iconv ((iconv_t) handle,
- &inbuf, &inavail,
- &outbuf, &outavail);
+ size_t r = iconv_adapter (iconv, (iconv_t) handle,
+ &inbuf, &inavail,
+ &outbuf, &outavail);
// FIXME: what if R==-1?
inpos += old_in - inavail;
@@ -132,12 +142,12 @@ gnu::gcj::convert::Output_iconv::write (jcharArray inbuffer,
size_t outavail = buf->length - count;
size_t old_out = outavail;
- const char *inbuf = (const char *) &chars[inpos];
+ char *inbuf = (char *) &chars[inpos];
char *outbuf = (char *) &out[count];
- size_t r = iconv ((iconv_t) handle,
- &inbuf, &inavail,
- &outbuf, &outavail);
+ size_t r = iconv_adapter (iconv, (iconv_t) handle,
+ &inbuf, &inavail,
+ &outbuf, &outavail);
// FIXME: what if R==-1?
count += old_out - outavail;