diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-15 20:24:00 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-15 20:24:00 +0000 |
commit | 489086774f3272fcd3468b0b10b82fd2b969578a (patch) | |
tree | ebbd03296fb12cfff4728c9560dded5efde34f6d /libjava/gnu/gcj/convert | |
parent | 2dcd83baa56239678afd819a18c1069cb2468c01 (diff) | |
download | gcc-489086774f3272fcd3468b0b10b82fd2b969578a.tar.gz |
* gnu/gcj/convert/natIconv.cc (read): Handle EINVAL and E2BIG
correctly.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44928 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/gcj/convert')
-rw-r--r-- | libjava/gnu/gcj/convert/natIconv.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libjava/gnu/gcj/convert/natIconv.cc b/libjava/gnu/gcj/convert/natIconv.cc index 03fad96f1f3..3c10c8ace61 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) |