aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile6
-rw-r--r--libgamma/AdjustmentMethod.java12
-rw-r--r--libgamma_AdjustmentMethod.c51
-rw-r--r--libgamma_CRTC.c126
-rw-r--r--libgamma_GammaRamps.c32
-rw-r--r--libgamma_LibgammaException.c4
-rw-r--r--libgamma_Partition.c10
-rw-r--r--libgamma_Ramp.c24
-rw-r--r--libgamma_Site.c8
9 files changed, 144 insertions, 129 deletions
diff --git a/Makefile b/Makefile
index a7b4217..0b24d91 100644
--- a/Makefile
+++ b/Makefile
@@ -44,6 +44,8 @@ OBJ =\
libgamma_Ramp.o\
libgamma_Site.o
+NATIVE_CLASSES = $$(printf '%s\n' $(OBJ:.o=) | sed 's/_/\./g' | tr '\n' ' ')
+
JAVA_HDR = $(OBJ:.o=.h)
JAVA_SRC = $(CLASS:.class=.java)
@@ -55,10 +57,10 @@ $(OBJ): $(JAVA_HDR)
$(CLASS) $(JAVA_HDR): $(JAVA_SRC)
@set -e;\
if $(JAVAH) -version 2>/dev/null >/dev/null; then\
- printf '%s\n' "$(JAVAH) -jni -d . -cp . $(JPKG).EQNative";\
- $(JAVAH) -jni -d . -cp . $(JPKG).EQNative;\
printf '%s\n' "$(JAVAC) '-Xlint:all' -O -cp . -d . $(JAVA_SRC)";\
$(JAVAC) '-Xlint:all' -O -cp . -d . $(JAVA_SRC);\
+ printf '%s\n' "$(JAVAH) -jni -d . -cp . $(NATIVE_CLASSES)";\
+ $(JAVAH) -jni -d . -cp . $(NATIVE_CLASSES);\
else\
printf '%s\n' "$(JAVAC) '-Xlint:all' -O -h . -cp . -d . $(JAVA_SRC)";\
$(JAVAC) '-Xlint:all' -O -h . -cp . -d . $(JAVA_SRC);\
diff --git a/libgamma/AdjustmentMethod.java b/libgamma/AdjustmentMethod.java
index 7d53090..4c87658 100644
--- a/libgamma/AdjustmentMethod.java
+++ b/libgamma/AdjustmentMethod.java
@@ -147,9 +147,12 @@ public enum AdjustmentMethod
*
* @return The capabilities of the adjustment method
*/
- public AdjustmentMethodCapabilities get_capabilities()
+ public AdjustmentMethodCapabilities get_capabilities() throws LibgammaException
{
- return new AdjustmentMethodCapabilities(libgamma_method_capabilities(this.value));
+ long[] r = libgamma_method_capabilities(this.value);
+ if (r[1] != 0)
+ throw new LibgammaException((int)(r[1]));
+ return new AdjustmentMethodCapabilities(r[0]);
}
@@ -202,9 +205,10 @@ public enum AdjustmentMethod
* Return the capabilities of an adjustment method
*
* @param method The adjustment method (display server and protocol)
- * @return Input parameter to the constructor of {@link AdjustmentMethodCapabilities}
+ * @return Element 0: Input parameter to the constructor of {@link AdjustmentMethodCapabilities}
+ * Eleemnt 1: Error code, zero on success
*/
- private static native long libgamma_method_capabilities(int method);
+ private static native long[] libgamma_method_capabilities(int method);
/**
* Return the default site for an adjustment method
diff --git a/libgamma_AdjustmentMethod.c b/libgamma_AdjustmentMethod.c
index 968aaaf..9ebf4ec 100644
--- a/libgamma_AdjustmentMethod.c
+++ b/libgamma_AdjustmentMethod.c
@@ -1,5 +1,6 @@
/* See LICENSE file for copyright and license details. */
#include "libgamma_AdjustmentMethod.h"
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -63,31 +64,39 @@ Java_libgamma_AdjustmentMethod_libgamma_1is_1method_1available(JNIEnv *env, jcla
* Return the capabilities of an adjustment method
*
* @param method The adjustment method (display server and protocol)
- * @return Input parameter to the constructor of {@link AdjustmentMethodCapabilities}
+ * @return Element 0: Input parameter to the constructor of {@link AdjustmentMethodCapabilities}
+ * Element 1: Error code, zero on success
*/
-jlong
+jlongArray
Java_libgamma_AdjustmentMethod_libgamma_1method_1capabilities(JNIEnv *env, jclass class, jint method)
{
- libgamma_method_capabilities_t caps;
- jlong rc;
-
- libgamma_method_capabilities(&caps, method);
+ jlongArray rv = (*env)->NewLongArray(env, 2);
+ struct libgamma_method_capabilities caps;
+ jlong rc = 0, e = 0;
+ int r = libgamma_method_capabilities(&caps, sizeof(caps), method);
+ if (r) {
+ e = (jlong)(r == LIBGAMMA_ERRNO_SET ? errno : r);
+ goto out;
+ }
rc = (jlong)(caps.crtc_information);
rc &= 0xFFFFFFFFLL;
- rc |= caps.default_site_known ? (1LL < 33) : 0;
- rc |= caps.multiple_sites ? (1LL < 34) : 0;
- rc |= caps.multiple_partitions ? (1LL < 35) : 0;
- rc |= caps.multiple_crtcs ? (1LL < 36) : 0;
- rc |= caps.partitions_are_graphics_cards ? (1LL < 37) : 0;
- rc |= caps.site_restore ? (1LL < 38) : 0;
- rc |= caps.partition_restore ? (1LL < 39) : 0;
- rc |= caps.crtc_restore ? (1LL < 40) : 0;
- rc |= caps.identical_gamma_sizes ? (1LL < 41) : 0;
- rc |= caps.fixed_gamma_size ? (1LL < 42) : 0;
- rc |= caps.fixed_gamma_depth ? (1LL < 43) : 0;
- rc |= caps.real ? (1LL < 44) : 0;
- rc |= caps.fake ? (1LL < 45) : 0;
- return rc;
+ rc |= caps.default_site_known ? (1LL << 33) : 0;
+ rc |= caps.multiple_sites ? (1LL << 34) : 0;
+ rc |= caps.multiple_partitions ? (1LL << 35) : 0;
+ rc |= caps.multiple_crtcs ? (1LL << 36) : 0;
+ rc |= caps.partitions_are_graphics_cards ? (1LL << 37) : 0;
+ rc |= caps.site_restore ? (1LL << 38) : 0;
+ rc |= caps.partition_restore ? (1LL << 39) : 0;
+ rc |= caps.crtc_restore ? (1LL << 40) : 0;
+ rc |= caps.identical_gamma_sizes ? (1LL << 41) : 0;
+ rc |= caps.fixed_gamma_size ? (1LL << 42) : 0;
+ rc |= caps.fixed_gamma_depth ? (1LL << 43) : 0;
+ rc |= caps.real ? (1LL << 44) : 0;
+ rc |= caps.fake ? (1LL << 45) : 0;
+out:
+ (*env)->SetLongArrayRegion(env, rv, 0, 1, &rc);
+ (*env)->SetLongArrayRegion(env, rv, 1, 1, &e);
+ return rv;
(void) env;
(void) class;
}
@@ -106,7 +115,7 @@ Java_libgamma_AdjustmentMethod_libgamma_1method_1default_1site(JNIEnv *env, jcla
* and error handing makes this unnecessarily comples,
* therefore we will simply skip it */
- char *do_not_free_this = libgamma_method_default_site(method);
+ const char *do_not_free_this = libgamma_method_default_site(method);
char *this_will_be_freed;
size_t n;
if (!do_not_free_this)
diff --git a/libgamma_CRTC.c b/libgamma_CRTC.c
index fe7197d..958be2e 100644
--- a/libgamma_CRTC.c
+++ b/libgamma_CRTC.c
@@ -34,7 +34,7 @@ fail(JNIEnv *env, int error_code)
static jlongArray
ok(JNIEnv *env, void *state)
{
- jlong a = (jlong)(size_t)state, z = 0;
+ jlong a = (jlong)(uintptr_t)state, z = 0;
jlongArray rc = (*env)->NewLongArray(env, 2);
(*env)->SetLongArrayRegion(env, rc, 0, 1, &a);
(*env)->SetLongArrayRegion(env, rc, 1, 1, &z);
@@ -52,8 +52,8 @@ ok(JNIEnv *env, void *state)
jlongArray
Java_libgamma_CRTC_libgamma_1crtc_1create(JNIEnv *env, jclass class, jlong partition, jint crtc)
{
- libgamma_crtc_state_t *state = malloc(sizeof(libgamma_crtc_state_t));
- void *super = (void *)(size_t)partition;
+ struct libgamma_crtc_state *state = malloc(sizeof(*state));
+ void *super = (void *)(uintptr_t)partition;
int r;
if (!state)
return fail(env, 0);
@@ -73,7 +73,7 @@ Java_libgamma_CRTC_libgamma_1crtc_1create(JNIEnv *env, jclass class, jlong parti
void
Java_libgamma_CRTC_libgamma_1crtc_1free(JNIEnv *env, jclass class, jlong address)
{
- void *this = (void *)(size_t)address;
+ void *this = (void *)(uintptr_t)address;
libgamma_crtc_free(this);
(void) env;
(void) class;
@@ -88,7 +88,7 @@ Java_libgamma_CRTC_libgamma_1crtc_1free(JNIEnv *env, jclass class, jlong address
jint
Java_libgamma_CRTC_libgamma_1crtc_1restore(JNIEnv *env, jclass class, jlong address)
{
- void *this = (void *)(size_t)address;
+ void *this = (void *)(uintptr_t)address;
int r = libgamma_crtc_restore(this);
if (r)
return r == LIBGAMMA_ERRNO_SET ? errno : r;
@@ -108,19 +108,19 @@ Java_libgamma_CRTC_libgamma_1crtc_1restore(JNIEnv *env, jclass class, jlong addr
jobjectArray
Java_libgamma_CRTC_libgamma_1get_1crtc_1information(JNIEnv *env, jclass class, jlong crtc, jint fields)
{
- void *this_voidp = (void *)(size_t)crtc;
- libgamma_crtc_state_t *this = this_voidp;
+ void *this_voidp = (void *)(uintptr_t)crtc;
+ struct libgamma_crtc_state *this = this_voidp;
jbyteArray edid = NULL;
jstring connector_name = NULL;
jclass class_of_jobject = (*env)->FindClass(env, "java/lang/Object");
jintArray ints_ = (*env)->NewIntArray(env, 25);
jfloatArray gamma_ = (*env)->NewFloatArray(env, 3);
jobjectArray rc = (*env)->NewObjectArray(env, 4, class_of_jobject, NULL);
- libgamma_crtc_information_t info;
+ struct libgamma_crtc_information info;
jint ints[25];
jfloat gamma[3];
- libgamma_get_crtc_information(&info, this, fields);
+ libgamma_get_crtc_information(&info, sizeof(info), this, fields);
if (info.edid) {
edid = (*env)->NewByteArray(env, (jsize)info.edid_length);
@@ -183,10 +183,10 @@ Java_libgamma_CRTC_libgamma_1get_1crtc_1information(JNIEnv *env, jclass class, j
jint
Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps8(JNIEnv *env, jclass class, jlong address, jlong ramps)
{
- void *crtc_voidp = (void *)(size_t)address;
- libgamma_crtc_state_t *crtc = crtc_voidp;
- void *output_voidp = (void *)(size_t)ramps;
- libgamma_gamma_ramps8_t *output = output_voidp;
+ void *crtc_voidp = (void *)(uintptr_t)address;
+ struct libgamma_crtc_state *crtc = crtc_voidp;
+ void *output_voidp = (void *)(uintptr_t)ramps;
+ struct libgamma_gamma_ramps8 *output = output_voidp;
int r = libgamma_crtc_get_gamma_ramps8(crtc, output);
return r == LIBGAMMA_ERRNO_SET ? errno : r;
(void) env;
@@ -203,11 +203,11 @@ Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps8(JNIEnv *env, jclass class,
jint
Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps8(JNIEnv *env, jclass class, jlong address, jlong ramps)
{
- void *crtc_voidp = (void *)(size_t)address;
- libgamma_crtc_state_t *crtc = crtc_voidp;
- void *values_voidp = (void *)(size_t)ramps;
- libgamma_gamma_ramps8_t *values = values_voidp;
- int r = libgamma_crtc_set_gamma_ramps8(crtc, *values);
+ void *crtc_voidp = (void *)(uintptr_t)address;
+ struct libgamma_crtc_state *crtc = crtc_voidp;
+ void *values_voidp = (void *)(uintptr_t)ramps;
+ struct libgamma_gamma_ramps8 *values = values_voidp;
+ int r = libgamma_crtc_set_gamma_ramps8(crtc, values);
return r == LIBGAMMA_ERRNO_SET ? errno : r;
(void) env;
(void) class;
@@ -223,10 +223,10 @@ Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps8(JNIEnv *env, jclass class,
jint
Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps16(JNIEnv *env, jclass class, jlong address, jlong ramps)
{
- void *crtc_voidp = (void *)(size_t)address;
- libgamma_crtc_state_t *crtc = crtc_voidp;
- void *output_voidp = (void *)(size_t)ramps;
- libgamma_gamma_ramps16_t *output = output_voidp;
+ void *crtc_voidp = (void *)(uintptr_t)address;
+ struct libgamma_crtc_state *crtc = crtc_voidp;
+ void *output_voidp = (void *)(uintptr_t)ramps;
+ struct libgamma_gamma_ramps16 *output = output_voidp;
int r = libgamma_crtc_get_gamma_ramps16(crtc, output);
return r == LIBGAMMA_ERRNO_SET ? errno : r;
(void) env;
@@ -243,11 +243,11 @@ Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps16(JNIEnv *env, jclass class
jint
Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps16(JNIEnv *env, jclass class, jlong address, jlong ramps)
{
- void *crtc_voidp = (void *)(size_t)address;
- libgamma_crtc_state_t *crtc = crtc_voidp;
- void *values_voidp = (void *)(size_t)ramps;
- libgamma_gamma_ramps16_t *values = values_voidp;
- int r = libgamma_crtc_set_gamma_ramps16(crtc, *values);
+ void *crtc_voidp = (void *)(uintptr_t)address;
+ struct libgamma_crtc_state *crtc = crtc_voidp;
+ void *values_voidp = (void *)(uintptr_t)ramps;
+ struct libgamma_gamma_ramps16 *values = values_voidp;
+ int r = libgamma_crtc_set_gamma_ramps16(crtc, values);
return r == LIBGAMMA_ERRNO_SET ? errno : r;
(void) env;
(void) class;
@@ -263,10 +263,10 @@ Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps16(JNIEnv *env, jclass class
jint
Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps32(JNIEnv *env, jclass class, jlong address, jlong ramps)
{
- void *crtc_voidp = (void *)(size_t)address;
- libgamma_crtc_state_t *crtc = crtc_voidp;
- void *output_voidp = (void *)(size_t)ramps;
- libgamma_gamma_ramps32_t *output = output_voidp;
+ void *crtc_voidp = (void *)(uintptr_t)address;
+ struct libgamma_crtc_state *crtc = crtc_voidp;
+ void *output_voidp = (void *)(uintptr_t)ramps;
+ struct libgamma_gamma_ramps32 *output = output_voidp;
int r = libgamma_crtc_get_gamma_ramps32(crtc, output);
return r == LIBGAMMA_ERRNO_SET ? errno : r;
(void) env;
@@ -283,11 +283,11 @@ Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps32(JNIEnv *env, jclass class
jint
Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps32(JNIEnv *env, jclass class, jlong address, jlong ramps)
{
- void *crtc_voidp = (void *)(size_t)address;
- libgamma_crtc_state_t *crtc = crtc_voidp;
- void *values_voidp = (void *)(size_t)ramps;
- libgamma_gamma_ramps32_t *values = values_voidp;
- int r = libgamma_crtc_set_gamma_ramps32(crtc, *values);
+ void *crtc_voidp = (void *)(uintptr_t)address;
+ struct libgamma_crtc_state *crtc = crtc_voidp;
+ void *values_voidp = (void *)(uintptr_t)ramps;
+ struct libgamma_gamma_ramps32 *values = values_voidp;
+ int r = libgamma_crtc_set_gamma_ramps32(crtc, values);
return r == LIBGAMMA_ERRNO_SET ? errno : r;
(void) env;
(void) class;
@@ -303,10 +303,10 @@ Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps32(JNIEnv *env, jclass class
jint
Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps64(JNIEnv *env, jclass class, jlong address, jlong ramps)
{
- void *crtc_voidp = (void *)(size_t)address;
- libgamma_crtc_state_t *crtc = crtc_voidp;
- void *output_voidp = (void *)(size_t)ramps;
- libgamma_gamma_ramps64_t *output = output_voidp;
+ void *crtc_voidp = (void *)(uintptr_t)address;
+ struct libgamma_crtc_state *crtc = crtc_voidp;
+ void *output_voidp = (void *)(uintptr_t)ramps;
+ struct libgamma_gamma_ramps64 *output = output_voidp;
int r = libgamma_crtc_get_gamma_ramps64(crtc, output);
return r == LIBGAMMA_ERRNO_SET ? errno : r;
(void) env;
@@ -323,11 +323,11 @@ Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps64(JNIEnv *env, jclass class
jint
Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps64(JNIEnv *env, jclass class, jlong address, jlong ramps)
{
- void *crtc_voidp = (void *)(size_t)address;
- libgamma_crtc_state_t *crtc = crtc_voidp;
- void *values_voidp = (void *)(size_t)ramps;
- libgamma_gamma_ramps64_t *values = values_voidp;
- int r = libgamma_crtc_set_gamma_ramps64(crtc, *values);
+ void *crtc_voidp = (void *)(uintptr_t)address;
+ struct libgamma_crtc_state *crtc = crtc_voidp;
+ void *values_voidp = (void *)(uintptr_t)ramps;
+ struct libgamma_gamma_ramps64 *values = values_voidp;
+ int r = libgamma_crtc_set_gamma_ramps64(crtc, values);
return r == LIBGAMMA_ERRNO_SET ? errno : r;
(void) env;
(void) class;
@@ -343,10 +343,10 @@ Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps64(JNIEnv *env, jclass class
jint
Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1rampsf(JNIEnv *env, jclass class, jlong address, jlong ramps)
{
- void *crtc_voidp = (void *)(size_t)address;
- libgamma_crtc_state_t *crtc = crtc_voidp;
- void *output_voidp = (void *)(size_t)ramps;
- libgamma_gamma_rampsf_t *output = output_voidp;
+ void *crtc_voidp = (void *)(uintptr_t)address;
+ struct libgamma_crtc_state *crtc = crtc_voidp;
+ void *output_voidp = (void *)(uintptr_t)ramps;
+ struct libgamma_gamma_rampsf *output = output_voidp;
int r = libgamma_crtc_get_gamma_rampsf(crtc, output);
return r == LIBGAMMA_ERRNO_SET ? errno : r;
(void) env;
@@ -363,11 +363,11 @@ Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1rampsf(JNIEnv *env, jclass class,
jint
Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1rampsf(JNIEnv *env, jclass class, jlong address, jlong ramps)
{
- void *crtc_voidp = (void *)(size_t)address;
- libgamma_crtc_state_t * crtc = crtc_voidp;
- void *values_voidp = (void *)(size_t)ramps;
- libgamma_gamma_rampsf_t * values = values_voidp;
- int r = libgamma_crtc_set_gamma_rampsf(crtc, *values);
+ void *crtc_voidp = (void *)(uintptr_t)address;
+ struct libgamma_crtc_state * crtc = crtc_voidp;
+ void *values_voidp = (void *)(uintptr_t)ramps;
+ struct libgamma_gamma_rampsf * values = values_voidp;
+ int r = libgamma_crtc_set_gamma_rampsf(crtc, values);
return r == LIBGAMMA_ERRNO_SET ? errno : r;
(void) env;
(void) class;
@@ -383,10 +383,10 @@ Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1rampsf(JNIEnv *env, jclass class,
jint
Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1rampsd(JNIEnv *env, jclass class, jlong address, jlong ramps)
{
- void *crtc_voidp = (void *)(size_t)address;
- libgamma_crtc_state_t *crtc = crtc_voidp;
- void *output_voidp = (void *)(size_t)ramps;
- libgamma_gamma_rampsd_t *output = output_voidp;
+ void *crtc_voidp = (void *)(uintptr_t)address;
+ struct libgamma_crtc_state *crtc = crtc_voidp;
+ void *output_voidp = (void *)(uintptr_t)ramps;
+ struct libgamma_gamma_rampsd *output = output_voidp;
int r = libgamma_crtc_get_gamma_rampsd(crtc, output);
return r == LIBGAMMA_ERRNO_SET ? errno : r;
(void) env;
@@ -403,11 +403,11 @@ Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1rampsd(JNIEnv *env, jclass class,
jint
Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1rampsd(JNIEnv *env, jclass class, jlong address, jlong ramps)
{
- void *crtc_voidp = (void *)(size_t)address;
- libgamma_crtc_state_t *crtc = crtc_voidp;
- void *values_voidp = (void *)(size_t)ramps;
- libgamma_gamma_rampsd_t *values = values_voidp;
- int r = libgamma_crtc_set_gamma_rampsd(crtc, *values);
+ void *crtc_voidp = (void *)(uintptr_t)address;
+ struct libgamma_crtc_state *crtc = crtc_voidp;
+ void *values_voidp = (void *)(uintptr_t)ramps;
+ struct libgamma_gamma_rampsd *values = values_voidp;
+ int r = libgamma_crtc_set_gamma_rampsd(crtc, values);
return r == LIBGAMMA_ERRNO_SET ? errno : r;
(void) env;
(void) class;
diff --git a/libgamma_GammaRamps.c b/libgamma_GammaRamps.c
index ebb2e98..ba3776a 100644
--- a/libgamma_GammaRamps.c
+++ b/libgamma_GammaRamps.c
@@ -40,10 +40,10 @@ fail(JNIEnv *env, int error_code)
static jlongArray
ok(JNIEnv *env, void *ramps, void *red, void *green, void *blue)
{
- jlong a = (jlong)(size_t)ramps;
- jlong b = (jlong)(size_t)red;
- jlong c = (jlong)(size_t)green;
- jlong d = (jlong)(size_t)blue, z = 0;
+ jlong a = (jlong)(uintptr_t)ramps;
+ jlong b = (jlong)(uintptr_t)red;
+ jlong c = (jlong)(uintptr_t)green;
+ jlong d = (jlong)(uintptr_t)blue, z = 0;
jlongArray rc = (*env)->NewLongArray(env, 5);
(*env)->SetLongArrayRegion(env, rc, 0, 1, &a);
(*env)->SetLongArrayRegion(env, rc, 1, 1, &b);
@@ -69,7 +69,7 @@ ok(JNIEnv *env, void *ramps, void *red, void *green, void *blue)
jlongArray
Java_libgamma_GammaRamps_libgamma_1gamma_1ramps8_1create(JNIEnv *env, jclass class, jint red_size, jint green_size, jint blue_size)
{
- libgamma_gamma_ramps8_t *ramps = malloc(sizeof(libgamma_gamma_ramps8_t));
+ struct libgamma_gamma_ramps8 *ramps = malloc(sizeof(*ramps));
int r;
if (!ramps)
return fail(env, 0);
@@ -99,7 +99,7 @@ Java_libgamma_GammaRamps_libgamma_1gamma_1ramps8_1create(JNIEnv *env, jclass cla
jlongArray
Java_libgamma_GammaRamps_libgamma_1gamma_1ramps16_1create(JNIEnv *env, jclass class, jint red_size, jint green_size, jint blue_size)
{
- libgamma_gamma_ramps16_t *ramps = malloc(sizeof(libgamma_gamma_ramps16_t));
+ struct libgamma_gamma_ramps16 *ramps = malloc(sizeof(*ramps));
int r;
if (!ramps)
return fail(env, 0);
@@ -129,7 +129,7 @@ Java_libgamma_GammaRamps_libgamma_1gamma_1ramps16_1create(JNIEnv *env, jclass cl
jlongArray
Java_libgamma_GammaRamps_libgamma_1gamma_1ramps32_1create(JNIEnv *env, jclass class, jint red_size, jint green_size, jint blue_size)
{
- libgamma_gamma_ramps32_t *ramps = malloc(sizeof(libgamma_gamma_ramps32_t));
+ struct libgamma_gamma_ramps32 *ramps = malloc(sizeof(*ramps));
int r;
if (!ramps)
return fail(env, 0);
@@ -159,7 +159,7 @@ Java_libgamma_GammaRamps_libgamma_1gamma_1ramps32_1create(JNIEnv *env, jclass cl
jlongArray
Java_libgamma_GammaRamps_libgamma_1gamma_1ramps64_1create(JNIEnv *env, jclass class, jint red_size, jint green_size, jint blue_size)
{
- libgamma_gamma_ramps64_t *ramps = malloc(sizeof(libgamma_gamma_ramps64_t));
+ struct libgamma_gamma_ramps64 *ramps = malloc(sizeof(*ramps));
int r;
if (!ramps)
return fail(env, 0);
@@ -189,7 +189,7 @@ Java_libgamma_GammaRamps_libgamma_1gamma_1ramps64_1create(JNIEnv *env, jclass cl
jlongArray
Java_libgamma_GammaRamps_libgamma_1gamma_1rampsf_1create(JNIEnv *env, jclass class, jint red_size, jint green_size, jint blue_size)
{
- libgamma_gamma_rampsf_t *ramps = malloc(sizeof(libgamma_gamma_rampsf_t));
+ struct libgamma_gamma_rampsf *ramps = malloc(sizeof(*ramps));
int r;
if (!ramps)
return fail(env, 0);
@@ -219,7 +219,7 @@ Java_libgamma_GammaRamps_libgamma_1gamma_1rampsf_1create(JNIEnv *env, jclass cla
jlongArray
Java_libgamma_GammaRamps_libgamma_1gamma_1rampsd_1create(JNIEnv *env, jclass class, jint red_size, jint green_size, jint blue_size)
{
- libgamma_gamma_rampsd_t *ramps = malloc(sizeof(libgamma_gamma_rampsd_t));
+ struct libgamma_gamma_rampsd *ramps = malloc(sizeof(*ramps));
int r;
if (!ramps)
return fail(env, 0);
@@ -244,7 +244,7 @@ Java_libgamma_GammaRamps_libgamma_1gamma_1rampsd_1create(JNIEnv *env, jclass cla
void
Java_libgamma_GammaRamps_libgamma_1gamma_1ramps8_1free(JNIEnv *env, jclass class, jlong address)
{
- void *this = (void *)(size_t)address;
+ void *this = (void *)(uintptr_t)address;
libgamma_gamma_ramps8_free(this);
(void) env;
(void) class;
@@ -261,7 +261,7 @@ Java_libgamma_GammaRamps_libgamma_1gamma_1ramps8_1free(JNIEnv *env, jclass class
void
Java_libgamma_GammaRamps_libgamma_1gamma_1ramps16_1free(JNIEnv *env, jclass class, jlong address)
{
- void *this = (void *)(size_t)address;
+ void *this = (void *)(uintptr_t)address;
libgamma_gamma_ramps16_free(this);
(void) env;
(void) class;
@@ -278,7 +278,7 @@ Java_libgamma_GammaRamps_libgamma_1gamma_1ramps16_1free(JNIEnv *env, jclass clas
void
Java_libgamma_GammaRamps_libgamma_1gamma_1ramps32_1free(JNIEnv *env, jclass class, jlong address)
{
- void *this = (void *)(size_t)address;
+ void *this = (void *)(uintptr_t)address;
libgamma_gamma_ramps32_free(this);
(void) env;
(void) class;
@@ -295,7 +295,7 @@ Java_libgamma_GammaRamps_libgamma_1gamma_1ramps32_1free(JNIEnv *env, jclass clas
void
Java_libgamma_GammaRamps_libgamma_1gamma_1ramps64_1free(JNIEnv *env, jclass class, jlong address)
{
- void *this = (void *)(size_t)address;
+ void *this = (void *)(uintptr_t)address;
libgamma_gamma_ramps64_free(this);
(void) env;
(void) class;
@@ -312,7 +312,7 @@ Java_libgamma_GammaRamps_libgamma_1gamma_1ramps64_1free(JNIEnv *env, jclass clas
void
Java_libgamma_GammaRamps_libgamma_1gamma_1rampsf_1free(JNIEnv *env, jclass class, jlong address)
{
- void *this = (void *)(size_t)address;
+ void *this = (void *)(uintptr_t)address;
libgamma_gamma_rampsf_free(this);
(void) env;
(void) class;
@@ -329,7 +329,7 @@ Java_libgamma_GammaRamps_libgamma_1gamma_1rampsf_1free(JNIEnv *env, jclass class
void
Java_libgamma_GammaRamps_libgamma_1gamma_1rampsd_1free(JNIEnv *env, jclass class, jlong address)
{
- void *this = (void *)(size_t)address;
+ void *this = (void *)(uintptr_t)address;
libgamma_gamma_rampsd_free(this);
(void) env;
(void) class;
diff --git a/libgamma_LibgammaException.c b/libgamma_LibgammaException.c
index f686dd8..47c5fde 100644
--- a/libgamma_LibgammaException.c
+++ b/libgamma_LibgammaException.c
@@ -65,7 +65,7 @@ Java_libgamma_LibgammaException_value_1of_1error(JNIEnv *env, jclass class, jstr
jint
Java_libgamma_LibgammaException_libgamma_1group_1gid(JNIEnv *env, jclass class)
{
- return (jint)libgamma_group_gid;
+ return (jint)libgamma_group_gid_get();
(void) env;
(void) class;
}
@@ -82,7 +82,7 @@ Java_libgamma_LibgammaException_libgamma_1group_1name(JNIEnv *env, jclass class)
* and error handing makes this unnecessarily comples,
* therefore we will simply skip it */
- const char *do_not_free_this = libgamma_group_name;
+ const char *do_not_free_this = libgamma_group_name_get();
char *this_will_be_freed;
size_t n;
if (!do_not_free_this)
diff --git a/libgamma_Partition.c b/libgamma_Partition.c
index 9b77ff1..b90396d 100644
--- a/libgamma_Partition.c
+++ b/libgamma_Partition.c
@@ -36,7 +36,7 @@ fail(JNIEnv *env, int error_code)
static jlongArray
ok(JNIEnv *env, void *state, size_t count)
{
- jlong a = (jlong)(size_t)state;
+ jlong a = (jlong)(uintptr_t)state;
jlong b = (jlong)count, z = 0;
jlongArray rc = (*env)->NewLongArray(env, 3);
(*env)->SetLongArrayRegion(env, rc, 0, 1, &a);
@@ -57,8 +57,8 @@ ok(JNIEnv *env, void *state, size_t count)
jlongArray
Java_libgamma_Partition_libgamma_1partition_1create(JNIEnv *env, jclass class, jlong site, jint partition)
{
- libgamma_partition_state_t *state = malloc(sizeof(libgamma_partition_state_t));
- void *super = (void *)(size_t)site;
+ struct libgamma_partition_state *state = malloc(sizeof(*state));
+ void *super = (void *)(uintptr_t)site;
int r;
if (state == NULL)
return fail(env, 0);
@@ -78,7 +78,7 @@ Java_libgamma_Partition_libgamma_1partition_1create(JNIEnv *env, jclass class, j
void
Java_libgamma_Partition_libgamma_1partition_1free(JNIEnv *env, jclass class, jlong address)
{
- void *this = (void *)(size_t)address;
+ void *this = (void *)(uintptr_t)address;
libgamma_partition_free(this);
(void) env;
(void) class;
@@ -93,7 +93,7 @@ Java_libgamma_Partition_libgamma_1partition_1free(JNIEnv *env, jclass class, jlo
jint
Java_libgamma_Partition_libgamma_1partition_1restore(JNIEnv *env, jclass class, jlong address)
{
- void *this = (void *)(size_t)address;
+ void *this = (void *)(uintptr_t)address;
int r = libgamma_partition_restore(this);
if (r)
return r == LIBGAMMA_ERRNO_SET ? errno : r;
diff --git a/libgamma_Ramp.c b/libgamma_Ramp.c
index 9202dc7..70bc798 100644
--- a/libgamma_Ramp.c
+++ b/libgamma_Ramp.c
@@ -13,7 +13,7 @@
jshort
Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1get(JNIEnv *env, jclass class, jlong address, jint stop)
{
- void *this_voidp = (void *)(size_t)address;
+ void *this_voidp = (void *)(uintptr_t)address;
uint8_t *this = this_voidp;
return (jshort)(this[stop]);
(void) env;
@@ -30,7 +30,7 @@ Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1get(JNIEnv *env, jclass class, jlong
jint
Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1get(JNIEnv *env, jclass class, jlong address, jint stop)
{
- void *this_voidp = (void *)(size_t)address;
+ void *this_voidp = (void *)(uintptr_t)address;
uint16_t *this = this_voidp;
return (jint)(this[stop]);
(void) env;
@@ -47,7 +47,7 @@ Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1get(JNIEnv *env, jclass class, jlon
jlong
Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1get(JNIEnv *env, jclass class, jlong address, jint stop)
{
- void *this_voidp = (void *)(size_t)address;
+ void *this_voidp = (void *)(uintptr_t)address;
uint32_t *this = this_voidp;
return (jlong)(this[stop]);
(void) env;
@@ -64,7 +64,7 @@ Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1get(JNIEnv *env, jclass class, jlon
jlong
Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1get(JNIEnv *env, jclass class, jlong address, jint stop)
{
- void *this_voidp = (void *)(size_t)address;
+ void *this_voidp = (void *)(uintptr_t)address;
uint64_t *this = this_voidp;
return (jlong)(this[stop]);
(void) env;
@@ -81,7 +81,7 @@ Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1get(JNIEnv *env, jclass class, jlon
jfloat
Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1get(JNIEnv *env, jclass class, jlong address, jint stop)
{
- void *this_voidp = (void *)(size_t)address;
+ void *this_voidp = (void *)(uintptr_t)address;
float *this = this_voidp;
return (jfloat)(this[stop]);
(void) env;
@@ -98,7 +98,7 @@ Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1get(JNIEnv *env, jclass class, jlong
jdouble
Java_libgamma_Ramp_libgamma_1gamma_1rampsd_1get(JNIEnv *env, jclass class, jlong address, jint stop)
{
- void *this_voidp = (void *)(size_t)address;
+ void *this_voidp = (void *)(uintptr_t)address;
double *this = this_voidp;
return (jdouble)(this[stop]);
(void) env;
@@ -115,7 +115,7 @@ Java_libgamma_Ramp_libgamma_1gamma_1rampsd_1get(JNIEnv *env, jclass class, jlong
void
Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1set(JNIEnv *env, jclass class, jlong address, jint stop, jshort value)
{
- void *this_voidp = (void *)(size_t)address;
+ void *this_voidp = (void *)(uintptr_t)address;
uint8_t *this = this_voidp;
this[stop] = (uint8_t)value;
(void) env;
@@ -132,7 +132,7 @@ Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1set(JNIEnv *env, jclass class, jlong
void
Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1set(JNIEnv *env, jclass class, jlong address, jint stop, jint value)
{
- void *this_voidp = (void *)(size_t)address;
+ void *this_voidp = (void *)(uintptr_t)address;
uint16_t *this = this_voidp;
this[stop] = (uint16_t)value;
(void) env;
@@ -149,7 +149,7 @@ Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1set(JNIEnv *env, jclass class, jlon
void
Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1set(JNIEnv *env, jclass class, jlong address, jint stop, jlong value)
{
- void *this_voidp = (void *)(size_t)address;
+ void *this_voidp = (void *)(uintptr_t)address;
uint32_t *this = this_voidp;
this[stop] = (uint32_t)value;
(void) env;
@@ -166,7 +166,7 @@ Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1set(JNIEnv *env, jclass class, jlon
void
Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1set(JNIEnv *env, jclass class, jlong address, jint stop, jlong value)
{
- void *this_voidp = (void *)(size_t)address;
+ void *this_voidp = (void *)(uintptr_t)address;
uint64_t *this = this_voidp;
this[stop] = (uint64_t)value;
(void) env;
@@ -184,7 +184,7 @@ Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1set(JNIEnv *env, jclass class, jlon
void
Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1set(JNIEnv *env, jclass class, jlong address, jint stop, jfloat value)
{
- void *this_voidp = (void *)(size_t)address;
+ void *this_voidp = (void *)(uintptr_t)address;
float *this = this_voidp;
this[stop] = (float)value;
(void) env;
@@ -202,7 +202,7 @@ Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1set(JNIEnv *env, jclass class, jlong
void
Java_libgamma_Ramp_libgamma_1gamma_1rampsd_1set(JNIEnv *env, jclass class, jlong address, jint stop, jdouble value)
{
- void *this_voidp = (void *)(size_t)address;
+ void *this_voidp = (void *)(uintptr_t)address;
double *this = this_voidp;
this[stop] = (double)value;
(void) env;
diff --git a/libgamma_Site.c b/libgamma_Site.c
index b28244a..f6293db 100644
--- a/libgamma_Site.c
+++ b/libgamma_Site.c
@@ -37,7 +37,7 @@ fail(JNIEnv *env, int error_code)
static jlongArray
ok(JNIEnv *env, void *state, size_t count)
{
- jlong a = (jlong)(size_t)state;
+ jlong a = (jlong)(uintptr_t)state;
jlong b = (jlong)count, z = 0;
jlongArray rc = (*env)->NewLongArray(env, 3);
(*env)->SetLongArrayRegion(env, rc, 0, 1, &a);
@@ -58,7 +58,7 @@ ok(JNIEnv *env, void *state, size_t count)
jlongArray
Java_libgamma_Site_libgamma_1site_1create(JNIEnv *env, jclass class, jint method, jstring site)
{
- libgamma_site_state_t *state = malloc(sizeof(libgamma_site_state_t));
+ struct libgamma_site_state *state = malloc(sizeof(*state));
const char *site_chars;
char *site_;
int r;
@@ -96,7 +96,7 @@ Java_libgamma_Site_libgamma_1site_1create(JNIEnv *env, jclass class, jint method
void
Java_libgamma_Site_libgamma_1site_1free(JNIEnv *env, jclass class, jlong address)
{
- void *this = (void *)(size_t)address;
+ void *this = (void *)(uintptr_t)address;
libgamma_site_free(this);
(void) env;
(void) class;
@@ -111,7 +111,7 @@ Java_libgamma_Site_libgamma_1site_1free(JNIEnv *env, jclass class, jlong address
jint
Java_libgamma_Site_libgamma_1site_1restore(JNIEnv *env, jclass class, jlong address)
{
- void *this = (void *)(size_t)address;
+ void *this = (void *)(uintptr_t)address;
int r = libgamma_site_restore(this);
if (r)
return r == LIBGAMMA_ERRNO_SET ? errno : r;