Commit eb8163ab by Bryce McKinlay Committed by Bryce McKinlay

BytesToUnicode.java (getDecoder): Pass original encoding name to iconv.

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

From-SVN: r83512
parent a91b0033
2004-06-22 Bryce McKinlay <mckinlay@redhat.com> 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.
2004-06-22 Bryce McKinlay <mckinlay@redhat.com>
PR libgcj/16134: PR libgcj/16134:
* gnu/gcj/convert/BytesToUnicode.java (getDecoder): Canonicalize * gnu/gcj/convert/BytesToUnicode.java (getDecoder): Canonicalize
encoding name before cache lookup. Thanks to Hannes Wallnoefer. encoding name before cache lookup. Thanks to Hannes Wallnoefer.
......
...@@ -75,14 +75,14 @@ public abstract class BytesToUnicode extends IOConverter ...@@ -75,14 +75,14 @@ public abstract class BytesToUnicode extends IOConverter
{ {
/* First hunt in our cache to see if we have a decoder that is /* First hunt in our cache to see if we have a decoder that is
already allocated. */ already allocated. */
encoding = canonicalize(encoding); String canonicalEncoding = canonicalize(encoding);
synchronized (BytesToUnicode.class) synchronized (BytesToUnicode.class)
{ {
int i; int i;
for (i = 0; i < decoderCache.length; ++i) for (i = 0; i < decoderCache.length; ++i)
{ {
if (decoderCache[i] != null if (decoderCache[i] != null
&& encoding.equals(decoderCache[i].getName ())) && canonicalEncoding.equals(decoderCache[i].getName ()))
{ {
BytesToUnicode rv = decoderCache[i]; BytesToUnicode rv = decoderCache[i];
decoderCache[i] = null; decoderCache[i] = null;
...@@ -92,7 +92,7 @@ public abstract class BytesToUnicode extends IOConverter ...@@ -92,7 +92,7 @@ public abstract class BytesToUnicode extends IOConverter
} }
// It's not in the cache, so now we have to do real work. // 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; Class decodingClass;
try try
{ {
......
...@@ -73,14 +73,14 @@ public abstract class UnicodeToBytes extends IOConverter ...@@ -73,14 +73,14 @@ public abstract class UnicodeToBytes extends IOConverter
{ {
/* First hunt in our cache to see if we have a encoder that is /* First hunt in our cache to see if we have a encoder that is
already allocated. */ already allocated. */
encoding = canonicalize(encoding); String canonicalEncoding = canonicalize(encoding);
synchronized (UnicodeToBytes.class) synchronized (UnicodeToBytes.class)
{ {
int i; int i;
for (i = 0; i < encoderCache.length; ++i) for (i = 0; i < encoderCache.length; ++i)
{ {
if (encoderCache[i] != null if (encoderCache[i] != null
&& encoding.equals(encoderCache[i].getName ())) && canonicalEncoding.equals(encoderCache[i].getName ()))
{ {
UnicodeToBytes rv = encoderCache[i]; UnicodeToBytes rv = encoderCache[i];
encoderCache[i] = null; encoderCache[i] = null;
...@@ -89,7 +89,7 @@ public abstract class UnicodeToBytes extends IOConverter ...@@ -89,7 +89,7 @@ public abstract class UnicodeToBytes extends IOConverter
} }
} }
String className = "gnu.gcj.convert.Output_" + encoding; String className = "gnu.gcj.convert.Output_" + canonicalEncoding;
Class encodingClass; Class encodingClass;
try try
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment