Partial fix for libgcj/9802
Mark Wielaard
mark@klomp.org
Fri Mar 14 17:31:00 GMT 2003
Hi,
On Sun, 2003-03-02 at 00:15, Tom Tromey wrote:
> >>>>> "Mark" == Mark Wielaard <mark@klomp.org> writes:
>
> Mark> + * gnu/gcj/convert/UnicodeToBytes.java (havePendingByes): New method.
>
> Should be "Bytes", not "Byes". There are several of these in the
> ChangeLog entry.
Fixed ChangeLog entry:
2002-03-14 James Clark <jjc@jclark.com>
Fix for PR libgcj/8738:
* gnu/gcj/convert/UnicodeToBytes.java (havePendingBytes): New method.
* gnu/gcj/convert/Output_SJIS.java (havePendingBytes): Likewise.
* gnu/gcj/convert/Output_EUCJIS.java (havePendingBytes): Likewise.
* gnu/gcj/convert/Output_UTF8.java (havePendingBytes): Likewise.
(write): Always decrease avail when count is increased.
* java/lang/natString.cc (getBytes): Check converter havePendingBytes()
and whether output buffer is full before increasing size.
> I'm inclined to put this in, but first a couple questions.
>
> What should we do about the iconv converter?
> Perhaps for 3.3 we can hack around the problem, and just ditch old
> glibc compatibility for 3.4. Or maybe now is the time
Since the iconv converter does not keep internal state it does not need
a havePendingBytes() method. But I think your patch is necessary since
we need to break out of the iconv loop when we hit errno == E2BIG, but
keep on converting/throwing away bytes when we see invalid sequences.
(But again, I didn't actually test it. The only test case that I
actually made is the surrogate Mauve test that James Clark pointed out.
We need some users which use different encodings to help us get all this
right/debugged.)
> Do we also need to update PrintStream and friends?
Yes. PrintStream and OutputStreamWriter should get the following
updates. PrintStream always clears a working buffer of 100 bytes so
doesn't need to flush or enlarge it, but OutputStreamWriter might be
using a very small BufferedOutputStream or when count is small might not
trigger an automatic flush() so it does need extra flushing. Although in
practice this will probably never actually happen.
2002-03-14 Mark Wielaard <mark@klomp.org>
* java/io/PrintStream.java (writeChars(char[],int, int)):
Check converter.havePendingBytes().
(writeChars(String,int,int)): Likewise.
* java/io/OutputStreamWriter.java (writeChars(char[], int, int)):
Check converter.havePendingBytes() and flush buffer when stalled.
No new tests created, but also no regression with the libgcj and Mauve
test suites. Should I check this in into branch and mainline?
Cheers,
Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: convert_4.patch
Type: text/x-patch
Size: 7260 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20030314/7b91733c/attachment.bin>
More information about the Java-patches
mailing list