summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-07-02 13:12:40 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-07-02 13:12:40 -0400
commit9a3c770a3bf430da8878a8691cee9b726a5f026c (patch)
tree51aa40d9d0e9f9b14bd777109f36b172a1554906 /indra
parent082913dd592366cac269d1ccb7804d7dac9a0676 (diff)
Eliminate c_str() calls from LLControlGroup::loadFromFile() calls.
Passing std::string::c_str() to a (const std::string&) function parameter is worse than clutter, it's pointless overhead: it forces the compiler to construct a new std::string instance, instead of passing a const reference to the one you already have in hand.
Diffstat (limited to 'indra')
-rw-r--r--indra/llxml/tests/llcontrol_test.cpp12
-rw-r--r--indra/newview/tests/llluamanager_test.cpp2
2 files changed, 7 insertions, 7 deletions
diff --git a/indra/llxml/tests/llcontrol_test.cpp b/indra/llxml/tests/llcontrol_test.cpp
index f5f8b285f7..595c6a600b 100644
--- a/indra/llxml/tests/llcontrol_test.cpp
+++ b/indra/llxml/tests/llcontrol_test.cpp
@@ -97,7 +97,7 @@ namespace tut
template<> template<>
void control_group_t::test<1>()
{
- int results = mCG->loadFromFile(mTestConfigFile.c_str());
+ int results = mCG->loadFromFile(mTestConfigFile);
ensure("number of settings", (results == 1));
ensure("value of setting", (mCG->getU32("TestSetting") == 12));
}
@@ -106,14 +106,14 @@ namespace tut
template<> template<>
void control_group_t::test<2>()
{
- int results = mCG->loadFromFile(mTestConfigFile.c_str());
+ int results = mCG->loadFromFile(mTestConfigFile);
mCG->setU32("TestSetting", 13);
ensure_equals("value of changed setting", mCG->getU32("TestSetting"), 13);
LLControlGroup test_cg("foo2");
std::string temp_test_file = (mTestConfigDir + "setting_llsd_temp.xml");
mCleanups.push_back(temp_test_file);
mCG->saveToFile(temp_test_file.c_str(), TRUE);
- results = test_cg.loadFromFile(temp_test_file.c_str());
+ results = test_cg.loadFromFile(temp_test_file);
ensure("number of changed settings loaded", (results == 1));
ensure("value of changed settings loaded", (test_cg.getU32("TestSetting") == 13));
}
@@ -126,7 +126,7 @@ namespace tut
// a default settings file that declares variables, rather than a user
// settings file. When loadFromFile() encounters an unrecognized user
// settings variable, it forcibly preserves it (CHOP-962).
- int results = mCG->loadFromFile(mTestConfigFile.c_str(), true);
+ int results = mCG->loadFromFile(mTestConfigFile, true);
LLControlVariable* control = mCG->getControl("TestSetting");
LLSD new_value = 13;
control->setValue(new_value, FALSE);
@@ -135,7 +135,7 @@ namespace tut
std::string temp_test_file = (mTestConfigDir + "setting_llsd_persist_temp.xml");
mCleanups.push_back(temp_test_file);
mCG->saveToFile(temp_test_file.c_str(), TRUE);
- results = test_cg.loadFromFile(temp_test_file.c_str());
+ results = test_cg.loadFromFile(temp_test_file);
//If we haven't changed any settings, then we shouldn't have any settings to load
ensure("number of non-persisted changed settings loaded", (results == 0));
}
@@ -144,7 +144,7 @@ namespace tut
template<> template<>
void control_group_t::test<4>()
{
- int results = mCG->loadFromFile(mTestConfigFile.c_str());
+ int results = mCG->loadFromFile(mTestConfigFile);
ensure("number of settings", (results == 1));
mCG->getControl("TestSetting")->getSignal()->connect(boost::bind(&this->handleListenerTest));
mCG->setU32("TestSetting", 13);
diff --git a/indra/newview/tests/llluamanager_test.cpp b/indra/newview/tests/llluamanager_test.cpp
index 55e87acaea..824ddd445b 100644
--- a/indra/newview/tests/llluamanager_test.cpp
+++ b/indra/newview/tests/llluamanager_test.cpp
@@ -69,7 +69,7 @@ namespace tut
auto settings{ newview / "app_settings" / "settings.xml" };
// true suppresses implicit declare; implicit declare requires
// that every variable in settings.xml has a Comment, which many don't.
- gSavedSettings.loadFromFile(settings.u8string().c_str(), true);
+ gSavedSettings.loadFromFile(settings.u8string(), true);
// At test time, since we don't have the app bundle available,
// extend LuaRequirePath to include the require directory in the
// source tree.