Commited this.
2005-04-25 Sven de Marothy <[EMAIL PROTECTED]>
* 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.
Index: java/io/InputStreamReader.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/InputStreamReader.java,v
retrieving revision 1.23
diff -u -r1.23 InputStreamReader.java
--- java/io/InputStreamReader.java 18 Apr 2005 22:17:49 -0000 1.23
+++ java/io/InputStreamReader.java 25 Apr 2005 23:12:32 -0000
@@ -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);
Index: native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c,v
retrieving revision 1.1
diff -u -r1.1 gnu_java_nio_charset_iconv_IconvDecoder.c
--- native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c 18 Apr 2005 11:35:13 -0000 1.1
+++ native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c 25 Apr 2005 23:12:32 -0000
@@ -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: native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c,v
retrieving revision 1.1
diff -u -r1.1 gnu_java_nio_charset_iconv_IconvEncoder.c
--- native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c 18 Apr 2005 11:35:13 -0000 1.1
+++ native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c 25 Apr 2005 23:12:32 -0000
@@ -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;
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches