Skip to content

Commit c4c03be

Browse files
authored
feat(api): use uintptr_t instead of intptr_t for pointers (#265)
Image methods now accept the `long` type instead of `int`, as they are expected to work with pointers as well.
1 parent 473521e commit c4c03be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+303
-303
lines changed

buildSrc/scripts/publish.sh

100644100755
File mode changed.

buildSrc/src/main/kotlin/tool/generator/api/util.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const val A_TYPE_VALUE_ACCESSOR_SETTER = "SETTER"
4545
const val A_TYPE_VALUE_ACCESSOR_GETTER = "GETTER"
4646

4747
const val PTR_JVM_FIELD = "ptr"
48-
const val PTR_JNI_CAST = "intptr_t"
48+
const val PTR_JNI_CAST = "uintptr_t"
4949
const val PTR_JNI_THIS = "THIS"
5050

5151
const val PARAM_ARR_LEN_POSTFIX = "Count"

imgui-binding/src/generated/java/imgui/ImDrawData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public ImVec4 getCmdListCmdBufferClipRect(final int cmdListIdx, final int cmdBuf
6464
* Ignore if never using images or multiple fonts atlas.
6565
*/
6666
public native int getCmdListCmdBufferTextureId(int cmdListIdx, int cmdBufferIdx); /*
67-
return (intptr_t)THIS->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].GetTexID();
67+
return (uintptr_t)THIS->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].GetTexID();
6868
*/
6969

7070
/**
@@ -326,7 +326,7 @@ public ImGuiViewport getOwnerViewport() {
326326
}
327327

328328
private native long nGetOwnerViewport(); /*
329-
return (intptr_t)THIS->OwnerViewport;
329+
return (uintptr_t)THIS->OwnerViewport;
330330
*/
331331

332332
// Functions

imgui-binding/src/generated/java/imgui/ImDrawList.java

Lines changed: 51 additions & 51 deletions
Large diffs are not rendered by default.

imgui-binding/src/generated/java/imgui/ImFont.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected long create() {
2626
*/
2727

2828
private native long nCreate(); /*
29-
return (intptr_t)(new ImFont());
29+
return (uintptr_t)(new ImFont());
3030
*/
3131

3232
// TODO IndexAdvanceX
@@ -95,7 +95,7 @@ public void setFallbackGlyph(final ImFontGlyph value) {
9595
}
9696

9797
private native long nGetFallbackGlyph(); /*
98-
return (intptr_t)THIS->FallbackGlyph;
98+
return (uintptr_t)THIS->FallbackGlyph;
9999
*/
100100

101101
private native void nSetFallbackGlyph(long value); /*
@@ -277,15 +277,15 @@ public ImFontGlyph findGlyph(final int c) {
277277
}
278278

279279
private native long nFindGlyph(int c); /*
280-
return (intptr_t)THIS->FindGlyph((ImWchar)c);
280+
return (uintptr_t)THIS->FindGlyph((ImWchar)c);
281281
*/
282282

283283
public ImFontGlyph findGlyphNoFallback(final int c) {
284284
return new ImFontGlyph(nFindGlyphNoFallback(c));
285285
}
286286

287287
private native long nFindGlyphNoFallback(int c); /*
288-
return (intptr_t)THIS->FindGlyphNoFallback((ImWchar)c);
288+
return (uintptr_t)THIS->FindGlyphNoFallback((ImWchar)c);
289289
*/
290290

291291
public float getCharAdvance(final int c) {

imgui-binding/src/generated/java/imgui/ImFontAtlas.java

Lines changed: 29 additions & 29 deletions
Large diffs are not rendered by default.

imgui-binding/src/generated/java/imgui/ImFontConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected long create() {
2424
private native long nCreate(); /*
2525
ImFontConfig* cfg = new ImFontConfig();
2626
cfg->FontDataOwnedByAtlas = false;
27-
return (intptr_t)cfg;
27+
return (uintptr_t)cfg;
2828
*/
2929

3030
/**
@@ -524,7 +524,7 @@ public void setDstFont(final ImFont value) {
524524
}
525525

526526
private native long nGetDstFont(); /*
527-
return (intptr_t)THIS->DstFont;
527+
return (uintptr_t)THIS->DstFont;
528528
*/
529529

530530
private native void nSetDstFont(long value); /*

imgui-binding/src/generated/java/imgui/ImFontGlyph.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected long create() {
2626
*/
2727

2828
private native long nCreate(); /*
29-
return (intptr_t)(new ImFontGlyph());
29+
return (uintptr_t)(new ImFontGlyph());
3030
*/
3131

3232
/**

imgui-binding/src/generated/java/imgui/ImGui.java

Lines changed: 67 additions & 67 deletions
Large diffs are not rendered by default.

imgui-binding/src/generated/java/imgui/ImGuiIO.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ public void setFonts(final ImFontAtlas value) {
389389
}
390390

391391
private native long nGetFonts(); /*
392-
return (intptr_t)THIS->Fonts;
392+
return (uintptr_t)THIS->Fonts;
393393
*/
394394

395395
private native void nSetFonts(long value); /*
@@ -455,7 +455,7 @@ public void setFontDefault(final ImFont value) {
455455
}
456456

457457
private native long nGetFontDefault(); /*
458-
return (intptr_t)THIS->FontDefault;
458+
return (uintptr_t)THIS->FontDefault;
459459
*/
460460

461461
private native void nSetFontDefault(long value); /*

0 commit comments

Comments
 (0)