Skip to content
Snippets Groups Projects
Commit 6515f936 authored by tromey's avatar tromey
Browse files

* 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
parent a866e0f2
No related branches found
No related tags found
No related merge requests found
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> 2005-07-06 Tom Tromey <tromey@redhat.com>
* testsuite/libjava.jacks/jacks.xfail: Removed 9.1.3-body-5. * testsuite/libjava.jacks/jacks.xfail: Removed 9.1.3-body-5.
......
/* Copyright (C) 2000, 2001 Free Software Foundation /* Copyright (C) 2000, 2001, 2005 Free Software Foundation
This file is part of libgcj. This file is part of libgcj.
...@@ -28,6 +28,8 @@ public abstract class IOConverter ...@@ -28,6 +28,8 @@ public abstract class IOConverter
// canonical name. // canonical name.
hash.put ("iso-latin-1", "8859_1"); hash.put ("iso-latin-1", "8859_1");
hash.put ("iso8859_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(), // On Solaris the default encoding, as returned by nl_langinfo(),
// is `646' (aka ASCII), but the Solaris iconv_open() doesn't // is `646' (aka ASCII), but the Solaris iconv_open() doesn't
// understand that. We work around the problem by adding an // understand that. We work around the problem by adding an
......
...@@ -289,9 +289,23 @@ public class InputStreamReader extends Reader ...@@ -289,9 +289,23 @@ public class InputStreamReader extends Reader
return -1; return -1;
converter.setInput(in.buf, in.pos, in.count); converter.setInput(in.buf, in.pos, in.count);
int count = converter.read(buf, offset, length); int count = converter.read(buf, offset, length);
in.skip(converter.inpos - in.pos);
if (count > 0) // We might have bytes but not have made any progress. In
return count; // 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;
}
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment