diff options
| author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-06 20:10:41 +0000 |
|---|---|---|
| committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-06 20:10:41 +0000 |
| commit | 6515f9367d9de381354d856efca1e6f22af32e70 (patch) | |
| tree | 06a0be07899ac10cca7cc949fdc95c1331d3b061 | |
| parent | a866e0f2b523463de856075b7872e8acf2556c67 (diff) | |
| download | ppe42-gcc-6515f9367d9de381354d856efca1e6f22af32e70.tar.gz ppe42-gcc-6515f9367d9de381354d856efca1e6f22af32e70.zip | |
* java/io/InputStreamReader.java (refill): Handle no-progress
case correctly.
* gnu/gcj/convert/IOConverter.java: Add 'utf8' alias.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101663 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | libjava/ChangeLog | 6 | ||||
| -rw-r--r-- | libjava/gnu/gcj/convert/IOConverter.java | 4 | ||||
| -rw-r--r-- | libjava/java/io/InputStreamReader.java | 20 |
3 files changed, 26 insertions, 4 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 39e2fd0736e..657e238d879 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,11 @@ 2005-07-06 Tom Tromey <tromey@redhat.com> + * java/io/InputStreamReader.java (refill): Handle no-progress + case correctly. + * gnu/gcj/convert/IOConverter.java: Add 'utf8' alias. + +2005-07-06 Tom Tromey <tromey@redhat.com> + * testsuite/libjava.jacks/jacks.xfail: Removed 9.1.3-body-5. 2005-07-05 Bryce McKinlay <mckinlay@redhat.com> diff --git a/libjava/gnu/gcj/convert/IOConverter.java b/libjava/gnu/gcj/convert/IOConverter.java index ba3260ac17e..2c6849ce7a3 100644 --- a/libjava/gnu/gcj/convert/IOConverter.java +++ b/libjava/gnu/gcj/convert/IOConverter.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001 Free Software Foundation +/* Copyright (C) 2000, 2001, 2005 Free Software Foundation This file is part of libgcj. @@ -28,6 +28,8 @@ public abstract class IOConverter // canonical name. hash.put ("iso-latin-1", "8859_1"); hash.put ("iso8859_1", "8859_1"); + // At least one build script out there uses 'utf8'. + hash.put ("utf8", "UTF8"); // On Solaris the default encoding, as returned by nl_langinfo(), // is `646' (aka ASCII), but the Solaris iconv_open() doesn't // understand that. We work around the problem by adding an diff --git a/libjava/java/io/InputStreamReader.java b/libjava/java/io/InputStreamReader.java index f8ad53cdd01..e55f1352caa 100644 --- a/libjava/java/io/InputStreamReader.java +++ b/libjava/java/io/InputStreamReader.java @@ -289,9 +289,23 @@ public class InputStreamReader extends Reader return -1; converter.setInput(in.buf, in.pos, in.count); int count = converter.read(buf, offset, length); - in.skip(converter.inpos - in.pos); - if (count > 0) - return count; + + // We might have bytes but not have made any progress. In + // this case we try to refill. If refilling fails, we assume + // we have a malformed character at the end of the stream. + if (count == 0 && converter.inpos == in.pos) + { + in.mark(in.count); + if (! in.refill ()) + throw new CharConversionException (); + in.reset(); + } + else + { + in.skip(converter.inpos - in.pos); + if (count > 0) + return count; + } } } } |

