OSDN Git Service

* gnu/gcj/convert/natIconv.cc (read): Handle EINVAL and E2BIG
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Aug 2001 20:24:00 +0000 (20:24 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Aug 2001 20:24:00 +0000 (20:24 +0000)
correctly.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44928 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/gnu/gcj/convert/natIconv.cc

index c9e6606..81acaa9 100644 (file)
@@ -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
index 03fad96..3c10c8a 100644 (file)
@@ -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)