diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | java/nio/ByteBufferImpl.java | 10 |
2 files changed, 8 insertions, 6 deletions
@@ -1,3 +1,7 @@ +2006-05-13 Tom Tromey <tromey@redhat.com> + + * java/nio/ByteBufferImpl.java (compact): Always set position. + 2006-05-11 Mark Wielaard <mark@klomp.org> * java/util/logging/Logger.java (global): Initialize inside static diff --git a/java/nio/ByteBufferImpl.java b/java/nio/ByteBufferImpl.java index cbe627b06..aa51a65bd 100644 --- a/java/nio/ByteBufferImpl.java +++ b/java/nio/ByteBufferImpl.java @@ -115,12 +115,10 @@ final class ByteBufferImpl extends ByteBuffer checkIfReadOnly(); mark = -1; int pos = position(); - if (pos > 0) - { - int count = remaining(); - shiftDown(0, pos, count); - position(count); - } + int n = limit() - pos; + if (n > 0) + shiftDown(0, pos, n); + position(n); limit(capacity()); return this; } |