Imported GNU Classpath 0.19 + gcj-import-20051115.

* sources.am: Regenerated.
       * Makefile.in: Likewise.
       * scripts/makemake.tcl: Use glob -nocomplain.

From-SVN: r107049
This commit is contained in:
Mark Wielaard
2005-11-15 23:20:01 +00:00
parent 02e549bfaa
commit 8f523f3a10
1241 changed files with 97711 additions and 25284 deletions
@@ -258,7 +258,7 @@ public final class SocketChannelImpl extends SocketChannel
}
else
{
dst.put (data, offset, len);
dst.put (data, offset, readBytes);
}
return readBytes;
@@ -175,7 +175,8 @@ public final class FileChannelImpl extends FileChannel
*/
protected void finalize() throws IOException
{
this.close();
if (fd != -1)
close();
}
public int read (ByteBuffer dst) throws IOException
@@ -54,6 +54,8 @@ final class UTF_16Decoder extends CharsetDecoder
static final int BIG_ENDIAN = 0;
static final int LITTLE_ENDIAN = 1;
static final int UNKNOWN_ENDIAN = 2;
static final int MAYBE_BIG_ENDIAN = 3;
static final int MAYBE_LITTLE_ENDIAN = 4;
private static final char BYTE_ORDER_MARK = 0xFEFF;
private static final char REVERSED_BYTE_ORDER_MARK = 0xFFFE;
@@ -81,26 +83,37 @@ final class UTF_16Decoder extends CharsetDecoder
byte b2 = in.get ();
// handle byte order mark
if (byteOrder == UNKNOWN_ENDIAN)
if (byteOrder == UNKNOWN_ENDIAN ||
byteOrder == MAYBE_BIG_ENDIAN ||
byteOrder == MAYBE_LITTLE_ENDIAN)
{
char c = (char) (((b1 & 0xFF) << 8) | (b2 & 0xFF));
if (c == BYTE_ORDER_MARK)
{
if (byteOrder == MAYBE_LITTLE_ENDIAN)
{
return CoderResult.malformedForLength (2);
}
byteOrder = BIG_ENDIAN;
inPos += 2;
continue;
}
else if (c == REVERSED_BYTE_ORDER_MARK)
{
if (byteOrder == MAYBE_BIG_ENDIAN)
{
return CoderResult.malformedForLength (2);
}
byteOrder = LITTLE_ENDIAN;
inPos += 2;
continue;
}
else
{
// assume big endian, do not consume bytes,
// assume big or little endian, do not consume bytes,
// continue with normal processing
byteOrder = BIG_ENDIAN;
byteOrder = (byteOrder == MAYBE_LITTLE_ENDIAN ?
LITTLE_ENDIAN : BIG_ENDIAN);
}
}
@@ -64,7 +64,7 @@ final class UnicodeLittle extends Charset
public CharsetDecoder newDecoder ()
{
return new UTF_16Decoder (this, UTF_16Decoder.UNKNOWN_ENDIAN);
return new UTF_16Decoder (this, UTF_16Decoder.MAYBE_LITTLE_ENDIAN);
}
public CharsetEncoder newEncoder ()
@@ -62,7 +62,11 @@ public final class IconvProvider extends CharsetProvider
}
}
private IconvProvider()
// Declaring the construtor public may violate the use of singleton.
// But it must be public so that an instance of this class can be
// created by Class.newInstance(), which is the case when this provider is
// defined in META-INF/services/java.nio.charset.spi.CharsetProvider.
public IconvProvider()
{
IconvMetaData.setup();
}