In NIO, we have a mistake in the slice() methods of all the view buffers. The position was computed incorrectly.
2007-04-27 Roman Kennke <[EMAIL PROTECTED]>
* java/nio/CharViewBufferImpl.java
(slice): Fixed offset for slice buffer.
* java/nio/DoubleViewBufferImpl.java
(slice): Fixed offset for slice buffer.
* java/nio/FloatViewBufferImpl.java
(slice): Fixed offset for slice buffer.
* java/nio/IntViewBufferImpl.java
(slice): Fixed offset for slice buffer.
* java/nio/LongViewBufferImpl.java
(slice): Fixed offset for slice buffer.
* java/nio/ShortViewBufferImpl.java
(slice): Fixed offset for slice buffer.
/Roman
--
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
? java/nio/DirectIntBuffer.java
Index: java/nio/CharViewBufferImpl.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/nio/CharViewBufferImpl.java,v
retrieving revision 1.7
diff -u -1 -5 -r1.7 CharViewBufferImpl.java
--- java/nio/CharViewBufferImpl.java 2 Jul 2005 20:32:39 -0000 1.7
+++ java/nio/CharViewBufferImpl.java 27 Apr 2007 14:14:17 -0000
@@ -121,31 +121,31 @@
bb.shiftDown(offset, offset + 2 * position(), 2 * count);
position (count);
limit (capacity ());
}
else
{
position(limit());
limit(capacity());
}
return this;
}
public CharBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
- return new CharViewBufferImpl (bb, (position () >> 1) + offset,
+ return new CharViewBufferImpl (bb, (position () << 1) + offset,
remaining (), remaining (), 0, -1,
isReadOnly (), endian);
}
CharBuffer duplicate (boolean readOnly)
{
int pos = position();
reset();
int mark = position();
position(pos);
return new CharViewBufferImpl (bb, offset, capacity(), limit(),
pos, mark, readOnly, endian);
}
public CharBuffer duplicate ()
Index: java/nio/DoubleViewBufferImpl.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/nio/DoubleViewBufferImpl.java,v
retrieving revision 1.8
diff -u -1 -5 -r1.8 DoubleViewBufferImpl.java
--- java/nio/DoubleViewBufferImpl.java 2 Jul 2005 20:32:39 -0000 1.8
+++ java/nio/DoubleViewBufferImpl.java 27 Apr 2007 14:14:17 -0000
@@ -118,31 +118,31 @@
int count = limit () - position ();
bb.shiftDown(offset, offset + 8 * position(), 8 * count);
position (count);
limit (capacity ());
}
else
{
position(limit());
limit(capacity());
}
return this;
}
public DoubleBuffer slice ()
{
- return new DoubleViewBufferImpl (bb, (position () >> 3) + offset,
+ return new DoubleViewBufferImpl (bb, (position () << 3) + offset,
remaining(), remaining(), 0, -1,
readOnly, endian);
}
DoubleBuffer duplicate (boolean readOnly)
{
int pos = position();
reset();
int mark = position();
position(pos);
return new DoubleViewBufferImpl (bb, offset, capacity(), limit(),
pos, mark, readOnly, endian);
}
public DoubleBuffer duplicate ()
Index: java/nio/FloatViewBufferImpl.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/nio/FloatViewBufferImpl.java,v
retrieving revision 1.8
diff -u -1 -5 -r1.8 FloatViewBufferImpl.java
--- java/nio/FloatViewBufferImpl.java 2 Jul 2005 20:32:39 -0000 1.8
+++ java/nio/FloatViewBufferImpl.java 27 Apr 2007 14:14:17 -0000
@@ -119,31 +119,31 @@
bb.shiftDown(offset, offset + 4 * position(), 4 * count);
position (count);
limit (capacity ());
}
else
{
position(limit());
limit(capacity());
}
return this;
}
public FloatBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
- return new FloatViewBufferImpl (bb, (position () >> 2) + offset,
+ return new FloatViewBufferImpl (bb, (position () << 2) + offset,
remaining(), remaining(), 0, -1,
readOnly, endian);
}
FloatBuffer duplicate (boolean readOnly)
{
int pos = position();
reset();
int mark = position();
position(pos);
return new FloatViewBufferImpl (bb, offset, capacity(), limit(),
pos, mark, readOnly, endian);
}
public FloatBuffer duplicate ()
Index: java/nio/IntViewBufferImpl.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/nio/IntViewBufferImpl.java,v
retrieving revision 1.8
diff -u -1 -5 -r1.8 IntViewBufferImpl.java
--- java/nio/IntViewBufferImpl.java 2 Jul 2005 20:32:39 -0000 1.8
+++ java/nio/IntViewBufferImpl.java 27 Apr 2007 14:14:17 -0000
@@ -119,31 +119,31 @@
bb.shiftDown(offset, offset + 4 * position(), 4 * count);
position (count);
limit (capacity ());
}
else
{
position(limit());
limit(capacity());
}
return this;
}
public IntBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
- return new IntViewBufferImpl (bb, (position () >> 2) + offset,
+ return new IntViewBufferImpl (bb, (position () << 2) + offset,
remaining(), remaining(), 0, -1,
readOnly, endian);
}
IntBuffer duplicate (boolean readOnly)
{
int pos = position();
reset();
int mark = position();
position(pos);
return new IntViewBufferImpl (bb, offset, capacity(), limit(),
pos, mark, readOnly, endian);
}
public IntBuffer duplicate ()
Index: java/nio/LongViewBufferImpl.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/nio/LongViewBufferImpl.java,v
retrieving revision 1.8
diff -u -1 -5 -r1.8 LongViewBufferImpl.java
--- java/nio/LongViewBufferImpl.java 2 Jul 2005 20:32:39 -0000 1.8
+++ java/nio/LongViewBufferImpl.java 27 Apr 2007 14:14:17 -0000
@@ -119,31 +119,31 @@
bb.shiftDown(offset, offset + 8 * position(), 8 * count);
position (count);
limit (capacity ());
}
else
{
position(limit());
limit(capacity());
}
return this;
}
public LongBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
- return new LongViewBufferImpl (bb, (position () >> 3) + offset,
+ return new LongViewBufferImpl (bb, (position () << 3) + offset,
remaining(), remaining(), 0, -1,
readOnly, endian);
}
LongBuffer duplicate (boolean readOnly)
{
int pos = position();
reset();
int mark = position();
position(pos);
return new LongViewBufferImpl (bb, offset, capacity(), limit(),
pos, mark, readOnly, endian);
}
public LongBuffer duplicate ()
Index: java/nio/ShortViewBufferImpl.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/nio/ShortViewBufferImpl.java,v
retrieving revision 1.8
diff -u -1 -5 -r1.8 ShortViewBufferImpl.java
--- java/nio/ShortViewBufferImpl.java 2 Jul 2005 20:32:39 -0000 1.8
+++ java/nio/ShortViewBufferImpl.java 27 Apr 2007 14:14:17 -0000
@@ -119,31 +119,31 @@
bb.shiftDown(offset, offset + 2 * position(), 2 * count);
position (count);
limit (capacity ());
}
else
{
position(limit());
limit(capacity());
}
return this;
}
public ShortBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
- return new ShortViewBufferImpl (bb, (position () >> 1) + offset,
+ return new ShortViewBufferImpl (bb, (position () << 1) + offset,
remaining(), remaining(), 0, -1,
readOnly, endian);
}
ShortBuffer duplicate (boolean readOnly)
{
int pos = position();
reset();
int mark = position();
position(pos);
return new ShortViewBufferImpl (bb, offset, capacity(), limit(),
pos, mark, readOnly, endian);
}
public ShortBuffer duplicate ()
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
