summaryrefslogtreecommitdiff
path: root/indra/llxml/llcontrol.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2026-09-01 18:35:23 +0800
committerErik Kundiman <erik@megapahit.org>2026-09-04 21:58:53 +0800
commit00bb3bb6f07660bd914d29a1389342bb3060d254 (patch)
tree431f574922494d2201718f13085f17bc6bd7fb42 /indra/llxml/llcontrol.cpp
parenta8636720129952c10cf49ab80da21bf8b340b96c (diff)
parent4ef9f8f14b35ed388c294d53767a0dca0e890924 (diff)
Merge remote-tracking branch 'secondlife/release/26.4' into 26.4
Diffstat (limited to 'indra/llxml/llcontrol.cpp')
-rw-r--r--indra/llxml/llcontrol.cpp42
1 files changed, 27 insertions, 15 deletions
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp
index 34643d5f5c..eccf672e46 100644
--- a/indra/llxml/llcontrol.cpp
+++ b/indra/llxml/llcontrol.cpp
@@ -192,20 +192,6 @@ LLSD LLControlVariable::getComparableValue(const LLSD& value)
storable_value = false;
}
}
- else if (TYPE_LLSD == type() && value.isString())
- {
- LLPointer<LLSDNotationParser> parser = new LLSDNotationParser;
- LLSD result;
- std::stringstream value_stream(value.asString());
- if (parser->parse(value_stream, result, LLSDSerialize::SIZE_UNLIMITED) != LLSDParser::PARSE_FAILURE)
- {
- storable_value = result;
- }
- else
- {
- storable_value = value;
- }
- }
else
{
storable_value = value;
@@ -399,10 +385,11 @@ static bool compareRoutine(settings_pair_t lhs, settings_pair_t rhs)
void LLControlGroup::cleanup()
{
+ LL_PROFILE_ZONE_SCOPED;
if(mSettingsProfile && getCount.size() != 0)
{
std::string file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, SETTINGS_PROFILE);
- LLFILE* out = LLFile::fopen(file, "w"); /* Flawfinder: ignore */
+ LLFILE* out = LLFile::fopen(file, LLFILE_MODE("w")); /* Flawfinder: ignore */
if(!out)
{
LL_WARNS("SettingsProfile") << "Error opening " << SETTINGS_PROFILE << LL_ENDL;
@@ -734,6 +721,30 @@ void LLControlGroup::setLLSD(std::string_view name, const LLSD& val)
set(name, val);
}
+bool LLControlVariable::setValueFromNotation(const std::string& notation, bool saved_value)
+{
+ if (mType == TYPE_LLSD)
+ {
+ LLPointer<LLSDNotationParser> parser = new LLSDNotationParser;
+ LLSD result;
+ std::stringstream value_stream(notation);
+ S32 parse_count = parser->parse(value_stream, result, LLSDSerialize::SIZE_UNLIMITED);
+ if (parse_count != LLSDParser::PARSE_FAILURE)
+ {
+ setValue(result, saved_value);
+ return true;
+ }
+ LL_WARNS("Controls") << "Failed to parse LLSD notation for control '"
+ << mName << "': " << notation << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("Controls") << "setValueFromNotation() called on non-LLSD control '"
+ << mName << "' (type " << LLControlGroup::typeEnumToString(mType) << "); ignoring." << LL_ENDL;
+ }
+ return false;
+}
+
void LLControlGroup::setUntypedValue(std::string_view name, const LLSD& val)
{
if (name.empty())
@@ -959,6 +970,7 @@ U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, bool require
U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only)
{
+ LL_PROFILE_ZONE_SCOPED;
LLSD settings;
int num_saved = 0;
for (ctrl_name_table_t::iterator iter = mNameTable.begin();