and fix a ton more minor performance issues

This commit is contained in:
DarthArgus
2014-10-27 22:39:57 -07:00
parent 14eaf713d0
commit c9c39d5713
97 changed files with 266 additions and 376 deletions
@@ -821,8 +821,7 @@ void getStringArray(const LocalObjectArrayRefParam & array, std::vector<const Un
std::vector<const Unicode::String *>::iterator stringsIter = strings.begin();
for (jsize i = 0; i < count; ++i, ++stringsIter)
{
if (*stringsIter != 0)
delete *stringsIter;
delete *stringsIter;
stringElement = static_cast<jstring>(env->GetObjectArrayElement(arrayRef, i));
if (stringElement != 0)
@@ -1265,7 +1265,7 @@ void JavaLibrary::initializeJavaThread()
const char * jdwpString = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n";
jdwpBuffer = new char[strlen(jdwpString) + 32];
strcpy(jdwpBuffer, jdwpString);
if (strlen(ConfigServerGame::getJavaDebugPort()) > 0)
if (ConfigServerGame::getJavaDebugPort()[0] == '\0')
{
strcat(jdwpBuffer, ",address=");
strcat(jdwpBuffer, ConfigServerGame::getJavaDebugPort());
@@ -5945,7 +5945,7 @@ const bool convert(const jobject & source, Vector & targetLoc, std::string & tar
JavaStringPtr sceneId = getStringField(LocalRefParam(source), JavaLibrary::ms_fidLocationArea);
if (sceneId == JavaString::cms_nullPtr)
{
targetSceneId = "";
targetSceneId.clear();
return false;
}
JavaLibrary::convert(*sceneId, targetSceneId);
@@ -5989,7 +5989,7 @@ const bool convertWorld(const jobject & source, Vector & targetLoc, std::string
JavaStringPtr sceneId = getStringField(LocalRefParam(source), JavaLibrary::ms_fidLocationArea);
if (sceneId == JavaString::cms_nullPtr)
{
targetSceneId = "";
targetSceneId.clear();
return false;
}
JavaLibrary::convert(*sceneId, targetSceneId);
@@ -467,8 +467,7 @@ void Scripting::InitScriptFuncHashMap(void)
*/
void Scripting::RemoveScriptFuncHashMap(void)
{
if (Scripting::ScriptFuncHashMap)
delete Scripting::ScriptFuncHashMap;
delete Scripting::ScriptFuncHashMap;
Scripting::ScriptFuncHashMap = NULL;
}
@@ -221,7 +221,7 @@ jboolean JNICALL ScriptMethodsBeastMasterNamespace::setBeastMasterPetCommands(JN
if (item != JavaString::cms_nullPtr)
JavaLibrary::convert(*item, commands[i]);
else
commands[i] = "";
commands[i].clear();
}
po->setPetCommandList(commands);
return JNI_TRUE;
@@ -261,7 +261,7 @@ jboolean JNICALL ScriptMethodsBeastMasterNamespace::setBeastMasterToggledPetComm
if (item != JavaString::cms_nullPtr)
JavaLibrary::convert(*item, commands[i]);
else
commands[i] = "";
commands[i]clear();
}
po->setPetToggledCommands(commands);
return JNI_TRUE;
@@ -109,7 +109,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv *
//get the event
std::string event;
JavaLibrary::convert(localEventType, event);
if (event == "")
if (event.empty())
return JNI_FALSE;
//get the hardpoint
@@ -167,7 +167,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObjLimited(J
//get the event
std::string event;
JavaLibrary::convert(localEventType, event);
if (event == "")
if (event.empty())
return JNI_FALSE;
//get the hardpoint
@@ -219,11 +219,11 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventLoc(JNIEnv *
//get the events
std::string eventSource;
JavaLibrary::convert(localEventSourceType, eventSource);
if(eventSource == "")
if(eventSource.empty())
return JNI_FALSE;
std::string eventDest;
JavaLibrary::convert(localEventDestType, eventDest);
if(eventDest == "")
if(eventDest.empty())
return JNI_FALSE;
//get the location
@@ -254,11 +254,11 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventLocLimited(J
//get the events
std::string eventSource;
JavaLibrary::convert(localEventSourceType, eventSource);
if(eventSource == "")
if(eventSource.empty())
return JNI_FALSE;
std::string eventDest;
JavaLibrary::convert(localEventDestType, eventDest);
if(eventDest == "")
if(eventDest.empty())
return JNI_FALSE;
//get the location
@@ -302,7 +302,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv
//get the effect
std::string effect;
JavaLibrary::convert(localEffectName, effect);
if(effect == "")
if(effect.empty())
return JNI_FALSE;
//get the hardpoint
@@ -369,7 +369,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObjLimited(
//get the effect
std::string effect;
JavaLibrary::convert(localEffectName, effect);
if(effect == "")
if(effect.empty())
return JNI_FALSE;
//get the hardpoint
@@ -432,7 +432,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLoc(JNIEnv
//get the effect
std::string effect;
JavaLibrary::convert(localEffectName, effect);
if(effect == "")
if(effect.empty())
return JNI_FALSE;
//get the location
@@ -470,7 +470,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLocLimited(
//get the effect
std::string effect;
JavaLibrary::convert(localEffectName, effect);
if(effect == "")
if(effect.empty())
return JNI_FALSE;
//get the location
@@ -554,7 +554,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabel(
//get the effect
std::string strLabelName;
JavaLibrary::convert(localLabel, strLabelName);
if(strLabelName == "")
if(strLabelName.empty())
return JNI_FALSE;
const NetworkId nid(objectEffectIsOn);
@@ -587,7 +587,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabelL
//get the effect
std::string strLabelName;
JavaLibrary::convert(localLabel, strLabelName);
if(strLabelName == "")
if(strLabelName.empty())
return JNI_FALSE;
const NetworkId nid(objectEffectIsOn);
@@ -613,7 +613,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::play2dNonLoopingMusic(JNIEn
std::string music;
JavaLibrary::convert(localMusicName, music);
if (music == "")
if (music.empty())
return JNI_FALSE;
PlayMusicMessage const msg(music, NetworkId::cms_invalid, 0, false);
@@ -637,7 +637,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::play2dNonLoopingSound(JNIEn
std::string music;
JavaLibrary::convert(localMusicName, music);
if (music == "")
if (music.empty())
return JNI_FALSE;
PlayMusicMessage const msg(music, NetworkId::cms_invalid, 1, false);
@@ -661,7 +661,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playMusicWithParms(JNIEnv *
std::string music;
JavaLibrary::convert(localMusicName, music);
if (music == "")
if (music.empty())
return JNI_FALSE;
PlayMusicMessage const msg(music, NetworkId(source), playType, loop);
@@ -688,7 +688,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectile(JNIE
// get the weapon object template name string
std::string weaponObjectTemplateNameString;
JavaLibrary::convert(localWeaponObjectTemplateName, weaponObjectTemplateNameString);
if (weaponObjectTemplateNameString == "")
if (weaponObjectTemplateNameString.empty())
return JNI_FALSE;
// get the start location
@@ -730,7 +730,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObjec
// get the weapon object template name string
std::string weaponObjectTemplateNameString;
JavaLibrary::convert(localWeaponObjectTemplateName, weaponObjectTemplateNameString);
if (weaponObjectTemplateNameString == "")
if (weaponObjectTemplateNameString.empty())
return JNI_FALSE;
// Get our source object
@@ -788,7 +788,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObje
// get the weapon object template name string
std::string weaponObjectTemplateNameString;
JavaLibrary::convert(localWeaponObjectTemplateName, weaponObjectTemplateNameString);
if (weaponObjectTemplateNameString == "")
if (weaponObjectTemplateNameString.empty())
return JNI_FALSE;
// Get our source object
@@ -841,7 +841,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat
// get the weapon object template name string
std::string weaponObjectTemplateNameString;
JavaLibrary::convert(localWeaponObjectTemplateName, weaponObjectTemplateNameString);
if (weaponObjectTemplateNameString == "")
if (weaponObjectTemplateNameString.empty())
return JNI_FALSE;
// Get our target object