summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-04-26 22:20:46 +0200
committerSven Gothel <[email protected]>2011-04-26 22:20:46 +0200
commita07892f07f15c96ca248fc12133748be7058241f (patch)
treecf5747dd3df05ffcc75cda349d8fa38fc4b5958c
parent245bd152c3f328e5df69d60da975697431fa923b (diff)
refactoring in common.nio public api - removed Int64Buffer
- removed Int64Buffer since it is no longer needed for LongBuffer emulation Signed-off-by: Sven Gothel <[email protected]>
-rwxr-xr-xsrc/java/com/jogamp/common/nio/Buffers.java17
-rw-r--r--src/java/com/jogamp/common/nio/Int64Buffer.java71
-rwxr-xr-xsrc/java/com/jogamp/common/nio/Int64BufferSE.java70
-rw-r--r--src/java/com/jogamp/gluegen/JavaEmitter.java4
-rw-r--r--src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java26
-rw-r--r--src/java/com/jogamp/gluegen/JavaType.java16
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java52
7 files changed, 46 insertions, 210 deletions
diff --git a/src/java/com/jogamp/common/nio/Buffers.java b/src/java/com/jogamp/common/nio/Buffers.java
index abf6692..ed9323e 100755
--- a/src/java/com/jogamp/common/nio/Buffers.java
+++ b/src/java/com/jogamp/common/nio/Buffers.java
@@ -297,8 +297,6 @@ public class Buffers {
}
if (buf instanceof Buffer) {
return ((Buffer) buf).isDirect();
- } else if (buf instanceof Int64Buffer) {
- return ((Int64Buffer) buf).isDirect();
} else if (buf instanceof PointerBuffer) {
return ((PointerBuffer) buf).isDirect();
}
@@ -324,16 +322,13 @@ public class Buffers {
return pos * SIZEOF_INT;
} else if (buf instanceof ShortBuffer) {
return pos * SIZEOF_SHORT;
- }else if (buf instanceof DoubleBuffer) {
+ } else if (buf instanceof DoubleBuffer) {
return pos * SIZEOF_DOUBLE;
} else if (buf instanceof LongBuffer) {
return pos * SIZEOF_LONG;
} else if (buf instanceof CharBuffer) {
return pos * SIZEOF_CHAR;
}
- } else if (buf instanceof Int64Buffer) {
- Int64Buffer int64Buffer = (Int64Buffer) buf;
- return int64Buffer.position() * Int64Buffer.elementSize();
} else if (buf instanceof PointerBuffer) {
PointerBuffer pointerBuffer = (PointerBuffer) buf;
return pointerBuffer.position() * PointerBuffer.elementSize();
@@ -352,8 +347,6 @@ public class Buffers {
}
if (buf instanceof Buffer) {
return ((Buffer) buf).array();
- } else if (buf instanceof Int64Buffer) {
- return ((Int64Buffer) buf).array();
} else if (buf instanceof PointerBuffer) {
return ((PointerBuffer) buf).array();
}
@@ -381,16 +374,13 @@ public class Buffers {
return (SIZEOF_INT * (((IntBuffer) buf).arrayOffset() + pos));
} else if (buf instanceof ShortBuffer) {
return (SIZEOF_SHORT * (((ShortBuffer) buf).arrayOffset() + pos));
- }else if (buf instanceof DoubleBuffer) {
+ } else if (buf instanceof DoubleBuffer) {
return (SIZEOF_DOUBLE * (((DoubleBuffer) buf).arrayOffset() + pos));
} else if (buf instanceof LongBuffer) {
return (SIZEOF_LONG * (((LongBuffer) buf).arrayOffset() + pos));
} else if (buf instanceof CharBuffer) {
return (SIZEOF_CHAR * (((CharBuffer) buf).arrayOffset() + pos));
}
- } else if (buf instanceof Int64Buffer) {
- Int64Buffer int64Buffer = (Int64Buffer) buf;
- return Int64Buffer.elementSize() * (int64Buffer.arrayOffset() + int64Buffer.position());
} else if (buf instanceof PointerBuffer) {
PointerBuffer pointerBuffer = (PointerBuffer) buf;
return PointerBuffer.elementSize() * (pointerBuffer.arrayOffset() + pointerBuffer.position());
@@ -782,9 +772,6 @@ public class Buffers {
} else if (buffer instanceof CharBuffer) {
bytesRemaining = elementsRemaining * SIZEOF_CHAR;
}
- } else if (buffer instanceof Int64Buffer) {
- Int64Buffer int64Buffer = (Int64Buffer) buffer;
- bytesRemaining = int64Buffer.remaining() * Int64Buffer.elementSize();
} else if (buffer instanceof PointerBuffer) {
PointerBuffer pointerBuffer = (PointerBuffer) buffer;
bytesRemaining = pointerBuffer.remaining() * PointerBuffer.elementSize();
diff --git a/src/java/com/jogamp/common/nio/Int64Buffer.java b/src/java/com/jogamp/common/nio/Int64Buffer.java
deleted file mode 100644
index 968e48d..0000000
--- a/src/java/com/jogamp/common/nio/Int64Buffer.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package com.jogamp.common.nio;
-
-import java.nio.ByteBuffer;
-
-/**
- * Hardware independent container for native int64_t arrays.
- *
- * The native values (NIO direct ByteBuffer) are always 64bit wide.
- *
- * @author Michael Bien
- * @author Sven Gothel
- */
-public abstract class Int64Buffer extends AbstractLongBuffer<Int64Buffer> {
-
- protected Int64Buffer(ByteBuffer bb) {
- super(bb, elementSize());
- }
-
- public static Int64Buffer allocate(int size) {
- return new Int64BufferSE(ByteBuffer.wrap(new byte[elementSize() * size]));
- }
-
- public static Int64Buffer allocateDirect(int size) {
- return new Int64BufferSE(Buffers.newDirectByteBuffer(elementSize() * size));
- }
-
- public static Int64Buffer wrap(ByteBuffer src) {
- Int64Buffer res = new Int64BufferSE(src);
- res.updateBackup();
- return res;
-
- }
-
- public static int elementSize() {
- return Buffers.SIZEOF_LONG;
- }
-
- @Override
- public String toString() {
- return "Int64Buffer:"+super.toString();
- }
-
-}
diff --git a/src/java/com/jogamp/common/nio/Int64BufferSE.java b/src/java/com/jogamp/common/nio/Int64BufferSE.java
deleted file mode 100755
index 4c410b4..0000000
--- a/src/java/com/jogamp/common/nio/Int64BufferSE.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- */
-package com.jogamp.common.nio;
-
-import java.nio.*;
-
-/**
- * @author Sven Gothel
- * @author Michael Bien
- */
-final class Int64BufferSE extends Int64Buffer {
-
- private LongBuffer pb;
-
- Int64BufferSE(ByteBuffer bb) {
- super(bb);
-
- this.pb = bb.asLongBuffer();
- }
-
- public final long get(int idx) {
- if (0 > idx || idx >= capacity) {
- throw new IndexOutOfBoundsException();
- }
- return pb.get(idx);
- }
-
- public final Int64BufferSE put(int idx, long v) {
- if (0 > idx || idx >= capacity) {
- throw new IndexOutOfBoundsException();
- }
- backup[idx] = v;
- pb.put(idx, v);
- return this;
- }
-}
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java
index 250da79..745176a 100644
--- a/src/java/com/jogamp/gluegen/JavaEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaEmitter.java
@@ -1844,7 +1844,7 @@ public class JavaEmitter implements GlueEmitter {
if (convertToArrays) {
result = result.replaceJavaArgumentType(i, javaType(ArrayTypes.longArrayClass));
} else {
- result = result.replaceJavaArgumentType(i, JavaType.forNIOInt64BufferClass());
+ result = result.replaceJavaArgumentType(i, JavaType.forNIOLongBufferClass());
}
} else if (t.isCFloatPointerType()) {
arrayPossible = true;
@@ -1880,7 +1880,7 @@ public class JavaEmitter implements GlueEmitter {
} else if (t.isCInt32PointerType()) {
result = result.replaceJavaArgumentType(-1, JavaType.forNIOIntBufferClass());
} else if (t.isCInt64PointerType()) {
- result = result.replaceJavaArgumentType(-1, JavaType.forNIOInt64BufferClass());
+ result = result.replaceJavaArgumentType(-1, JavaType.forNIOLongBufferClass());
} else if (t.isCFloatPointerType()) {
result = result.replaceJavaArgumentType(-1, JavaType.forNIOFloatBufferClass());
} else if (t.isCDoublePointerType()) {
diff --git a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
index 3bf3dc1..ce1acc2 100644
--- a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
@@ -39,12 +39,15 @@
package com.jogamp.gluegen;
-import java.io.*;
-import java.util.*;
+import com.jogamp.gluegen.cgram.HeaderParser;
+import com.jogamp.gluegen.cgram.types.ArrayType;
+import com.jogamp.gluegen.cgram.types.CompoundType;
+import com.jogamp.gluegen.cgram.types.EnumType;
+import com.jogamp.gluegen.cgram.types.PointerType;
+import com.jogamp.gluegen.cgram.types.Type;
+import java.io.PrintWriter;
import java.text.MessageFormat;
-
-import com.jogamp.gluegen.cgram.types.*;
-import com.jogamp.gluegen.cgram.*;
+import java.util.List;
/**
* An emitter that emits only the interface for a Java<->C JNI binding.
@@ -592,7 +595,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter {
}
if (type.isNIOBuffer()) {
- if(type.isNIOInt64Buffer() || type.isNIOPointerBuffer()) {
+ if(type.isNIOPointerBuffer()) {
if (directNIOOnly) {
writer.print( getArgumentName(i)+ " != null ? " + getArgumentName(i) + ".getBuffer() : null");
} else {
@@ -735,15 +738,14 @@ public class JavaMethodBindingEmitter extends FunctionEmitter {
if (getBinding().getCReturnType().pointerDepth() >= 2) {
if (returnType.isNIOPointerBuffer()) {
writer.println(" return PointerBuffer.wrap(_res);");
- } else if (returnType.isNIOInt64Buffer()) {
- writer.println(" return Int64Buffer.wrap(_res);");
+ } else if (returnType.isNIOLongBuffer()) {
+ writer.println(" return _res.asLongBuffer();");
} else {
throw new RuntimeException("While emitting glue code for " + getName() +
- ": can not legally make pointers opaque to anything but PointerBuffer or Int64Buffer/long");
+ ": can not legally make pointers opaque to anything but PointerBuffer or LongBuffer/long");
}
- } else if (getBinding().getCReturnType().pointerDepth() == 1 &&
- returnType.isNIOInt64Buffer()) {
- writer.println(" return Int64Buffer.wrap(_res);");
+ } else if (getBinding().getCReturnType().pointerDepth() == 1 && returnType.isNIOLongBuffer()) {
+ writer.println(" return _res.asLongBuffer();");
} else {
String returnTypeName = returnType.getName().substring("java.nio.".length());
writer.println(" return _res.as" + returnTypeName + "();");
diff --git a/src/java/com/jogamp/gluegen/JavaType.java b/src/java/com/jogamp/gluegen/JavaType.java
index 9a89203..04d14de 100644
--- a/src/java/com/jogamp/gluegen/JavaType.java
+++ b/src/java/com/jogamp/gluegen/JavaType.java
@@ -70,7 +70,6 @@ public class JavaType {
private static JavaType nioIntBufferType;
private static JavaType nioLongBufferType;
private static JavaType nioPointerBufferType;
- private static JavaType nioInt64BufferType;
private static JavaType nioFloatBufferType;
private static JavaType nioDoubleBufferType;
private static JavaType nioByteBufferArrayType;
@@ -194,12 +193,6 @@ public class JavaType {
return nioLongBufferType;
}
- public static JavaType forNIOInt64BufferClass() {
- if(nioInt64BufferType == null)
- nioInt64BufferType = createForClass(com.jogamp.common.nio.Int64Buffer.class);
- return nioInt64BufferType;
- }
-
public static JavaType forNIOPointerBufferClass() {
if(nioPointerBufferType == null)
nioPointerBufferType = createForClass(com.jogamp.common.nio.PointerBuffer.class);
@@ -338,9 +331,8 @@ public class JavaType {
}
public boolean isNIOBuffer() {
- return clazz != null && ( (java.nio.Buffer.class).isAssignableFrom(clazz) ||
- (com.jogamp.common.nio.PointerBuffer.class).isAssignableFrom(clazz) ||
- (com.jogamp.common.nio.Int64Buffer.class).isAssignableFrom(clazz) ) ;
+ return clazz != null && ( java.nio.Buffer.class.isAssignableFrom(clazz) ||
+ com.jogamp.common.nio.NativeBuffer.class.isAssignableFrom(clazz)) ;
}
public boolean isNIOByteBuffer() {
@@ -359,10 +351,6 @@ public class JavaType {
return (clazz == java.nio.LongBuffer.class);
}
- public boolean isNIOInt64Buffer() {
- return (clazz == com.jogamp.common.nio.Int64Buffer.class);
- }
-
public boolean isNIOPointerBuffer() {
return (clazz == com.jogamp.common.nio.PointerBuffer.class);
}
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
index 7837bc4..30ef6fd 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
@@ -30,10 +30,10 @@ package com.jogamp.gluegen.test.junit.generation;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
-import com.jogamp.common.nio.Int64Buffer;
import com.jogamp.common.os.Platform;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
+import java.nio.LongBuffer;
import org.junit.Assert;
@@ -73,7 +73,7 @@ public class BaseClass {
long result;
long context = 0;
ByteBuffer bb=null;
- Int64Buffer lb=null;
+ LongBuffer lb=null;
PointerBuffer pb=null;
IntBuffer ib=null;
long[] larray = null;
@@ -148,11 +148,11 @@ public class BaseClass {
long result;
long context = 1;
- Int64Buffer lb = Int64Buffer.allocateDirect(1);
+ LongBuffer lb = Buffers.newDirectLongBuffer(1);
lb.put(0, 10);
ByteBuffer bb2 = Buffers.newDirectByteBuffer(Buffers.SIZEOF_LONG);
- Int64Buffer bb2L = Int64Buffer.wrap(bb2);
+ LongBuffer bb2L = bb2.asLongBuffer();
bb2L.put(0, 100);
IntBuffer ib1 = Buffers.newDirectByteBuffer(Buffers.SIZEOF_INT * Bindingtest1.ARRAY_SIZE).asIntBuffer();
@@ -160,11 +160,11 @@ public class BaseClass {
ib1.put(i, 1000);
}
- Int64Buffer lb1 = Int64Buffer.allocateDirect(Bindingtest1.ARRAY_SIZE);
+ LongBuffer lb1 = Buffers.newDirectLongBuffer(Bindingtest1.ARRAY_SIZE);
for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) {
lb1.put(i, 1000);
}
- Int64Buffer lb2 = Int64Buffer.allocateDirect(Bindingtest1.ARRAY_SIZE);
+ LongBuffer lb2 = Buffers.newDirectLongBuffer(Bindingtest1.ARRAY_SIZE);
for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) {
lb2.put(i, 10000);
}
@@ -208,10 +208,10 @@ public class BaseClass {
result = binding.arrayTestFooNioOnly(context, lb1);
Assert.assertTrue("Wrong result: "+result, 1+8000==result);
- // Int64Buffer arrayTestFoo2 ( Int64Buffer )
+ // LongBuffer arrayTestFoo2 ( LongBuffer )
{
lb2.rewind();
- Int64Buffer lb3 = Int64Buffer.allocateDirect(Bindingtest1.ARRAY_SIZE);
+ LongBuffer lb3 = Buffers.newDirectLongBuffer(Bindingtest1.ARRAY_SIZE);
lb3.put(lb2);
lb3.rewind();
lb2.rewind();
@@ -220,7 +220,7 @@ public class BaseClass {
Assert.assertTrue("Wrong result: "+lb3.capacity(), Bindingtest1.ARRAY_SIZE == lb3.capacity());
Assert.assertTrue("Wrong result: "+lb3.remaining(), Bindingtest1.ARRAY_SIZE == lb3.remaining());
- Int64Buffer lbR = binding.arrayTestFoo2(lb3);
+ LongBuffer lbR = binding.arrayTestFoo2(lb3);
// System.out.println("lbR: "+lbR);
Assert.assertNotNull(lbR);
@@ -234,14 +234,14 @@ public class BaseClass {
}
}
- // Int64Buffer arrayTestFoo2 ( long[], int )
+ // LongBuffer arrayTestFoo2 ( long[], int )
{
long[] larray3 = new long[Bindingtest1.ARRAY_SIZE];
for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) {
larray3[i]= larray2[i];
}
- Int64Buffer lbR = binding.arrayTestFoo2(larray3, 0);
+ LongBuffer lbR = binding.arrayTestFoo2(larray3, 0);
Assert.assertNotNull(lbR);
Assert.assertTrue("Wrong result: "+lbR.capacity(), Bindingtest1.ARRAY_SIZE == lbR.capacity());
@@ -252,11 +252,11 @@ public class BaseClass {
}
}
- // PointerBuffer arrayTestFoo3ArrayToPtrPtr(Int64Buffer)
+ // PointerBuffer arrayTestFoo3ArrayToPtrPtr(LongBuffer)
// PointerBuffer arrayTestFoo3PtrPtr(PointerBuffer)
{
lb2.rewind();
- Int64Buffer lb3 = Int64Buffer.allocateDirect(Bindingtest1.ARRAY_SIZE*Bindingtest1.ARRAY_SIZE);
+ LongBuffer lb3 = Buffers.newDirectLongBuffer(Bindingtest1.ARRAY_SIZE*Bindingtest1.ARRAY_SIZE);
int j;
for(j=0; j<Bindingtest1.ARRAY_SIZE; j++) {
lb3.put(lb2);
@@ -284,19 +284,19 @@ public class BaseClass {
}
}
- // PointerBuffer.referenceBuffer(Int64Buffer.getBuffer)
+ // PointerBuffer.referenceBuffer(LongBuffer.getBuffer)
// " "
// PointerBuffer arrayTestFoo3PtrPtr(PointerBuffer)
{
PointerBuffer pb = PointerBuffer.allocateDirect(Bindingtest1.ARRAY_SIZE);
int j;
for(j=0; j<Bindingtest1.ARRAY_SIZE; j++) {
- Int64Buffer lb3 = Int64Buffer.allocateDirect(Bindingtest1.ARRAY_SIZE);
+ LongBuffer lb3 = Buffers.newDirectLongBuffer(Bindingtest1.ARRAY_SIZE);
lb3.put(lb2);
lb2.rewind();
lb3.rewind();
- pb.referenceBuffer(lb3.getBuffer());
+ pb.referenceBuffer(lb3);
}
pb.rewind();
@@ -304,7 +304,7 @@ public class BaseClass {
Assert.assertTrue("Wrong result: "+pb.capacity(), Bindingtest1.ARRAY_SIZE == pb.capacity());
Assert.assertTrue("Wrong result: "+pb.remaining(), Bindingtest1.ARRAY_SIZE == pb.remaining());
Assert.assertNotNull(pb.getReferencedBuffer(0));
- Assert.assertTrue("Wrong result: "+pb.getReferencedBuffer(0)+" != "+lb2.getBuffer(), pb.getReferencedBuffer(0).equals(lb2.getBuffer()));
+ Assert.assertTrue("Wrong result: "+pb.getReferencedBuffer(0)+" != "+lb2, pb.getReferencedBuffer(0).equals(lb2));
PointerBuffer pb2 = binding.arrayTestFoo3PtrPtr(pb);
@@ -313,35 +313,35 @@ public class BaseClass {
Assert.assertTrue("Wrong result: "+pb2.remaining(), Bindingtest1.ARRAY_SIZE == pb2.remaining());
for(j=0; j<Bindingtest1.ARRAY_SIZE; j++) {
ByteBuffer bb = (ByteBuffer) pb.getReferencedBuffer(j);
- Int64Buffer i64b = Int64Buffer.wrap(bb);
+ LongBuffer i64b = bb.asLongBuffer();
for(i=0; i<Bindingtest1.ARRAY_SIZE; i++) {
Assert.assertTrue("Wrong result: ["+j+"]["+i+"] s:"+lb2.get(i)+" d: "+i64b.get(i), 1+lb2.get(i)==i64b.get(i));
}
}
}
- result = binding.bufferTest(lb.getBuffer());
+ result = binding.bufferTest(lb);
Assert.assertTrue("Wrong result: "+result, 10==result);
- result = binding.bufferTestNioOnly(lb.getBuffer());
+ result = binding.bufferTestNioOnly(lb);
Assert.assertTrue("Wrong result: "+result, 10==result);
- result = binding.doubleTest(context, lb.getBuffer(), lb1, bb2, lb2);
+ result = binding.doubleTest(context, lb, lb1, bb2, lb2);
Assert.assertTrue("Wrong result: "+result, 1+10+8000+100+80000==result);
- result = binding.doubleTest(context, lb.getBuffer(), larray1, larray1_offset, bb2, larray2, larray2_offset);
+ result = binding.doubleTest(context, lb, larray1, larray1_offset, bb2, larray2, larray2_offset);
Assert.assertTrue("Wrong result: "+result, 1+10+8000+100+80000==result);
- result = binding.doubleTestNioOnly(context, lb.getBuffer(), lb1, bb2, lb2);
+ result = binding.doubleTestNioOnly(context, lb, lb1, bb2, lb2);
Assert.assertTrue("Wrong result: "+result, 1+10+8000+100+80000==result);
- result = binding.mixedTest(context, lb.getBuffer(), lb1);
+ result = binding.mixedTest(context, lb, lb1);
Assert.assertTrue("Wrong result: "+result, 1+10+8000==result);
- result = binding.mixedTest(context, lb.getBuffer(), larray1, larray1_offset);
+ result = binding.mixedTest(context, lb, larray1, larray1_offset);
Assert.assertTrue("Wrong result: "+result, 1+10+8000==result);
- result = binding.mixedTestNioOnly(context, lb.getBuffer(), lb1);
+ result = binding.mixedTestNioOnly(context, lb, lb1);
Assert.assertTrue("Wrong result: "+result, 1+10+8000==result);
result = binding.nopTest();