diff options
author | Tom Tromey <tromey@redhat.com> | 2001-08-15 20:24:00 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2001-08-15 20:24:00 +0000 |
commit | 369e1d74c6c3ffc4acb1c6c3defabd9ba19401b9 (patch) | |
tree | ebbd03296fb12cfff4728c9560dded5efde34f6d /libjava | |
parent | 44ce0063663da883cd4d1281310734d4a36e8a00 (diff) | |
download | gcc-369e1d74c6c3ffc4acb1c6c3defabd9ba19401b9.zip gcc-369e1d74c6c3ffc4acb1c6c3defabd9ba19401b9.tar.gz gcc-369e1d74c6c3ffc4acb1c6c3defabd9ba19401b9.tar.bz2 |
natIconv.cc (read): Handle EINVAL and E2BIG correctly.
* gnu/gcj/convert/natIconv.cc (read): Handle EINVAL and E2BIG
correctly.
From-SVN: r44928
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/gnu/gcj/convert/natIconv.cc | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index c9e6606..81acaa9 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2001-08-15 Tom Tromey <tromey@redhat.com> + + * gnu/gcj/convert/natIconv.cc (read): Handle EINVAL and E2BIG + correctly. + 2001-08-09 Tom Tromey <tromey@redhat.com> * java/awt/image/SampleModel.java (getPixel): Set correct array diff --git a/libjava/gnu/gcj/convert/natIconv.cc b/libjava/gnu/gcj/convert/natIconv.cc index 03fad96..3c10c8a 100644 --- a/libjava/gnu/gcj/convert/natIconv.cc +++ b/libjava/gnu/gcj/convert/natIconv.cc @@ -90,10 +90,13 @@ gnu::gcj::convert::Input_iconv::read (jcharArray outbuffer, if (r == (size_t) -1) { - // Incomplete character. - if (errno == EINVAL || errno == E2BIG) - return 0; - throw new java::io::CharConversionException (); + // If we see EINVAL then there is an incomplete sequence at the + // end of the input buffer. If we see E2BIG then we ran out of + // space in the output buffer. However, in both these cases + // some conversion might have taken place. So we fall through + // to the normal case. + if (errno != EINVAL && errno != E2BIG) + throw new java::io::CharConversionException (); } if (iconv_byte_swap) |