From 8b552927c4c44efcb7e09a696ca44783a799ce14 Mon Sep 17 00:00:00 2001 From: Ioannis Tsakpinis Date: Wed, 18 Jan 2017 21:09:35 +0200 Subject: [PATCH] Convert even more int parameters and return values to boolean This commit fixes functions that were missed in #181 and d6b0694278dc1565661692f72193e03e2229f233. --- doc/notes/3.1.2.md | 9 ++++++++- modules/core/src/main/java/org/lwjgl/opengl/GL.java | 2 +- modules/core/src/test/java/org/lwjgl/opencl/CLTest.java | 2 +- .../main/kotlin/org/lwjgl/generator/CallbackFunction.kt | 6 +----- .../src/main/kotlin/org/lwjgl/opencl/CLTypes.kt | 2 +- .../main/kotlin/org/lwjgl/system/dyncall/DynCallTypes.kt | 2 +- .../src/main/kotlin/org/lwjgl/system/linux/XTypes.kt | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/doc/notes/3.1.2.md b/doc/notes/3.1.2.md index f530c24d86..629e816f3d 100644 --- a/doc/notes/3.1.2.md +++ b/doc/notes/3.1.2.md @@ -27,4 +27,11 @@ This build includes the following changes: - Assimp: Struct member nullability fixes - Linux: Removed dependencies to newer GLIBC versions. - LibOVR: Fixed layout of the `ovrInputState` struct. -- OpenAL: Removed buffer auto-sizing from `alcCaptureSamples`. The number of samples must now be specified explicitly, similar to `alcRenderSamplesSOFT`. \ No newline at end of file +- OpenAL: Removed buffer auto-sizing from `alcCaptureSamples`. The number of samples must now be specified explicitly, similar to `alcRenderSamplesSOFT`. + +### Breaking Changes + +- Mapped more integer parameters and return values to Java `boolean`, that were missed while working on #181. + * Xlib's `Bool` + * OpenCL's `cl_bool` + * DynCall's `DCbool` \ No newline at end of file diff --git a/modules/core/src/main/java/org/lwjgl/opengl/GL.java b/modules/core/src/main/java/org/lwjgl/opengl/GL.java index 1fa99b497b..7b72a7f492 100644 --- a/modules/core/src/main/java/org/lwjgl/opengl/GL.java +++ b/modules/core/src/main/java/org/lwjgl/opengl/GL.java @@ -565,7 +565,7 @@ public static GLXCapabilities createCapabilitiesGLX(long display, int screen) { IntBuffer piMajor = stack.ints(0); IntBuffer piMinor = stack.ints(0); - if ( glXQueryVersion(display, piMajor, piMinor) == 0 ) + if ( !glXQueryVersion(display, piMajor, piMinor) ) throw new IllegalStateException("Failed to query GLX version"); majorVersion = piMajor.get(0); diff --git a/modules/core/src/test/java/org/lwjgl/opencl/CLTest.java b/modules/core/src/test/java/org/lwjgl/opencl/CLTest.java index 012357d677..6066afa90f 100644 --- a/modules/core/src/test/java/org/lwjgl/opencl/CLTest.java +++ b/modules/core/src/test/java/org/lwjgl/opencl/CLTest.java @@ -157,7 +157,7 @@ public void testNativeKernel() { for ( int i = 0; i < bufferContents.capacity(); i++ ) bufferContents.put(i, (byte)i); - checkCLError(clEnqueueWriteBuffer(queue, buffer, CL_TRUE, 0, bufferContents, null, null)); + checkCLError(clEnqueueWriteBuffer(queue, buffer, true, 0, bufferContents, null, null)); // Prepare enqueue arguments diff --git a/modules/generator/src/main/kotlin/org/lwjgl/generator/CallbackFunction.kt b/modules/generator/src/main/kotlin/org/lwjgl/generator/CallbackFunction.kt index e873bedd0c..1c721fc38b 100644 --- a/modules/generator/src/main/kotlin/org/lwjgl/generator/CallbackFunction.kt +++ b/modules/generator/src/main/kotlin/org/lwjgl/generator/CallbackFunction.kt @@ -149,11 +149,7 @@ ${access.modifier}interface ${className}I extends CallbackI.${returns.mapping.jn print("return ") print("""invoke( ${signature.asSequence().map { - "\t\t\tdcbArg${it.nativeType.argType}(args)${when (it.nativeType.mapping) { - PrimitiveMapping.BOOLEAN, - PrimitiveMapping.BOOLEAN4 -> " != 0" - else -> "" - }}" + "\t\t\tdcbArg${it.nativeType.argType}(args)${if (it.nativeType.mapping === PrimitiveMapping.BOOLEAN4)" != 0" else ""}" }.joinToString(",\n")} ); } diff --git a/modules/templates/src/main/kotlin/org/lwjgl/opencl/CLTypes.kt b/modules/templates/src/main/kotlin/org/lwjgl/opencl/CLTypes.kt index dd94476d49..29ece9297f 100644 --- a/modules/templates/src/main/kotlin/org/lwjgl/opencl/CLTypes.kt +++ b/modules/templates/src/main/kotlin/org/lwjgl/opencl/CLTypes.kt @@ -57,7 +57,7 @@ val cl_sampler_p = cl_sampler.p // typedefs -val cl_bool = typedef(cl_uint, "cl_bool") +val cl_bool = typedef(intb, "cl_bool") val cl_bitfield = typedef(cl_ulong, "cl_bitfield") val cl_device_type = typedef(cl_bitfield, "cl_device_type") val cl_platform_info = typedef(cl_uint, "cl_platform_info") diff --git a/modules/templates/src/main/kotlin/org/lwjgl/system/dyncall/DynCallTypes.kt b/modules/templates/src/main/kotlin/org/lwjgl/system/dyncall/DynCallTypes.kt index 69e10741fa..016194785f 100644 --- a/modules/templates/src/main/kotlin/org/lwjgl/system/dyncall/DynCallTypes.kt +++ b/modules/templates/src/main/kotlin/org/lwjgl/system/dyncall/DynCallTypes.kt @@ -36,7 +36,7 @@ val DCstruct_p = "DCstruct".p val DCvoid = NativeType("DCvoid", TypeMapping.VOID) -val DCbool = typedef(int, "DCbool") +val DCbool = typedef(intb, "DCbool") val DCchar = typedef(char, "DCchar") val DCuchar = typedef(unsigned_char, "DCuchar") val DCshort = typedef(short, "DCshort") diff --git a/modules/templates/src/main/kotlin/org/lwjgl/system/linux/XTypes.kt b/modules/templates/src/main/kotlin/org/lwjgl/system/linux/XTypes.kt index 50d7ba9a49..ebfa72b543 100644 --- a/modules/templates/src/main/kotlin/org/lwjgl/system/linux/XTypes.kt +++ b/modules/templates/src/main/kotlin/org/lwjgl/system/linux/XTypes.kt @@ -6,7 +6,7 @@ package org.lwjgl.system.linux import org.lwjgl.generator.* -val Bool = typedef(int, "Bool") +val Bool = typedef(intb, "Bool") val XID = typedef(unsigned_long, "XID") val VisualID = typedef(unsigned_long, "VisualID")