[kaffe] CVS kaffe (kaz): gnu/java/nio/charset/UnicodeLittle.java

Kaffe CVS cvs-commits at kaffe.org
Fri Jun 24 09:02:41 PDT 2005


PatchSet 6663 
Date: 2005/06/24 15:57:25
Author: kaz
Branch: HEAD
Tag: (none) 
Log:
2005-06-24  Ito Kazumitsu  <kaz at maczuka.gcd.org>

        * gnu/java/nio/charset/UnicodeLittle.java
        (newDecoder): Set the default endian to be little endian.

        * gnu/java/nio/charset/UTF_16Decoder.java
        (decodeLoop): Use 0x00FF instead of 0xFF for masking.

Members: 
	ChangeLog:1.4188->1.4189 
	libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java:1.3->1.4 
	libraries/javalib/gnu/java/nio/charset/UnicodeLittle.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4188 kaffe/ChangeLog:1.4189
--- kaffe/ChangeLog:1.4188	Fri Jun 24 13:02:24 2005
+++ kaffe/ChangeLog	Fri Jun 24 15:57:25 2005
@@ -1,3 +1,11 @@
+2005-06-24  Ito Kazumitsu  <kaz at maczuka.gcd.org>
+
+	* gnu/java/nio/charset/UnicodeLittle.java
+	(newDecoder): Set the default endian to be little endian.
+
+	* gnu/java/nio/charset/UTF_16Decoder.java
+	(decodeLoop): Use 0x00FF instead of 0xFF for masking.
+
 2005-06-24  Guilhem Lavaux  <guilhem at kaffe.org>
 
 	* kaffe/kaffe/main.c
Index: kaffe/libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java
diff -u kaffe/libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java:1.3 kaffe/libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java:1.4
--- kaffe/libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java:1.3	Tue Apr 19 10:12:23 2005
+++ kaffe/libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java	Fri Jun 24 15:57:28 2005
@@ -83,7 +83,7 @@
             // handle byte order mark
             if (byteOrder == UNKNOWN_ENDIAN)
               {
-                char c = (char) (((b1 & 0xFF) << 8) | (b2 & 0xFF));
+                char c = (char) (((b1 & 0x00FF) << 8) | (b2 & 0x00FF));
                 if (c == BYTE_ORDER_MARK)
                   {
                     byteOrder = BIG_ENDIAN;
@@ -105,8 +105,9 @@
               }
 
 	    // FIXME: Change so you only do a single comparison here.
-            char c = byteOrder == BIG_ENDIAN ? (char) ((b1 << 8) | b2)
-                                             : (char) ((b2 << 8) | b1);
+            char c = byteOrder == BIG_ENDIAN ?
+                 (char) (((b1 & 0x00FF) << 8) | (b2 & 0x00FF)) :
+                 (char) (((b2 & 0x00FF) << 8) | (b1 & 0X00FF));
 
             if (0xD800 <= c && c <= 0xDFFF)
               {
Index: kaffe/libraries/javalib/gnu/java/nio/charset/UnicodeLittle.java
diff -u kaffe/libraries/javalib/gnu/java/nio/charset/UnicodeLittle.java:1.1 kaffe/libraries/javalib/gnu/java/nio/charset/UnicodeLittle.java:1.2
--- kaffe/libraries/javalib/gnu/java/nio/charset/UnicodeLittle.java:1.1	Tue Apr 19 10:12:23 2005
+++ kaffe/libraries/javalib/gnu/java/nio/charset/UnicodeLittle.java	Fri Jun 24 15:57:28 2005
@@ -64,7 +64,7 @@
 
   public CharsetDecoder newDecoder ()
   {
-    return new UTF_16Decoder (this, UTF_16Decoder.UNKNOWN_ENDIAN);
+    return new UTF_16Decoder (this, UTF_16Decoder.LITTLE_ENDIAN);
   }
 
   public CharsetEncoder newEncoder ()



More information about the kaffe mailing list