Skip to content

Commit 9060e10

Browse files
committed
[[ Bug ]] Fix nativeNotify to use correctly sized parameters to cast pointers
1 parent c2158fe commit 9060e10

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

engine/src/java/com/runrev/android/Engine.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ public void run()
246246
});
247247
}
248248

249-
public void nativeNotify(int p_callback, int p_context)
250-
{
251-
final int t_callback = p_callback;
252-
final int t_context = p_context;
249+
public void nativeNotify(long p_callback, long p_context)
250+
{
251+
final long t_callback = p_callback;
252+
final long t_context = p_context;
253253
post(new Runnable() {
254254
public void run()
255255
{
@@ -3800,7 +3800,7 @@ public static native void doPurchaseStateChanged(boolean verified, int purchaseS
38003800
public static native void doResume();
38013801
public static native void doLowMemory();
38023802

3803-
public static native void doNativeNotify(int callback, int context);
3803+
public static native void doNativeNotify(long callback, long context);
38043804

38053805
////////////////////////////////////////////////////////////////////////////////
38063806

engine/src/mblandroiddc.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2947,8 +2947,8 @@ class MCRunOnMainThreadHelper
29472947
int m_options;
29482948
};
29492949

2950-
extern "C" JNIEXPORT void JNICALL Java_com_runrev_android_Engine_doNativeNotify(JNIEnv *env, jobject object, int p_callback, int p_context) __attribute__((visibility("default")));
2951-
JNIEXPORT void JNICALL Java_com_runrev_android_Engine_doNativeNotify(JNIEnv *env, jobject object, int p_callback, int p_context)
2950+
extern "C" JNIEXPORT void JNICALL Java_com_runrev_android_Engine_doNativeNotify(JNIEnv *env, jobject object, jlong p_callback, jlong p_context) __attribute__((visibility("default")));
2951+
JNIEXPORT void JNICALL Java_com_runrev_android_Engine_doNativeNotify(JNIEnv *env, jobject object, jlong p_callback, jlong p_context)
29522952
{
29532953
co_yield_to_engine_and_call((co_yield_callback_t)p_callback, (void *)p_context);
29542954
}
@@ -2993,8 +2993,8 @@ bool android_run_on_main_thread(void *p_callback, void *p_callback_state, int p_
29932993

29942994
MCRunOnMainThreadHelper *t_helper;
29952995
t_helper = new (nothrow) MCRunOnMainThreadHelper(p_callback, p_callback_state, p_options);
2996-
MCAndroidEngineCall("nativeNotify", "vii", nil, MCRunOnMainThreadHelper::DispatchThunk, t_helper);
2997-
return true;
2996+
MCAndroidEngineCall("nativeNotify", "vjj", nil, reinterpret_cast<jlong>(MCRunOnMainThreadHelper::DispatchThunk), reinterpret_cast<jlong>(t_helper));
2997+
return true;
29982998
}
29992999

30003000
// Unsafe and immediate -> queue and perform
@@ -3011,8 +3011,8 @@ bool android_run_on_main_thread(void *p_callback, void *p_callback_state, int p_
30113011

30123012
MCRunOnMainThreadHelper *t_helper;
30133013
t_helper = new (nothrow) MCRunOnMainThreadHelper(p_callback, p_callback_state, p_options & ~kMCExternalRunOnMainThreadPost);
3014-
MCAndroidEngineCall("nativeNotify", "vii", nil, MCRunOnMainThreadHelper::DispatchThunk, t_helper);
3015-
return true;
3014+
MCAndroidEngineCall("nativeNotify", "vjj", nil, reinterpret_cast<jlong>(MCRunOnMainThreadHelper::DispatchThunk), reinterpret_cast<jlong>(t_helper));
3015+
return true;
30163016
}
30173017

30183018
// Safe and immediate -> post to front of event queue

0 commit comments

Comments
 (0)