[kaffe] CVS kaffe (robilad): Resynced with gnu classpath: character conversion fixes

Kaffe CVS cvs-commits at kaffe.org
Sat May 14 16:37:13 PDT 2005


PatchSet 6467 
Date: 2005/05/14 23:32:05
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with gnu classpath: character conversion fixes

2005-05-15  Dalibor Topic  <robilad at kaffe.org>

        Resynced with GNU Classpath.

        2005-04-25  Sven de Marothy  <sven at physto.se>

        * java/io/InputStreamReader.java:
        (InputStreamReader): Always replace invalid chars.
        (read): Return -1 if zero bytes are read.
        * native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c,
        * native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c:
        Correct C pointer arithmetic.

Members: 
	ChangeLog:1.3994->1.3995 
	libraries/clib/nio/gnu_java_nio_charset_iconv_IconvDecoder.c:1.1->1.2 
	libraries/clib/nio/gnu_java_nio_charset_iconv_IconvEncoder.c:1.1->1.2 
	libraries/javalib/java/io/InputStreamReader.java:1.22->1.23 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3994 kaffe/ChangeLog:1.3995
--- kaffe/ChangeLog:1.3994	Sat May 14 23:17:48 2005
+++ kaffe/ChangeLog	Sat May 14 23:32:05 2005
@@ -2,6 +2,19 @@
 
 	Resynced with GNU Classpath.
 
+	2005-04-25  Sven de Marothy  <sven at physto.se>
+
+        * java/io/InputStreamReader.java:
+        (InputStreamReader): Always replace invalid chars.
+        (read): Return -1 if zero bytes are read.
+        * native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c,
+        * native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c:
+        Correct C pointer arithmetic.
+
+2005-05-15  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
 	2005-04-25  David Gilbert  <david.gilbert at object-refinery.com>
 
         * java/awt/Transparency.java
Index: kaffe/libraries/clib/nio/gnu_java_nio_charset_iconv_IconvDecoder.c
diff -u kaffe/libraries/clib/nio/gnu_java_nio_charset_iconv_IconvDecoder.c:1.1 kaffe/libraries/clib/nio/gnu_java_nio_charset_iconv_IconvDecoder.c:1.2
--- kaffe/libraries/clib/nio/gnu_java_nio_charset_iconv_IconvDecoder.c:1.1	Sat Apr 23 09:54:21 2005
+++ kaffe/libraries/clib/nio/gnu_java_nio_charset_iconv_IconvDecoder.c	Sat May 14 23:32:07 2005
@@ -98,7 +98,7 @@
   outputcopy = output = (*env)->GetCharArrayElements (env, outArr, 0);
 
   input += posIn;
-  output += posOut * 2;
+  output += posOut;
 
   in = (char **) &input;
   out = (char **) &output;
Index: kaffe/libraries/clib/nio/gnu_java_nio_charset_iconv_IconvEncoder.c
diff -u kaffe/libraries/clib/nio/gnu_java_nio_charset_iconv_IconvEncoder.c:1.1 kaffe/libraries/clib/nio/gnu_java_nio_charset_iconv_IconvEncoder.c:1.2
--- kaffe/libraries/clib/nio/gnu_java_nio_charset_iconv_IconvEncoder.c:1.1	Sat Apr 23 09:54:21 2005
+++ kaffe/libraries/clib/nio/gnu_java_nio_charset_iconv_IconvEncoder.c	Sat May 14 23:32:07 2005
@@ -97,7 +97,7 @@
   inputcopy = input = (*env)->GetCharArrayElements (env, inArr, 0);
   outputcopy = output = (*env)->GetByteArrayElements (env, outArr, 0);
 
-  input += posIn * 2;
+  input += posIn;
   output += posOut;
 
   in = (char **) &input;
Index: kaffe/libraries/javalib/java/io/InputStreamReader.java
diff -u kaffe/libraries/javalib/java/io/InputStreamReader.java:1.22 kaffe/libraries/javalib/java/io/InputStreamReader.java:1.23
--- kaffe/libraries/javalib/java/io/InputStreamReader.java:1.22	Sat Apr 23 10:24:47 2005
+++ kaffe/libraries/javalib/java/io/InputStreamReader.java	Sat May 14 23:32:08 2005
@@ -237,9 +237,8 @@
     this.in = in;
     decoder = charset.newDecoder();
 
-    // JDK reports errors, so we do the same.
-    decoder.onMalformedInput(CodingErrorAction.REPORT);
-    decoder.onUnmappableCharacter(CodingErrorAction.REPORT);
+    decoder.onMalformedInput(CodingErrorAction.REPLACE);
+    decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
     decoder.reset();
     encoding = EncodingHelper.getOldCanonical(charset.name());
   }
@@ -258,9 +257,8 @@
 	maxBytesPerChar = 1f;
     } 
 
-    // JDK reports errors, so we do the same.
-    decoder.onMalformedInput(CodingErrorAction.REPORT);
-    decoder.onUnmappableCharacter(CodingErrorAction.REPORT);
+    decoder.onMalformedInput(CodingErrorAction.REPLACE);
+    decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
     decoder.reset();
     encoding = EncodingHelper.getOldCanonical(decoder.charset().name());      
   }
@@ -390,7 +388,8 @@
 	} else
 	    byteBuffer = null;
 
-	return (read == 0)?-1:(cb.position() - startPos);
+	read = cb.position() - startPos;
+	return (read <= 0) ? -1 : read;
     } else {
 	byte[] bytes = new byte[length];
 	int read = in.read(bytes);




More information about the kaffe mailing list