This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: FYI: natIconv -vs- EINVAL/E2BIG


I'm checking this in on the trunk.

This fixes a bug in natIconv.cc when conversion returns EINVAL or
E2BIG.  The original reporter never got back to me about this fix, but
I think it is right and I've been running it for a while without harm.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* gnu/gcj/convert/natIconv.cc (read): Handle EINVAL and E2BIG
	correctly.

Index: gnu/gcj/convert/natIconv.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/convert/natIconv.cc,v
retrieving revision 1.11
diff -u -r1.11 natIconv.cc
--- gnu/gcj/convert/natIconv.cc 2001/08/10 17:39:34 1.11
+++ gnu/gcj/convert/natIconv.cc 2001/08/15 20:17:16
@@ -90,10 +90,13 @@
 
   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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]