Restore memcpy-wrapper (with small #ifdef fix).

Fix some spacing and style to minimize the differences to upstream as much as possible for later reintegration.
Rename ssEndpointCompanionDescriptor Java variable to ssEndpointCompanionDescriptorPointer.
Fix all -Wconversion warnings.
Constify new structures as needed.
Use NewDirectReadOnlyBuffer as needed.
Add missing function declarations.
This commit is contained in:
Luca Longinotti 2013-07-15 14:26:45 +02:00
parent 9a608c7edc
commit c9d4b1c53b
20 changed files with 88 additions and 76 deletions

View File

@ -9,8 +9,9 @@ set -e
OS="linux"
ARCH="x86_64"
HOST="$ARCH-$OS-gnu"
CFLAGS="-m64"
CFLAGS="-m64 -Wl,--wrap=memcpy"
LIBUSB_CONFIG="--disable-shared --disable-udev"
USB4JAVA_LIBS="-lrt"
USB4JAVA_CFLAGS="-DWRAP_MEMCPY"
build

View File

@ -7,7 +7,7 @@
#include "BosDevCapabilityDescriptor.h"
void setBosDescriptor(JNIEnv* env,
struct libusb_bos_descriptor* descriptor, jobject object)
const struct libusb_bos_descriptor* descriptor, jobject object)
{
SET_POINTER(env, descriptor, object, "bosDescriptorPointer");
}
@ -35,7 +35,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(BosDescriptor, bLength)
struct libusb_bos_descriptor *descriptor =
unwrapBosDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bLength;
return (jbyte) descriptor->bLength;
}
/**
@ -49,7 +49,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(BosDescriptor, bDescriptorType)
struct libusb_bos_descriptor *descriptor =
unwrapBosDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bDescriptorType;
return (jbyte) descriptor->bDescriptorType;
}
/**
@ -63,7 +63,7 @@ JNIEXPORT jshort JNICALL METHOD_NAME(BosDescriptor, wTotalLength)
struct libusb_bos_descriptor *descriptor =
unwrapBosDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->wTotalLength;
return (jshort) descriptor->wTotalLength;
}
/**
@ -77,7 +77,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(BosDescriptor, bNumDeviceCaps)
struct libusb_bos_descriptor *descriptor =
unwrapBosDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bNumDeviceCaps;
return (jbyte) descriptor->bNumDeviceCaps;
}
/**

View File

@ -8,7 +8,7 @@
#include "usb4java.h"
void setBosDescriptor(JNIEnv*, struct libusb_bos_descriptor*, jobject);
void setBosDescriptor(JNIEnv*, const struct libusb_bos_descriptor*, jobject);
struct libusb_bos_descriptor* unwrapBosDescriptor(JNIEnv*, jobject);
void resetBosDescriptor(JNIEnv*, jobject);

View File

@ -13,21 +13,21 @@ jobject wrapBosDevCapabilityDescriptor(JNIEnv *env,
}
jobjectArray wrapBosDevCapabilityDescriptors(JNIEnv *env, int count,
struct libusb_bos_dev_capability_descriptor **descriptors)
struct libusb_bos_dev_capability_descriptor * const *descriptors)
{
int i;
jobjectArray array = (jobjectArray) (*env)->NewObjectArray(env,
count, (*env)->FindClass(env, PACKAGE_DIR"/BosDevCapabilityDescriptor"),
NULL);
for (i = 0; i < count; i++)
for (int i = 0; i < count; i++)
(*env)->SetObjectArrayElement(env, array, i,
wrapBosDevCapabilityDescriptor(env, descriptors[i]));
return array;
}
struct libusb_bos_dev_capability_descriptor
*unwrapBosDevCapabilityDescriptor(JNIEnv *env, jobject obj)
struct libusb_bos_dev_capability_descriptor*
unwrapBosDevCapabilityDescriptor(JNIEnv *env, jobject obj)
{
UNWRAP_POINTER(env, obj, struct libusb_bos_dev_capability_descriptor*,
"bosDevCapabilityDescriptorPointer");
@ -44,7 +44,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(BosDevCapabilityDescriptor, bLength)
struct libusb_bos_dev_capability_descriptor* descriptor =
unwrapBosDevCapabilityDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bLength;
return (jbyte) descriptor->bLength;
}
/**
@ -59,7 +59,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(BosDevCapabilityDescriptor,
struct libusb_bos_dev_capability_descriptor* descriptor =
unwrapBosDevCapabilityDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bDescriptorType;
return (jbyte) descriptor->bDescriptorType;
}
/**
@ -74,7 +74,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(BosDevCapabilityDescriptor,
struct libusb_bos_dev_capability_descriptor* descriptor =
unwrapBosDevCapabilityDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bDevCapabilityType;
return (jbyte) descriptor->bDevCapabilityType;
}
/**
@ -89,6 +89,5 @@ JNIEXPORT jobject JNICALL METHOD_NAME(BosDevCapabilityDescriptor,
struct libusb_bos_dev_capability_descriptor *descriptor =
unwrapBosDevCapabilityDescriptor(env, this);
if (!descriptor) return NULL;
return (*env)->NewDirectByteBuffer(env, (void *)
descriptor->dev_capability_data, descriptor->bLength - 3);
return NewDirectReadOnlyByteBuffer(env, descriptor->dev_capability_data, descriptor->bLength - 3);
}

View File

@ -8,9 +8,11 @@
#include "usb4java.h"
jobject wrapBosDevCapabilityDescriptor(JNIEnv *,
const struct libusb_bos_dev_capability_descriptor *);
jobjectArray wrapBosDevCapabilityDescriptors(JNIEnv*, int,
struct libusb_bos_dev_capability_descriptor**);
struct libusb_bos_dev_capability_descriptor
*unwrapBosDevCapabilityDescriptor(JNIEnv *, jobject);
struct libusb_bos_dev_capability_descriptor * const *);
struct libusb_bos_dev_capability_descriptor*
unwrapBosDevCapabilityDescriptor(JNIEnv *, jobject);
#endif

View File

@ -6,7 +6,7 @@
#include "ContainerIdDescriptor.h"
void setContainerIdDescriptor(JNIEnv* env,
struct libusb_container_id_descriptor* descriptor, jobject object)
const struct libusb_container_id_descriptor* descriptor, jobject object)
{
SET_POINTER(env, descriptor, object, "containerIdDescriptorPointer");
}
@ -35,7 +35,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(ContainerIdDescriptor, bLength)
struct libusb_container_id_descriptor *descriptor =
unwrapContainerIdDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bLength;
return (jbyte) descriptor->bLength;
}
/**
@ -49,7 +49,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(ContainerIdDescriptor, bDescriptorType)
struct libusb_container_id_descriptor *descriptor =
unwrapContainerIdDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bDescriptorType;
return (jbyte) descriptor->bDescriptorType;
}
/**
@ -63,7 +63,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(ContainerIdDescriptor, bDevCapabilityType)
struct libusb_container_id_descriptor *descriptor =
unwrapContainerIdDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bDevCapabilityType;
return (jbyte) descriptor->bDevCapabilityType;
}
/**
@ -77,7 +77,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(ContainerIdDescriptor, bReserved)
struct libusb_container_id_descriptor *descriptor =
unwrapContainerIdDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bReserved;
return (jbyte) descriptor->bReserved;
}
/**
@ -91,6 +91,5 @@ JNIEXPORT jobject JNICALL METHOD_NAME(ContainerIdDescriptor, containerId)
struct libusb_container_id_descriptor *descriptor =
unwrapContainerIdDescriptor(env, this);
if (!descriptor) return NULL;
return (*env)->NewDirectByteBuffer(env, (void *) descriptor->ContainerID,
16);
return NewDirectReadOnlyByteBuffer(env, descriptor->ContainerID, 16);
}

View File

@ -9,7 +9,7 @@
#include "usb4java.h"
void setContainerIdDescriptor(JNIEnv*,
struct libusb_container_id_descriptor*, jobject);
const struct libusb_container_id_descriptor*, jobject);
struct libusb_container_id_descriptor*
unwrapContainerIdDescriptor(JNIEnv*, jobject);
void resetContainerIdDescriptor(JNIEnv*, jobject);

View File

@ -11,10 +11,10 @@ void setDeviceDescriptor(JNIEnv* env,
SET_POINTER(env, descriptor, object, "deviceDescriptorPointer");
}
struct libusb_device_descriptor* unwrapDeviceDescriptor(JNIEnv *env,
jobject obj)
struct libusb_device_descriptor* unwrapDeviceDescriptor(JNIEnv* env,
jobject descriptor)
{
UNWRAP_POINTER(env, obj, struct libusb_device_descriptor*,
UNWRAP_POINTER(env, descriptor, struct libusb_device_descriptor*,
"deviceDescriptorPointer");
}

View File

@ -18,8 +18,7 @@ jobject wrapDeviceHandle(JNIEnv* env, const libusb_device_handle* deviceHandle)
libusb_device_handle* unwrapDeviceHandle(JNIEnv* env, jobject deviceHandle)
{
UNWRAP_POINTER(env, deviceHandle, libusb_device_handle*,
"deviceHandlePointer");
UNWRAP_POINTER(env, deviceHandle, libusb_device_handle*, "deviceHandlePointer");
}
void resetDeviceHandle(JNIEnv* env, jobject object)

View File

@ -6,7 +6,7 @@
#include "DeviceList.h"
#include "Device.h"
void setDeviceList(JNIEnv* env, libusb_device* const * list, jint size, jobject object)
void setDeviceList(JNIEnv* env, libusb_device* const *list, jint size, jobject object)
{
SET_POINTER(env, list, object, "deviceListPointer");
@ -38,7 +38,7 @@ JNIEXPORT jobject JNICALL METHOD_NAME(DeviceList, get)
JNIEnv *env, jobject this, jint index
)
{
libusb_device **list = unwrapDeviceList(env, this);
libusb_device* const *list = unwrapDeviceList(env, this);
if (!list) return NULL;
jclass cls = (*env)->GetObjectClass(env, this);

View File

@ -198,7 +198,7 @@ JNIEXPORT jint JNICALL METHOD_NAME(LibUsb, getPortNumbers)
libusb_device *dev = unwrapDevice(env, device);
if (!dev) return 0;
jlong path_size = (*env)->GetDirectBufferCapacity(env, path);
return libusb_get_port_numbers(dev, path_ptr, path_size);
return libusb_get_port_numbers(dev, path_ptr, (int) path_size);
}
/**
@ -254,7 +254,6 @@ JNIEXPORT jint JNICALL METHOD_NAME(LibUsb, getMaxPacketSize)
NOT_NULL(env, device, return 0);
libusb_device *dev = unwrapDevice(env, device);
if (!dev) return 0;
return libusb_get_max_packet_size(dev, (unsigned char) endpoint);
}
@ -269,7 +268,6 @@ JNIEXPORT jint JNICALL METHOD_NAME(LibUsb, getMaxIsoPacketSize)
NOT_NULL(env, device, return 0);
libusb_device *dev = unwrapDevice(env, device);
if (!dev) return 0;
return libusb_get_max_iso_packet_size(dev, (unsigned char) endpoint);
}
@ -284,7 +282,6 @@ JNIEXPORT jobject JNICALL METHOD_NAME(LibUsb, refDevice)
NOT_NULL(env, device, return NULL);
libusb_device *dev = unwrapDevice(env, device);
if (!dev) return NULL;
return wrapDevice(env, libusb_ref_device(dev));
}
@ -456,7 +453,6 @@ JNIEXPORT jint JNICALL METHOD_NAME(LibUsb, clearHalt)
NOT_NULL(env, handle, return 0);
libusb_device_handle *dev_handle = unwrapDeviceHandle(env, handle);
if (!dev_handle) return 0;
return libusb_clear_halt(dev_handle, (unsigned char) endpoint);
}
@ -624,6 +620,7 @@ JNIEXPORT jint JNICALL METHOD_NAME(LibUsb, getDeviceDescriptor)
}
else
{
// Free memory again on error.
free(dev_desc);
}
return result;
@ -761,7 +758,7 @@ JNIEXPORT jint JNICALL METHOD_NAME(LibUsb, getSsEndpointCompanionDescriptor)
if (!ctx && context) return 0;
NOT_NULL(env, endpointDescriptor, return 0);
NOT_NULL(env, companionDescriptor, return 0);
NOT_SET(env, companionDescriptor, "ssEndpointCompanionDescriptor", return 0);
NOT_SET(env, companionDescriptor, "ssEndpointCompanionDescriptorPointer", return 0);
struct libusb_endpoint_descriptor *endpoint_descriptor =
unwrapEndpointDescriptor(env, endpointDescriptor);

View File

@ -7,9 +7,9 @@
#include "Interface.h"
void setSsEndpointCompanionDescriptor(JNIEnv* env,
struct libusb_ss_endpoint_companion_descriptor* descriptor, jobject object)
const struct libusb_ss_endpoint_companion_descriptor* descriptor, jobject object)
{
SET_POINTER(env, descriptor, object, "ssEndpointCompanionDescriptor");
SET_POINTER(env, descriptor, object, "ssEndpointCompanionDescriptorPointer");
}
struct libusb_ss_endpoint_companion_descriptor*
@ -17,12 +17,12 @@ struct libusb_ss_endpoint_companion_descriptor*
{
UNWRAP_POINTER(env, descriptor,
struct libusb_ss_endpoint_companion_descriptor*,
"ssEndpointCompanionDescriptor");
"ssEndpointCompanionDescriptorPointer");
}
void resetSsEndpointCompanionDescriptor(JNIEnv* env, jobject obj)
{
RESET_POINTER(env, obj, "ssEndpointCompanionDescriptor");
RESET_POINTER(env, obj, "ssEndpointCompanionDescriptorPointer");
}
/**
@ -36,7 +36,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(SsEndpointCompanionDescriptor, bLength)
struct libusb_ss_endpoint_companion_descriptor *descriptor =
unwrapSsEndpointCompanionDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bLength;
return (jbyte) descriptor->bLength;
}
/**
@ -51,7 +51,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(SsEndpointCompanionDescriptor,
struct libusb_ss_endpoint_companion_descriptor *descriptor =
unwrapSsEndpointCompanionDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bDescriptorType;
return (jbyte) descriptor->bDescriptorType;
}
/**
@ -65,7 +65,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(SsEndpointCompanionDescriptor, bMaxBurst)
struct libusb_ss_endpoint_companion_descriptor *descriptor =
unwrapSsEndpointCompanionDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bMaxBurst;
return (jbyte) descriptor->bMaxBurst;
}
/**
@ -79,7 +79,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(SsEndpointCompanionDescriptor, bmAttributes)
struct libusb_ss_endpoint_companion_descriptor *descriptor =
unwrapSsEndpointCompanionDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bmAttributes;
return (jbyte) descriptor->bmAttributes;
}
/**
@ -93,5 +93,5 @@ JNIEXPORT jshort JNICALL METHOD_NAME(SsEndpointCompanionDescriptor, wBytesPerInt
struct libusb_ss_endpoint_companion_descriptor *descriptor =
unwrapSsEndpointCompanionDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->wBytesPerInterval;
return (jshort) descriptor->wBytesPerInterval;
}

View File

@ -9,7 +9,7 @@
#include "usb4java.h"
void setSsEndpointCompanionDescriptor(JNIEnv*,
struct libusb_ss_endpoint_companion_descriptor*, jobject);
const struct libusb_ss_endpoint_companion_descriptor*, jobject);
struct libusb_ss_endpoint_companion_descriptor*
unwrapSsEndpointCompanionDescriptor(JNIEnv*, jobject);
void resetSsEndpointCompanionDescriptor(JNIEnv*, jobject);

View File

@ -6,7 +6,7 @@
#include "SsUsbDeviceCapabilityDescriptor.h"
void setSsUsbDeviceCapabilityDescriptor(JNIEnv* env,
struct libusb_ss_usb_device_capability_descriptor* descriptor, jobject object)
const struct libusb_ss_usb_device_capability_descriptor* descriptor, jobject object)
{
SET_POINTER(env, descriptor, object, "ssUsbDeviceCapabilityDescriptorPointer");
}
@ -35,7 +35,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(SsUsbDeviceCapabilityDescriptor, bLength)
struct libusb_ss_usb_device_capability_descriptor *descriptor =
unwrapSsUsbDeviceCapabilityDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bLength;
return (jbyte) descriptor->bLength;
}
/**
@ -49,7 +49,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(SsUsbDeviceCapabilityDescriptor, bDescriptor
struct libusb_ss_usb_device_capability_descriptor *descriptor =
unwrapSsUsbDeviceCapabilityDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bDescriptorType;
return (jbyte) descriptor->bDescriptorType;
}
/**
@ -64,11 +64,11 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(SsUsbDeviceCapabilityDescriptor,
struct libusb_ss_usb_device_capability_descriptor *descriptor =
unwrapSsUsbDeviceCapabilityDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bDevCapabilityType;
return (jbyte) descriptor->bDevCapabilityType;
}
/**
* int bmAttributes()
* byte bmAttributes()
*/
JNIEXPORT jbyte JNICALL METHOD_NAME(SsUsbDeviceCapabilityDescriptor,
bmAttributes)
@ -79,7 +79,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(SsUsbDeviceCapabilityDescriptor,
struct libusb_ss_usb_device_capability_descriptor *descriptor =
unwrapSsUsbDeviceCapabilityDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bmAttributes;
return (jbyte) descriptor->bmAttributes;
}
/**
@ -94,7 +94,7 @@ JNIEXPORT jshort JNICALL METHOD_NAME(SsUsbDeviceCapabilityDescriptor,
struct libusb_ss_usb_device_capability_descriptor *descriptor =
unwrapSsUsbDeviceCapabilityDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->wSpeedSupported;
return (jshort) descriptor->wSpeedSupported;
}
/**
@ -109,7 +109,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(SsUsbDeviceCapabilityDescriptor,
struct libusb_ss_usb_device_capability_descriptor *descriptor =
unwrapSsUsbDeviceCapabilityDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bFunctionalitySupport;
return (jbyte) descriptor->bFunctionalitySupport;
}
/**
@ -124,7 +124,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(SsUsbDeviceCapabilityDescriptor,
struct libusb_ss_usb_device_capability_descriptor *descriptor =
unwrapSsUsbDeviceCapabilityDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bU1DevExitLat;
return (jbyte) descriptor->bU1DevExitLat;
}
/**
@ -139,5 +139,5 @@ JNIEXPORT jshort JNICALL METHOD_NAME(SsUsbDeviceCapabilityDescriptor,
struct libusb_ss_usb_device_capability_descriptor *descriptor =
unwrapSsUsbDeviceCapabilityDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bU2DevExitLat;
return (jshort) descriptor->bU2DevExitLat;
}

View File

@ -9,7 +9,7 @@
#include "usb4java.h"
void setSsUsbDeviceCapabilityDescriptor(JNIEnv*,
struct libusb_ss_usb_device_capability_descriptor*, jobject);
const struct libusb_ss_usb_device_capability_descriptor*, jobject);
struct libusb_ss_usb_device_capability_descriptor*
unwrapSsUsbDeviceCapabilityDescriptor(JNIEnv*, jobject);
void resetSsUsbDeviceCapabilityDescriptor(JNIEnv*, jobject);

View File

@ -6,7 +6,7 @@
#include "Usb20ExtensionDescriptor.h"
void setUsb20ExtensionDescriptor(JNIEnv* env,
struct libusb_usb_2_0_extension_descriptor* descriptor, jobject object)
const struct libusb_usb_2_0_extension_descriptor* descriptor, jobject object)
{
SET_POINTER(env, descriptor, object, "usb20ExtensionDescriptorPointer");
}
@ -35,7 +35,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(Usb20ExtensionDescriptor, bLength)
struct libusb_usb_2_0_extension_descriptor *descriptor =
unwrapUsb20ExtensionDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bLength;
return (jbyte) descriptor->bLength;
}
/**
@ -49,7 +49,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(Usb20ExtensionDescriptor, bDescriptorType)
struct libusb_usb_2_0_extension_descriptor *descriptor =
unwrapUsb20ExtensionDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bDescriptorType;
return (jbyte) descriptor->bDescriptorType;
}
/**
@ -64,7 +64,7 @@ JNIEXPORT jbyte JNICALL METHOD_NAME(Usb20ExtensionDescriptor,
struct libusb_usb_2_0_extension_descriptor *descriptor =
unwrapUsb20ExtensionDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bDevCapabilityType;
return (jbyte) descriptor->bDevCapabilityType;
}
/**
@ -79,5 +79,5 @@ JNIEXPORT jint JNICALL METHOD_NAME(Usb20ExtensionDescriptor,
struct libusb_usb_2_0_extension_descriptor *descriptor =
unwrapUsb20ExtensionDescriptor(env, this);
if (!descriptor) return 0;
return descriptor->bmAttributes;
return (jint) descriptor->bmAttributes;
}

View File

@ -9,7 +9,7 @@
#include "usb4java.h"
void setUsb20ExtensionDescriptor(JNIEnv*,
struct libusb_usb_2_0_extension_descriptor*, jobject);
const struct libusb_usb_2_0_extension_descriptor*, jobject);
struct libusb_usb_2_0_extension_descriptor*
unwrapUsb20ExtensionDescriptor(JNIEnv*, jobject);
void resetUsb20ExtensionDescriptor(JNIEnv*, jobject);

View File

@ -51,11 +51,11 @@
// GetDirectBufferAddress returns NULL if called on a non-direct buffer.
#define DIRECT_BUFFER(ENV, VAR, BUFFER, ACTION) \
unsigned char *BUFFER = (*ENV)->GetDirectBufferAddress(ENV, VAR); \
if (!BUFFER) \
{ \
illegalArgument(ENV, #VAR" must be a direct buffer"); \
ACTION; \
}
if (!BUFFER) \
{ \
illegalArgument(ENV, #VAR" must be a direct buffer"); \
ACTION; \
}
#define NOT_NULL(ENV, VAR, ACTION) \
if (!VAR) \

15
src/main/c/src/wrappers.c Normal file
View File

@ -0,0 +1,15 @@
/*
* Copyright (C) 2013 Klaus Reimer (k@ailis.de)
* See COPYING file for copying conditions
*/
#include <string.h>
// Enforce usage of older memcpy to be compatible with older libc versions
#ifdef WRAP_MEMCPY
asm (".symver memcpy, memcpy@GLIBC_2.2.5");
void *__wrap_memcpy(void *dest, const void *src, size_t n)
{
return memcpy(dest, src, n);
}
#endif

View File

@ -32,7 +32,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
public final class SsEndpointCompanionDescriptor
{
/** The native pointer to the descriptor structure. */
private long ssEndpointCompanionDescriptor;
private long ssEndpointCompanionDescriptorPointer;
/**
* Constructs a new descriptor which can be passed to the
@ -52,7 +52,7 @@ public final class SsEndpointCompanionDescriptor
*/
public long getPointer()
{
return this.ssEndpointCompanionDescriptor;
return this.ssEndpointCompanionDescriptorPointer;
}
/**