diff options
author | Sven Gothel <[email protected]> | 2023-06-20 11:24:12 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-06-20 11:24:12 +0200 |
commit | 65e9c14e1566d5bfa88435d460c699c2a8fd23b7 (patch) | |
tree | 1a906a84fec2466c23c6bba0a530e5a7a8701c4b /src/junit | |
parent | b9dc722d689760bf85628edd8766dc6cd2360c8e (diff) |
GlueGen Struct [15b]: FunctionPointer: Drop is<FuncName>Null() -> use get<FuncName>()
Diffstat (limited to 'src/junit')
3 files changed, 19 insertions, 20 deletions
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test2.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test2.java index 636eea7..28a3060 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test2.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test2.java @@ -82,20 +82,19 @@ public class Test2 extends BaseClass { Assert.assertEquals(true, options.isOverrideThreadAffinityNull()); Assert.assertEquals(true, options.isProductNameNull()); Assert.assertEquals(true, options.isProductVersionNull()); - Assert.assertEquals(true, options.isCustomFuncA1Null()); - Assert.assertEquals(true, options.isCustomFuncA2Null()); - Assert.assertEquals(true, options.isCustomFuncB1Null()); - Assert.assertEquals(true, options.isCustomFuncB2Null()); + Assert.assertEquals(0, options.getCustomFuncA1()); + Assert.assertEquals(0, options.getCustomFuncA2()); + Assert.assertEquals(0, options.getCustomFuncB1()); + Assert.assertEquals(0, options.getCustomFuncB2()); bt2.Initialize(options); Assert.assertEquals(true, options.isOverrideThreadAffinityNull()); Assert.assertEquals(false, options.isProductNameNull()); Assert.assertEquals(false, options.isProductVersionNull()); - Assert.assertEquals(false, options.isCustomFuncA1Null()); - Assert.assertEquals(false, options.isCustomFuncA2Null()); - Assert.assertEquals(false, options.isCustomFuncB1Null()); - Assert.assertEquals(false, options.isCustomFuncB2Null()); - Assert.assertEquals(false, options.isCustomFuncA1Null()); + Assert.assertNotEquals(0, options.getCustomFuncA1()); + Assert.assertNotEquals(0, options.getCustomFuncA2()); + Assert.assertNotEquals(0, options.getCustomFuncB1()); + Assert.assertNotEquals(0, options.getCustomFuncB2()); Assert.assertEquals(1, options.getApiVersion()); Assert.assertEquals("Product Name", options.getProductName()); Assert.assertEquals("Product Version", options.getProductVersion()); @@ -135,10 +134,10 @@ public class Test2 extends BaseClass { Assert.assertEquals(true, options.isOverrideThreadAffinityNull()); Assert.assertEquals(true, options.isProductNameNull()); Assert.assertEquals(true, options.isProductVersionNull()); - Assert.assertEquals(true, options.isCustomFuncA1Null()); - Assert.assertEquals(true, options.isCustomFuncA2Null()); - Assert.assertEquals(true, options.isCustomFuncB1Null()); - Assert.assertEquals(true, options.isCustomFuncB2Null()); + Assert.assertEquals(0, options.getCustomFuncA1()); + // const Assert.assertEquals(0, options.getCustomFuncA2()); + Assert.assertEquals(0, options.getCustomFuncB1()); + Assert.assertEquals(0, options.getCustomFuncB2()); } public static void main(final String args[]) throws IOException { diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c index 561b3ae..75eafcf 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c @@ -24,13 +24,13 @@ static int32_t CustomFuncB2(T2_UserData* pUserData) { int Initialize(T2_InitializeOptions* Options) { Options->ProductName = calloc(100, sizeof(char)); Options->ProductVersion = calloc(100, sizeof(char)); - strncpy(Options->ProductName, "Product Name", 100); - strncpy(Options->ProductVersion, "Product Version", 100); + strncpy((char*)Options->ProductName, "Product Name", 100); // yuck: nonsense-warning + strncpy((char*)Options->ProductVersion, "Product Version", 100); // yuck: nonsense-warning Options->ApiVersion = 1; Options->Reserved1 = NULL; Options->CustomFuncA1 = CustomFuncA1; - Options->CustomFuncA2 = CustomFuncA2; + *( (T2_CustomFuncA*) &Options->CustomFuncA2 ) = CustomFuncA2; // yuck: real yuck Options->CustomFuncB1 = CustomFuncB1; Options->CustomFuncB2 = CustomFuncB2; @@ -39,15 +39,15 @@ int Initialize(T2_InitializeOptions* Options) { int Release(T2_InitializeOptions* Options) { if( NULL != Options->ProductName ) { - free( Options->ProductName ); + free( (void*) Options->ProductName ); // yuck: nonsense-warning Options->ProductName = NULL; } if( NULL != Options->ProductVersion ) { - free( Options->ProductVersion ); + free( (void*) Options->ProductVersion ); // yuck: nonsense-warning Options->ProductVersion = NULL; } Options->CustomFuncA1 = NULL; - Options->CustomFuncA2 = NULL; + // Options->CustomFuncA2 = NULL; // keep const Options->CustomFuncB1 = NULL; Options->CustomFuncB2 = NULL; } diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h index 0fca16a..cf0808d 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h @@ -29,7 +29,7 @@ typedef struct { void* Reserved1; T2_CustomFuncA CustomFuncA1; - T2_CustomFuncA CustomFuncA2; + const T2_CustomFuncA CustomFuncA2; T2_CustomFuncB CustomFuncB1; T2_CustomFuncB CustomFuncB2; |