mirror of https://github.com/axmolengine/axmol.git
Remove unnecessary DeleteLocalRef (?) and clean up checking code
This commit is contained in:
parent
210cf68cab
commit
f3141826b2
|
@ -17,28 +17,31 @@ namespace CocosDenshion {
|
||||||
#define METHOD_NAME "getDeviceModel"
|
#define METHOD_NAME "getDeviceModel"
|
||||||
|
|
||||||
bool is_buggy_device(void) {
|
bool is_buggy_device(void) {
|
||||||
bool buggydevice = false;
|
|
||||||
|
|
||||||
JniMethodInfo methodInfo;
|
JniMethodInfo methodInfo;
|
||||||
jstring jstr;
|
jstring jstr;
|
||||||
if (JniHelper::getStaticMethodInfo(methodInfo, CLASS_NAME, METHOD_NAME, "()Ljava/lang/String;"))
|
if (JniHelper::getStaticMethodInfo(methodInfo,
|
||||||
{
|
CLASS_NAME,
|
||||||
jstr = (jstring)methodInfo.env->CallStaticObjectMethod(methodInfo.classID, methodInfo.methodID);
|
METHOD_NAME,
|
||||||
}
|
"()Ljava/lang/String;")) {
|
||||||
methodInfo.env->DeleteLocalRef(methodInfo.classID);
|
jstr = (jstring)methodInfo.env->CallStaticObjectMethod(methodInfo.classID,
|
||||||
|
methodInfo.methodID);
|
||||||
|
}
|
||||||
|
|
||||||
const char* deviceModel = methodInfo.env->GetStringUTFChars(jstr, NULL);
|
const char* deviceModel = methodInfo.env->GetStringUTFChars(jstr, NULL);
|
||||||
LOGD("%s", deviceModel);
|
if (NULL == deviceModel) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGD("deviceModel = %s", deviceModel);
|
||||||
|
methodInfo.env->ReleaseStringUTFChars(jstr, deviceModel);
|
||||||
|
methodInfo.env->DeleteLocalRef(jstr);
|
||||||
|
|
||||||
if (strcmp(I9100_MODEL, deviceModel) == 0) {
|
if (strcmp(I9100_MODEL, deviceModel) == 0) {
|
||||||
LOGD("i9100 model\nSwitch to OpenSLES");
|
LOGD("i9100 model\nSwitch to OpenSLES");
|
||||||
buggydevice = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
methodInfo.env->ReleaseStringUTFChars(jstr, deviceModel);
|
|
||||||
methodInfo.env->DeleteLocalRef(jstr);
|
|
||||||
|
|
||||||
return buggydevice;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getFullPathWithoutAssetsPrefix(const char* pszFilename) {
|
std::string getFullPathWithoutAssetsPrefix(const char* pszFilename) {
|
||||||
|
|
Loading…
Reference in New Issue