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

View File

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