Skip to content

Commit

Permalink
fix callback passing any
Browse files Browse the repository at this point in the history
  • Loading branch information
xpenatan committed Sep 1, 2024
1 parent b047731 commit 4e4ffab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions example/lib/lib-build/src/main/cpp/TestLib.idl
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ interface CallbackClassImpl {
[Const] void onStringCallback([Const] DOMString strValue01);
unsigned long onUnsignedIntCallback(unsigned long unsignedInt);
[Const] unsigned short onUnsignedShortCallback(unsigned short unsignedShort);
[Const] void onAnyCallback(any anyPtr);
};
CallbackClassImpl implements CallbackClass;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ class CallbackClass
virtual void onStringCallback(const char* strValue01) const = 0;
virtual unsigned int onUnsignedIntCallback(unsigned int unsignedInt) = 0;
virtual unsigned short onUnsignedShortCallback(unsigned short unsignedShort) const = 0;
virtual void onAnyCallback(void * anyPtr) const = 0;

int addInt(int a, int b)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ else if(type.contains("long")) {
}

if(type.equals("any") || type.equals("VoidPtr")) {
type = "long";
type = "void*";
isAny = true;
}

Expand Down Expand Up @@ -109,6 +109,9 @@ else if(type.equals("double[]")) {
}

public String getType() {
if(isAny) {
return "long";
}
return type.replace("unsigned", "").trim();
}

Expand Down

0 comments on commit 4e4ffab

Please sign in to comment.