summaryrefslogtreecommitdiff
path: root/indra/llxml
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-08-18 00:30:13 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-08-18 15:16:12 +0300
commitb33d4053eca36480098f764c7b7ad8f3516641ea (patch)
tree296395fdc11741c4e4b71cee8f126352989dad39 /indra/llxml
parentd4e63aead64cf4910fcee9590af72ba8bc68ceb5 (diff)
#1841 Fix viewer attempting to parse joystick key string into an llsd
Key already is an LLSD::String and needs no further parsing. This parsing was added for command line handling and should be done explicitly in command line's parser. Also extended event listeners, there should be no ambiguity in what kind of data we are passing.
Diffstat (limited to 'indra/llxml')
-rw-r--r--indra/llxml/llcontrol.cpp38
-rw-r--r--indra/llxml/llcontrol.h1
2 files changed, 25 insertions, 14 deletions
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp
index 84d03a6d0c..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;
@@ -735,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())
diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h
index ad283c89b1..7f28c71232 100644
--- a/indra/llxml/llcontrol.h
+++ b/indra/llxml/llcontrol.h
@@ -127,6 +127,7 @@ public:
void setPersist(ePersist);
void setHiddenFromSettingsEditor(bool hide);
void setComment(const std::string& comment);
+ bool setValueFromNotation(const std::string& notation, bool saved_value = true);
private:
void firePropertyChanged(const LLSD &pPreviousValue)