>>>>> "Mark" == Mark Wielaard <[EMAIL PROTECTED]> writes:

>> 2006-05-01  Tom Tromey  <[EMAIL PROTECTED]>
>> * java/nio/ByteBufferImpl.java (compact): Don't reset position
>> in empty case.

Mark> This does introduce a mauve regression.

Sorry about that.

Mark> Could you take a look?

Fixed as appended.  This is a little bigger than need be, I made it
more closely resemble the other compact() implementations.

Tom

2006-05-13  Tom Tromey  <[EMAIL PROTECTED]>

        * java/nio/ByteBufferImpl.java (compact): Always set position.

Index: java/nio/ByteBufferImpl.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/nio/ByteBufferImpl.java,v
retrieving revision 1.14
diff -u -r1.14 ByteBufferImpl.java
--- java/nio/ByteBufferImpl.java        1 May 2006 22:41:20 -0000       1.14
+++ java/nio/ByteBufferImpl.java        13 May 2006 17:13:37 -0000
@@ -115,12 +115,10 @@
     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;
   }

Reply via email to