diff options
author | Sven Gothel <[email protected]> | 2023-06-16 00:43:11 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-06-16 00:43:11 +0200 |
commit | 03c548d96e5c81d0fc39503fe3042cf03e0a75e2 (patch) | |
tree | 604aa5b285e5f0476727f0d9b3d23aaf557833a3 /src/native/common/PointerBuffer.c | |
parent | ffd0c48999daa2b321a00fb9ad7ba175734486e3 (diff) |
GlueGen Struct [1]: Enhance com.jogamp.common.nio.* to serve a most native-free-code Struct-Code generation
Recfactored all NIO buffer utils to Buffers, i.e. buffer <-> address, memcpy, strnlen, etc
Buffers:
- Added copyNativeToDirectByteBuffer(..), allowing to copy a native memory slice into a direct buffer.
- Added typeNameToBufferClass(String) and sizeOfBufferElem(Class<? extends Buffer>)
- Completed slize2<Type>(..) buffer-mapping methods
- Exposure of safe getDirectByteBuffer(..) w/ null-check (package private)
Added NativeBuffer.storeDirectAddress(..), allowing to write the array address into a native buffer (struct, etc),
allowing to referencing the ElementBuffer (linear array of elements) and PointerBuffer (array of pointer).
Hint: This can be read via PointerBuffer.wrap(..).get(0)
Added ElementBuffer (a NativeBuffer) mapping an array of elements,
completing native abstraction next to PointerBuffer (array of pointer).
ElementBuffer can dereference an existing element-array by native address via ElementBuffer.derefPointer(..).
Views of its content can be directly accessed via ElementBuffer.slice(..).
+++
These utilities and buffer abstractions will allow to reuse code and simplify the GlueGen struct get/set implementations
and help to reduce native code injection.
Diffstat (limited to 'src/native/common/PointerBuffer.c')
-rw-r--r-- | src/native/common/PointerBuffer.c | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/src/native/common/PointerBuffer.c b/src/native/common/PointerBuffer.c deleted file mode 100644 index f3e25d3..0000000 --- a/src/native/common/PointerBuffer.c +++ /dev/null @@ -1,14 +0,0 @@ - -#include <jni.h> - -#include <assert.h> - -#include <gluegen_stdint.h> - -#include "com_jogamp_common_nio_PointerBuffer.h" - -JNIEXPORT jlong JNICALL -Java_com_jogamp_common_nio_PointerBuffer_getDirectBufferAddressImpl(JNIEnv *env, jclass _unused, jobject directBuffer) { - return ( NULL != directBuffer ) ? (jlong) (intptr_t) (*env)->GetDirectBufferAddress(env, directBuffer) : 0L ; -} - |