summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2006-08-07 22:13:14 +0000
committerMark Wielaard <mark@klomp.org>2006-08-07 22:13:14 +0000
commit8e44dc1fa015c1e58adce96dea2793c46f9bb218 (patch)
tree93839d25c83e38d9eb69bf473fa3d1ef6fb427a4
parentfc0c582fa1349b0291363e88278a53e9550db88f (diff)
downloadclasspath-8e44dc1fa015c1e58adce96dea2793c46f9bb218.tar.gz
2006-08-07 C. Scott Marshall <csm@gnu.org>
Fixes PR 28608. * java/nio/DirectByteBufferImpl.java (duplicate): only reset if the mark has been set. * native/jni/java-nio/java_nio_VMDirectByteBuffer.c (Java_java_nio_VMDirectByteBuffer_allocate): zero out the allocated data.
-rw-r--r--ChangeLog9
-rw-r--r--java/nio/DirectByteBufferImpl.java1
-rw-r--r--native/jni/java-nio/java_nio_VMDirectByteBuffer.c2
3 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 5d24d1ce4..6c18aaa2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-08-07 C. Scott Marshall <csm@gnu.org>
+
+ Fixes PR 28608.
+ * java/nio/DirectByteBufferImpl.java (duplicate): only reset if
+ the mark has been set.
+ * native/jni/java-nio/java_nio_VMDirectByteBuffer.c
+ (Java_java_nio_VMDirectByteBuffer_allocate): zero out the
+ allocated data.
+
2006-08-07 Sven de Marothy <sven@physto.se>
* gnu/java/awt/peer/gtk/CairoGraphics2D.java
diff --git a/java/nio/DirectByteBufferImpl.java b/java/nio/DirectByteBufferImpl.java
index 53bb668aa..3a9036f31 100644
--- a/java/nio/DirectByteBufferImpl.java
+++ b/java/nio/DirectByteBufferImpl.java
@@ -232,6 +232,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
private ByteBuffer duplicate(boolean readOnly)
{
int pos = position();
+ if (this.mark != -1)
reset();
int mark = position();
position(pos);
diff --git a/native/jni/java-nio/java_nio_VMDirectByteBuffer.c b/native/jni/java-nio/java_nio_VMDirectByteBuffer.c
index f725cf2a4..bfee7e9dc 100644
--- a/native/jni/java-nio/java_nio_VMDirectByteBuffer.c
+++ b/native/jni/java-nio/java_nio_VMDirectByteBuffer.c
@@ -60,6 +60,8 @@ Java_java_nio_VMDirectByteBuffer_allocate
return 0;
}
+ memset (buffer, 0, capacity);
+
return JCL_NewRawDataObject (env, buffer);
}