summaryrefslogtreecommitdiff
path: root/indra/llxml/llcontrol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llxml/llcontrol.cpp')
-rw-r--r--indra/llxml/llcontrol.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp
index 6b7f63c192..c0f27e2c22 100644
--- a/indra/llxml/llcontrol.cpp
+++ b/indra/llxml/llcontrol.cpp
@@ -210,7 +210,7 @@ LLSD LLControlVariable::getComparableValue(const LLSD& value)
void LLControlVariable::setValue(const LLSD& new_value, bool saved_value)
{
- if (mValidateSignal(this, new_value) == false)
+ if (!mValidateSignal(this, new_value))
{
// can not set new value, exit
return;
@@ -218,12 +218,12 @@ void LLControlVariable::setValue(const LLSD& new_value, bool saved_value)
LLSD storable_value = getComparableValue(new_value);
LLSD original_value = getValue();
- bool value_changed = llsd_compare(original_value, storable_value) == false;
+ bool value_changed = !llsd_compare(original_value, storable_value);
if(saved_value)
{
// If we're going to save this value, return to default but don't fire
resetToDefault(false);
- if (llsd_compare(mValues.back(), storable_value) == false)
+ if (!llsd_compare(mValues.back(), storable_value))
{
mValues.push_back(storable_value);
}
@@ -233,7 +233,7 @@ void LLControlVariable::setValue(const LLSD& new_value, bool saved_value)
// This is an unsaved value. Its needs to reside at
// mValues[2] (or greater). It must not affect
// the result of getSaveValue()
- if (llsd_compare(mValues.back(), storable_value) == false)
+ if (!llsd_compare(mValues.back(), storable_value))
{
while(mValues.size() > 2)
{
@@ -267,10 +267,10 @@ void LLControlVariable::setDefaultValue(const LLSD& value)
LLSD comparable_value = getComparableValue(value);
LLSD original_value = getValue();
- bool value_changed = (llsd_compare(original_value, comparable_value) == false);
+ bool value_changed = !llsd_compare(original_value, comparable_value);
resetToDefault(false);
mValues[0] = comparable_value;
- if(value_changed)
+ if (value_changed)
{
firePropertyChanged(original_value);
}
@@ -753,13 +753,13 @@ void LLControlGroup::setUntypedValue(std::string_view name, const LLSD& val)
//---------------------------------------------------------------
// Returns number of controls loaded, so 0 if failure
-U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, const std::string& xml, bool require_declaration, eControlType declare_as)
+U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, bool require_declaration, eControlType declare_as)
{
std::string name;
LLXmlTree xml_controls;
- if (!xml_controls.parseString(xml))
+ if (!xml_controls.parseFile(filename))
{
LL_WARNS("Settings") << "Unable to open control file " << filename << LL_ENDL;
return 0;
@@ -772,7 +772,7 @@ U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, const std::s
return 0;
}
- U32 validitems = 0;
+ U32 validitems = 0;
S32 version;
rootp->getAttributeS32("version", version);
@@ -990,24 +990,24 @@ U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only
U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values, bool save_values)
{
LLSD settings;
-
- std::string xml = gDirUtilp->getFileContents(filename);
- if (xml.empty())
+ llifstream infile;
+ infile.open(filename.c_str());
+ if(!infile.is_open())
{
LL_WARNS("Settings") << "Cannot find file " << filename << " to load." << LL_ENDL;
return 0;
}
- std::stringstream stream(xml);
- if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(settings, stream))
+ if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(settings, infile))
{
+ infile.close();
LL_WARNS("Settings") << "Unable to parse LLSD control file " << filename << ". Trying Legacy Method." << LL_ENDL;
- return loadFromFileLegacy(filename, xml, true, TYPE_STRING);
+ return loadFromFileLegacy(filename, true, TYPE_STRING);
}
U32 validitems = 0;
bool hidefromsettingseditor = false;
-
+
for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr)
{
LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT;
@@ -1019,7 +1019,7 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v
persist = control_map["Persist"].asInteger()?
LLControlVariable::PERSIST_NONDFT : LLControlVariable::PERSIST_NO;
}
-
+
// Sometimes we want to use the settings system to provide cheap persistence, but we
// don't want the settings themselves to be easily manipulated in the UI because
// doing so can cause support problems. So we have this option:
@@ -1031,7 +1031,7 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v
{
hidefromsettingseditor = false;
}
-
+
// If the control exists just set the value from the input file.
LLControlVariable* existing_control = getControl(name);
if(existing_control)