summaryrefslogtreecommitdiff
path: root/indra/llxml
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-06-26 00:39:00 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-06-26 00:39:00 +0000
commit25c10ed028da5c547b11f1f461916897272b0e6d (patch)
tree350a5858f8970b6e28b2dc395625d74d8bd597b2 /indra/llxml
parent6dd125d375b38455997a0c4b8747659f4c2351aa (diff)
QAR-628 merge string-cleanup-5 -r 90476:90508 -> release
dataserver-is-deprecated
Diffstat (limited to 'indra/llxml')
-rw-r--r--indra/llxml/llcontrol.cpp156
-rw-r--r--indra/llxml/llcontrol.h126
-rw-r--r--indra/llxml/llxmlnode.cpp228
-rw-r--r--indra/llxml/llxmlnode.h92
-rw-r--r--indra/llxml/llxmlparser.cpp14
-rw-r--r--indra/llxml/llxmlparser.h2
-rw-r--r--indra/llxml/llxmltree.cpp94
-rw-r--r--indra/llxml/llxmltree.h20
8 files changed, 363 insertions, 369 deletions
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp
index cb0c4f001a..c5d86f161a 100644
--- a/indra/llxml/llcontrol.cpp
+++ b/indra/llxml/llcontrol.cpp
@@ -99,8 +99,8 @@ bool LLControlVariable::llsd_compare(const LLSD& a, const LLSD & b)
return result;
}
-LLControlVariable::LLControlVariable(const LLString& name, eControlType type,
- LLSD initial, const LLString& comment,
+LLControlVariable::LLControlVariable(const std::string& name, eControlType type,
+ LLSD initial, const std::string& comment,
BOOL persist)
: mName(name),
mComment(comment),
@@ -129,7 +129,7 @@ void LLControlVariable::setValue(const LLSD& value, bool saved_value)
if(TYPE_BOOLEAN == type() && value.isString())
{
BOOL temp;
- if(LLString::convertToBOOL(value.asString(), temp))
+ if(LLStringUtil::convertToBOOL(value.asString(), temp))
{
storable_value = temp;
}
@@ -206,7 +206,7 @@ LLSD LLControlVariable::getSaveValue() const
return mValues[0];
}
-LLControlVariable* LLControlGroup::getControl(const LLString& name)
+LLControlVariable* LLControlGroup::getControl(const std::string& name)
{
ctrl_name_table_t::iterator iter = mNameTable.find(name);
return iter == mNameTable.end() ? NULL : iter->second;
@@ -242,7 +242,7 @@ void LLControlGroup::cleanup()
mNameTable.clear();
}
-eControlType LLControlGroup::typeStringToEnum(const LLString& typestr)
+eControlType LLControlGroup::typeStringToEnum(const std::string& typestr)
{
for(int i = 0; i < (int)TYPE_COUNT; ++i)
{
@@ -251,12 +251,12 @@ eControlType LLControlGroup::typeStringToEnum(const LLString& typestr)
return (eControlType)-1;
}
-LLString LLControlGroup::typeEnumToString(eControlType typeenum)
+std::string LLControlGroup::typeEnumToString(eControlType typeenum)
{
return mTypeString[typeenum];
}
-BOOL LLControlGroup::declareControl(const LLString& name, eControlType type, const LLSD initial_val, const LLString& comment, BOOL persist)
+BOOL LLControlGroup::declareControl(const std::string& name, eControlType type, const LLSD initial_val, const std::string& comment, BOOL persist)
{
if(mNameTable.find(name) != mNameTable.end())
{
@@ -270,67 +270,67 @@ BOOL LLControlGroup::declareControl(const LLString& name, eControlType type, con
return TRUE;
}
-BOOL LLControlGroup::declareU32(const LLString& name, const U32 initial_val, const LLString& comment, BOOL persist)
+BOOL LLControlGroup::declareU32(const std::string& name, const U32 initial_val, const std::string& comment, BOOL persist)
{
return declareControl(name, TYPE_U32, (LLSD::Integer) initial_val, comment, persist);
}
-BOOL LLControlGroup::declareS32(const LLString& name, const S32 initial_val, const LLString& comment, BOOL persist)
+BOOL LLControlGroup::declareS32(const std::string& name, const S32 initial_val, const std::string& comment, BOOL persist)
{
return declareControl(name, TYPE_S32, initial_val, comment, persist);
}
-BOOL LLControlGroup::declareF32(const LLString& name, const F32 initial_val, const LLString& comment, BOOL persist)
+BOOL LLControlGroup::declareF32(const std::string& name, const F32 initial_val, const std::string& comment, BOOL persist)
{
return declareControl(name, TYPE_F32, initial_val, comment, persist);
}
-BOOL LLControlGroup::declareBOOL(const LLString& name, const BOOL initial_val, const LLString& comment, BOOL persist)
+BOOL LLControlGroup::declareBOOL(const std::string& name, const BOOL initial_val, const std::string& comment, BOOL persist)
{
return declareControl(name, TYPE_BOOLEAN, initial_val, comment, persist);
}
-BOOL LLControlGroup::declareString(const LLString& name, const LLString& initial_val, const LLString& comment, BOOL persist)
+BOOL LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, BOOL persist)
{
return declareControl(name, TYPE_STRING, initial_val, comment, persist);
}
-BOOL LLControlGroup::declareVec3(const LLString& name, const LLVector3 &initial_val, const LLString& comment, BOOL persist)
+BOOL LLControlGroup::declareVec3(const std::string& name, const LLVector3 &initial_val, const std::string& comment, BOOL persist)
{
return declareControl(name, TYPE_VEC3, initial_val.getValue(), comment, persist);
}
-BOOL LLControlGroup::declareVec3d(const LLString& name, const LLVector3d &initial_val, const LLString& comment, BOOL persist)
+BOOL LLControlGroup::declareVec3d(const std::string& name, const LLVector3d &initial_val, const std::string& comment, BOOL persist)
{
return declareControl(name, TYPE_VEC3D, initial_val.getValue(), comment, persist);
}
-BOOL LLControlGroup::declareRect(const LLString& name, const LLRect &initial_val, const LLString& comment, BOOL persist)
+BOOL LLControlGroup::declareRect(const std::string& name, const LLRect &initial_val, const std::string& comment, BOOL persist)
{
return declareControl(name, TYPE_RECT, initial_val.getValue(), comment, persist);
}
-BOOL LLControlGroup::declareColor4U(const LLString& name, const LLColor4U &initial_val, const LLString& comment, BOOL persist )
+BOOL LLControlGroup::declareColor4U(const std::string& name, const LLColor4U &initial_val, const std::string& comment, BOOL persist )
{
return declareControl(name, TYPE_COL4U, initial_val.getValue(), comment, persist);
}
-BOOL LLControlGroup::declareColor4(const LLString& name, const LLColor4 &initial_val, const LLString& comment, BOOL persist )
+BOOL LLControlGroup::declareColor4(const std::string& name, const LLColor4 &initial_val, const std::string& comment, BOOL persist )
{
return declareControl(name, TYPE_COL4, initial_val.getValue(), comment, persist);
}
-BOOL LLControlGroup::declareColor3(const LLString& name, const LLColor3 &initial_val, const LLString& comment, BOOL persist )
+BOOL LLControlGroup::declareColor3(const std::string& name, const LLColor3 &initial_val, const std::string& comment, BOOL persist )
{
return declareControl(name, TYPE_COL3, initial_val.getValue(), comment, persist);
}
-BOOL LLControlGroup::declareLLSD(const LLString& name, const LLSD &initial_val, const LLString& comment, BOOL persist )
+BOOL LLControlGroup::declareLLSD(const std::string& name, const LLSD &initial_val, const std::string& comment, BOOL persist )
{
return declareControl(name, TYPE_LLSD, initial_val, comment, persist);
}
-BOOL LLControlGroup::getBOOL(const LLString& name)
+BOOL LLControlGroup::getBOOL(const std::string& name)
{
LLControlVariable* control = getControl(name);
@@ -343,7 +343,7 @@ BOOL LLControlGroup::getBOOL(const LLString& name)
}
}
-S32 LLControlGroup::getS32(const LLString& name)
+S32 LLControlGroup::getS32(const std::string& name)
{
LLControlVariable* control = getControl(name);
@@ -356,7 +356,7 @@ S32 LLControlGroup::getS32(const LLString& name)
}
}
-U32 LLControlGroup::getU32(const LLString& name)
+U32 LLControlGroup::getU32(const std::string& name)
{
LLControlVariable* control = getControl(name);
@@ -369,7 +369,7 @@ U32 LLControlGroup::getU32(const LLString& name)
}
}
-F32 LLControlGroup::getF32(const LLString& name)
+F32 LLControlGroup::getF32(const std::string& name)
{
LLControlVariable* control = getControl(name);
@@ -382,16 +382,16 @@ F32 LLControlGroup::getF32(const LLString& name)
}
}
-LLString LLControlGroup::findString(const LLString& name)
+std::string LLControlGroup::findString(const std::string& name)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_STRING))
return control->get().asString();
- return LLString::null;
+ return LLStringUtil::null;
}
-LLString LLControlGroup::getString(const LLString& name)
+std::string LLControlGroup::getString(const std::string& name)
{
LLControlVariable* control = getControl(name);
@@ -400,24 +400,24 @@ LLString LLControlGroup::getString(const LLString& name)
else
{
CONTROL_ERRS << "Invalid string control " << name << llendl;
- return LLString::null;
+ return LLStringUtil::null;
}
}
-LLWString LLControlGroup::getWString(const LLString& name)
+LLWString LLControlGroup::getWString(const std::string& name)
{
return utf8str_to_wstring(getString(name));
}
-LLString LLControlGroup::getText(const LLString& name)
+std::string LLControlGroup::getText(const std::string& name)
{
- LLString utf8_string = getString(name);
- LLString::replaceChar(utf8_string, '^', '\n');
- LLString::replaceChar(utf8_string, '%', ' ');
+ std::string utf8_string = getString(name);
+ LLStringUtil::replaceChar(utf8_string, '^', '\n');
+ LLStringUtil::replaceChar(utf8_string, '%', ' ');
return (utf8_string);
}
-LLVector3 LLControlGroup::getVector3(const LLString& name)
+LLVector3 LLControlGroup::getVector3(const std::string& name)
{
LLControlVariable* control = getControl(name);
@@ -430,7 +430,7 @@ LLVector3 LLControlGroup::getVector3(const LLString& name)
}
}
-LLVector3d LLControlGroup::getVector3d(const LLString& name)
+LLVector3d LLControlGroup::getVector3d(const std::string& name)
{
LLControlVariable* control = getControl(name);
@@ -443,7 +443,7 @@ LLVector3d LLControlGroup::getVector3d(const LLString& name)
}
}
-LLRect LLControlGroup::getRect(const LLString& name)
+LLRect LLControlGroup::getRect(const std::string& name)
{
LLControlVariable* control = getControl(name);
@@ -457,7 +457,7 @@ LLRect LLControlGroup::getRect(const LLString& name)
}
-LLColor4 LLControlGroup::getColor(const LLString& name)
+LLColor4 LLControlGroup::getColor(const std::string& name)
{
ctrl_name_table_t::const_iterator i = mNameTable.find(name);
@@ -489,7 +489,7 @@ LLColor4 LLControlGroup::getColor(const LLString& name)
}
}
-LLColor4U LLControlGroup::getColor4U(const LLString& name)
+LLColor4U LLControlGroup::getColor4U(const std::string& name)
{
LLControlVariable* control = getControl(name);
@@ -502,7 +502,7 @@ LLColor4U LLControlGroup::getColor4U(const LLString& name)
}
}
-LLColor4 LLControlGroup::getColor4(const LLString& name)
+LLColor4 LLControlGroup::getColor4(const std::string& name)
{
LLControlVariable* control = getControl(name);
@@ -515,7 +515,7 @@ LLColor4 LLControlGroup::getColor4(const LLString& name)
}
}
-LLColor3 LLControlGroup::getColor3(const LLString& name)
+LLColor3 LLControlGroup::getColor3(const std::string& name)
{
LLControlVariable* control = getControl(name);
@@ -528,7 +528,7 @@ LLColor3 LLControlGroup::getColor3(const LLString& name)
}
}
-LLSD LLControlGroup::getLLSD(const LLString& name)
+LLSD LLControlGroup::getLLSD(const std::string& name)
{
LLControlVariable* control = getControl(name);
@@ -538,7 +538,7 @@ LLSD LLControlGroup::getLLSD(const LLString& name)
return LLSD();
}
-BOOL LLControlGroup::controlExists(const LLString& name)
+BOOL LLControlGroup::controlExists(const std::string& name)
{
ctrl_name_table_t::iterator iter = mNameTable.find(name);
return iter != mNameTable.end();
@@ -548,7 +548,7 @@ BOOL LLControlGroup::controlExists(const LLString& name)
// Set functions
//-------------------------------------------------------------------
-void LLControlGroup::setBOOL(const LLString& name, BOOL val)
+void LLControlGroup::setBOOL(const std::string& name, BOOL val)
{
LLControlVariable* control = getControl(name);
@@ -563,7 +563,7 @@ void LLControlGroup::setBOOL(const LLString& name, BOOL val)
}
-void LLControlGroup::setS32(const LLString& name, S32 val)
+void LLControlGroup::setS32(const std::string& name, S32 val)
{
LLControlVariable* control = getControl(name);
@@ -578,7 +578,7 @@ void LLControlGroup::setS32(const LLString& name, S32 val)
}
-void LLControlGroup::setF32(const LLString& name, F32 val)
+void LLControlGroup::setF32(const std::string& name, F32 val)
{
LLControlVariable* control = getControl(name);
@@ -593,7 +593,7 @@ void LLControlGroup::setF32(const LLString& name, F32 val)
}
-void LLControlGroup::setU32(const LLString& name, U32 val)
+void LLControlGroup::setU32(const std::string& name, U32 val)
{
LLControlVariable* control = getControl(name);
@@ -608,7 +608,7 @@ void LLControlGroup::setU32(const LLString& name, U32 val)
}
-void LLControlGroup::setString(const LLString& name, const LLString &val)
+void LLControlGroup::setString(const std::string& name, const std::string &val)
{
LLControlVariable* control = getControl(name);
@@ -623,7 +623,7 @@ void LLControlGroup::setString(const LLString& name, const LLString &val)
}
-void LLControlGroup::setVector3(const LLString& name, const LLVector3 &val)
+void LLControlGroup::setVector3(const std::string& name, const LLVector3 &val)
{
LLControlVariable* control = getControl(name);
@@ -637,7 +637,7 @@ void LLControlGroup::setVector3(const LLString& name, const LLVector3 &val)
}
}
-void LLControlGroup::setVector3d(const LLString& name, const LLVector3d &val)
+void LLControlGroup::setVector3d(const std::string& name, const LLVector3d &val)
{
LLControlVariable* control = getControl(name);
@@ -651,7 +651,7 @@ void LLControlGroup::setVector3d(const LLString& name, const LLVector3d &val)
}
}
-void LLControlGroup::setRect(const LLString& name, const LLRect &val)
+void LLControlGroup::setRect(const std::string& name, const LLRect &val)
{
LLControlVariable* control = getControl(name);
@@ -665,7 +665,7 @@ void LLControlGroup::setRect(const LLString& name, const LLRect &val)
}
}
-void LLControlGroup::setColor4U(const LLString& name, const LLColor4U &val)
+void LLControlGroup::setColor4U(const std::string& name, const LLColor4U &val)
{
LLControlVariable* control = getControl(name);
@@ -679,7 +679,7 @@ void LLControlGroup::setColor4U(const LLString& name, const LLColor4U &val)
}
}
-void LLControlGroup::setColor4(const LLString& name, const LLColor4 &val)
+void LLControlGroup::setColor4(const std::string& name, const LLColor4 &val)
{
LLControlVariable* control = getControl(name);
@@ -693,7 +693,7 @@ void LLControlGroup::setColor4(const LLString& name, const LLColor4 &val)
}
}
-void LLControlGroup::setLLSD(const LLString& name, const LLSD& val)
+void LLControlGroup::setLLSD(const std::string& name, const LLSD& val)
{
LLControlVariable* control = getControl(name);
@@ -707,7 +707,7 @@ void LLControlGroup::setLLSD(const LLString& name, const LLSD& val)
}
}
-void LLControlGroup::setValue(const LLString& name, const LLSD& val)
+void LLControlGroup::setValue(const std::string& name, const LLSD& val)
{
if (name.empty())
{
@@ -731,9 +731,9 @@ void LLControlGroup::setValue(const LLString& name, const LLSD& val)
//---------------------------------------------------------------
// Returns number of controls loaded, so 0 if failure
-U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_declaration, eControlType declare_as)
+U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, BOOL require_declaration, eControlType declare_as)
{
- LLString name;
+ std::string name;
LLXmlTree xml_controls;
@@ -792,14 +792,14 @@ U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_de
switch(declare_as)
{
case TYPE_COL4:
- declareColor4(name, LLColor4::white, "", NO_PERSIST);
+ declareColor4(name, LLColor4::white, LLStringUtil::null, NO_PERSIST);
break;
case TYPE_COL4U:
- declareColor4U(name, LLColor4U::white, "", NO_PERSIST);
+ declareColor4U(name, LLColor4U::white, LLStringUtil::null, NO_PERSIST);
break;
case TYPE_STRING:
default:
- declareString(name, LLString::null, "", NO_PERSIST);
+ declareString(name, LLStringUtil::null, LLStringUtil::null, NO_PERSIST);
break;
}
}
@@ -851,12 +851,8 @@ U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_de
break;
case TYPE_STRING:
{
- LLString string;
+ std::string string;
child_nodep->getAttributeString("value", string);
- if (string == LLString::null)
- {
- string = "";
- }
control->set(string);
validitems++;
}
@@ -883,7 +879,7 @@ U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_de
case TYPE_RECT:
{
//RN: hack to support reading rectangles from a string
- LLString rect_string;
+ std::string rect_string;
child_nodep->getAttributeString("value", rect_string);
std::istringstream istream(rect_string);
@@ -937,7 +933,7 @@ U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_de
return validitems;
}
-U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only)
+U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only)
{
LLSD settings;
int num_saved = 0;
@@ -967,7 +963,7 @@ U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only)
}
}
llofstream file;
- file.open(filename.c_str());
+ file.open(filename);
if (file.is_open())
{
LLSDSerialize::toPrettyXML(settings, file);
@@ -983,13 +979,13 @@ U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only)
return num_saved;
}
-U32 LLControlGroup::loadFromFile(const LLString& filename)
+U32 LLControlGroup::loadFromFile(const std::string& filename)
{
- LLString name;
+ std::string name;
LLSD settings;
LLSD control_map;
llifstream infile;
- infile.open(filename.c_str());
+ infile.open(filename);
if(!infile.is_open())
{
llwarns << "Cannot find file " << filename << " to load." << llendl;
@@ -1067,10 +1063,10 @@ void LLControlGroup::applyToAll(ApplyFunctor* func)
//============================================================================
// First-use
-static LLString get_warn_name(const LLString& name)
+static std::string get_warn_name(const std::string& name)
{
- LLString warnname = "Warn" + name;
- for (LLString::iterator iter = warnname.begin(); iter != warnname.end(); ++iter)
+ std::string warnname = "Warn" + name;
+ for (std::string::iterator iter = warnname.begin(); iter != warnname.end(); ++iter)
{
char c = *iter;
if (!isalnum(c))
@@ -1081,32 +1077,32 @@ static LLString get_warn_name(const LLString& name)
return warnname;
}
-void LLControlGroup::addWarning(const LLString& name)
+void LLControlGroup::addWarning(const std::string& name)
{
- LLString warnname = get_warn_name(name);
+ std::string warnname = get_warn_name(name);
if(mNameTable.find(warnname) == mNameTable.end())
{
- LLString comment = LLString("Enables ") + name + LLString(" warning dialog");
+ std::string comment = std::string("Enables ") + name + std::string(" warning dialog");
declareBOOL(warnname, TRUE, comment);
mWarnings.insert(warnname);
}
}
-BOOL LLControlGroup::getWarning(const LLString& name)
+BOOL LLControlGroup::getWarning(const std::string& name)
{
- LLString warnname = get_warn_name(name);
+ std::string warnname = get_warn_name(name);
return getBOOL(warnname);
}
-void LLControlGroup::setWarning(const LLString& name, BOOL val)
+void LLControlGroup::setWarning(const std::string& name, BOOL val)
{
- LLString warnname = get_warn_name(name);
+ std::string warnname = get_warn_name(name);
setBOOL(warnname, val);
}
void LLControlGroup::resetWarnings()
{
- for (std::set<LLString>::iterator iter = mWarnings.begin();
+ for (std::set<std::string>::iterator iter = mWarnings.begin();
iter != mWarnings.end(); ++iter)
{
setBOOL(*iter, TRUE);
diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h
index fdbbe11b91..289e85b8a4 100644
--- a/indra/llxml/llcontrol.h
+++ b/indra/llxml/llcontrol.h
@@ -89,8 +89,8 @@ class LLControlVariable
typedef boost::signal<void(const LLSD&)> signal_t;
private:
- LLString mName;
- LLString mComment;
+ std::string mName;
+ std::string mComment;
eControlType mType;
BOOL mPersist;
std::vector<LLSD> mValues;
@@ -98,14 +98,14 @@ private:
signal_t mSignal;
public:
- LLControlVariable(const LLString& name, eControlType type,
- LLSD initial, const LLString& comment,
+ LLControlVariable(const std::string& name, eControlType type,
+ LLSD initial, const std::string& comment,
BOOL persist = TRUE);
virtual ~LLControlVariable();
- const LLString& getName() const { return mName; }
- const LLString& getComment() const { return mComment; }
+ const std::string& getName() const { return mName; }
+ const std::string& getComment() const { return mComment; }
eControlType type() { return mType; }
BOOL isType(eControlType tp) { return tp == mType; }
@@ -134,95 +134,95 @@ public:
class LLControlGroup
{
protected:
- typedef std::map<LLString, LLControlVariable* > ctrl_name_table_t;
+ typedef std::map<std::string, LLControlVariable* > ctrl_name_table_t;
ctrl_name_table_t mNameTable;
- std::set<LLString> mWarnings;
- LLString mTypeString[TYPE_COUNT];
+ std::set<std::string> mWarnings;
+ std::string mTypeString[TYPE_COUNT];
- eControlType typeStringToEnum(const LLString& typestr);
- LLString typeEnumToString(eControlType typeenum);
+ eControlType typeStringToEnum(const std::string& typestr);
+ std::string typeEnumToString(eControlType typeenum);
public:
LLControlGroup();
~LLControlGroup();
void cleanup();
- LLControlVariable* getControl(const LLString& name);
+ LLControlVariable* getControl(const std::string& name);
struct ApplyFunctor
{
virtual ~ApplyFunctor() {};
- virtual void apply(const LLString& name, LLControlVariable* control) = 0;
+ virtual void apply(const std::string& name, LLControlVariable* control) = 0;
};
void applyToAll(ApplyFunctor* func);
- BOOL declareControl(const LLString& name, eControlType type, const LLSD initial_val, const LLString& comment, BOOL persist);
- BOOL declareU32(const LLString& name, U32 initial_val, const LLString& comment, BOOL persist = TRUE);
- BOOL declareS32(const LLString& name, S32 initial_val, const LLString& comment, BOOL persist = TRUE);
- BOOL declareF32(const LLString& name, F32 initial_val, const LLString& comment, BOOL persist = TRUE);
- BOOL declareBOOL(const LLString& name, BOOL initial_val, const LLString& comment, BOOL persist = TRUE);
- BOOL declareString(const LLString& name, const LLString &initial_val, const LLString& comment, BOOL persist = TRUE);
- BOOL declareVec3(const LLString& name, const LLVector3 &initial_val,const LLString& comment, BOOL persist = TRUE);
- BOOL declareVec3d(const LLString& name, const LLVector3d &initial_val, const LLString& comment, BOOL persist = TRUE);
- BOOL declareRect(const LLString& name, const LLRect &initial_val, const LLString& comment, BOOL persist = TRUE);
- BOOL declareColor4U(const LLString& name, const LLColor4U &initial_val, const LLString& comment, BOOL persist = TRUE);
- BOOL declareColor4(const LLString& name, const LLColor4 &initial_val, const LLString& comment, BOOL persist = TRUE);
- BOOL declareColor3(const LLString& name, const LLColor3 &initial_val, const LLString& comment, BOOL persist = TRUE);
- BOOL declareLLSD(const LLString& name, const LLSD &initial_val, const LLString& comment, BOOL persist = TRUE);
+ BOOL declareControl(const std::string& name, eControlType type, const LLSD initial_val, const std::string& comment, BOOL persist);
+ BOOL declareU32(const std::string& name, U32 initial_val, const std::string& comment, BOOL persist = TRUE);
+ BOOL declareS32(const std::string& name, S32 initial_val, const std::string& comment, BOOL persist = TRUE);
+ BOOL declareF32(const std::string& name, F32 initial_val, const std::string& comment, BOOL persist = TRUE);
+ BOOL declareBOOL(const std::string& name, BOOL initial_val, const std::string& comment, BOOL persist = TRUE);
+ BOOL declareString(const std::string& name, const std::string &initial_val, const std::string& comment, BOOL persist = TRUE);
+ BOOL declareVec3(const std::string& name, const LLVector3 &initial_val,const std::string& comment, BOOL persist = TRUE);
+ BOOL declareVec3d(const std::string& name, const LLVector3d &initial_val, const std::string& comment, BOOL persist = TRUE);
+ BOOL declareRect(const std::string& name, const LLRect &initial_val, const std::string& comment, BOOL persist = TRUE);
+ BOOL declareColor4U(const std::string& name, const LLColor4U &initial_val, const std::string& comment, BOOL persist = TRUE);
+ BOOL declareColor4(const std::string& name, const LLColor4 &initial_val, const std::string& comment, BOOL persist = TRUE);
+ BOOL declareColor3(const std::string& name, const LLColor3 &initial_val, const std::string& comment, BOOL persist = TRUE);
+ BOOL declareLLSD(const std::string& name, const LLSD &initial_val, const std::string& comment, BOOL persist = TRUE);
- LLString findString(const LLString& name);
+ std::string findString(const std::string& name);
- LLString getString(const LLString& name);
- LLWString getWString(const LLString& name);
- LLString getText(const LLString& name);
- LLVector3 getVector3(const LLString& name);
- LLVector3d getVector3d(const LLString& name);
- LLRect getRect(const LLString& name);
- BOOL getBOOL(const LLString& name);
- S32 getS32(const LLString& name);
- F32 getF32(const LLString& name);
- U32 getU32(const LLString& name);
- LLSD getLLSD(const LLString& name);
+ std::string getString(const std::string& name);
+ LLWString getWString(const std::string& name);
+ std::string getText(const std::string& name);
+ LLVector3 getVector3(const std::string& name);
+ LLVector3d getVector3d(const std::string& name);
+ LLRect getRect(const std::string& name);
+ BOOL getBOOL(const std::string& name);
+ S32 getS32(const std::string& name);
+ F32 getF32(const std::string& name);
+ U32 getU32(const std::string& name);
+ LLSD getLLSD(const std::string& name);
// Note: If an LLColor4U control exists, it will cast it to the correct
// LLColor4 for you.
- LLColor4 getColor(const LLString& name);
- LLColor4U getColor4U(const LLString& name);
- LLColor4 getColor4(const LLString& name);
- LLColor3 getColor3(const LLString& name);
-
- void setBOOL(const LLString& name, BOOL val);
- void setS32(const LLString& name, S32 val);
- void setF32(const LLString& name, F32 val);
- void setU32(const LLString& name, U32 val);
- void setString(const LLString& name, const LLString& val);
- void setVector3(const LLString& name, const LLVector3 &val);
- void setVector3d(const LLString& name, const LLVector3d &val);
- void setRect(const LLString& name, const LLRect &val);
- void setColor4U(const LLString& name, const LLColor4U &val);
- void setColor4(const LLString& name, const LLColor4 &val);
- void setColor3(const LLString& name, const LLColor3 &val);
- void setLLSD(const LLString& name, const LLSD& val);
- void setValue(const LLString& name, const LLSD& val);
+ LLColor4 getColor(const std::string& name);
+ LLColor4U getColor4U(const std::string& name);
+ LLColor4 getColor4(const std::string& name);
+ LLColor3 getColor3(const std::string& name);
+
+ void setBOOL(const std::string& name, BOOL val);
+ void setS32(const std::string& name, S32 val);
+ void setF32(const std::string& name, F32 val);
+ void setU32(const std::string& name, U32 val);
+ void setString(const std::string& name, const std::string& val);
+ void setVector3(const std::string& name, const LLVector3 &val);
+ void setVector3d(const std::string& name, const LLVector3d &val);
+ void setRect(const std::string& name, const LLRect &val);
+ void setColor4U(const std::string& name, const LLColor4U &val);
+ void setColor4(const std::string& name, const LLColor4 &val);
+ void setColor3(const std::string& name, const LLColor3 &val);
+ void setLLSD(const std::string& name, const LLSD& val);
+ void setValue(const std::string& name, const LLSD& val);
- BOOL controlExists(const LLString& name);
+ BOOL controlExists(const std::string& name);
// Returns number of controls loaded, 0 if failed
// If require_declaration is false, will auto-declare controls it finds
// as the given type.
- U32 loadFromFileLegacy(const LLString& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING);
- U32 saveToFile(const LLString& filename, BOOL nondefault_only);
- U32 loadFromFile(const LLString& filename);
+ U32 loadFromFileLegacy(const std::string& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING);
+ U32 saveToFile(const std::string& filename, BOOL nondefault_only);
+ U32 loadFromFile(const std::string& filename);
void resetToDefaults();
// Ignorable Warnings
// Add a config variable to be reset on resetWarnings()
- void addWarning(const LLString& name);
- BOOL getWarning(const LLString& name);
- void setWarning(const LLString& name, BOOL val);
+ void addWarning(const std::string& name);
+ BOOL getWarning(const std::string& name);
+ void setWarning(const std::string& name, BOOL val);
// Resets all ignorables
void resetWarnings();
diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp
index bd465c30f0..750c1fc1ef 100644
--- a/indra/llxml/llxmlnode.cpp
+++ b/indra/llxml/llxmlnode.cpp
@@ -71,7 +71,7 @@ LLXMLNode::LLXMLNode() :
{
}
-LLXMLNode::LLXMLNode(const LLString& name, BOOL is_attribute) :
+LLXMLNode::LLXMLNode(const char* name, BOOL is_attribute) :
mID(""),
mParser(NULL),
mIsAttribute(is_attribute),
@@ -215,7 +215,7 @@ void LLXMLNode::addChild(LLXMLNodePtr new_child)
new_child->mParent = this;
if (new_child->mIsAttribute)
{
- mAttributes.insert(std::pair<LLStringTableEntry*, LLXMLNodePtr>(new_child->mName, new_child));
+ mAttributes.insert(std::make_pair(new_child->mName, new_child));
}
else
{
@@ -225,7 +225,7 @@ void LLXMLNode::addChild(LLXMLNodePtr new_child)
mChildren->head = new_child;
mChildren->tail = new_child;
}
- mChildren->map.insert(std::pair<LLStringTableEntry*, LLXMLNodePtr>(new_child->mName, new_child));
+ mChildren->map.insert(std::make_pair(new_child->mName, new_child));
if (mChildren->tail != new_child)
{
@@ -239,7 +239,7 @@ void LLXMLNode::addChild(LLXMLNodePtr new_child)
}
// virtual
-LLXMLNodePtr LLXMLNode::createChild(const LLString& name, BOOL is_attribute)
+LLXMLNodePtr LLXMLNode::createChild(const char* name, BOOL is_attribute)
{
return createChild(gStringTable.addStringEntry(name), is_attribute);
}
@@ -248,7 +248,7 @@ LLXMLNodePtr LLXMLNode::createChild(const LLString& name, BOOL is_attribute)
LLXMLNodePtr LLXMLNode::createChild(LLStringTableEntry* name, BOOL is_attribute)
{
LLXMLNode* ret = new LLXMLNode(name, is_attribute);
- ret->mID = "";
+ ret->mID.clear();
addChild(ret);
return ret;
}
@@ -312,7 +312,7 @@ void XMLCALL StartXMLNode(void *userData,
// Create a new node
LLXMLNode *new_node_ptr = new LLXMLNode(name, FALSE);
LLXMLNodePtr new_node = new_node_ptr;
- new_node->mID = "";
+ new_node->mID.clear();
LLXMLNodePtr ptr_new_node = new_node;
// Set the parent-child relationship with the current active node
@@ -334,8 +334,8 @@ void XMLCALL StartXMLNode(void *userData,
U32 pos = 0;
while (atts[pos] != NULL)
{
- LLString attr_name = atts[pos];
- LLString attr_value = atts[pos+1];
+ std::string attr_name = atts[pos];
+ std::string attr_value = atts[pos+1];
// Special cases
if ('i' == attr_name[0] && "id" == attr_name)
@@ -413,9 +413,9 @@ void XMLCALL StartXMLNode(void *userData,
// only one attribute child per description
LLXMLNodePtr attr_node;
- if (!new_node->getAttribute(attr_name, attr_node, FALSE))
+ if (!new_node->getAttribute(attr_name.c_str(), attr_node, FALSE))
{
- attr_node = new LLXMLNode(attr_name, TRUE);
+ attr_node = new LLXMLNode(attr_name.c_str(), TRUE);
}
attr_node->setValue(attr_value);
new_node->addChild(attr_node);
@@ -439,7 +439,7 @@ void XMLCALL EndXMLNode(void *userData,
// SJB: total hack:
if (LLXMLNode::sStripWhitespaceValues)
{
- LLString value = node->getValue();
+ std::string value = node->getValue();
BOOL is_empty = TRUE;
for (std::string::size_type s = 0; s < value.length(); s++)
{
@@ -463,13 +463,13 @@ void XMLCALL XMLData(void *userData,
int len)
{
LLXMLNode* current_node = (LLXMLNode *)userData;
- LLString value = current_node->getValue();
+ std::string value = current_node->getValue();
if (LLXMLNode::sStripEscapedStrings)
{
if (s[0] == '\"' && s[len-1] == '\"')
{
// Special-case: Escaped string.
- LLString unescaped_string;
+ std::string unescaped_string;
for (S32 pos=1; pos<len-1; ++pos)
{
if (s[pos] == '\\' && s[pos+1] == '\\')
@@ -540,8 +540,8 @@ bool LLXMLNode::updateNode(
{
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
{
- LLString nodeName;
- LLString updateName;
+ std::string nodeName;
+ std::string updateName;
updateChild->getAttributeString("name", updateName);
child->getAttributeString("name", nodeName);
@@ -569,13 +569,11 @@ bool LLXMLNode::updateNode(
// static
-bool LLXMLNode::parseFile(
- LLString filename,
- LLXMLNodePtr& node,
- LLXMLNode* defaults_tree)
+bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXMLNode* defaults_tree)
{
// Read file
- LLFILE* fp = LLFile::fopen(filename.c_str(), "rb"); /* Flawfinder: ignore */
+ LL_DEBUGS("XMLNode") << "parsing XML file: " << filename << LL_ENDL;
+ LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
if (fp == NULL)
{
node = new LLXMLNode();
@@ -749,7 +747,7 @@ void LLXMLNode::writeHeaderToFile(LLFILE *fOut)
fprintf(fOut, "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n");
}
-void LLXMLNode::writeToFile(LLFILE *fOut, LLString indent)
+void LLXMLNode::writeToFile(LLFILE *fOut, const std::string& indent)
{
if (isFullyDefault())
{
@@ -759,14 +757,14 @@ void LLXMLNode::writeToFile(LLFILE *fOut, LLString indent)
std::ostringstream ostream;
writeToOstream(ostream, indent);
- LLString outstring = ostream.str();
+ std::string outstring = ostream.str();
if (fwrite(outstring.c_str(), 1, outstring.length(), fOut) != outstring.length())
{
llwarns << "Short write" << llendl;
}
}
-void LLXMLNode::writeToOstream(std::ostream& output_stream, const LLString& indent)
+void LLXMLNode::writeToOstream(std::ostream& output_stream, const std::string& indent)
{
if (isFullyDefault())
{
@@ -780,12 +778,12 @@ void LLXMLNode::writeToOstream(std::ostream& output_stream, const LLString& inde
BOOL has_default_length = mDefault.isNull()?FALSE:(mLength == mDefault->mLength);
// stream the name
- output_stream << indent.c_str() << "<" << mName->mString;
+ output_stream << indent << "<" << mName->mString;
// ID
if (mID != "")
{
- output_stream << " id=\"" << mID.c_str() << "\"";
+ output_stream << " id=\"" << mID << "\"";
}
// Type
@@ -865,7 +863,7 @@ void LLXMLNode::writeToOstream(std::ostream& output_stream, const LLString& inde
LLXMLNodePtr child = (*attr_itr).second;
if (child->mDefault.isNull() || child->mDefault->mValue != child->mValue)
{
- LLString attr = child->mName->mString;
+ std::string attr = child->mName->mString;
if (attr == "id" ||
attr == "type" ||
attr == "encoding" ||
@@ -876,7 +874,7 @@ void LLXMLNode::writeToOstream(std::ostream& output_stream, const LLString& inde
continue; // skip built-in attributes
}
- LLString attr_str = llformat(" %s=\"%s\"",
+ std::string attr_str = llformat(" %s=\"%s\"",
attr.c_str(),
escapeXML(child->mValue).c_str());
if (col_pos + (S32)attr_str.length() > MAX_COLUMN_WIDTH)
@@ -901,7 +899,7 @@ void LLXMLNode::writeToOstream(std::ostream& output_stream, const LLString& inde
if (mChildren)
{
// stream non-attributes
- LLString next_indent = indent + "\t";
+ std::string next_indent = indent + "\t";
for (LLXMLNode* child = getFirstChild(); child; child = child->getNextSibling())
{
child->writeToOstream(output_stream, next_indent);
@@ -909,19 +907,19 @@ void LLXMLNode::writeToOstream(std::ostream& output_stream, const LLString& inde
}
if (!mValue.empty())
{
- LLString contents = getTextContents();
- output_stream << indent.c_str() << "\t" << escapeXML(contents) << "\n";
+ std::string contents = getTextContents();
+ output_stream << indent << "\t" << escapeXML(contents) << "\n";
}
- output_stream << indent.c_str() << "</" << mName->mString << ">\n";
+ output_stream << indent << "</" << mName->mString << ">\n";
}
}
-void LLXMLNode::findName(const LLString& name, LLXMLNodeList &results)
+void LLXMLNode::findName(const std::string& name, LLXMLNodeList &results)
{
LLStringTableEntry* name_entry = gStringTable.checkStringEntry(name);
if (name_entry == mName)
{
- results.insert(std::pair<LLString, LLXMLNode*>(this->mName->mString, this));
+ results.insert(std::make_pair(this->mName->mString, this));
return;
}
if (mChildren)
@@ -940,7 +938,7 @@ void LLXMLNode::findName(LLStringTableEntry* name, LLXMLNodeList &results)
{
if (name == mName)
{
- results.insert(std::pair<LLString, LLXMLNode*>(this->mName->mString, this));
+ results.insert(std::make_pair(this->mName->mString, this));
return;
}
if (mChildren)
@@ -955,11 +953,11 @@ void LLXMLNode::findName(LLStringTableEntry* name, LLXMLNodeList &results)
}
}
-void LLXMLNode::findID(const LLString& id, LLXMLNodeList &results)
+void LLXMLNode::findID(const std::string& id, LLXMLNodeList &results)
{
if (id == mID)
{
- results.insert(std::pair<LLString, LLXMLNode*>(this->mName->mString, this));
+ results.insert(std::make_pair(this->mName->mString, this));
return;
}
if (mChildren)
@@ -1018,7 +1016,7 @@ void LLXMLNode::scrubToTree(LLXMLNode *tree)
}
}
-bool LLXMLNode::getChild(const LLString& name, LLXMLNodePtr& node, BOOL use_default_if_missing)
+bool LLXMLNode::getChild(const char* name, LLXMLNodePtr& node, BOOL use_default_if_missing)
{
return getChild(gStringTable.checkStringEntry(name), node, use_default_if_missing);
}
@@ -1042,7 +1040,7 @@ bool LLXMLNode::getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, BOO
return false;
}
-void LLXMLNode::getChildren(const LLString& name, LLXMLNodeList &children, BOOL use_default_if_missing) const
+void LLXMLNode::getChildren(const char* name, LLXMLNodeList &children, BOOL use_default_if_missing) const
{
getChildren(gStringTable.checkStringEntry(name), children, use_default_if_missing);
}
@@ -1062,7 +1060,7 @@ void LLXMLNode::getChildren(const LLStringTableEntry* name, LLXMLNodeList &child
{
break;
}
- children.insert(std::pair<LLString, LLXMLNodePtr>(child->mName->mString, child));
+ children.insert(std::make_pair(child->mName->mString, child));
child_itr++;
}
}
@@ -1073,7 +1071,7 @@ void LLXMLNode::getChildren(const LLStringTableEntry* name, LLXMLNodeList &child
}
}
-bool LLXMLNode::getAttribute(const LLString& name, LLXMLNodePtr& node, BOOL use_default_if_missing)
+bool LLXMLNode::getAttribute(const char* name, LLXMLNodePtr& node, BOOL use_default_if_missing)
{
return getAttribute(gStringTable.checkStringEntry(name), node, use_default_if_missing);
}
@@ -1094,7 +1092,7 @@ bool LLXMLNode::getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node,
return false;
}
-bool LLXMLNode::setAttributeString(const LLString& attr, const LLString& value)
+bool LLXMLNode::setAttributeString(const char* attr, const std::string& value)
{
LLStringTableEntry* name = gStringTable.checkStringEntry(attr);
LLXMLAttribList::const_iterator child_itr = mAttributes.find(name);
@@ -1107,25 +1105,25 @@ bool LLXMLNode::setAttributeString(const LLString& attr, const LLString& value)
return false;
}
-BOOL LLXMLNode::hasAttribute(const LLString& name )
+BOOL LLXMLNode::hasAttribute(const char* name )
{
LLXMLNodePtr node;
return getAttribute(name, node);
}
-BOOL LLXMLNode::getAttributeBOOL(const LLString& name, BOOL& value )
+BOOL LLXMLNode::getAttributeBOOL(const char* name, BOOL& value )
{
LLXMLNodePtr node;
return (getAttribute(name, node) && node->getBoolValue(1, &value));
}
-BOOL LLXMLNode::getAttributeU8(const LLString& name, U8& value )
+BOOL LLXMLNode::getAttributeU8(const char* name, U8& value )
{
LLXMLNodePtr node;
return (getAttribute(name, node) && node->getByteValue(1, &value));
}
-BOOL LLXMLNode::getAttributeS8(const LLString& name, S8& value )
+BOOL LLXMLNode::getAttributeS8(const char* name, S8& value )
{
LLXMLNodePtr node;
S32 val;
@@ -1137,7 +1135,7 @@ BOOL LLXMLNode::getAttributeS8(const LLString& name, S8& value )
return true;
}
-BOOL LLXMLNode::getAttributeU16(const LLString& name, U16& value )
+BOOL LLXMLNode::getAttributeU16(const char* name, U16& value )
{
LLXMLNodePtr node;
U32 val;
@@ -1149,7 +1147,7 @@ BOOL LLXMLNode::getAttributeU16(const LLString& name, U16& value )
return true;
}
-BOOL LLXMLNode::getAttributeS16(const LLString& name, S16& value )
+BOOL LLXMLNode::getAttributeS16(const char* name, S16& value )
{
LLXMLNodePtr node;
S32 val;
@@ -1161,73 +1159,73 @@ BOOL LLXMLNode::getAttributeS16(const LLString& name, S16& value )
return true;
}
-BOOL LLXMLNode::getAttributeU32(const LLString& name, U32& value )
+BOOL LLXMLNode::getAttributeU32(const char* name, U32& value )
{
LLXMLNodePtr node;
return (getAttribute(name, node) && node->getUnsignedValue(1, &value));
}
-BOOL LLXMLNode::getAttributeS32(const LLString& name, S32& value )
+BOOL LLXMLNode::getAttributeS32(const char* name, S32& value )
{
LLXMLNodePtr node;
return (getAttribute(name, node) && node->getIntValue(1, &value));
}
-BOOL LLXMLNode::getAttributeF32(const LLString& name, F32& value )
+BOOL LLXMLNode::getAttributeF32(const char* name, F32& value )
{
LLXMLNodePtr node;
return (getAttribute(name, node) && node->getFloatValue(1, &value));
}
-BOOL LLXMLNode::getAttributeF64(const LLString& name, F64& value )
+BOOL LLXMLNode::getAttributeF64(const char* name, F64& value )
{
LLXMLNodePtr node;
return (getAttribute(name, node) && node->getDoubleValue(1, &value));
}
-BOOL LLXMLNode::getAttributeColor(const LLString& name, LLColor4& value )
+BOOL LLXMLNode::getAttributeColor(const char* name, LLColor4& value )
{
LLXMLNodePtr node;
return (getAttribute(name, node) && node->getFloatValue(4, value.mV));
}
-BOOL LLXMLNode::getAttributeColor4(const LLString& name, LLColor4& value )
+BOOL LLXMLNode::getAttributeColor4(const char* name, LLColor4& value )
{
LLXMLNodePtr node;
return (getAttribute(name, node) && node->getFloatValue(4, value.mV));
}
-BOOL LLXMLNode::getAttributeColor4U(const LLString& name, LLColor4U& value )
+BOOL LLXMLNode::getAttributeColor4U(const char* name, LLColor4U& value )
{
LLXMLNodePtr node;
return (getAttribute(name, node) && node->getByteValue(4, value.mV));
}
-BOOL LLXMLNode::getAttributeVector3(const LLString& name, LLVector3& value )
+BOOL LLXMLNode::getAttributeVector3(const char* name, LLVector3& value )
{
LLXMLNodePtr node;
return (getAttribute(name, node) && node->getFloatValue(3, value.mV));
}
-BOOL LLXMLNode::getAttributeVector3d(const LLString& name, LLVector3d& value )
+BOOL LLXMLNode::getAttributeVector3d(const char* name, LLVector3d& value )
{
LLXMLNodePtr node;
return (getAttribute(name, node) && node->getDoubleValue(3, value.mdV));
}
-BOOL LLXMLNode::getAttributeQuat(const LLString& name, LLQuaternion& value )
+BOOL LLXMLNode::getAttributeQuat(const char* name, LLQuaternion& value )
{
LLXMLNodePtr node;
return (getAttribute(name, node) && node->getFloatValue(4, value.mQ));
}
-BOOL LLXMLNode::getAttributeUUID(const LLString& name, LLUUID& value )
+BOOL LLXMLNode::getAttributeUUID(const char* name, LLUUID& value )
{
LLXMLNodePtr node;
return (getAttribute(name, node) && node->getUUIDValue(1, &value));
}
-BOOL LLXMLNode::getAttributeString(const LLString& name, LLString& value )
+BOOL LLXMLNode::getAttributeString(const char* name, std::string& value )
{
LLXMLNodePtr node;
if (!getAttribute(name, node))
@@ -1539,14 +1537,14 @@ U32 LLXMLNode::getBoolValue(U32 expected_length, BOOL *array)
return 0;
}
- LLString *str_array = new LLString[expected_length];
+ std::string *str_array = new std::string[expected_length];
U32 length = getStringValue(expected_length, str_array);
U32 ret_length = 0;
for (U32 i=0; i<length; ++i)
{
- LLString::toLower(str_array[i]);
+ LLStringUtil::toLower(str_array[i]);
if (str_array[i] == "false")
{
array[ret_length++] = FALSE;
@@ -1875,7 +1873,7 @@ U32 LLXMLNode::getDoubleValue(U32 expected_length, F64 *array, Encoding encoding
return i;
}
-U32 LLXMLNode::getStringValue(U32 expected_length, LLString *array)
+U32 LLXMLNode::getStringValue(U32 expected_length, std::string *array)
{
llassert(array);
@@ -1950,7 +1948,7 @@ U32 LLXMLNode::getUUIDValue(U32 expected_length, LLUUID *array)
memcpy(uuid_string, value_string, (UUID_STR_LENGTH-1)); /* Flawfinder: ignore */
uuid_string[(UUID_STR_LENGTH-1)] = 0;
- if (!LLUUID::parseUUID(uuid_string, &uuid_value))
+ if (!LLUUID::parseUUID(std::string(uuid_string), &uuid_value))
{
break;
}
@@ -1978,7 +1976,7 @@ U32 LLXMLNode::getNodeRefValue(U32 expected_length, LLXMLNode **array)
return 0;
}
- LLString *string_array = new LLString[expected_length];
+ std::string *string_array = new std::string[expected_length];
U32 num_strings = getStringValue(expected_length, string_array);
@@ -2018,7 +2016,7 @@ void LLXMLNode::setBoolValue(U32 length, const BOOL *array)
{
if (length == 0) return;
- LLString new_value;
+ std::string new_value;
for (U32 pos=0; pos<length; ++pos)
{
if (pos > 0)
@@ -2041,7 +2039,7 @@ void LLXMLNode::setByteValue(U32 length, const U8* const array, Encoding encodin
{
if (length == 0) return;
- LLString new_value;
+ std::string new_value;
if (encoding == ENCODING_DEFAULT || encoding == ENCODING_DECIMAL)
{
for (U32 pos=0; pos<length; ++pos)
@@ -2084,7 +2082,7 @@ void LLXMLNode::setIntValue(U32 length, const S32 *array, Encoding encoding)
{
if (length == 0) return;
- LLString new_value;
+ std::string new_value;
if (encoding == ENCODING_DEFAULT || encoding == ENCODING_DECIMAL)
{
for (U32 pos=0; pos<length; ++pos)
@@ -2131,7 +2129,7 @@ void LLXMLNode::setUnsignedValue(U32 length, const U32* array, Encoding encoding
{
if (length == 0) return;
- LLString new_value;
+ std::string new_value;
if (encoding == ENCODING_DEFAULT || encoding == ENCODING_DECIMAL)
{
for (U32 pos=0; pos<length; ++pos)
@@ -2180,7 +2178,7 @@ void LLXMLNode::setLongValue(U32 length, const U64* array, Encoding encoding)
{
if (length == 0) return;
- LLString new_value;
+ std::string new_value;
if (encoding == ENCODING_DEFAULT || encoding == ENCODING_DECIMAL)
{
for (U32 pos=0; pos<length; ++pos)
@@ -2229,21 +2227,21 @@ void LLXMLNode::setFloatValue(U32 length, const F32 *array, Encoding encoding, U
{
if (length == 0) return;
- LLString new_value;
+ std::string new_value;
if (encoding == ENCODING_DEFAULT || encoding == ENCODING_DECIMAL)
{
- char format_string[10]; /* Flawfinder: ignore */
+ std::string format_string;
if (precision > 0)
{
if (precision > 25)
{
precision = 25;
}
- snprintf(format_string, sizeof(format_string), "%%.%dg", precision); /* Flawfinder: ignore */
+ format_string = llformat( "%%.%dg", precision);
}
else
{
- snprintf(format_string, sizeof(format_string), "%%g"); /* Flawfinder: ignore */
+ format_string = llformat( "%%g");
}
for (U32 pos=0; pos<length; ++pos)
@@ -2251,11 +2249,11 @@ void LLXMLNode::setFloatValue(U32 length, const F32 *array, Encoding encoding, U
if (pos > 0)
{
new_value.append(" ");
- new_value.append(llformat(format_string, array[pos]));
+ new_value.append(llformat(format_string.c_str(), array[pos]));
}
else
{
- new_value.assign(llformat(format_string, array[pos]));
+ new_value.assign(llformat(format_string.c_str(), array[pos]));
}
}
mValue = new_value;
@@ -2280,32 +2278,32 @@ void LLXMLNode::setDoubleValue(U32 length, const F64 *array, Encoding encoding,
{
if (length == 0) return;
- LLString new_value;
+ std::string new_value;
if (encoding == ENCODING_DEFAULT || encoding == ENCODING_DECIMAL)
{
- char format_string[10]; /* Flawfinder: ignore */
+ std::string format_string;
if (precision > 0)
{
if (precision > 25)
{
precision = 25;
}
- snprintf(format_string, sizeof(format_string), "%%.%dg", precision); /* Flawfinder: ignore */
+ format_string = llformat( "%%.%dg", precision);
}
else
{
- snprintf(format_string, sizeof(format_string), "%%g"); /* Flawfinder: ignore */
+ format_string = llformat( "%%g");
}
for (U32 pos=0; pos<length; ++pos)
{
if (pos > 0)
{
new_value.append(" ");
- new_value.append(llformat(format_string, array[pos]));
+ new_value.append(llformat(format_string.c_str(), array[pos]));
}
else
{
- new_value.assign(llformat(format_string, array[pos]));
+ new_value.assign(llformat(format_string.c_str(), array[pos]));
}
}
mValue = new_value;
@@ -2328,10 +2326,10 @@ void LLXMLNode::setDoubleValue(U32 length, const F64 *array, Encoding encoding,
}
// static
-LLString LLXMLNode::escapeXML(const LLString& xml)
+std::string LLXMLNode::escapeXML(const std::string& xml)
{
- LLString out;
- for (LLString::size_type i = 0; i < xml.size(); ++i)
+ std::string out;
+ for (std::string::size_type i = 0; i < xml.size(); ++i)
{
char c = xml[i];
switch(c)
@@ -2347,11 +2345,11 @@ LLString LLXMLNode::escapeXML(const LLString& xml)
return out;
}
-void LLXMLNode::setStringValue(U32 length, const LLString *array)
+void LLXMLNode::setStringValue(U32 length, const std::string *array)
{
if (length == 0) return;
- LLString new_value;
+ std::string new_value;
for (U32 pos=0; pos<length; ++pos)
{
new_value.append(escapeXML(array[pos]));
@@ -2368,7 +2366,7 @@ void LLXMLNode::setUUIDValue(U32 length, const LLUUID *array)
{
if (length == 0) return;
- LLString new_value;
+ std::string new_value;
for (U32 pos=0; pos<length; ++pos)
{
new_value.append(array[pos].asString());
@@ -2385,7 +2383,7 @@ void LLXMLNode::setNodeRefValue(U32 length, const LLXMLNode **array)
{
if (length == 0) return;
- LLString new_value;
+ std::string new_value;
for (U32 pos=0; pos<length; ++pos)
{
if (array[pos]->mID != "")
@@ -2405,7 +2403,7 @@ void LLXMLNode::setNodeRefValue(U32 length, const LLXMLNode **array)
mType = TYPE_NODEREF;
}
-void LLXMLNode::setValue(const LLString& value)
+void LLXMLNode::setValue(const std::string& value)
{
if (TYPE_CONTAINER == mType)
{
@@ -2442,7 +2440,7 @@ void LLXMLNode::findDefault(LLXMLNode *defaults_list)
mDefault = NULL;
}
-BOOL LLXMLNode::deleteChildren(const LLString& name)
+BOOL LLXMLNode::deleteChildren(const std::string& name)
{
U32 removed_count = 0;
LLXMLNodeList node_list;
@@ -2494,7 +2492,7 @@ void LLXMLNode::setAttributes(LLXMLNode::ValueType type, U32 precision, LLXMLNod
mLength = length;
}
-void LLXMLNode::setName(const LLString& name)
+void LLXMLNode::setName(const std::string& name)
{
setName(gStringTable.addStringEntry(name));
}
@@ -2515,10 +2513,11 @@ void LLXMLNode::setName(LLStringTableEntry* name)
}
}
-void LLXMLNode::appendValue(const LLString& value)
-{
- mValue.append(value);
-}
+// Unused
+// void LLXMLNode::appendValue(const std::string& value)
+// {
+// mValue.append(value);
+// }
U32 LLXMLNode::getChildCount() const
{
@@ -2568,14 +2567,13 @@ LLXMLNode *get_rand_node(LLXMLNode *node)
void LLXMLNode::createUnitTest(S32 max_num_children)
{
// Random ID
- char rand_id[20]; /* Flawfinder: ignore */
+ std::string rand_id;
U32 rand_id_len = get_rand(10)+5;
- U32 pos = 0;
- for (; pos<rand_id_len; ++pos)
+ for (U32 pos = 0; pos<rand_id_len; ++pos)
{
- rand_id[pos] = get_rand(26)+'a';
+ char c = 'a' + get_rand(26);
+ rand_id.append(1, c);
}
- rand_id[pos] = 0;
mID = rand_id;
if (max_num_children < 2)
@@ -2597,26 +2595,24 @@ void LLXMLNode::createUnitTest(S32 max_num_children)
for (U32 child_num=0; child_num<num_children; ++child_num)
{
// Random Name
- char child_name[20]; /* Flawfinder: ignore */
+ std::string child_name;
U32 child_name_len = get_rand(10)+5;
- pos = 0;
- for (; pos<child_name_len; ++pos)
+ for (U32 pos = 0; pos<child_name_len; ++pos)
{
- child_name[pos] = get_rand(26)+'a';
+ char c = 'a' + get_rand(26);
+ child_name.append(1, c);
}
- child_name[pos] = 0;
- LLXMLNode *new_child = createChild(child_name, FALSE);
+ LLXMLNode *new_child = createChild(child_name.c_str(), FALSE);
// Random ID
- char child_id[20]; /* Flawfinder: ignore */
+ std::string child_id;
U32 child_id_len = get_rand(10)+5;
- pos = 0;
- for (; pos<child_id_len; ++pos)
+ for (U32 pos=0; pos<child_id_len; ++pos)
{
- child_id[pos] = get_rand(26)+'a';
+ char c = 'a' + get_rand(26);
+ child_id.append(1, c);
}
- child_id[pos] = 0;
new_child->mID = child_id;
// Random Length
@@ -2750,7 +2746,7 @@ void LLXMLNode::createUnitTest(S32 max_num_children)
createChild("float_checksum", TRUE)->setUnsignedValue(1, &float_checksum, LLXMLNode::ENCODING_HEX);
}
-BOOL LLXMLNode::performUnitTest(LLString &error_buffer)
+BOOL LLXMLNode::performUnitTest(std::string &error_buffer)
{
if (!mChildren)
{
@@ -3024,10 +3020,10 @@ LLXMLNodePtr LLXMLNode::getNextSibling()
return ret;
}
-LLString LLXMLNode::getTextContents() const
+std::string LLXMLNode::getTextContents() const
{
std::string msg;
- LLString contents = mValue;
+ std::string contents = mValue;
std::string::size_type n = contents.find_first_not_of(" \t\n");
if (n != std::string::npos && contents[n] == '\"')
{
@@ -3071,10 +3067,10 @@ LLString LLXMLNode::getTextContents() const
else
{
// Case 2: node has embedded text (beginning and trailing whitespace trimmed)
- LLString::size_type start = mValue.find_first_not_of(" \t\n");
+ std::string::size_type start = mValue.find_first_not_of(" \t\n");
if (start != mValue.npos)
{
- LLString::size_type end = mValue.find_last_not_of(" \t\n");
+ std::string::size_type end = mValue.find_last_not_of(" \t\n");
if (end != mValue.npos)
{
msg = mValue.substr(start, end+1-start);
diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h
index 58cef95ce0..5ca726effe 100644
--- a/indra/llxml/llxmlnode.h
+++ b/indra/llxml/llxmlnode.h
@@ -75,7 +75,7 @@ struct CompareAttributes
class LLXMLNode;
typedef LLPointer<LLXMLNode> LLXMLNodePtr;
-typedef std::multimap<LLString, LLXMLNodePtr > LLXMLNodeList;
+typedef std::multimap<std::string, LLXMLNodePtr > LLXMLNodeList;
typedef std::multimap<const LLStringTableEntry *, LLXMLNodePtr > LLXMLChildList;
typedef std::map<const LLStringTableEntry *, LLXMLNodePtr, CompareAttributes> LLXMLAttribList;
@@ -122,7 +122,7 @@ protected:
public:
LLXMLNode();
- LLXMLNode(const LLString& name, BOOL is_attribute);
+ LLXMLNode(const char* name, BOOL is_attribute);
LLXMLNode(LLStringTableEntry* name, BOOL is_attribute);
BOOL isNull();
@@ -133,7 +133,7 @@ public:
// Serialization
static bool parseFile(
- LLString filename,
+ const std::string& filename,
LLXMLNodePtr& node,
LLXMLNode* defaults_tree);
static bool parseBuffer(
@@ -149,16 +149,16 @@ public:
LLXMLNodePtr& node,
LLXMLNodePtr& update_node);
static void writeHeaderToFile(LLFILE *fOut);
- void writeToFile(LLFILE *fOut, LLString indent = LLString());
- void writeToOstream(std::ostream& output_stream, const LLString& indent = LLString());
+ void writeToFile(LLFILE *fOut, const std::string& indent = std::string());
+ void writeToOstream(std::ostream& output_stream, const std::string& indent = std::string());
// Utility
- void findName(const LLString& name, LLXMLNodeList &results);
+ void findName(const std::string& name, LLXMLNodeList &results);
void findName(LLStringTableEntry* name, LLXMLNodeList &results);
- void findID(const LLString& id, LLXMLNodeList &results);
+ void findID(const std::string& id, LLXMLNodeList &results);
- virtual LLXMLNodePtr createChild(const LLString& name, BOOL is_attribute);
+ virtual LLXMLNodePtr createChild(const char* name, BOOL is_attribute);
virtual LLXMLNodePtr createChild(LLStringTableEntry* name, BOOL is_attribute);
@@ -170,49 +170,49 @@ public:
U32 getLongValue(U32 expected_length, U64 *array, Encoding encoding = ENCODING_DEFAULT);
U32 getFloatValue(U32 expected_length, F32 *array, Encoding encoding = ENCODING_DEFAULT);
U32 getDoubleValue(U32 expected_length, F64 *array, Encoding encoding = ENCODING_DEFAULT);
- U32 getStringValue(U32 expected_length, LLString *array);
+ U32 getStringValue(U32 expected_length, std::string *array);
U32 getUUIDValue(U32 expected_length, LLUUID *array);
U32 getNodeRefValue(U32 expected_length, LLXMLNode **array);
- BOOL hasAttribute(const LLString& name );
-
- BOOL getAttributeBOOL(const LLString& name, BOOL& value );
- BOOL getAttributeU8(const LLString& name, U8& value );
- BOOL getAttributeS8(const LLString& name, S8& value );
- BOOL getAttributeU16(const LLString& name, U16& value );
- BOOL getAttributeS16(const LLString& name, S16& value );
- BOOL getAttributeU32(const LLString& name, U32& value );
- BOOL getAttributeS32(const LLString& name, S32& value );
- BOOL getAttributeF32(const LLString& name, F32& value );
- BOOL getAttributeF64(const LLString& name, F64& value );
- BOOL getAttributeColor(const LLString& name, LLColor4& value );
- BOOL getAttributeColor4(const LLString& name, LLColor4& value );
- BOOL getAttributeColor4U(const LLString& name, LLColor4U& value );
- BOOL getAttributeVector3(const LLString& name, LLVector3& value );
- BOOL getAttributeVector3d(const LLString& name, LLVector3d& value );
- BOOL getAttributeQuat(const LLString& name, LLQuaternion& value );
- BOOL getAttributeUUID(const LLString& name, LLUUID& value );
- BOOL getAttributeString(const LLString& name, LLString& value );
+ BOOL hasAttribute(const char* name );
+
+ BOOL getAttributeBOOL(const char* name, BOOL& value );
+ BOOL getAttributeU8(const char* name, U8& value );
+ BOOL getAttributeS8(const char* name, S8& value );
+ BOOL getAttributeU16(const char* name, U16& value );
+ BOOL getAttributeS16(const char* name, S16& value );
+ BOOL getAttributeU32(const char* name, U32& value );
+ BOOL getAttributeS32(const char* name, S32& value );
+ BOOL getAttributeF32(const char* name, F32& value );
+ BOOL getAttributeF64(const char* name, F64& value );
+ BOOL getAttributeColor(const char* name, LLColor4& value );
+ BOOL getAttributeColor4(const char* name, LLColor4& value );
+ BOOL getAttributeColor4U(const char* name, LLColor4U& value );
+ BOOL getAttributeVector3(const char* name, LLVector3& value );
+ BOOL getAttributeVector3d(const char* name, LLVector3d& value );
+ BOOL getAttributeQuat(const char* name, LLQuaternion& value );
+ BOOL getAttributeUUID(const char* name, LLUUID& value );
+ BOOL getAttributeString(const char* name, std::string& value );
const ValueType& getType() const { return mType; }
U32 getLength() const { return mLength; }
U32 getPrecision() const { return mPrecision; }
- const LLString& getValue() const { return mValue; }
- LLString getTextContents() const;
+ const std::string& getValue() const { return mValue; }
+ std::string getTextContents() const;
const LLStringTableEntry* getName() const { return mName; }
BOOL hasName(const char* name) const { return mName == gStringTable.checkStringEntry(name); }
- BOOL hasName(LLString name) const { return mName == gStringTable.checkStringEntry(name.c_str()); }
- const LLString& getID() const { return mID; }
+ BOOL hasName(const std::string& name) const { return mName == gStringTable.checkStringEntry(name.c_str()); }
+ const std::string& getID() const { return mID; }
U32 getChildCount() const;
// getChild returns a Null LLXMLNode (not a NULL pointer) if there is no such child.
// This child has no value so any getTYPEValue() calls on it will return 0.
- bool getChild(const LLString& name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE);
+ bool getChild(const char* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE);
bool getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE);
- void getChildren(const LLString& name, LLXMLNodeList &children, BOOL use_default_if_missing = TRUE) const;
+ void getChildren(const char* name, LLXMLNodeList &children, BOOL use_default_if_missing = TRUE) const;
void getChildren(const LLStringTableEntry* name, LLXMLNodeList &children, BOOL use_default_if_missing = TRUE) const;
- bool getAttribute(const LLString& name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE);
+ bool getAttribute(const char* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE);
bool getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE);
// The following skip over attributes
@@ -223,7 +223,7 @@ public:
// Setters
- bool setAttributeString(const LLString& attr, const LLString& value);
+ bool setAttributeString(const char* attr, const std::string& value);
void setBoolValue(const BOOL value) { setBoolValue(1, &value); }
void setByteValue(const U8 value, Encoding encoding = ENCODING_DEFAULT) { setByteValue(1, &value, encoding); }
@@ -232,7 +232,7 @@ public:
void setLongValue(const U64 value, Encoding encoding = ENCODING_DEFAULT) { setLongValue(1, &value, encoding); }
void setFloatValue(const F32 value, Encoding encoding = ENCODING_DEFAULT, U32 precision = 0) { setFloatValue(1, &value, encoding); }
void setDoubleValue(const F64 value, Encoding encoding = ENCODING_DEFAULT, U32 precision = 0) { setDoubleValue(1, &value, encoding); }
- void setStringValue(const LLString value) { setStringValue(1, &value); }
+ void setStringValue(const std::string& value) { setStringValue(1, &value); }
void setUUIDValue(const LLUUID value) { setUUIDValue(1, &value); }
void setNodeRefValue(const LLXMLNode *value) { setNodeRefValue(1, &value); }
@@ -243,16 +243,16 @@ public:
void setLongValue(U32 length, const U64 *array, Encoding encoding = ENCODING_DEFAULT);
void setFloatValue(U32 length, const F32 *array, Encoding encoding = ENCODING_DEFAULT, U32 precision = 0);
void setDoubleValue(U32 length, const F64 *array, Encoding encoding = ENCODING_DEFAULT, U32 precision = 0);
- void setStringValue(U32 length, const LLString *array);
+ void setStringValue(U32 length, const std::string *array);
void setUUIDValue(U32 length, const LLUUID *array);
void setNodeRefValue(U32 length, const LLXMLNode **array);
- void setValue(const LLString& value);
- void setName(const LLString& name);
+ void setValue(const std::string& value);
+ void setName(const std::string& name);
void setName(LLStringTableEntry* name);
// Escapes " (quot) ' (apos) & (amp) < (lt) > (gt)
// TomY TODO: Make this private
- static LLString escapeXML(const LLString& xml);
+ static std::string escapeXML(const std::string& xml);
// Set the default node corresponding to this default node
void setDefault(LLXMLNode *default_node);
@@ -265,20 +265,20 @@ public:
// Delete any child nodes that aren't among the tree's children, recursive
void scrubToTree(LLXMLNode *tree);
- BOOL deleteChildren(const LLString& name);
+ BOOL deleteChildren(const std::string& name);
BOOL deleteChildren(LLStringTableEntry* name);
void setAttributes(ValueType type, U32 precision, Encoding encoding, U32 length);
- void appendValue(const LLString& value);
+// void appendValue(const std::string& value); // Unused
// Unit Testing
void createUnitTest(S32 max_num_children);
- BOOL performUnitTest(LLString &error_buffer);
+ BOOL performUnitTest(std::string &error_buffer);
protected:
BOOL removeChild(LLXMLNode* child);
public:
- LLString mID; // The ID attribute of this node
+ std::string mID; // The ID attribute of this node
XML_Parser *mParser; // Temporary pointer while loading
@@ -301,7 +301,7 @@ public:
protected:
LLStringTableEntry *mName; // The name of this node
- LLString mValue; // The value of this node (use getters/setters only)
+ std::string mValue; // The value of this node (use getters/setters only)
LLXMLNodePtr mDefault; // Mirror node in the default tree
diff --git a/indra/llxml/llxmlparser.cpp b/indra/llxml/llxmlparser.cpp
index 5591551bb7..6a3953edd9 100644
--- a/indra/llxml/llxmlparser.cpp
+++ b/indra/llxml/llxmlparser.cpp
@@ -45,7 +45,7 @@ LLXmlParser::LLXmlParser()
mParser( NULL ),
mDepth( 0 )
{
- strcpy( mAuxErrorString, "no error" ); /* Flawfinder: ignore */
+ mAuxErrorString = "no error";
// Override the document's declared encoding.
mParser = XML_ParserCreate(NULL);
@@ -77,10 +77,10 @@ BOOL LLXmlParser::parseFile(const std::string &path)
BOOL success = TRUE;
- LLFILE* file = LLFile::fopen(path.c_str(), "rb"); /* Flawfinder: ignore */
+ LLFILE* file = LLFile::fopen(path, "rb"); /* Flawfinder: ignore */
if( !file )
{
- snprintf( mAuxErrorString, sizeof(mAuxErrorString), "Couldn't open file %s", path.c_str()); /* Flawfinder: ignore */
+ mAuxErrorString = llformat( "Couldn't open file %s", path.c_str());
success = FALSE;
}
else
@@ -94,7 +94,7 @@ BOOL LLXmlParser::parseFile(const std::string &path)
void* buffer = XML_GetBuffer(mParser, buffer_size);
if( !buffer )
{
- snprintf( mAuxErrorString, sizeof(mAuxErrorString), "Unable to allocate XML buffer while reading file %s", path.c_str() ); /* Flawfinder: ignore */
+ mAuxErrorString = llformat( "Unable to allocate XML buffer while reading file %s", path.c_str() );
success = FALSE;
goto exit_label;
}
@@ -102,14 +102,14 @@ BOOL LLXmlParser::parseFile(const std::string &path)
bytes_read = (S32)fread(buffer, 1, buffer_size, file);
if( bytes_read <= 0 )
{
- snprintf( mAuxErrorString, sizeof(mAuxErrorString), "Error while reading file %s", path.c_str() ); /* Flawfinder: ignore */
+ mAuxErrorString = llformat( "Error while reading file %s", path.c_str() );
success = FALSE;
goto exit_label;
}
if( !XML_ParseBuffer(mParser, bytes_read, TRUE ) )
{
- snprintf( mAuxErrorString, sizeof(mAuxErrorString), "Error while parsing file %s", path.c_str() ); /* Flawfinder: ignore */
+ mAuxErrorString = llformat( "Error while parsing file %s", path.c_str() );
success = FALSE;
}
@@ -146,7 +146,7 @@ const char* LLXmlParser::getErrorString()
const char* error_string = XML_ErrorString(XML_GetErrorCode( mParser ));
if( !error_string )
{
- error_string = mAuxErrorString;
+ error_string = mAuxErrorString.c_str();
}
return error_string;
}
diff --git a/indra/llxml/llxmlparser.h b/indra/llxml/llxmlparser.h
index 747cf3d0ca..1ccda7b7c6 100644
--- a/indra/llxml/llxmlparser.h
+++ b/indra/llxml/llxmlparser.h
@@ -132,7 +132,7 @@ public:
protected:
XML_Parser mParser;
int mDepth;
- char mAuxErrorString[1024]; /*Flawfinder: ignore*/
+ std::string mAuxErrorString;
};
#endif // LL_LLXMLPARSER_H
diff --git a/indra/llxml/llxmltree.cpp b/indra/llxml/llxmltree.cpp
index a036b876a9..20a9cbdede 100644
--- a/indra/llxml/llxmltree.cpp
+++ b/indra/llxml/llxmltree.cpp
@@ -90,11 +90,11 @@ void LLXmlTree::dump()
}
}
-void LLXmlTree::dumpNode( LLXmlTreeNode* node, const LLString& prefix )
+void LLXmlTree::dumpNode( LLXmlTreeNode* node, const std::string& prefix )
{
node->dump( prefix );
- LLString new_prefix = prefix + " ";
+ std::string new_prefix = prefix + " ";
for( LLXmlTreeNode* child = node->getFirstChild(); child; child = node->getNextChild() )
{
dumpNode( child, new_prefix );
@@ -121,7 +121,7 @@ LLXmlTreeNode::~LLXmlTreeNode()
delete *child_iter;
}
-void LLXmlTreeNode::dump( const LLString& prefix )
+void LLXmlTreeNode::dump( const std::string& prefix )
{
llinfos << prefix << mName ;
if( !mContents.empty() )
@@ -132,7 +132,7 @@ void LLXmlTreeNode::dump( const LLString& prefix )
for (iter=mAttributes.begin(); iter != mAttributes.end(); iter++)
{
LLStdStringHandle key = iter->first;
- const LLString* value = iter->second;
+ const std::string* value = iter->second;
llcont << prefix << " " << key << "=" << (value->empty() ? "NULL" : *value);
}
llcont << llendl;
@@ -148,7 +148,7 @@ BOOL LLXmlTreeNode::hasAttribute(const std::string& name)
void LLXmlTreeNode::addAttribute(const std::string& name, const std::string& value)
{
LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name );
- const LLString *newstr = new LLString(value);
+ const std::string *newstr = new std::string(value);
mAttributes[canonical_name] = newstr; // insert + copy
}
@@ -204,103 +204,103 @@ void LLXmlTreeNode::addChild(LLXmlTreeNode* child)
BOOL LLXmlTreeNode::getFastAttributeBOOL(LLStdStringHandle canonical_name, BOOL& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s && LLString::convertToBOOL( *s, value );
+ const std::string *s = getAttribute( canonical_name );
+ return s && LLStringUtil::convertToBOOL( *s, value );
}
BOOL LLXmlTreeNode::getFastAttributeU8(LLStdStringHandle canonical_name, U8& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s && LLString::convertToU8( *s, value );
+ const std::string *s = getAttribute( canonical_name );
+ return s && LLStringUtil::convertToU8( *s, value );
}
BOOL LLXmlTreeNode::getFastAttributeS8(LLStdStringHandle canonical_name, S8& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s && LLString::convertToS8( *s, value );
+ const std::string *s = getAttribute( canonical_name );
+ return s && LLStringUtil::convertToS8( *s, value );
}
BOOL LLXmlTreeNode::getFastAttributeS16(LLStdStringHandle canonical_name, S16& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s && LLString::convertToS16( *s, value );
+ const std::string *s = getAttribute( canonical_name );
+ return s && LLStringUtil::convertToS16( *s, value );
}
BOOL LLXmlTreeNode::getFastAttributeU16(LLStdStringHandle canonical_name, U16& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s && LLString::convertToU16( *s, value );
+ const std::string *s = getAttribute( canonical_name );
+ return s && LLStringUtil::convertToU16( *s, value );
}
BOOL LLXmlTreeNode::getFastAttributeU32(LLStdStringHandle canonical_name, U32& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s && LLString::convertToU32( *s, value );
+ const std::string *s = getAttribute( canonical_name );
+ return s && LLStringUtil::convertToU32( *s, value );
}
BOOL LLXmlTreeNode::getFastAttributeS32(LLStdStringHandle canonical_name, S32& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s && LLString::convertToS32( *s, value );
+ const std::string *s = getAttribute( canonical_name );
+ return s && LLStringUtil::convertToS32( *s, value );
}
BOOL LLXmlTreeNode::getFastAttributeF32(LLStdStringHandle canonical_name, F32& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s && LLString::convertToF32( *s, value );
+ const std::string *s = getAttribute( canonical_name );
+ return s && LLStringUtil::convertToF32( *s, value );
}
BOOL LLXmlTreeNode::getFastAttributeF64(LLStdStringHandle canonical_name, F64& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s && LLString::convertToF64( *s, value );
+ const std::string *s = getAttribute( canonical_name );
+ return s && LLStringUtil::convertToF64( *s, value );
}
BOOL LLXmlTreeNode::getFastAttributeColor(LLStdStringHandle canonical_name, LLColor4& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s ? LLColor4::parseColor(s->c_str(), &value) : FALSE;
+ const std::string *s = getAttribute( canonical_name );
+ return s ? LLColor4::parseColor(*s, &value) : FALSE;
}
BOOL LLXmlTreeNode::getFastAttributeColor4(LLStdStringHandle canonical_name, LLColor4& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s ? LLColor4::parseColor4(s->c_str(), &value) : FALSE;
+ const std::string *s = getAttribute( canonical_name );
+ return s ? LLColor4::parseColor4(*s, &value) : FALSE;
}
BOOL LLXmlTreeNode::getFastAttributeColor4U(LLStdStringHandle canonical_name, LLColor4U& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s ? LLColor4U::parseColor4U(s->c_str(), &value ) : FALSE;
+ const std::string *s = getAttribute( canonical_name );
+ return s ? LLColor4U::parseColor4U(*s, &value ) : FALSE;
}
BOOL LLXmlTreeNode::getFastAttributeVector3(LLStdStringHandle canonical_name, LLVector3& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s ? LLVector3::parseVector3(s->c_str(), &value ) : FALSE;
+ const std::string *s = getAttribute( canonical_name );
+ return s ? LLVector3::parseVector3(*s, &value ) : FALSE;
}
BOOL LLXmlTreeNode::getFastAttributeVector3d(LLStdStringHandle canonical_name, LLVector3d& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s ? LLVector3d::parseVector3d(s->c_str(), &value ) : FALSE;
+ const std::string *s = getAttribute( canonical_name );
+ return s ? LLVector3d::parseVector3d(*s, &value ) : FALSE;
}
BOOL LLXmlTreeNode::getFastAttributeQuat(LLStdStringHandle canonical_name, LLQuaternion& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s ? LLQuaternion::parseQuat(s->c_str(), &value ) : FALSE;
+ const std::string *s = getAttribute( canonical_name );
+ return s ? LLQuaternion::parseQuat(*s, &value ) : FALSE;
}
BOOL LLXmlTreeNode::getFastAttributeUUID(LLStdStringHandle canonical_name, LLUUID& value)
{
- const LLString *s = getAttribute( canonical_name );
- return s ? LLUUID::parseUUID(s->c_str(), &value ) : FALSE;
+ const std::string *s = getAttribute( canonical_name );
+ return s ? LLUUID::parseUUID(*s, &value ) : FALSE;
}
-BOOL LLXmlTreeNode::getFastAttributeString(LLStdStringHandle canonical_name, LLString& value)
+BOOL LLXmlTreeNode::getFastAttributeString(LLStdStringHandle canonical_name, std::string& value)
{
- const LLString *s = getAttribute( canonical_name );
+ const std::string *s = getAttribute( canonical_name );
if( !s )
{
return FALSE;
@@ -409,7 +409,7 @@ BOOL LLXmlTreeNode::getAttributeUUID(const std::string& name, LLUUID& value)
return getFastAttributeUUID(canonical_name, value);
}
-BOOL LLXmlTreeNode::getAttributeString(const std::string& name, LLString& value)
+BOOL LLXmlTreeNode::getAttributeString(const std::string& name, std::string& value)
{
LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name );
return getFastAttributeString(canonical_name, value);
@@ -437,7 +437,7 @@ The quick brown fox
*/
-LLString LLXmlTreeNode::getTextContents()
+std::string LLXmlTreeNode::getTextContents()
{
std::string msg;
LLXmlTreeNode* p = getChildByName("p");
@@ -541,7 +541,7 @@ BOOL LLXmlTreeParser::parseFile(const std::string &path, LLXmlTreeNode** root, B
const std::string& LLXmlTreeParser::tabs()
{
- static LLString s;
+ static std::string s;
s = "";
S32 num_tabs = getDepth() - 1;
for( S32 i = 0; i < num_tabs; i++)
@@ -602,8 +602,8 @@ void LLXmlTreeParser::endElement(const char* name)
if( !mCurrent->mContents.empty() )
{
- LLString::trim(mCurrent->mContents);
- LLString::removeCRLF(mCurrent->mContents);
+ LLStringUtil::trim(mCurrent->mContents);
+ LLStringUtil::removeCRLF(mCurrent->mContents);
}
mCurrent = mCurrent->getParent();
@@ -611,7 +611,8 @@ void LLXmlTreeParser::endElement(const char* name)
void LLXmlTreeParser::characterData(const char *s, int len)
{
- LLString str(s, len);
+ std::string str;
+ if (s) str = std::string(s, len);
if( mDump )
{
llinfos << tabs() << "CharacterData " << str << llendl;
@@ -659,7 +660,8 @@ void LLXmlTreeParser::defaultData(const char *s, int len)
{
if( mDump )
{
- LLString str(s, len);
+ std::string str;
+ if (s) str = std::string(s, len);
llinfos << tabs() << "defaultData " << str << llendl;
}
}
diff --git a/indra/llxml/llxmltree.h b/indra/llxml/llxmltree.h
index d4926656be..e54d5c6960 100644
--- a/indra/llxml/llxmltree.h
+++ b/indra/llxml/llxmltree.h
@@ -65,7 +65,7 @@ public:
LLXmlTreeNode* getRoot() { return mRoot; }
void dump();
- void dumpNode( LLXmlTreeNode* node, const LLString &prefix );
+ void dumpNode( LLXmlTreeNode* node, const std::string& prefix );
static LLStdStringHandle addAttributeString( const std::string& name)
{
@@ -126,7 +126,7 @@ public:
BOOL getFastAttributeVector3d( LLStdStringHandle cannonical_name, LLVector3d& value );
BOOL getFastAttributeQuat( LLStdStringHandle cannonical_name, LLQuaternion& value );
BOOL getFastAttributeUUID( LLStdStringHandle cannonical_name, LLUUID& value );
- BOOL getFastAttributeString( LLStdStringHandle cannonical_name, LLString& value );
+ BOOL getFastAttributeString( LLStdStringHandle cannonical_name, std::string& value );
// Normal versions find 'name' in LLXmlTree::sAttributeKeys then call fast versions
virtual BOOL getAttributeBOOL( const std::string& name, BOOL& value );
@@ -145,13 +145,13 @@ public:
virtual BOOL getAttributeVector3d( const std::string& name, LLVector3d& value );
virtual BOOL getAttributeQuat( const std::string& name, LLQuaternion& value );
virtual BOOL getAttributeUUID( const std::string& name, LLUUID& value );
- virtual BOOL getAttributeString( const std::string& name, LLString& value );
+ virtual BOOL getAttributeString( const std::string& name, std::string& value );
- const LLString& getContents()
+ const std::string& getContents()
{
return mContents;
}
- LLString getTextContents();
+ std::string getTextContents();
LLXmlTreeNode* getParent() { return mParent; }
LLXmlTreeNode* getFirstChild();
@@ -161,7 +161,7 @@ public:
LLXmlTreeNode* getNextNamedChild(); // returns next child with name, NULL if none
protected:
- const LLString* getAttribute( LLStdStringHandle name)
+ const std::string* getAttribute( LLStdStringHandle name)
{
attribute_map_t::iterator iter = mAttributes.find(name);
return (iter == mAttributes.end()) ? 0 : iter->second;
@@ -172,15 +172,15 @@ private:
void appendContents( const std::string& str );
void addChild( LLXmlTreeNode* child );
- void dump( const LLString& prefix );
+ void dump( const std::string& prefix );
protected:
- typedef std::map<LLStdStringHandle, const LLString*> attribute_map_t;
+ typedef std::map<LLStdStringHandle, const std::string*> attribute_map_t;
attribute_map_t mAttributes;
private:
- LLString mName;
- LLString mContents;
+ std::string mName;
+ std::string mContents;
typedef std::list<class LLXmlTreeNode *> child_list_t;
child_list_t mChildList;