Add missing param JNIEnv* for natvie interfaces [ci build]

This commit is contained in:
halx99 2020-11-18 12:15:02 +08:00
parent 5ff9f4786e
commit 53122216ee
2 changed files with 9 additions and 15 deletions

View File

@ -42,7 +42,7 @@ extern "C" {
cocos2d::Director::getInstance()->mainLoop(); cocos2d::Director::getInstance()->mainLoop();
} }
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnPause() { JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnPause(JNIEnv* env) {
if (Director::getInstance()->getOpenGLView()) { if (Director::getInstance()->getOpenGLView()) {
Application::getInstance()->applicationDidEnterBackground(); Application::getInstance()->applicationDidEnterBackground();
cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND); cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND);
@ -50,7 +50,7 @@ extern "C" {
} }
} }
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume() { JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume(JNIEnv* env) {
static bool firstTime = true; static bool firstTime = true;
if (Director::getInstance()->getOpenGLView()) { if (Director::getInstance()->getOpenGLView()) {
// don't invoke at first to keep the same logic as iOS // don't invoke at first to keep the same logic as iOS
@ -75,11 +75,9 @@ extern "C" {
cocos2d::IMEDispatcher::sharedDispatcher()->dispatchDeleteBackward(); cocos2d::IMEDispatcher::sharedDispatcher()->dispatchDeleteBackward();
} }
JNIEXPORT jstring JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeGetContentText() { JNIEXPORT jstring JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeGetContentText(JNIEnv* env) {
JNIEnv * env = 0; if (! env) {
return nullptr;
if (JniHelper::getJavaVM()->GetEnv((void**)&env, JNI_VERSION_1_4) != JNI_OK || ! env) {
return 0;
} }
std::string pszText = cocos2d::IMEDispatcher::sharedDispatcher()->getContentText(); std::string pszText = cocos2d::IMEDispatcher::sharedDispatcher()->getContentText();
return cocos2d::StringUtils::newStringUTFJNI(env, pszText); return cocos2d::StringUtils::newStringUTFJNI(env, pszText);

View File

@ -37,16 +37,14 @@
extern "C" { extern "C" {
JNIEXPORT jint JNICALL Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge_callLuaFunctionWithString JNIEXPORT jint JNICALL Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge_callLuaFunctionWithString(JNIEnv *env, jclass cls, jint functionId, jstring value)
(JNIEnv *env, jclass cls, jint functionId, jstring value)
{ {
std::string strValue = cocos2d::StringUtils::getStringUTFCharsJNI(env, value); std::string strValue = cocos2d::StringUtils::getStringUTFCharsJNI(env, value);
int ret = LuaJavaBridge::callLuaFunctionById(functionId, strValue.c_str()); int ret = LuaJavaBridge::callLuaFunctionById(functionId, strValue.c_str());
return ret; return ret;
} }
JNIEXPORT jint JNICALL Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge_callLuaGlobalFunctionWithString JNIEXPORT jint JNICALL Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge_callLuaGlobalFunctionWithString(JNIEnv *env, jclass cls, jstring luaFunctionName, jstring value)
(JNIEnv *env, jclass cls, jstring luaFunctionName, jstring value)
{ {
std::string functionNameStr = cocos2d::StringUtils::getStringUTFCharsJNI(env, luaFunctionName); std::string functionNameStr = cocos2d::StringUtils::getStringUTFCharsJNI(env, luaFunctionName);
std::string valueStr = cocos2d::StringUtils::getStringUTFCharsJNI(env, value); std::string valueStr = cocos2d::StringUtils::getStringUTFCharsJNI(env, value);
@ -55,14 +53,12 @@ JNIEXPORT jint JNICALL Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge_callLuaGlobal
return ret; return ret;
} }
JNIEXPORT jint JNICALL Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge_retainLuaFunction JNIEXPORT jint JNICALL Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge_retainLuaFunction(JNIEnv *env, jclass cls, jint luaFunctionId)
(JNIEnv *env, jclass cls, jint luaFunctionId)
{ {
return LuaJavaBridge::retainLuaFunctionById(luaFunctionId); return LuaJavaBridge::retainLuaFunctionById(luaFunctionId);
} }
JNIEXPORT jint JNICALL Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge_releaseLuaFunction JNIEXPORT jint JNICALL Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge_releaseLuaFunction(JNIEnv *env, jclass cls, jint luaFunctionId)
(JNIEnv *env, jclass cls, jint luaFunctionId)
{ {
return LuaJavaBridge::releaseLuaFunctionById(luaFunctionId); return LuaJavaBridge::releaseLuaFunctionById(luaFunctionId);
} }