diff options
Diffstat (limited to 'indra/llxml')
-rwxr-xr-x[-rw-r--r--] | indra/llxml/CMakeLists.txt | 10 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llxml/llcontrol.cpp | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llxml/llcontrol.h | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llxml/llcontrolgroupreader.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llxml/llxmlnode.cpp | 97 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llxml/llxmlnode.h | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llxml/llxmlparser.cpp | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llxml/llxmlparser.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llxml/llxmltree.cpp | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llxml/llxmltree.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llxml/tests/llcontrol_test.cpp | 0 |
11 files changed, 37 insertions, 82 deletions
diff --git a/indra/llxml/CMakeLists.txt b/indra/llxml/CMakeLists.txt index beefcda361..cf96f26a77 100644..100755 --- a/indra/llxml/CMakeLists.txt +++ b/indra/llxml/CMakeLists.txt @@ -13,6 +13,9 @@ include_directories( ${LLMATH_INCLUDE_DIRS} ${LLVFS_INCLUDE_DIRS} ) +include_directories( + ${LLCOMMON_SYSTEM_INCLUDE_DIRS} + ) set(llxml_SOURCE_FILES llcontrol.cpp @@ -39,9 +42,10 @@ list(APPEND llxml_SOURCE_FILES ${llxml_HEADER_FILES}) add_library (llxml ${llxml_SOURCE_FILES}) # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level -target_link_libraries( llxml - llvfs - llmath +target_link_libraries(llxml + ${LLVFS_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLCOMMON_LIBRARIES} ${EXPAT_LIBRARIES} ) diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 53d9380f4f..666c03e9ff 100644..100755 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -850,12 +850,10 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v return 0; } - S32 ret = LLSDSerialize::fromXML(settings, infile); - - if (ret <= 0) + if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(settings, infile)) { infile.close(); - llwarns << "Unable to open LLSD control file " << filename << ". Trying Legacy Method." << llendl; + llwarns << "Unable to parse LLSD control file " << filename << ". Trying Legacy Method." << llendl; return loadFromFileLegacy(filename, TRUE, TYPE_STRING); } diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index 9a3a40e476..ee7d1d50b7 100644..100755 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -254,6 +254,7 @@ public: else { llwarns << "Control " << name << " not found." << llendl; + return T(); } return convert_from_llsd<T>(value, type, name); } diff --git a/indra/llxml/llcontrolgroupreader.h b/indra/llxml/llcontrolgroupreader.h index 6a27a65499..6a27a65499 100644..100755 --- a/indra/llxml/llcontrolgroupreader.h +++ b/indra/llxml/llcontrolgroupreader.h diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 2ffb0d8503..7aa2ce9606 100644..100755 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -147,13 +147,15 @@ LLXMLNodePtr LLXMLNode::deepCopy() for (LLXMLChildList::iterator iter = mChildren->map.begin(); iter != mChildren->map.end(); ++iter) { - newnode->addChild(iter->second->deepCopy()); + LLXMLNodePtr temp_ptr_for_gcc(iter->second->deepCopy()); + newnode->addChild(temp_ptr_for_gcc); } } for (LLXMLAttribList::iterator iter = mAttributes.begin(); iter != mAttributes.end(); ++iter) { - newnode->addChild(iter->second->deepCopy()); + LLXMLNodePtr temp_ptr_for_gcc(iter->second->deepCopy()); + newnode->addChild(temp_ptr_for_gcc); } return newnode; @@ -259,7 +261,7 @@ BOOL LLXMLNode::removeChild(LLXMLNode *target_child) return FALSE; } -void LLXMLNode::addChild(LLXMLNodePtr new_child, LLXMLNodePtr after_child) +void LLXMLNode::addChild(LLXMLNodePtr& new_child) { if (new_child->mParent != NULL) { @@ -273,6 +275,11 @@ void LLXMLNode::addChild(LLXMLNodePtr new_child, LLXMLNodePtr after_child) new_child->mParent = this; if (new_child->mIsAttribute) { + LLXMLAttribList::iterator found_it = mAttributes.find(new_child->mName); + if (found_it != mAttributes.end()) + { + removeChild(found_it->second); + } mAttributes.insert(std::make_pair(new_child->mName, new_child)); } else @@ -285,49 +292,11 @@ void LLXMLNode::addChild(LLXMLNodePtr new_child, LLXMLNodePtr after_child) } mChildren->map.insert(std::make_pair(new_child->mName, new_child)); - // if after_child is specified, it damn well better be in the list of children - // for this node. I'm not going to assert that, because it would be expensive, - // but don't specify that parameter if you didn't get the value for it from the - // list of children of this node! - if (after_child.isNull()) - { - if (mChildren->tail != new_child) - { - mChildren->tail->mNext = new_child; - new_child->mPrev = mChildren->tail; - mChildren->tail = new_child; - } - } - // if after_child == parent, then put new_child at beginning - else if (after_child == this) - { - // add to front of list - new_child->mNext = mChildren->head; - if (mChildren->head) - { - mChildren->head->mPrev = new_child; - mChildren->head = new_child; - } - else // no children - { - mChildren->head = new_child; - mChildren->tail = new_child; - } - } - else + if (mChildren->tail != new_child) { - if (after_child->mNext.notNull()) - { - // if after_child was not the last item, fix up some pointers - after_child->mNext->mPrev = new_child; - new_child->mNext = after_child->mNext; - } - new_child->mPrev = after_child; - after_child->mNext = new_child; - if (mChildren->tail == after_child) - { - mChildren->tail = new_child; - } + mChildren->tail->mNext = new_child; + new_child->mPrev = mChildren->tail; + mChildren->tail = new_child; } } @@ -343,8 +312,9 @@ LLXMLNodePtr LLXMLNode::createChild(const char* name, BOOL is_attribute) // virtual LLXMLNodePtr LLXMLNode::createChild(LLStringTableEntry* name, BOOL is_attribute) { - LLXMLNode* ret = new LLXMLNode(name, is_attribute); + LLXMLNodePtr ret(new LLXMLNode(name, is_attribute)); ret->mID.clear(); + addChild(ret); return ret; } @@ -358,11 +328,12 @@ BOOL LLXMLNode::deleteChild(LLXMLNode *child) return FALSE; } -void LLXMLNode::setParent(LLXMLNodePtr new_parent) +void LLXMLNode::setParent(LLXMLNodePtr& new_parent) { if (new_parent.notNull()) { - new_parent->addChild(this); + LLXMLNodePtr this_ptr(this); + new_parent->addChild(this_ptr); } else { @@ -681,27 +652,6 @@ bool LLXMLNode::updateNode( return TRUE; } - -// static -LLXMLNodePtr LLXMLNode::replaceNode(LLXMLNodePtr node, LLXMLNodePtr update_node) -{ - if (!node || !update_node) - { - llwarns << "Node invalid" << llendl; - return node; - } - - LLXMLNodePtr cloned_node = update_node->deepCopy(); - node->mParent->addChild(cloned_node, node); // add after node - LLXMLNodePtr parent = node->mParent; - parent->removeChild(node); - parent->updateDefault(); - - return cloned_node; -} - - - // static bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXMLNode* defaults_tree) { @@ -897,7 +847,8 @@ bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root, std::vector<std::string>::const_iterator itor; - for (itor = paths.begin(), ++itor; itor != paths.end(); ++itor) + // We've already dealt with the first item, skip that one + for (itor = paths.begin() + 1; itor != paths.end(); ++itor) { std::string layer_filename = *itor; if(layer_filename.empty() || layer_filename == filename) @@ -1198,7 +1149,8 @@ void LLXMLNode::scrubToTree(LLXMLNode *tree) std::vector<LLXMLNodePtr>::iterator itor3; for (itor3=to_delete_list.begin(); itor3!=to_delete_list.end(); ++itor3) { - (*itor3)->setParent(NULL); + LLXMLNodePtr ptr; + (*itor3)->setParent(ptr); } } } @@ -2733,7 +2685,8 @@ void LLXMLNode::setName(LLStringTableEntry* name) mName = name; if (old_parent) { - old_parent->addChild(this); + LLXMLNodePtr this_ptr(this); + old_parent->addChild(this_ptr); } } diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index e3da7169e7..ec486d7957 100644..100755 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -127,8 +127,8 @@ public: BOOL isNull(); BOOL deleteChild(LLXMLNode* child); - void addChild(LLXMLNodePtr new_child, LLXMLNodePtr after_child = LLXMLNodePtr(NULL)); - void setParent(LLXMLNodePtr new_parent); // reparent if necessary + void addChild(LLXMLNodePtr& new_child); + void setParent(LLXMLNodePtr& new_parent); // reparent if necessary // Serialization static bool parseFile( @@ -147,7 +147,6 @@ public: static bool updateNode( LLXMLNodePtr& node, LLXMLNodePtr& update_node); - static LLXMLNodePtr replaceNode(LLXMLNodePtr node, LLXMLNodePtr replacement_node); static bool getLayeredXMLNode(LLXMLNodePtr& root, const std::vector<std::string>& paths); diff --git a/indra/llxml/llxmlparser.cpp b/indra/llxml/llxmlparser.cpp index 7db4a90b57..7db4a90b57 100644..100755 --- a/indra/llxml/llxmlparser.cpp +++ b/indra/llxml/llxmlparser.cpp diff --git a/indra/llxml/llxmlparser.h b/indra/llxml/llxmlparser.h index e0f8b69452..e0f8b69452 100644..100755 --- a/indra/llxml/llxmlparser.h +++ b/indra/llxml/llxmlparser.h diff --git a/indra/llxml/llxmltree.cpp b/indra/llxml/llxmltree.cpp index f2386700a1..f2386700a1 100644..100755 --- a/indra/llxml/llxmltree.cpp +++ b/indra/llxml/llxmltree.cpp diff --git a/indra/llxml/llxmltree.h b/indra/llxml/llxmltree.h index bdcb56f1f3..bdcb56f1f3 100644..100755 --- a/indra/llxml/llxmltree.h +++ b/indra/llxml/llxmltree.h diff --git a/indra/llxml/tests/llcontrol_test.cpp b/indra/llxml/tests/llcontrol_test.cpp index ede81956ec..ede81956ec 100644..100755 --- a/indra/llxml/tests/llcontrol_test.cpp +++ b/indra/llxml/tests/llcontrol_test.cpp |