diff options
| author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-07 18:35:00 +0000 |
|---|---|---|
| committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-07 18:35:00 +0000 |
| commit | a3cef0cf3594b7f7e54cad0fabd05584daf96849 (patch) | |
| tree | 4416490914744db9c6d980b6558414bd86715239 /libjava/gnu | |
| parent | 0978d75cf2c65b9c4b9910edd57fd3a2c3416cf6 (diff) | |
| download | ppe42-gcc-a3cef0cf3594b7f7e54cad0fabd05584daf96849.tar.gz ppe42-gcc-a3cef0cf3594b7f7e54cad0fabd05584daf96849.zip | |
2002-06-06 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.
2002-06-06 Mark Wielaard <mark@klomp dot 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67595 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu')
| -rw-r--r-- | libjava/gnu/gcj/convert/Output_EUCJIS.java | 7 | ||||
| -rw-r--r-- | libjava/gnu/gcj/convert/Output_SJIS.java | 7 | ||||
| -rw-r--r-- | libjava/gnu/gcj/convert/Output_UTF8.java | 9 | ||||
| -rw-r--r-- | libjava/gnu/gcj/convert/UnicodeToBytes.java | 13 |
4 files changed, 32 insertions, 4 deletions
diff --git a/libjava/gnu/gcj/convert/Output_EUCJIS.java b/libjava/gnu/gcj/convert/Output_EUCJIS.java index 0662239aa85..c0cc4378b26 100644 --- a/libjava/gnu/gcj/convert/Output_EUCJIS.java +++ b/libjava/gnu/gcj/convert/Output_EUCJIS.java @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 1999, 2003 Free Software Foundation This file is part of libgcj. @@ -22,6 +22,11 @@ public class Output_EUCJIS extends UnicodeToBytes public native int write (String str, int inpos, int inlength, char[] work); + public boolean havePendingBytes() + { + return pending1 >= 0; + } + int pending1 = -1; int pending2; } diff --git a/libjava/gnu/gcj/convert/Output_SJIS.java b/libjava/gnu/gcj/convert/Output_SJIS.java index c5370642378..67470ba7803 100644 --- a/libjava/gnu/gcj/convert/Output_SJIS.java +++ b/libjava/gnu/gcj/convert/Output_SJIS.java @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 1999, 2003 Free Software Foundation This file is part of libgcj. @@ -22,5 +22,10 @@ public class Output_SJIS extends UnicodeToBytes public native int write (String str, int inpos, int inlength, char[] work); + public boolean havePendingBytes() + { + return pending >= 0; + } + int pending = -1; } diff --git a/libjava/gnu/gcj/convert/Output_UTF8.java b/libjava/gnu/gcj/convert/Output_UTF8.java index 01f5ce890e3..f54e7ebcfc2 100644 --- a/libjava/gnu/gcj/convert/Output_UTF8.java +++ b/libjava/gnu/gcj/convert/Output_UTF8.java @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000 Free Software Foundation +/* Copyright (C) 1999, 2000, 2003 Free Software Foundation This file is part of libgcj. @@ -104,6 +104,7 @@ public class Output_UTF8 extends UnicodeToBytes { value = (hi_part - 0xD800) * 0x400 + (ch - 0xDC00) + 0x10000; buf[count++] = (byte) (0xF0 | (value >> 18)); + avail--; bytes_todo = 3; hi_part = 0; } @@ -118,4 +119,10 @@ public class Output_UTF8 extends UnicodeToBytes } return inpos - start_pos; } + + public boolean havePendingBytes() + { + return bytes_todo > 0; + } + } diff --git a/libjava/gnu/gcj/convert/UnicodeToBytes.java b/libjava/gnu/gcj/convert/UnicodeToBytes.java index 8181cb83109..0785d7ea43e 100644 --- a/libjava/gnu/gcj/convert/UnicodeToBytes.java +++ b/libjava/gnu/gcj/convert/UnicodeToBytes.java @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000, 2001 Free Software Foundation +/* Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation This file is part of libgcj. @@ -146,6 +146,17 @@ public abstract class UnicodeToBytes extends IOConverter return write(work, 0, srcEnd - inpos); } + /** + * Returns true when the converter has consumed some bytes that are + * not yet converted to characters because further continuation + * bytes are needed. Defaults to false, should be overridden by + * decoders that internally store some bytes. + */ + public boolean havePendingBytes() + { + return false; + } + /** Indicate that the converter is resuable. * This class keeps track of converters on a per-encoding basis. * When done with an encoder you may call this method to indicate |

