summaryrefslogtreecommitdiff
path: root/indra/llxml
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llxml')
-rw-r--r--indra/llxml/CMakeLists.txt6
-rw-r--r--indra/llxml/llcontrol.cpp42
-rw-r--r--indra/llxml/llcontrol.h3
-rw-r--r--indra/llxml/llxmlnode.cpp2
-rw-r--r--indra/llxml/llxmlparser.cpp4
-rw-r--r--indra/llxml/tests/llcontrol_test.cpp2
6 files changed, 38 insertions, 21 deletions
diff --git a/indra/llxml/CMakeLists.txt b/indra/llxml/CMakeLists.txt
index 03ac4bc9f2..ffb819a29f 100644
--- a/indra/llxml/CMakeLists.txt
+++ b/indra/llxml/CMakeLists.txt
@@ -32,12 +32,16 @@ target_link_libraries( llxml
llmath
llcommon
ll::expat
- ll::SDL
+ ll::SDL3
)
target_include_directories( llxml INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
include(LibraryInstall)
+if (USE_PRECOMPILED_HEADERS)
+ target_precompile_headers(llxml REUSE_FROM llprecompiled)
+endif ()
+
# tests
if (LL_TESTS)
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();
diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h
index 5aa2b9715e..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)
@@ -321,7 +322,7 @@ public:
{
if(!group.controlExists(name))
{
- LL_ERRS() << "Control named " << name << "not found." << LL_ENDL;
+ LL_ERRS() << "Control named " << name << " not found." << LL_ENDL;
}
bindToControl(group, name);
diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp
index 16860ab8b8..77743fe0c2 100644
--- a/indra/llxml/llxmlnode.cpp
+++ b/indra/llxml/llxmlnode.cpp
@@ -29,7 +29,7 @@
#include <iostream>
#include <map>
-#if LL_SDL
+#if LL_SDL_WINDOW
#include <SDL_rwops.h>
#endif
diff --git a/indra/llxml/llxmlparser.cpp b/indra/llxml/llxmlparser.cpp
index e2c7d17e2a..8afd412cda 100644
--- a/indra/llxml/llxmlparser.cpp
+++ b/indra/llxml/llxmlparser.cpp
@@ -72,7 +72,7 @@ bool LLXmlParser::parseFile(const std::string &path)
bool success = true;
- LLFILE* file = LLFile::fopen(path, "rb"); /* Flawfinder: ignore */
+ LLFILE* file = LLFile::fopen(path, LLFILE_MODE("rb")); /* Flawfinder: ignore */
if( !file )
{
mAuxErrorString = llformat( "Couldn't open file %s", path.c_str());
@@ -388,7 +388,7 @@ int main()
{
char buf[1024];
- LLFILE* file = LLFile::fopen("test.xml", "rb");
+ LLFILE* file = LLFile::fopen("test.xml", LLFILE_MODE("rb"));
if( !file )
{
return 1;
diff --git a/indra/llxml/tests/llcontrol_test.cpp b/indra/llxml/tests/llcontrol_test.cpp
index 4192e029c5..e15117fc29 100644
--- a/indra/llxml/tests/llcontrol_test.cpp
+++ b/indra/llxml/tests/llcontrol_test.cpp
@@ -69,7 +69,7 @@ namespace tut
LLFile::remove(filename);
}
LLFile::remove(mTestConfigFile);
- LLFile::rmdir(mTestConfigDir);
+ LLFile::remove(mTestConfigDir);
}
void writeSettingsFile(const LLSD& config)
{