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]
Other format: [Raw text]

Re: Patch: FYI: PR 16134


Tom Tromey wrote:

Bryce> + encoding = canonicalize(encoding);

The original intent of this code was that the original (non-canonical)
name be passed to the iconv converter.  The idea is that our
canonicalization might result in a name not known by the underlying
iconv implementation.

This patch changes that. And actually I don't know that this has ever
mattered. But it would be simple to restore this behavior by keeping
the non-canonical name and passing it to the iconv converter
constructor.



Doh, there is even a comment to that effect that I failed to read. This patch fixes it. I'm checking it in.


Regards

Bryce


2004-06-22  Bryce McKinlay  <mckinlay@redhat.com>

	* gnu/gcj/convert/BytesToUnicode.java (getDecoder): Pass original
	encoding name to iconv.
	* gnu/gcj/convert/UnicodeToBytes.java (getEncoder): Likewise.

Index: gnu/gcj/convert/BytesToUnicode.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/convert/BytesToUnicode.java,v
retrieving revision 1.10
diff -u -r1.10 BytesToUnicode.java
--- gnu/gcj/convert/BytesToUnicode.java	22 Jun 2004 17:21:23 -0000	1.10
+++ gnu/gcj/convert/BytesToUnicode.java	22 Jun 2004 18:32:02 -0000
@@ -75,14 +75,14 @@
   {
     /* First hunt in our cache to see if we have a decoder that is
        already allocated. */
-    encoding = canonicalize(encoding);
+    String canonicalEncoding = canonicalize(encoding);
     synchronized (BytesToUnicode.class)
       {
 	int i;
 	for (i = 0; i < decoderCache.length; ++i)
 	  {
 	    if (decoderCache[i] != null
-		&& encoding.equals(decoderCache[i].getName ()))
+		&& canonicalEncoding.equals(decoderCache[i].getName ()))
 	      {
 		BytesToUnicode rv = decoderCache[i];
 		decoderCache[i] = null;
@@ -92,7 +92,7 @@
       }
 
     // It's not in the cache, so now we have to do real work.
-    String className = "gnu.gcj.convert.Input_" + encoding;
+    String className = "gnu.gcj.convert.Input_" + canonicalEncoding;
     Class decodingClass;
     try 
       { 
Index: gnu/gcj/convert/UnicodeToBytes.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/convert/UnicodeToBytes.java,v
retrieving revision 1.11
diff -u -r1.11 UnicodeToBytes.java
--- gnu/gcj/convert/UnicodeToBytes.java	22 Jun 2004 17:21:23 -0000	1.11
+++ gnu/gcj/convert/UnicodeToBytes.java	22 Jun 2004 18:32:02 -0000
@@ -73,14 +73,14 @@
   {
     /* First hunt in our cache to see if we have a encoder that is
        already allocated. */
-    encoding = canonicalize(encoding);
+    String canonicalEncoding = canonicalize(encoding);
     synchronized (UnicodeToBytes.class)
       {
 	int i;
 	for (i = 0; i < encoderCache.length; ++i)
 	  {
 	    if (encoderCache[i] != null
-		&& encoding.equals(encoderCache[i].getName ()))
+		&& canonicalEncoding.equals(encoderCache[i].getName ()))
 	      {
 		UnicodeToBytes rv = encoderCache[i];
 		encoderCache[i] = null;
@@ -89,7 +89,7 @@
 	  }
       }
 
-    String className = "gnu.gcj.convert.Output_" + encoding;
+    String className = "gnu.gcj.convert.Output_" + canonicalEncoding;
     Class encodingClass;
     try 
       { 

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