diff options
author | Mark Wielaard <mark@klomp.org> | 2006-05-14 14:47:49 +0000 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2006-05-14 14:47:49 +0000 |
commit | 3b0f954cf611df0f4e12b05ca98f0fd89474a01b (patch) | |
tree | 91c8603c71e75fb320b9cb36a079da208eb4f798 | |
parent | 4d18649bfaaff2ed6c2a4deec58d2700baf1495f (diff) | |
download | classpath-3b0f954cf611df0f4e12b05ca98f0fd89474a01b.tar.gz |
2006-05-13 Tom Tromey <tromey@redhat.com>
* java/nio/ByteBufferImpl.java (compact): Always set position.
-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; } |