diff options
author | Sven Gothel <[email protected]> | 2010-03-19 05:12:40 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-03-19 05:12:40 +0100 |
commit | 58d9dd488cbd7eee530031ef9ea523037be175cd (patch) | |
tree | c47ae5b560b9a935b7789ac1215a25cc8e2c7c4e /src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase | |
parent | 30d3d3a30fed35f23a8189dca3e7b4c92d57e2ad (diff) |
Drop PointerBuffer.wrapNative2Java(..)
in favor of a simple PointerBuffer.wrap(..),
due to the new semantics, ie internal integer/long presentation.
Fixed the javame code in this regard.
Diffstat (limited to 'src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase')
-rwxr-xr-x | src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase b/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase index 57ad05c..851c400 100755 --- a/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase +++ b/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase @@ -113,26 +113,6 @@ public class PointerBuffer { return res; } - /** - * Wraps pointer arrays created by native code. - * Note: In case this is not a 64bit system, each pointer is being converted. */ - public static PointerBuffer wrapNative2Java(ByteBuffer src, boolean keepDirect) { - PointerBuffer res; - if (CPU.is32Bit()) { - // Must convert each pointer from 32-bit to 64-bit - IntBuffer buf = src.asIntBuffer(); - int len = buf.capacity(); - res = (src.isDirect() && keepDirect) ? PointerBuffer.allocateDirect(len) : PointerBuffer.allocate(len); - for (int i = 0; i < len; i++) { - res.put(i, buf.get(i)); - } - } else { - res = new PointerBuffer(src); - res.updateBackup(); - } - return res; - } - public ByteBuffer getBuffer() { return bb; } @@ -145,10 +125,11 @@ public class PointerBuffer { if(0>idx || idx>=capacity) { throw new IndexOutOfBoundsException(); } - if(CPU.is32Bit()) + if(CPU.is32Bit()) { return ((IntBuffer)pb).get(idx); - else + } else { return ((LongBuffer)pb).get(idx); + } } public long get() { @@ -162,10 +143,11 @@ public class PointerBuffer { throw new IndexOutOfBoundsException(); } backup[idx] = v; - if (CPU.is32Bit()) + if(CPU.is32Bit()) { ((IntBuffer)pb).put(idx, (int)v); - else + } else { ((LongBuffer)pb).put(idx, v); + } return this; } @@ -184,5 +166,4 @@ public class PointerBuffer { public static int elementSize() { return CPU.is32Bit() ? BufferFactory.SIZEOF_INT : BufferFactory.SIZEOF_LONG; } - -}
\ No newline at end of file +} |