diff options
27 files changed, 380 insertions, 426 deletions
diff --git a/indra/llappearance/llavatarappearancedefines.h b/indra/llappearance/llavatarappearancedefines.h index 21c0dedeba..0bba3ddfcc 100644 --- a/indra/llappearance/llavatarappearancedefines.h +++ b/indra/llappearance/llavatarappearancedefines.h @@ -40,7 +40,7 @@ namespace LLAvatarAppearanceDefines extern const S32 SCRATCH_TEX_WIDTH; extern const S32 SCRATCH_TEX_HEIGHT; -static const U32 AVATAR_HOVER = 11001; +static constexpr U32 AVATAR_HOVER = 11001; //-------------------------------------------------------------------- // Enums diff --git a/indra/llappearance/llavatarjointmesh.h b/indra/llappearance/llavatarjointmesh.h index 57cf5a26f8..0d815643e9 100644 --- a/indra/llappearance/llavatarjointmesh.h +++ b/indra/llappearance/llavatarjointmesh.h @@ -122,9 +122,6 @@ public: // Sets up joint matrix data for rendering void setupJoint(LLAvatarJoint* current_joint); - // Render time method to upload batches of joint matrices - void uploadJointMatrices(); - // Sets ID for picking void setMeshID( S32 id ) {mMeshID = id;} diff --git a/indra/llappearance/llpolymorph.h b/indra/llappearance/llpolymorph.h index 5544344036..a932433819 100644 --- a/indra/llappearance/llpolymorph.h +++ b/indra/llappearance/llpolymorph.h @@ -183,7 +183,7 @@ protected: LLPolyVertexMask * mVertMask; ESex mLastSex; // number of morph masks that haven't been generated, must be 0 before this morph is applied - BOOL mNumMorphMasksPending; + S32 mNumMorphMasksPending; typedef std::vector<LLPolyVolumeMorph> volume_list_t; volume_list_t mVolumeMorphs; diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index f0bfb3ba89..e1a378e4c3 100644 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -40,21 +40,21 @@ #include "xform.h" #include "llmatrix4a.h" -const S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15; +constexpr S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15; // Need to set this to count of animate-able joints, // currently = #bones + #collision_volumes + #attachments + 2, // rounded to next multiple of 4. -const U32 LL_CHARACTER_MAX_ANIMATED_JOINTS = 216; // must be divisible by 4! -const U32 LL_MAX_JOINTS_PER_MESH_OBJECT = 110; +constexpr U32 LL_CHARACTER_MAX_ANIMATED_JOINTS = 216; // must be divisible by 4! +constexpr U32 LL_MAX_JOINTS_PER_MESH_OBJECT = 110; // These should be higher than the joint_num of any // other joint, to avoid conflicts in updateMotionsByType() -const U32 LL_HAND_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-1); -const U32 LL_FACE_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-2); -const S32 LL_CHARACTER_MAX_PRIORITY = 7; -const F32 LL_MAX_PELVIS_OFFSET = 5.f; +constexpr U32 LL_HAND_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-1); +constexpr U32 LL_FACE_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-2); +constexpr S32 LL_CHARACTER_MAX_PRIORITY = 7; +constexpr F32 LL_MAX_PELVIS_OFFSET = 5.f; -const F32 LL_JOINT_TRESHOLD_POS_OFFSET = 0.0001f; //0.1 mm +constexpr F32 LL_JOINT_TRESHOLD_POS_OFFSET = 0.0001f; //0.1 mm class LLVector3OverrideMap { diff --git a/indra/llcommon/tests/llstring_test.cpp b/indra/llcommon/tests/llstring_test.cpp index a7aa347222..3e31a5d667 100644 --- a/indra/llcommon/tests/llstring_test.cpp +++ b/indra/llcommon/tests/llstring_test.cpp @@ -231,7 +231,7 @@ namespace tut template<> template<> void string_index_object_t::test<17>() { - BOOL value; + bool value; std::string str_val("1"); ensure("convertToBOOL 1 failed", LLStringUtil::convertToBOOL(str_val, value) && value); str_val = "T"; diff --git a/indra/llfilesystem/lldir_linux.cpp b/indra/llfilesystem/lldir_linux.cpp index 80ad05345a..44e24a1625 100644 --- a/indra/llfilesystem/lldir_linux.cpp +++ b/indra/llfilesystem/lldir_linux.cpp @@ -247,11 +247,11 @@ bool LLDir_Linux::fileExists(const std::string &filename) const int res = stat(filename.c_str(), &stat_data); if (!res) { - return TRUE; + return true; } else { - return FALSE; + return false; } } diff --git a/indra/llfilesystem/lldir_win32.cpp b/indra/llfilesystem/lldir_win32.cpp index b3b3afb37e..41a70bf724 100644 --- a/indra/llfilesystem/lldir_win32.cpp +++ b/indra/llfilesystem/lldir_win32.cpp @@ -47,7 +47,9 @@ DWORD GetDllVersion(LPCTSTR lpszDllName); namespace { // anonymous - enum class prst { INIT, OPEN, SKIP } state = prst::INIT; + enum class prst { INIT, OPEN, SKIP }; + prst state{ prst::INIT }; + // This is called so early that we can't count on static objects being // properly constructed yet, so declare a pointer instead of an instance. std::ofstream* prelogf = nullptr; @@ -75,6 +77,7 @@ namespace (*prelogf) << "========================================================================" << std::endl; // fall through, don't break + [[fallthrough]]; case prst::OPEN: (*prelogf) << message << std::endl; @@ -253,7 +256,7 @@ LLDir_Win32::LLDir_Win32() // Determine the location of the App-Read-Only-Data // Try the working directory then the exe's dir. - mAppRODataDir = mWorkingDir; + mAppRODataDir = mWorkingDir; // if (mExecutableDir.find("indra") == std::string::npos) @@ -379,11 +382,11 @@ bool LLDir_Win32::fileExists(const std::string &filename) const int res = LLFile::stat(filename, &stat_data); if (!res) { - return TRUE; + return true; } else { - return FALSE; + return false; } } diff --git a/indra/llfilesystem/lldir_win32.h b/indra/llfilesystem/lldir_win32.h index 450efaf9da..fa6d5fd320 100644 --- a/indra/llfilesystem/lldir_win32.h +++ b/indra/llfilesystem/lldir_win32.h @@ -50,7 +50,7 @@ public: /*virtual*/ std::string getLLPluginFilename(std::string base_name); private: - void* mDirSearch_h; + void* mDirSearch_h{ nullptr }; llutf16string mCurrentDir; }; diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index 032396ca33..ae27fcbe48 100644 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -277,7 +277,7 @@ bool font_desc_init_from_xml(LLXMLNodePtr node, LLFontDescriptor& desc) if (child->hasAttribute("load_collection")) { - BOOL col = FALSE; + bool col = false; child->getAttributeBOOL("load_collection", col); if (col) { diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 138ba8bf02..c122ab1c9b 100644 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -930,10 +930,10 @@ bool LLXUIParser::writeFlag(Parser& parser, const void* val_ptr, name_stack_t& s bool LLXUIParser::readBoolValue(Parser& parser, void* val_ptr) { - S32 value; + bool value; LLXUIParser& self = static_cast<LLXUIParser&>(parser); bool success = self.mCurReadNode->getBoolValue(1, &value); - *((bool*)val_ptr) = (value != FALSE); + *((bool*)val_ptr) = (value != false); return success; } diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 455df13e48..9c7ac66f01 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -44,13 +44,13 @@ #include "lldir.h" // static -BOOL LLXMLNode::sStripEscapedStrings = TRUE; -BOOL LLXMLNode::sStripWhitespaceValues = FALSE; +bool LLXMLNode::sStripEscapedStrings = true; +bool LLXMLNode::sStripWhitespaceValues = false; LLXMLNode::LLXMLNode() : mID(""), mParser(NULL), - mIsAttribute(FALSE), + mIsAttribute(false), mVersionMajor(0), mVersionMinor(0), mLength(0), @@ -69,7 +69,7 @@ LLXMLNode::LLXMLNode() : { } -LLXMLNode::LLXMLNode(const char* name, BOOL is_attribute) : +LLXMLNode::LLXMLNode(const char* name, bool is_attribute) : mID(""), mParser(NULL), mIsAttribute(is_attribute), @@ -91,7 +91,7 @@ LLXMLNode::LLXMLNode(const char* name, BOOL is_attribute) : mName = gStringTable.addStringEntry(name); } -LLXMLNode::LLXMLNode(LLStringTableEntry* name, BOOL is_attribute) : +LLXMLNode::LLXMLNode(LLStringTableEntry* name, bool is_attribute) : mID(""), mParser(NULL), mIsAttribute(is_attribute), @@ -193,17 +193,17 @@ LLXMLNode::~LLXMLNode() mDefault = NULL; } -BOOL LLXMLNode::isNull() +bool LLXMLNode::isNull() { return (mName == NULL); } // protected -BOOL LLXMLNode::removeChild(LLXMLNode *target_child) +bool LLXMLNode::removeChild(LLXMLNode *target_child) { if (!target_child) { - return FALSE; + return false; } if (target_child->mIsAttribute) { @@ -212,7 +212,7 @@ BOOL LLXMLNode::removeChild(LLXMLNode *target_child) { target_child->mParent = NULL; mAttributes.erase(children_itr); - return TRUE; + return true; } } else if (mChildren.notNull()) @@ -244,7 +244,7 @@ BOOL LLXMLNode::removeChild(LLXMLNode *target_child) { mChildren = NULL; } - return TRUE; + return true; } else if (children_itr->first != target_child->mName) { @@ -256,7 +256,7 @@ BOOL LLXMLNode::removeChild(LLXMLNode *target_child) } } } - return FALSE; + return false; } void LLXMLNode::addChild(LLXMLNodePtr& new_child) @@ -302,13 +302,13 @@ void LLXMLNode::addChild(LLXMLNodePtr& new_child) } // virtual -LLXMLNodePtr LLXMLNode::createChild(const char* name, BOOL is_attribute) +LLXMLNodePtr LLXMLNode::createChild(const char* name, bool is_attribute) { return createChild(gStringTable.addStringEntry(name), is_attribute); } // virtual -LLXMLNodePtr LLXMLNode::createChild(LLStringTableEntry* name, BOOL is_attribute) +LLXMLNodePtr LLXMLNode::createChild(LLStringTableEntry* name, bool is_attribute) { LLXMLNodePtr ret(new LLXMLNode(name, is_attribute)); ret->mID.clear(); @@ -317,13 +317,13 @@ LLXMLNodePtr LLXMLNode::createChild(LLStringTableEntry* name, BOOL is_attribute) return ret; } -BOOL LLXMLNode::deleteChild(LLXMLNode *child) +bool LLXMLNode::deleteChild(LLXMLNode *child) { if (removeChild(child)) { - return TRUE; + return true; } - return FALSE; + return false; } void LLXMLNode::setParent(LLXMLNodePtr& new_parent) @@ -375,7 +375,7 @@ void XMLCALL StartXMLNode(void *userData, const XML_Char **atts) { // Create a new node - LLXMLNode *new_node_ptr = new LLXMLNode(name, FALSE); + LLXMLNode *new_node_ptr = new LLXMLNode(name, false); LLXMLNodePtr new_node = new_node_ptr; new_node->mID.clear(); @@ -480,9 +480,9 @@ void XMLCALL StartXMLNode(void *userData, // only one attribute child per description LLXMLNodePtr attr_node; - if (!new_node->getAttribute(attr_name.c_str(), attr_node, FALSE)) + if (!new_node->getAttribute(attr_name.c_str(), attr_node, false)) { - attr_node = new LLXMLNode(attr_name.c_str(), TRUE); + attr_node = new LLXMLNode(attr_name.c_str(), true); attr_node->setLineNumber(XML_GetCurrentLineNumber(*new_node_ptr->mParser)); } attr_node->setValue(attr_value); @@ -508,13 +508,13 @@ void XMLCALL EndXMLNode(void *userData, if (LLXMLNode::sStripWhitespaceValues) { std::string value = node->getValue(); - BOOL is_empty = TRUE; + bool is_empty = true; for (std::string::size_type s = 0; s < value.length(); s++) { char c = value[s]; if (c != ' ' && c != '\t' && c != '\n') { - is_empty = FALSE; + is_empty = false; break; } } @@ -575,7 +575,7 @@ bool LLXMLNode::updateNode( if (!node || !update_node) { LL_WARNS() << "Node invalid" << LL_ENDL; - return FALSE; + return false; } //update the node value @@ -647,7 +647,7 @@ bool LLXMLNode::updateNode( } } - return TRUE; + return true; } // static @@ -688,7 +688,7 @@ bool LLXMLNode::parseBuffer( XML_SetCharacterDataHandler(my_parser, XMLData); // Create a root node - LLXMLNode *file_node_ptr = new LLXMLNode("XML", FALSE); + LLXMLNode *file_node_ptr = new LLXMLNode("XML", false); LLXMLNodePtr file_node = file_node_ptr; file_node->mParser = &my_parser; @@ -696,7 +696,7 @@ bool LLXMLNode::parseBuffer( XML_SetUserData(my_parser, (void *)file_node_ptr); // Do the parsing - if (XML_Parse(my_parser, (const char *)buffer, length, TRUE) != XML_STATUS_OK) + if (XML_Parse(my_parser, (const char *)buffer, length, true) != XML_STATUS_OK) { LL_WARNS() << "Error parsing xml error code: " << XML_ErrorString(XML_GetErrorCode(my_parser)) @@ -736,7 +736,7 @@ bool LLXMLNode::parseStream( XML_SetCharacterDataHandler(my_parser, XMLData); // Create a root node - LLXMLNode *file_node_ptr = new LLXMLNode("XML", FALSE); + LLXMLNode *file_node_ptr = new LLXMLNode("XML", false); LLXMLNodePtr file_node = file_node_ptr; file_node->mParser = &my_parser; @@ -784,18 +784,18 @@ bool LLXMLNode::parseStream( } -BOOL LLXMLNode::isFullyDefault() +bool LLXMLNode::isFullyDefault() { if (mDefault.isNull()) { - return FALSE; + return false; } - BOOL has_default_value = (mValue == mDefault->mValue); - BOOL has_default_attribute = (mIsAttribute == mDefault->mIsAttribute); - BOOL has_default_type = mIsAttribute || (mType == mDefault->mType); - BOOL has_default_encoding = mIsAttribute || (mEncoding == mDefault->mEncoding); - BOOL has_default_precision = mIsAttribute || (mPrecision == mDefault->mPrecision); - BOOL has_default_length = mIsAttribute || (mLength == mDefault->mLength); + bool has_default_value = (mValue == mDefault->mValue); + bool has_default_attribute = (mIsAttribute == mDefault->mIsAttribute); + bool has_default_type = mIsAttribute || (mType == mDefault->mType); + bool has_default_encoding = mIsAttribute || (mEncoding == mDefault->mEncoding); + bool has_default_precision = mIsAttribute || (mPrecision == mDefault->mPrecision); + bool has_default_length = mIsAttribute || (mLength == mDefault->mLength); if (has_default_value && has_default_type @@ -813,14 +813,14 @@ BOOL LLXMLNode::isFullyDefault() LLXMLNodePtr child = (*children_itr).second; if (!child->isFullyDefault()) { - return FALSE; + return false; } } } - return TRUE; + return true; } - return FALSE; + return false; } // static @@ -908,10 +908,10 @@ void LLXMLNode::writeToOstream(std::ostream& output_stream, const std::string& i return; } - BOOL has_default_type = mDefault.isNull()?FALSE:(mType == mDefault->mType); - BOOL has_default_encoding = mDefault.isNull()?FALSE:(mEncoding == mDefault->mEncoding); - BOOL has_default_precision = mDefault.isNull()?FALSE:(mPrecision == mDefault->mPrecision); - BOOL has_default_length = mDefault.isNull()?FALSE:(mLength == mDefault->mLength); + bool has_default_type = mDefault.isNull()?false:(mType == mDefault->mType); + bool has_default_encoding = mDefault.isNull()?false:(mEncoding == mDefault->mEncoding); + bool has_default_precision = mDefault.isNull()?false:(mPrecision == mDefault->mPrecision); + bool has_default_length = mDefault.isNull()?false:(mLength == mDefault->mLength); // stream the name output_stream << indent << "<" << mName->mString << "\n"; @@ -1153,12 +1153,12 @@ void LLXMLNode::scrubToTree(LLXMLNode *tree) } } -bool LLXMLNode::getChild(const char* 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); } -bool LLXMLNode::getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing) +bool LLXMLNode::getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, bool use_default_if_missing) { if (mChildren.notNull()) { @@ -1171,18 +1171,18 @@ bool LLXMLNode::getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, BOO } if (use_default_if_missing && !mDefault.isNull()) { - return mDefault->getChild(name, node, FALSE); + return mDefault->getChild(name, node, false); } node = NULL; return false; } -void LLXMLNode::getChildren(const char* 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); } -void LLXMLNode::getChildren(const LLStringTableEntry* name, LLXMLNodeList &children, BOOL use_default_if_missing) const +void LLXMLNode::getChildren(const LLStringTableEntry* name, LLXMLNodeList &children, bool use_default_if_missing) const { if (mChildren.notNull()) { @@ -1204,7 +1204,7 @@ void LLXMLNode::getChildren(const LLStringTableEntry* name, LLXMLNodeList &child } if (children.size() == 0 && use_default_if_missing && !mDefault.isNull()) { - mDefault->getChildren(name, children, FALSE); + mDefault->getChildren(name, children, false); } } @@ -1227,12 +1227,12 @@ void LLXMLNode::getDescendants(const LLStringTableEntry* name, LLXMLNodeList &ch } } -bool LLXMLNode::getAttribute(const char* 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); } -bool LLXMLNode::getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing) +bool LLXMLNode::getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, bool use_default_if_missing) { LLXMLAttribList::const_iterator child_itr = mAttributes.find(name); if (child_itr != mAttributes.end()) @@ -1242,7 +1242,7 @@ bool LLXMLNode::getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, } if (use_default_if_missing && !mDefault.isNull()) { - return mDefault->getAttribute(name, node, FALSE); + return mDefault->getAttribute(name, node, false); } return false; @@ -1261,42 +1261,25 @@ bool LLXMLNode::setAttributeString(const char* attr, const std::string& value) return false; } -BOOL LLXMLNode::hasAttribute(const char* name ) +bool LLXMLNode::hasAttribute(const char* name ) { LLXMLNodePtr node; return getAttribute(name, node); } -// the structure of these getAttribute_ functions is ugly, but it's because the -// underlying system is based on BOOL and LLString; if we change -// so that they're based on more generic mechanisms, these will be -// simplified. -bool LLXMLNode::getAttribute_bool(const char* name, bool& value ) -{ - LLXMLNodePtr node; - if (!getAttribute(name, node)) - { - return false; - } - BOOL temp; - bool retval = node->getBoolValue(1, &temp); - value = temp; - return retval; -} - -BOOL LLXMLNode::getAttributeBOOL(const char* 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 char* 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 char* name, S8& value ) +bool LLXMLNode::getAttributeS8(const char* name, S8& value ) { LLXMLNodePtr node; S32 val; @@ -1308,7 +1291,7 @@ BOOL LLXMLNode::getAttributeS8(const char* name, S8& value ) return true; } -BOOL LLXMLNode::getAttributeU16(const char* name, U16& value ) +bool LLXMLNode::getAttributeU16(const char* name, U16& value ) { LLXMLNodePtr node; U32 val; @@ -1320,7 +1303,7 @@ BOOL LLXMLNode::getAttributeU16(const char* name, U16& value ) return true; } -BOOL LLXMLNode::getAttributeS16(const char* name, S16& value ) +bool LLXMLNode::getAttributeS16(const char* name, S16& value ) { LLXMLNodePtr node; S32 val; @@ -1332,73 +1315,73 @@ BOOL LLXMLNode::getAttributeS16(const char* name, S16& value ) return true; } -BOOL LLXMLNode::getAttributeU32(const char* 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 char* 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 char* 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 char* 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 char* 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 char* 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 char* 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 char* 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 char* 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 char* 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 char* 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 char* name, std::string& value ) +bool LLXMLNode::getAttributeString(const char* name, std::string& value ) { LLXMLNodePtr node; if (!getAttribute(name, node)) @@ -1435,10 +1418,10 @@ const char *LLXMLNode::skipNonWhitespace(const char *str) } /*static */ -const char *LLXMLNode::parseInteger(const char *str, U64 *dest, BOOL *is_negative, U32 precision, Encoding encoding) +const char *LLXMLNode::parseInteger(const char *str, U64 *dest, bool *is_negative, U32 precision, Encoding encoding) { *dest = 0; - *is_negative = FALSE; + *is_negative = false; str = skipWhitespace(str); @@ -1452,7 +1435,7 @@ const char *LLXMLNode::parseInteger(const char *str, U64 *dest, BOOL *is_negativ } if (str[0] == '-') { - *is_negative = TRUE; + *is_negative = true; ++str; } @@ -1653,7 +1636,7 @@ const char *LLXMLNode::parseFloat(const char *str, F64 *dest, U32 precision, Enc // Scientific notation! ++str; U64 exp; - BOOL is_negative; + bool is_negative; str = parseInteger(str, &exp, &is_negative, 64, ENCODING_DECIMAL); if (str == NULL) { @@ -1677,7 +1660,7 @@ const char *LLXMLNode::parseFloat(const char *str, F64 *dest, U32 precision, Enc if (encoding == ENCODING_HEX) { U64 bytes_dest; - BOOL is_negative; + bool is_negative; str = parseInteger(str, (U64 *)&bytes_dest, &is_negative, precision, ENCODING_HEX); // Upcast to F64 switch (precision) @@ -1700,7 +1683,7 @@ const char *LLXMLNode::parseFloat(const char *str, F64 *dest, U32 precision, Enc return NULL; } -U32 LLXMLNode::getBoolValue(U32 expected_length, BOOL *array) +U32 LLXMLNode::getBoolValue(U32 expected_length, bool *array) { llassert(array); @@ -1720,11 +1703,11 @@ U32 LLXMLNode::getBoolValue(U32 expected_length, BOOL *array) LLStringUtil::toLower(str_array[i]); if (str_array[i] == "false") { - array[ret_length++] = FALSE; + array[ret_length++] = false; } else if (str_array[i] == "true") { - array[ret_length++] = TRUE; + array[ret_length++] = true; } } @@ -1770,7 +1753,7 @@ U32 LLXMLNode::getByteValue(U32 expected_length, U8 *array, Encoding encoding) for (i=0; i<expected_length; ++i) { U64 value; - BOOL is_negative; + bool is_negative; value_string = parseInteger(value_string, &value, &is_negative, 8, encoding); if (value_string == NULL) { @@ -1822,7 +1805,7 @@ U32 LLXMLNode::getIntValue(U32 expected_length, S32 *array, Encoding encoding) for (i=0; i<expected_length; ++i) { U64 value; - BOOL is_negative; + bool is_negative; value_string = parseInteger(value_string, &value, &is_negative, 32, encoding); if (value_string == NULL) { @@ -1876,7 +1859,7 @@ U32 LLXMLNode::getUnsignedValue(U32 expected_length, U32 *array, Encoding encodi for (i=0; i<expected_length; ++i) { U64 value; - BOOL is_negative; + bool is_negative; value_string = parseInteger(value_string, &value, &is_negative, 32, encoding); if (value_string == NULL) { @@ -1930,7 +1913,7 @@ U32 LLXMLNode::getLongValue(U32 expected_length, U64 *array, Encoding encoding) for (i=0; i<expected_length; ++i) { U64 value; - BOOL is_negative; + bool is_negative; value_string = parseInteger(value_string, &value, &is_negative, 64, encoding); if (value_string == NULL) { @@ -2185,7 +2168,7 @@ U32 LLXMLNode::getNodeRefValue(U32 expected_length, LLXMLNode **array) return num_returned_refs; } -void LLXMLNode::setBoolValue(U32 length, const BOOL *array) +void LLXMLNode::setBoolValue(U32 length, const bool *array) { if (length == 0) return; @@ -2614,7 +2597,7 @@ void LLXMLNode::findDefault(LLXMLNode *defaults_list) mDefault = NULL; } -BOOL LLXMLNode::deleteChildren(const std::string& name) +bool LLXMLNode::deleteChildren(const std::string& name) { U32 removed_count = 0; LLXMLNodeList node_list; @@ -2633,10 +2616,10 @@ BOOL LLXMLNode::deleteChildren(const std::string& name) } } } - return removed_count > 0 ? TRUE : FALSE; + return removed_count > 0; } -BOOL LLXMLNode::deleteChildren(LLStringTableEntry* name) +bool LLXMLNode::deleteChildren(LLStringTableEntry* name) { U32 removed_count = 0; LLXMLNodeList node_list; @@ -2655,7 +2638,7 @@ BOOL LLXMLNode::deleteChildren(LLStringTableEntry* name) } } } - return removed_count > 0 ? TRUE : FALSE; + return removed_count > 0; } void LLXMLNode::setAttributes(LLXMLNode::ValueType type, U32 precision, LLXMLNode::Encoding encoding, U32 length) @@ -2778,7 +2761,7 @@ void LLXMLNode::createUnitTest(S32 max_num_children) child_name.append(1, c); } - LLXMLNode *new_child = createChild(child_name.c_str(), FALSE); + LLXMLNode *new_child = createChild(child_name.c_str(), false); // Random ID std::string child_id; @@ -2805,7 +2788,7 @@ void LLXMLNode::createUnitTest(S32 max_num_children) break; case 1: // TYPE_BOOLEAN { - BOOL random_bool_values[30]; + bool random_bool_values[30]; for (U32 value=0; value<array_size; ++value) { random_bool_values[value] = get_rand(2); @@ -2913,20 +2896,20 @@ void LLXMLNode::createUnitTest(S32 max_num_children) } } - createChild("integer_checksum", TRUE)->setUnsignedValue(1, &integer_checksum, LLXMLNode::ENCODING_HEX); - createChild("long_checksum", TRUE)->setLongValue(1, &long_checksum, LLXMLNode::ENCODING_HEX); - createChild("bool_true_count", TRUE)->setUnsignedValue(1, &bool_true_count, LLXMLNode::ENCODING_HEX); - createChild("uuid_checksum", TRUE)->setUUIDValue(1, &uuid_checksum); - createChild("noderef_checksum", TRUE)->setUnsignedValue(1, &noderef_checksum, LLXMLNode::ENCODING_HEX); - createChild("float_checksum", TRUE)->setUnsignedValue(1, &float_checksum, LLXMLNode::ENCODING_HEX); + createChild("integer_checksum", true)->setUnsignedValue(1, &integer_checksum, LLXMLNode::ENCODING_HEX); + createChild("long_checksum", true)->setLongValue(1, &long_checksum, LLXMLNode::ENCODING_HEX); + createChild("bool_true_count", true)->setUnsignedValue(1, &bool_true_count, LLXMLNode::ENCODING_HEX); + createChild("uuid_checksum", true)->setUUIDValue(1, &uuid_checksum); + createChild("noderef_checksum", true)->setUnsignedValue(1, &noderef_checksum, LLXMLNode::ENCODING_HEX); + createChild("float_checksum", true)->setUnsignedValue(1, &float_checksum, LLXMLNode::ENCODING_HEX); } -BOOL LLXMLNode::performUnitTest(std::string &error_buffer) +bool LLXMLNode::performUnitTest(std::string &error_buffer) { if (mChildren.isNull()) { error_buffer.append(llformat("ERROR Node %s: No children found.\n", mName->mString)); - return FALSE; + return false; } // Checksums @@ -2950,14 +2933,14 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (!node->performUnitTest(error_buffer)) { error_buffer.append(llformat("Child test failed for %s.\n", mName->mString)); - //return FALSE; + //return false; } continue; } if (node->mLength < 1 || node->mLength > 30) { error_buffer.append(llformat("ERROR Node %s: Invalid array length %d, child %s.\n", mName->mString, node->mLength, node->mName->mString)); - return FALSE; + return false; } switch (node->mType) { @@ -2966,11 +2949,11 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) break; case TYPE_BOOLEAN: { - BOOL bool_array[30]; + bool bool_array[30]; if (node->getBoolValue(node->mLength, bool_array) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read boolean array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<(U32)node->mLength; ++pos) { @@ -2989,7 +2972,7 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (node->getUnsignedValue(node->mLength, integer_array, node->mEncoding) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read integer array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<(U32)node->mLength; ++pos) { @@ -3002,7 +2985,7 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (node->getLongValue(node->mLength, integer_array, node->mEncoding) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read long integer array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<(U32)node->mLength; ++pos) { @@ -3019,7 +3002,7 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (node->getFloatValue(node->mLength, float_array, node->mEncoding) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read float array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<(U32)node->mLength; ++pos) { @@ -3033,7 +3016,7 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (node->getDoubleValue(node->mLength, float_array, node->mEncoding) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read float array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<(U32)node->mLength; ++pos) { @@ -3051,7 +3034,7 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (node->getUUIDValue(node->mLength, uuid_array) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read uuid array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<(U32)node->mLength; ++pos) { @@ -3068,7 +3051,7 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (node->getNodeRefValue(node->mLength, node_array) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read node ref array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<node->mLength; ++pos) { @@ -3089,97 +3072,97 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) // Compare checksums { U32 node_integer_checksum = 0; - if (!getAttribute("integer_checksum", checksum_node, FALSE) || + if (!getAttribute("integer_checksum", checksum_node, false) || checksum_node->getUnsignedValue(1, &node_integer_checksum, ENCODING_HEX) != 1) { error_buffer.append(llformat("ERROR Node %s: Integer checksum missing.\n", mName->mString)); - return FALSE; + return false; } if (node_integer_checksum != integer_checksum) { error_buffer.append(llformat("ERROR Node %s: Integer checksum mismatch: read %X / calc %X.\n", mName->mString, node_integer_checksum, integer_checksum)); - return FALSE; + return false; } } { U64 node_long_checksum = 0; - if (!getAttribute("long_checksum", checksum_node, FALSE) || + if (!getAttribute("long_checksum", checksum_node, false) || checksum_node->getLongValue(1, &node_long_checksum, ENCODING_HEX) != 1) { error_buffer.append(llformat("ERROR Node %s: Long Integer checksum missing.\n", mName->mString)); - return FALSE; + return false; } if (node_long_checksum != long_checksum) { U32 *pp1 = (U32 *)&node_long_checksum; U32 *pp2 = (U32 *)&long_checksum; error_buffer.append(llformat("ERROR Node %s: Long Integer checksum mismatch: read %08X%08X / calc %08X%08X.\n", mName->mString, pp1[1], pp1[0], pp2[1], pp2[0])); - return FALSE; + return false; } } { U32 node_bool_true_count = 0; - if (!getAttribute("bool_true_count", checksum_node, FALSE) || + if (!getAttribute("bool_true_count", checksum_node, false) || checksum_node->getUnsignedValue(1, &node_bool_true_count, ENCODING_HEX) != 1) { error_buffer.append(llformat("ERROR Node %s: Boolean checksum missing.\n", mName->mString)); - return FALSE; + return false; } if (node_bool_true_count != bool_true_count) { error_buffer.append(llformat("ERROR Node %s: Boolean checksum mismatch: read %X / calc %X.\n", mName->mString, node_bool_true_count, bool_true_count)); - return FALSE; + return false; } } { LLUUID node_uuid_checksum; - if (!getAttribute("uuid_checksum", checksum_node, FALSE) || + if (!getAttribute("uuid_checksum", checksum_node, false) || checksum_node->getUUIDValue(1, &node_uuid_checksum) != 1) { error_buffer.append(llformat("ERROR Node %s: UUID checksum missing.\n", mName->mString)); - return FALSE; + return false; } if (node_uuid_checksum != uuid_checksum) { error_buffer.append(llformat("ERROR Node %s: UUID checksum mismatch: read %s / calc %s.\n", mName->mString, node_uuid_checksum.asString().c_str(), uuid_checksum.asString().c_str())); - return FALSE; + return false; } } { U32 node_noderef_checksum = 0; - if (!getAttribute("noderef_checksum", checksum_node, FALSE) || + if (!getAttribute("noderef_checksum", checksum_node, false) || checksum_node->getUnsignedValue(1, &node_noderef_checksum, ENCODING_HEX) != 1) { error_buffer.append(llformat("ERROR Node %s: Node Ref checksum missing.\n", mName->mString)); - return FALSE; + return false; } if (node_noderef_checksum != noderef_checksum) { error_buffer.append(llformat("ERROR Node %s: Node Ref checksum mismatch: read %X / calc %X.\n", mName->mString, node_noderef_checksum, noderef_checksum)); - return FALSE; + return false; } } { U32 node_float_checksum = 0; - if (!getAttribute("float_checksum", checksum_node, FALSE) || + if (!getAttribute("float_checksum", checksum_node, false) || checksum_node->getUnsignedValue(1, &node_float_checksum, ENCODING_HEX) != 1) { error_buffer.append(llformat("ERROR Node %s: Float checksum missing.\n", mName->mString)); - return FALSE; + return false; } if (node_float_checksum != float_checksum) { error_buffer.append(llformat("ERROR Node %s: Float checksum mismatch: read %X / calc %X.\n", mName->mString, node_float_checksum, float_checksum)); - return FALSE; + return false; } } - return TRUE; + return true; } LLXMLNodePtr LLXMLNode::getFirstChild() const diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index 0b8da5dc5d..21a7dee4cc 100644 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -57,9 +57,9 @@ struct CompareAttributes bool operator()(const LLStringTableEntry* const lhs, const LLStringTableEntry* const rhs) const { if (lhs == NULL) - return TRUE; + return true; if (rhs == NULL) - return FALSE; + return true; return strcmp(lhs->mString, rhs->mString) < 0; } @@ -118,14 +118,14 @@ protected: public: LLXMLNode(); - LLXMLNode(const char* name, BOOL is_attribute); - LLXMLNode(LLStringTableEntry* name, BOOL is_attribute); + LLXMLNode(const char* name, bool is_attribute); + LLXMLNode(LLStringTableEntry* name, bool is_attribute); LLXMLNode(const LLXMLNode& rhs); LLXMLNodePtr deepCopy(); - BOOL isNull(); + bool isNull(); - BOOL deleteChild(LLXMLNode* child); + bool deleteChild(LLXMLNode* child); void addChild(LLXMLNodePtr& new_child); void setParent(LLXMLNodePtr& new_parent); // reparent if necessary @@ -165,12 +165,12 @@ public: void findID(const std::string& id, LLXMLNodeList &results); - virtual LLXMLNodePtr createChild(const char* name, BOOL is_attribute); - virtual LLXMLNodePtr createChild(LLStringTableEntry* name, BOOL is_attribute); + virtual LLXMLNodePtr createChild(const char* name, bool is_attribute); + virtual LLXMLNodePtr createChild(LLStringTableEntry* name, bool is_attribute); // Getters - U32 getBoolValue(U32 expected_length, BOOL *array); + U32 getBoolValue(U32 expected_length, bool *array); U32 getByteValue(U32 expected_length, U8 *array, Encoding encoding = ENCODING_DEFAULT); U32 getIntValue(U32 expected_length, S32 *array, Encoding encoding = ENCODING_DEFAULT); U32 getUnsignedValue(U32 expected_length, U32 *array, Encoding encoding = ENCODING_DEFAULT); @@ -181,29 +181,25 @@ public: U32 getUUIDValue(U32 expected_length, LLUUID *array); U32 getNodeRefValue(U32 expected_length, LLXMLNode **array); - BOOL hasAttribute(const char* name ); - - // these are designed to be more generic versions of the functions - // rather than relying on LL-types - bool getAttribute_bool(const char* name, bool& value ); - - 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 ); + 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; } @@ -212,23 +208,23 @@ public: std::string getSanitizedValue() const; std::string getTextContents() const; const LLStringTableEntry* getName() const { return mName; } - BOOL hasName(const char* name) const { return mName == gStringTable.checkStringEntry(name); } - BOOL hasName(const std::string& name) const { return mName == gStringTable.checkStringEntry(name.c_str()); } + bool hasName(const char* name) const { return mName == gStringTable.checkStringEntry(name); } + 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 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 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 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 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; // recursively finds all children at any level matching name void getDescendants(const LLStringTableEntry* name, LLXMLNodeList &children) const; - 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); + 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); S32 getLineNumber(); @@ -242,7 +238,7 @@ public: bool setAttributeString(const char* attr, const std::string& value); - void setBoolValue(const BOOL value) { setBoolValue(1, &value); } + void setBoolValue(const bool value) { setBoolValue(1, &value); } void setByteValue(const U8 value, Encoding encoding = ENCODING_DEFAULT) { setByteValue(1, &value, encoding); } void setIntValue(const S32 value, Encoding encoding = ENCODING_DEFAULT) { setIntValue(1, &value, encoding); } void setUnsignedValue(const U32 value, Encoding encoding = ENCODING_DEFAULT) { setUnsignedValue(1, &value, encoding); } @@ -253,7 +249,7 @@ public: void setUUIDValue(const LLUUID value) { setUUIDValue(1, &value); } void setNodeRefValue(const LLXMLNode *value) { setNodeRefValue(1, &value); } - void setBoolValue(U32 length, const BOOL *array); + void setBoolValue(U32 length, const bool *array); void setByteValue(U32 length, const U8 *array, Encoding encoding = ENCODING_DEFAULT); void setIntValue(U32 length, const S32 *array, Encoding encoding = ENCODING_DEFAULT); void setUnsignedValue(U32 length, const U32* array, Encoding encoding = ENCODING_DEFAULT); @@ -283,17 +279,17 @@ public: // Delete any child nodes that aren't among the tree's children, recursive void scrubToTree(LLXMLNode *tree); - BOOL deleteChildren(const std::string& name); - BOOL deleteChildren(LLStringTableEntry* name); + bool deleteChildren(const std::string& name); + bool deleteChildren(LLStringTableEntry* name); void setAttributes(ValueType type, U32 precision, Encoding encoding, U32 length); // void appendValue(const std::string& value); // Unused // Unit Testing void createUnitTest(S32 max_num_children); - BOOL performUnitTest(std::string &error_buffer); + bool performUnitTest(std::string &error_buffer); protected: - BOOL removeChild(LLXMLNode* child); + bool removeChild(LLXMLNode* child); public: std::string mID; // The ID attribute of this node @@ -315,8 +311,8 @@ public: LLXMLNodePtr mPrev; // Double-linked list previous node LLXMLNodePtr mNext; // Double-linked list next node - static BOOL sStripEscapedStrings; - static BOOL sStripWhitespaceValues; + static bool sStripEscapedStrings; + static bool sStripWhitespaceValues; protected: LLStringTableEntry *mName; // The name of this node @@ -330,10 +326,10 @@ protected: static const char *skipWhitespace(const char *str); static const char *skipNonWhitespace(const char *str); - static const char *parseInteger(const char *str, U64 *dest, BOOL *is_negative, U32 precision, Encoding encoding); + static const char *parseInteger(const char *str, U64 *dest, bool *is_negative, U32 precision, Encoding encoding); static const char *parseFloat(const char *str, F64 *dest, U32 precision, Encoding encoding); - BOOL isFullyDefault(); + bool isFullyDefault(); }; #endif // LL_LLXMLNODE diff --git a/indra/llxml/llxmlparser.cpp b/indra/llxml/llxmlparser.cpp index 1bdc283f67..f4116626f6 100644 --- a/indra/llxml/llxmlparser.cpp +++ b/indra/llxml/llxmlparser.cpp @@ -66,17 +66,17 @@ LLXmlParser::~LLXmlParser() } -BOOL LLXmlParser::parseFile(const std::string &path) +bool LLXmlParser::parseFile(const std::string &path) { llassert( !mDepth ); - BOOL success = TRUE; + bool success = true; LLFILE* file = LLFile::fopen(path, "rb"); /* Flawfinder: ignore */ if( !file ) { mAuxErrorString = llformat( "Couldn't open file %s", path.c_str()); - success = FALSE; + success = false; } else { @@ -90,7 +90,7 @@ BOOL LLXmlParser::parseFile(const std::string &path) if( !buffer ) { mAuxErrorString = llformat( "Unable to allocate XML buffer while reading file %s", path.c_str() ); - success = FALSE; + success = false; goto exit_label; } @@ -98,14 +98,14 @@ BOOL LLXmlParser::parseFile(const std::string &path) if( bytes_read <= 0 ) { mAuxErrorString = llformat( "Error while reading file %s", path.c_str() ); - success = FALSE; + success = false; goto exit_label; } - if( !XML_ParseBuffer(mParser, bytes_read, TRUE ) ) + if( !XML_ParseBuffer(mParser, bytes_read, true ) ) { mAuxErrorString = llformat( "Error while parsing file %s", path.c_str() ); - success = FALSE; + success = false; } exit_label: diff --git a/indra/llxml/llxmlparser.h b/indra/llxml/llxmlparser.h index a5b210404f..c5025ef450 100644 --- a/indra/llxml/llxmlparser.h +++ b/indra/llxml/llxmlparser.h @@ -43,7 +43,7 @@ public: virtual ~LLXmlParser(); // Parses entire file - BOOL parseFile(const std::string &path); + bool parseFile(const std::string &path); // Parses some input. Returns 0 if a fatal error is detected. // The last call must have isFinal true; diff --git a/indra/llxml/llxmltree.cpp b/indra/llxml/llxmltree.cpp index 4991e99a96..be3bcf2a66 100644 --- a/indra/llxml/llxmltree.cpp +++ b/indra/llxml/llxmltree.cpp @@ -61,13 +61,13 @@ void LLXmlTree::cleanup() } -BOOL LLXmlTree::parseFile(const std::string &path, BOOL keep_contents) +bool LLXmlTree::parseFile(const std::string &path, bool keep_contents) { delete mRoot; mRoot = NULL; LLXmlTreeParser parser(this); - BOOL success = parser.parseFile( path, &mRoot, keep_contents ); + bool success = parser.parseFile( path, &mRoot, keep_contents ); if( !success ) { S32 line_number = parser.getCurrentLineNumber(); @@ -135,7 +135,7 @@ void LLXmlTreeNode::dump( const std::string& prefix ) LL_CONT << LL_ENDL; } -BOOL LLXmlTreeNode::hasAttribute(const std::string& name) +bool LLXmlTreeNode::hasAttribute(const std::string& name) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); attribute_map_t::iterator iter = mAttributes.find(canonical_name); @@ -205,106 +205,106 @@ bool LLXmlTreeNode::getFastAttributeBOOL(LLStdStringHandle canonical_name, bool& return s && LLStringUtil::convertToBOOL( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeU8(LLStdStringHandle canonical_name, U8& value) +bool LLXmlTreeNode::getFastAttributeU8(LLStdStringHandle canonical_name, U8& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToU8( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeS8(LLStdStringHandle canonical_name, S8& value) +bool LLXmlTreeNode::getFastAttributeS8(LLStdStringHandle canonical_name, S8& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToS8( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeS16(LLStdStringHandle canonical_name, S16& value) +bool LLXmlTreeNode::getFastAttributeS16(LLStdStringHandle canonical_name, S16& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToS16( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeU16(LLStdStringHandle canonical_name, U16& value) +bool LLXmlTreeNode::getFastAttributeU16(LLStdStringHandle canonical_name, U16& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToU16( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeU32(LLStdStringHandle canonical_name, U32& value) +bool LLXmlTreeNode::getFastAttributeU32(LLStdStringHandle canonical_name, U32& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToU32( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeS32(LLStdStringHandle canonical_name, S32& value) +bool LLXmlTreeNode::getFastAttributeS32(LLStdStringHandle canonical_name, S32& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToS32( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeF32(LLStdStringHandle canonical_name, F32& value) +bool LLXmlTreeNode::getFastAttributeF32(LLStdStringHandle canonical_name, F32& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToF32( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeF64(LLStdStringHandle canonical_name, F64& value) +bool LLXmlTreeNode::getFastAttributeF64(LLStdStringHandle canonical_name, F64& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToF64( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeColor(LLStdStringHandle canonical_name, LLColor4& value) +bool LLXmlTreeNode::getFastAttributeColor(LLStdStringHandle canonical_name, LLColor4& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLColor4::parseColor(*s, &value) : FALSE; + return s ? LLColor4::parseColor(*s, &value) : false; } -BOOL LLXmlTreeNode::getFastAttributeColor4(LLStdStringHandle canonical_name, LLColor4& value) +bool LLXmlTreeNode::getFastAttributeColor4(LLStdStringHandle canonical_name, LLColor4& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLColor4::parseColor4(*s, &value) : FALSE; + return s ? LLColor4::parseColor4(*s, &value) : false; } -BOOL LLXmlTreeNode::getFastAttributeColor4U(LLStdStringHandle canonical_name, LLColor4U& value) +bool LLXmlTreeNode::getFastAttributeColor4U(LLStdStringHandle canonical_name, LLColor4U& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLColor4U::parseColor4U(*s, &value ) : FALSE; + return s ? LLColor4U::parseColor4U(*s, &value ) : false; } -BOOL LLXmlTreeNode::getFastAttributeVector3(LLStdStringHandle canonical_name, LLVector3& value) +bool LLXmlTreeNode::getFastAttributeVector3(LLStdStringHandle canonical_name, LLVector3& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLVector3::parseVector3(*s, &value ) : FALSE; + return s ? LLVector3::parseVector3(*s, &value ) : false; } -BOOL LLXmlTreeNode::getFastAttributeVector3d(LLStdStringHandle canonical_name, LLVector3d& value) +bool LLXmlTreeNode::getFastAttributeVector3d(LLStdStringHandle canonical_name, LLVector3d& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLVector3d::parseVector3d(*s, &value ) : FALSE; + return s ? LLVector3d::parseVector3d(*s, &value ) : false; } -BOOL LLXmlTreeNode::getFastAttributeQuat(LLStdStringHandle canonical_name, LLQuaternion& value) +bool LLXmlTreeNode::getFastAttributeQuat(LLStdStringHandle canonical_name, LLQuaternion& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLQuaternion::parseQuat(*s, &value ) : FALSE; + return s ? LLQuaternion::parseQuat(*s, &value ) : false; } -BOOL LLXmlTreeNode::getFastAttributeUUID(LLStdStringHandle canonical_name, LLUUID& value) +bool LLXmlTreeNode::getFastAttributeUUID(LLStdStringHandle canonical_name, LLUUID& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLUUID::parseUUID(*s, &value ) : FALSE; + return s ? LLUUID::parseUUID(*s, &value ) : false; } -BOOL LLXmlTreeNode::getFastAttributeString(LLStdStringHandle canonical_name, std::string& value) +bool LLXmlTreeNode::getFastAttributeString(LLStdStringHandle canonical_name, std::string& value) { const std::string *s = getAttribute( canonical_name ); if( !s ) { - return FALSE; + return false; } value = *s; - return TRUE; + return true; } @@ -316,97 +316,97 @@ bool LLXmlTreeNode::getAttributeBOOL(const std::string& name, bool& value) return getFastAttributeBOOL(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeU8(const std::string& name, U8& value) +bool LLXmlTreeNode::getAttributeU8(const std::string& name, U8& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeU8(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeS8(const std::string& name, S8& value) +bool LLXmlTreeNode::getAttributeS8(const std::string& name, S8& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeS8(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeS16(const std::string& name, S16& value) +bool LLXmlTreeNode::getAttributeS16(const std::string& name, S16& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeS16(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeU16(const std::string& name, U16& value) +bool LLXmlTreeNode::getAttributeU16(const std::string& name, U16& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeU16(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeU32(const std::string& name, U32& value) +bool LLXmlTreeNode::getAttributeU32(const std::string& name, U32& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeU32(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeS32(const std::string& name, S32& value) +bool LLXmlTreeNode::getAttributeS32(const std::string& name, S32& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeS32(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeF32(const std::string& name, F32& value) +bool LLXmlTreeNode::getAttributeF32(const std::string& name, F32& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeF32(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeF64(const std::string& name, F64& value) +bool LLXmlTreeNode::getAttributeF64(const std::string& name, F64& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeF64(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeColor(const std::string& name, LLColor4& value) +bool LLXmlTreeNode::getAttributeColor(const std::string& name, LLColor4& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeColor(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeColor4(const std::string& name, LLColor4& value) +bool LLXmlTreeNode::getAttributeColor4(const std::string& name, LLColor4& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeColor4(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeColor4U(const std::string& name, LLColor4U& value) +bool LLXmlTreeNode::getAttributeColor4U(const std::string& name, LLColor4U& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeColor4U(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeVector3(const std::string& name, LLVector3& value) +bool LLXmlTreeNode::getAttributeVector3(const std::string& name, LLVector3& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeVector3(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeVector3d(const std::string& name, LLVector3d& value) +bool LLXmlTreeNode::getAttributeVector3d(const std::string& name, LLVector3d& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeVector3d(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeQuat(const std::string& name, LLQuaternion& value) +bool LLXmlTreeNode::getAttributeQuat(const std::string& name, LLQuaternion& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeQuat(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeUUID(const std::string& name, LLUUID& value) +bool LLXmlTreeNode::getAttributeUUID(const std::string& name, LLUUID& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeUUID(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeString(const std::string& name, std::string& value) +bool LLXmlTreeNode::getAttributeString(const std::string& name, std::string& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeString(canonical_name, value); @@ -506,8 +506,8 @@ LLXmlTreeParser::LLXmlTreeParser(LLXmlTree* tree) : mTree(tree), mRoot( NULL ), mCurrent( NULL ), - mDump( FALSE ), - mKeepContents(FALSE) + mDump( false ), + mKeepContents(false) { } @@ -515,14 +515,14 @@ LLXmlTreeParser::~LLXmlTreeParser() { } -BOOL LLXmlTreeParser::parseFile(const std::string &path, LLXmlTreeNode** root, BOOL keep_contents) +bool LLXmlTreeParser::parseFile(const std::string &path, LLXmlTreeNode** root, bool keep_contents) { llassert( !mRoot ); llassert( !mCurrent ); mKeepContents = keep_contents; - BOOL success = LLXmlParser::parseFile(path); + bool success = LLXmlParser::parseFile(path); *root = mRoot; mRoot = NULL; @@ -685,7 +685,7 @@ void LLXmlTreeParser::unparsedEntityDecl( void test_llxmltree() { LLXmlTree tree; - BOOL success = tree.parseFile( "test.xml" ); + bool success = tree.parseFile( "test.xml" ); if( success ) { tree.dump(); diff --git a/indra/llxml/llxmltree.h b/indra/llxml/llxmltree.h index 5d33e2c660..5d15c4c7f5 100644 --- a/indra/llxml/llxmltree.h +++ b/indra/llxml/llxmltree.h @@ -55,7 +55,7 @@ public: virtual ~LLXmlTree(); void cleanup(); - virtual BOOL parseFile(const std::string &path, BOOL keep_contents = TRUE); + virtual bool parseFile(const std::string &path, bool keep_contents = true); LLXmlTreeNode* getRoot() { return mRoot; } @@ -97,50 +97,50 @@ public: { return mName; } - BOOL hasName( const std::string& name ) + bool hasName( const std::string& name ) { return mName == name; } - BOOL hasAttribute( const std::string& name ); + bool hasAttribute( const std::string& name ); // Fast versions use cannonical_name handlee to entru in LLXmlTree::sAttributeKeys string table bool getFastAttributeBOOL( LLStdStringHandle cannonical_name, bool& value ); - BOOL getFastAttributeU8( LLStdStringHandle cannonical_name, U8& value ); - BOOL getFastAttributeS8( LLStdStringHandle cannonical_name, S8& value ); - BOOL getFastAttributeU16( LLStdStringHandle cannonical_name, U16& value ); - BOOL getFastAttributeS16( LLStdStringHandle cannonical_name, S16& value ); - BOOL getFastAttributeU32( LLStdStringHandle cannonical_name, U32& value ); - BOOL getFastAttributeS32( LLStdStringHandle cannonical_name, S32& value ); - BOOL getFastAttributeF32( LLStdStringHandle cannonical_name, F32& value ); - BOOL getFastAttributeF64( LLStdStringHandle cannonical_name, F64& value ); - BOOL getFastAttributeColor( LLStdStringHandle cannonical_name, LLColor4& value ); - BOOL getFastAttributeColor4( LLStdStringHandle cannonical_name, LLColor4& value ); - BOOL getFastAttributeColor4U( LLStdStringHandle cannonical_name, LLColor4U& value ); - BOOL getFastAttributeVector3( LLStdStringHandle cannonical_name, LLVector3& value ); - 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, std::string& value ); + bool getFastAttributeU8( LLStdStringHandle cannonical_name, U8& value ); + bool getFastAttributeS8( LLStdStringHandle cannonical_name, S8& value ); + bool getFastAttributeU16( LLStdStringHandle cannonical_name, U16& value ); + bool getFastAttributeS16( LLStdStringHandle cannonical_name, S16& value ); + bool getFastAttributeU32( LLStdStringHandle cannonical_name, U32& value ); + bool getFastAttributeS32( LLStdStringHandle cannonical_name, S32& value ); + bool getFastAttributeF32( LLStdStringHandle cannonical_name, F32& value ); + bool getFastAttributeF64( LLStdStringHandle cannonical_name, F64& value ); + bool getFastAttributeColor( LLStdStringHandle cannonical_name, LLColor4& value ); + bool getFastAttributeColor4( LLStdStringHandle cannonical_name, LLColor4& value ); + bool getFastAttributeColor4U( LLStdStringHandle cannonical_name, LLColor4U& value ); + bool getFastAttributeVector3( LLStdStringHandle cannonical_name, LLVector3& value ); + 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, std::string& value ); // Normal versions find 'name' in LLXmlTree::sAttributeKeys then call fast versions virtual bool getAttributeBOOL( const std::string& name, bool& value ); - virtual BOOL getAttributeU8( const std::string& name, U8& value ); - virtual BOOL getAttributeS8( const std::string& name, S8& value ); - virtual BOOL getAttributeU16( const std::string& name, U16& value ); - virtual BOOL getAttributeS16( const std::string& name, S16& value ); - virtual BOOL getAttributeU32( const std::string& name, U32& value ); - virtual BOOL getAttributeS32( const std::string& name, S32& value ); - virtual BOOL getAttributeF32( const std::string& name, F32& value ); - virtual BOOL getAttributeF64( const std::string& name, F64& value ); - virtual BOOL getAttributeColor( const std::string& name, LLColor4& value ); - virtual BOOL getAttributeColor4( const std::string& name, LLColor4& value ); - virtual BOOL getAttributeColor4U( const std::string& name, LLColor4U& value ); - virtual BOOL getAttributeVector3( const std::string& name, LLVector3& value ); - 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, std::string& value ); + virtual bool getAttributeU8( const std::string& name, U8& value ); + virtual bool getAttributeS8( const std::string& name, S8& value ); + virtual bool getAttributeU16( const std::string& name, U16& value ); + virtual bool getAttributeS16( const std::string& name, S16& value ); + virtual bool getAttributeU32( const std::string& name, U32& value ); + virtual bool getAttributeS32( const std::string& name, S32& value ); + virtual bool getAttributeF32( const std::string& name, F32& value ); + virtual bool getAttributeF64( const std::string& name, F64& value ); + virtual bool getAttributeColor( const std::string& name, LLColor4& value ); + virtual bool getAttributeColor4( const std::string& name, LLColor4& value ); + virtual bool getAttributeColor4U( const std::string& name, LLColor4U& value ); + virtual bool getAttributeVector3( const std::string& name, LLVector3& value ); + 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, std::string& value ); const std::string& getContents() { @@ -199,7 +199,7 @@ public: LLXmlTreeParser(LLXmlTree* tree); virtual ~LLXmlTreeParser(); - BOOL parseFile(const std::string &path, LLXmlTreeNode** root, BOOL keep_contents ); + bool parseFile(const std::string &path, LLXmlTreeNode** root, bool keep_contents ); protected: const std::string& tabs(); @@ -227,8 +227,8 @@ protected: LLXmlTree* mTree; LLXmlTreeNode* mRoot; LLXmlTreeNode* mCurrent; - BOOL mDump; // Dump parse tree to LL_INFOS() as it is read. - BOOL mKeepContents; + bool mDump; // Dump parse tree to LL_INFOS() as it is read. + bool mKeepContents; }; #endif // LL_LLXMLTREE_H diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 405432fe90..4a66bef86e 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -56,7 +56,7 @@ LLAgentWearables gAgentWearables; -BOOL LLAgentWearables::mInitialWearablesUpdateReceived = FALSE; +bool LLAgentWearables::mInitialWearablesUpdateReceived = false; using namespace LLAvatarAppearanceDefines; @@ -194,7 +194,7 @@ struct LLAgentDumper LLAgentWearables::LLAgentWearables() : LLWearableData(), - mWearablesLoaded(FALSE) + mWearablesLoaded(false) , mCOFChangeInProgress(false) { } @@ -375,7 +375,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, const std::string& description, - BOOL save_in_lost_and_found) + bool save_in_lost_and_found) { if (!isWearableCopyable(type, index)) { @@ -493,13 +493,13 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string& } -BOOL LLAgentWearables::isWearableModifiable(LLWearableType::EType type, U32 index) const +bool LLAgentWearables::isWearableModifiable(LLWearableType::EType type, U32 index) const { LLUUID item_id = getWearableItemID(type, index); - return item_id.notNull() ? isWearableModifiable(item_id) : FALSE; + return item_id.notNull() ? isWearableModifiable(item_id) : false; } -BOOL LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const +bool LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const { const LLUUID& linked_id = gInventory.getLinkedItemID(item_id); if (linked_id.notNull()) @@ -508,13 +508,13 @@ BOOL LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const if (item && item->getPermissions().allowModifyBy(gAgent.getID(), gAgent.getGroupID())) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) const +bool LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) const { LLUUID item_id = getWearableItemID(type, index); if (!item_id.isNull()) @@ -523,27 +523,11 @@ BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) if (item && item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID())) { - return TRUE; + return true; } } - return FALSE; -} - -/* - U32 LLAgentWearables::getWearablePermMask(LLWearableType::EType type) - { - LLUUID item_id = getWearableItemID(type); - if (!item_id.isNull()) - { - LLInventoryItem* item = gInventory.getItem(item_id); - if (item) - { - return item->getPermissions().getMaskOwner(); - } - } - return PERM_NONE; - } -*/ + return false; +} LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::EType type, U32 index) { @@ -617,7 +601,7 @@ const LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType } // static -BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type) +bool LLAgentWearables::selfHasWearable(LLWearableType::EType type) { return (gAgentWearables.getWearableCount(type) > 0); } @@ -675,9 +659,9 @@ const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U3 return LLUUID(); } -BOOL LLAgentWearables::isWearingItem(const LLUUID& item_id) const +bool LLAgentWearables::isWearingItem(const LLUUID& item_id) const { - return getWearableFromItemID(item_id) != NULL; + return getWearableFromItemID(item_id) != nullptr; } void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index) @@ -772,21 +756,21 @@ void LLAgentWearables::createStandardWearables() if (!isAgentAvatarValid()) return; - const BOOL create[LLWearableType::WT_COUNT] = + constexpr bool create[LLWearableType::WT_COUNT] = { - TRUE, //LLWearableType::WT_SHAPE - TRUE, //LLWearableType::WT_SKIN - TRUE, //LLWearableType::WT_HAIR - TRUE, //LLWearableType::WT_EYES - TRUE, //LLWearableType::WT_SHIRT - TRUE, //LLWearableType::WT_PANTS - TRUE, //LLWearableType::WT_SHOES - TRUE, //LLWearableType::WT_SOCKS - FALSE, //LLWearableType::WT_JACKET - FALSE, //LLWearableType::WT_GLOVES - TRUE, //LLWearableType::WT_UNDERSHIRT - TRUE, //LLWearableType::WT_UNDERPANTS - FALSE //LLWearableType::WT_SKIRT + true, //LLWearableType::WT_SHAPE + true, //LLWearableType::WT_SKIN + true, //LLWearableType::WT_HAIR + true, //LLWearableType::WT_EYES + true, //LLWearableType::WT_SHIRT + true, //LLWearableType::WT_PANTS + true, //LLWearableType::WT_SHOES + true, //LLWearableType::WT_SOCKS + false, //LLWearableType::WT_JACKET + false, //LLWearableType::WT_GLOVES + true, //LLWearableType::WT_UNDERSHIRT + true, //LLWearableType::WT_UNDERPANTS + false //LLWearableType::WT_SKIRT }; LLPointer<LLInventoryCallback> cb = new OnWearableItemCreatedCB; @@ -865,7 +849,7 @@ void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index) void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb, LLViewerWearable* wearable, const LLUUID& category_id, - BOOL notify) + bool notify) { create_inventory_wearable(gAgent.getID(), gAgent.getSessionID(), @@ -987,7 +971,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it S32 matched = 0, mismatched = 0; const S32 arr_size = LLWearableType::WT_COUNT; S32 type_counts[arr_size]; - BOOL update_inventory = FALSE; + bool update_inventory{ false }; std::fill(type_counts,type_counts+arr_size,0); for (S32 i = 0; i < count; i++) { @@ -1025,7 +1009,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it << curr_wearable->getName() << " vs " << new_item->getName() << " item ids " << curr_wearable->getItemID() << " vs " << new_item->getUUID() << LL_ENDL; - update_inventory = TRUE; + update_inventory = true; continue; } // If we got here, everything matches. @@ -1092,7 +1076,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it pushWearable(type,new_wearable); } - const BOOL removed = FALSE; + constexpr bool removed = false; wearableUpdated(new_wearable, removed); } } @@ -1110,7 +1094,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it if (isAgentAvatarValid()) { - gAgentAvatarp->setCompositeUpdatesEnabled(TRUE); + gAgentAvatarp->setCompositeUpdatesEnabled(true); // If we have not yet declouded, we may want to use // baked texture UUIDs sent from the first objectUpdate message @@ -1124,7 +1108,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it } // Start rendering & update the server - mWearablesLoaded = TRUE; + mWearablesLoaded = true; notifyLoadingFinished(); @@ -1434,7 +1418,7 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra ++it) { const LLInventoryItem* item = *it; - LLAttachmentsMgr::instance().addAttachmentRequest(item->getLinkedUUID(), 0, TRUE); + LLAttachmentsMgr::instance().addAttachmentRequest(item->getLinkedUUID(), 0, true); } } @@ -1452,7 +1436,7 @@ bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_bod return wearable != marginal_wearable; } -BOOL LLAgentWearables::areWearablesLoaded() const +bool LLAgentWearables::areWearablesLoaded() const { return mWearablesLoaded; } @@ -1620,7 +1604,7 @@ void LLAgentWearables::editWearable(const LLUUID& item_id) return; } - const BOOL disable_camera_switch = LLWearableType::getInstance()->getDisableCameraSwitch(wearable->getType()); + const bool disable_camera_switch = LLWearableType::getInstance()->getDisableCameraSwitch(wearable->getType()); LLPanel* panel = LLFloaterSidePanelContainer::getPanel("appearance"); LLSidepanelAppearance::editWearable(wearable, panel, disable_camera_switch); } diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 2a888573d6..bb7837acf8 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -66,16 +66,14 @@ public: // Queries //-------------------------------------------------------------------- public: - BOOL isWearingItem(const LLUUID& item_id) const; - BOOL isWearableModifiable(LLWearableType::EType type, U32 index /*= 0*/) const; - BOOL isWearableModifiable(const LLUUID& item_id) const; + bool isWearingItem(const LLUUID& item_id) const; + bool isWearableModifiable(LLWearableType::EType type, U32 index /*= 0*/) const; + bool isWearableModifiable(const LLUUID& item_id) const; - BOOL isWearableCopyable(LLWearableType::EType type, U32 index /*= 0*/) const; - BOOL areWearablesLoaded() const; + bool isWearableCopyable(LLWearableType::EType type, U32 index /*= 0*/) const; + bool areWearablesLoaded() const; bool isCOFChangeInProgress() const { return mCOFChangeInProgress; } F32 getCOFChangeTime() const { return mCOFChangeTimer.getElapsedTimeF32(); } - void updateWearablesLoaded(); - void checkWearablesLoaded() const; bool canMoveWearable(const LLUUID& item_id, bool closer_to_body) const; // Note: False for shape, skin, eyes, and hair, unless you have MORE than 1. @@ -95,7 +93,7 @@ public: LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/); const LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const; LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type, U32 index /*= 0*/); - static BOOL selfHasWearable(LLWearableType::EType type); + static bool selfHasWearable(LLWearableType::EType type); //-------------------------------------------------------------------- // Setters @@ -116,20 +114,18 @@ protected: void addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb, LLViewerWearable* wearable, const LLUUID& category_id = LLUUID::null, - BOOL notify = TRUE); + bool notify = true); void addWearabletoAgentInventoryDone(const LLWearableType::EType type, const U32 index, const LLUUID& item_id, LLViewerWearable* wearable); - void recoverMissingWearable(const LLWearableType::EType type, U32 index /*= 0*/); - void recoverMissingWearableDone(); //-------------------------------------------------------------------- // Editing/moving wearables //-------------------------------------------------------------------- public: - static void createWearable(LLWearableType::EType type, bool wear = false, const LLUUID& parent_id = LLUUID::null, std::function<void(const LLUUID&)> created_cb = NULL); + static void createWearable(LLWearableType::EType type, bool wear = false, const LLUUID& parent_id = LLUUID::null, std::function<void(const LLUUID&)> created_cb = nullptr); static void editWearable(const LLUUID& item_id); bool moveWearable(const LLViewerInventoryItem* item, bool closer_to_body); @@ -159,7 +155,7 @@ private: // Save Wearables //-------------------------------------------------------------------- public: - void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, const std::string& description, BOOL save_in_lost_and_found); + void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, const std::string& description, bool save_in_lost_and_found); void saveWearable(const LLWearableType::EType type, const U32 index, const std::string new_name = ""); void saveAllWearables(); @@ -212,13 +208,13 @@ private: // Member variables //-------------------------------------------------------------------- private: - static BOOL mInitialWearablesUpdateReceived; - BOOL mWearablesLoaded; + static bool mInitialWearablesUpdateReceived; + bool mWearablesLoaded; /** * True if agent's outfit is being changed now. */ - BOOL mCOFChangeInProgress; + bool mCOFChangeInProgress; LLTimer mCOFChangeTimer; //-------------------------------------------------------------------------------- diff --git a/indra/newview/llmimetypes.cpp b/indra/newview/llmimetypes.cpp index 790a184068..d374263c49 100644 --- a/indra/newview/llmimetypes.cpp +++ b/indra/newview/llmimetypes.cpp @@ -131,15 +131,15 @@ bool LLMIMETypes::parseMIMETypes(const std::string& xml_filename) } if (child->hasName("allow_resize")) { - BOOL allow_resize = FALSE; + bool allow_resize = false; child->getBoolValue( 1, &allow_resize ); - info.mAllowResize = (bool)allow_resize; + info.mAllowResize = allow_resize; } if (child->hasName("allow_looping")) { - BOOL allow_looping = FALSE; + bool allow_looping = false; child->getBoolValue( 1, &allow_looping ); - info.mAllowLooping = (bool)allow_looping; + info.mAllowLooping = allow_looping; } } sWidgetMap[set_name] = info; diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp index 22d70d482b..08b47d9df3 100644 --- a/indra/newview/llviewerjoint.cpp +++ b/indra/newview/llviewerjoint.cpp @@ -38,7 +38,7 @@ #include "llvoavatar.h" #include "pipeline.h" -static const S32 MIN_PIXEL_AREA_3PASS_HAIR = 64*64; +static constexpr S32 MIN_PIXEL_AREA_3PASS_HAIR = 64*64; //----------------------------------------------------------------------------- // LLViewerJoint() diff --git a/indra/newview/llviewerjointattachment.cpp b/indra/newview/llviewerjointattachment.cpp index eed482b598..7e99844717 100644 --- a/indra/newview/llviewerjointattachment.cpp +++ b/indra/newview/llviewerjointattachment.cpp @@ -45,19 +45,19 @@ #include "llglheaders.h" extern LLPipeline gPipeline; -const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters +constexpr F32 MAX_ATTACHMENT_DIST = 3.5f; // meters //----------------------------------------------------------------------------- // LLViewerJointAttachment() //----------------------------------------------------------------------------- LLViewerJointAttachment::LLViewerJointAttachment() : - mVisibleInFirst(FALSE), + mVisibleInFirst(false), mGroup(0), - mIsHUDAttachment(FALSE), + mIsHUDAttachment(false), mPieSlice(-1) { - mValid = FALSE; - mUpdateXform = FALSE; + mValid = false; + mUpdateXform = false; mAttachedObjects.clear(); } @@ -236,7 +236,7 @@ void LLViewerJointAttachment::removeObject(LLViewerObject *object) } // force object visibile - setAttachmentVisibility(TRUE); + setAttachmentVisibility(true); mAttachedObjects.erase(iter); if (object->mDrawable.notNull()) @@ -309,7 +309,7 @@ void LLViewerJointAttachment::removeObject(LLViewerObject *object) } if (mAttachedObjects.size() == 0) { - mUpdateXform = FALSE; + mUpdateXform = false; } object->setAttachmentItemID(LLUUID::null); } @@ -426,11 +426,11 @@ void LLViewerJointAttachment::calcLOD() //----------------------------------------------------------------------------- bool LLViewerJointAttachment::updateLOD(F32 pixel_area, bool activate) { - BOOL res = FALSE; + bool res{ false }; if (!mValid) { - setValid(TRUE, TRUE); - res = TRUE; + setValid(true, true); + res = true; } return res; } @@ -462,7 +462,7 @@ const LLViewerObject *LLViewerJointAttachment::getAttachedObject(const LLUUID &o return attached_object; } } - return NULL; + return nullptr; } LLViewerObject *LLViewerJointAttachment::getAttachedObject(const LLUUID &object_id) @@ -477,5 +477,5 @@ LLViewerObject *LLViewerJointAttachment::getAttachedObject(const LLUUID &object_ return attached_object; } } - return NULL; + return nullptr; } diff --git a/indra/newview/llviewerjointattachment.h b/indra/newview/llviewerjointattachment.h index 883df5b2c4..c470ad783f 100644 --- a/indra/newview/llviewerjointattachment.h +++ b/indra/newview/llviewerjointattachment.h @@ -47,17 +47,15 @@ public: LLViewerJointAttachment(); virtual ~LLViewerJointAttachment(); - //virtual U32 render( F32 pixelArea ); // Returns triangle count - // Returns true if this object is transparent. // This is used to determine in which order to draw objects. - /*virtual*/ bool isTransparent(); + bool isTransparent() override; // Draws the shape attached to a joint. // Called by render(). - /*virtual*/ U32 drawShape( F32 pixelArea, bool first_pass, bool is_dummy ); + U32 drawShape( F32 pixelArea, bool first_pass, bool is_dummy ) override; - /*virtual*/ bool updateLOD(F32 pixel_area, bool activate); + bool updateLOD(F32 pixel_area, bool activate) override; // // accessors @@ -65,7 +63,7 @@ public: void setPieSlice(S32 pie_slice) { mPieSlice = pie_slice; } void setVisibleInFirstPerson(bool visibility) { mVisibleInFirst = visibility; } - BOOL getVisibleInFirstPerson() const { return mVisibleInFirst; } + bool getVisibleInFirstPerson() const { return mVisibleInFirst; } void setGroup(S32 group) { mGroup = group; } void setOriginalPosition(LLVector3 &position); void setAttachmentVisibility(bool visible); diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index fd45bc37b2..ef1ec357fb 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -108,7 +108,7 @@ void LLViewerJointMesh::uploadJointMatrices() S32 joint_num; LLPolyMesh *reference_mesh = mMesh->getReferenceMesh(); LLDrawPool *poolp = mFace ? mFace->getPool() : NULL; - BOOL hardware_skinning = (poolp && poolp->getShaderLevel() > 0) ? TRUE : FALSE; + bool hardware_skinning = (poolp && poolp->getShaderLevel() > 0); //calculate joint matrices for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++) @@ -123,7 +123,7 @@ void LLViewerJointMesh::uploadJointMatrices() gJointRotUnaligned[joint_num] = joint_mat.getMat3(); } - BOOL last_pivot_uploaded = FALSE; + bool last_pivot_uploaded{ false }; S32 j = 0; //upload joint pivots @@ -144,11 +144,11 @@ void LLViewerJointMesh::uploadJointMatrices() gJointPivot[j++] = child_pivot; - last_pivot_uploaded = TRUE; + last_pivot_uploaded = true; } else { - last_pivot_uploaded = FALSE; + last_pivot_uploaded = false; } } @@ -358,7 +358,7 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, bool damp_w } LLDrawPool *poolp = mFace->getPool(); - BOOL hardware_skinning = (poolp && poolp->getShaderLevel() > 0) ? TRUE : FALSE; + bool hardware_skinning = (poolp && poolp->getShaderLevel() > 0); if (!hardware_skinning && terse_update) { //no need to do terse updates if we're doing software vertex skinning diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h index c7f2b1bbac..1b4fa397ac 100644 --- a/indra/newview/llviewerjointmesh.h +++ b/indra/newview/llviewerjointmesh.h @@ -54,19 +54,19 @@ public: void uploadJointMatrices(); // overloaded from base class - /*virtual*/ U32 drawShape( F32 pixelArea, bool first_pass, bool is_dummy ); + U32 drawShape( F32 pixelArea, bool first_pass, bool is_dummy ) override; // necessary because MS's compiler warns on function inheritance via dominance in the diamond inheritance here. // warns even though LLViewerJoint holds the only non virtual implementation. - /*virtual*/ U32 render( F32 pixelArea, bool first_pass = true, bool is_dummy = false ) { return LLViewerJoint::render(pixelArea,first_pass,is_dummy);} + U32 render(F32 pixelArea, bool first_pass = true, bool is_dummy = false) override { return LLViewerJoint::render(pixelArea, first_pass, is_dummy); } - /*virtual*/ void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area); - /*virtual*/ void updateFaceData(LLFace *face, F32 pixel_area, bool damp_wind = false, bool terse_update = false); - /*virtual*/ bool updateLOD(F32 pixel_area, bool activate); - /*virtual*/ void updateJointGeometry(); - /*virtual*/ void dump(); + void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area) override; + void updateFaceData(LLFace *face, F32 pixel_area, bool damp_wind = false, bool terse_update = false) override; + bool updateLOD(F32 pixel_area, bool activate) override; + void updateJointGeometry() override; + void dump() override; - /*virtual*/ bool isAnimatable() const { return false; } + bool isAnimatable() const override { return false; } private: diff --git a/indra/newview/llviewertexlayer.h b/indra/newview/llviewertexlayer.h index d1c01bf1ad..832512ab85 100644 --- a/indra/newview/llviewertexlayer.h +++ b/indra/newview/llviewertexlayer.h @@ -124,7 +124,7 @@ protected: void doUpdate(); void restartUpdateTimer(); private: - BOOL mNeedsUpdate; // Whether we need to locally update our baked textures + bool mNeedsUpdate; // Whether we need to locally update our baked textures U32 mNumLowresUpdates; // Number of times we've locally updated with lowres version of our baked textures LLFrameTimer mNeedsUpdateTimer; // Tracks time since update was requested and performed. }; diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 478db3a6fc..9ba02e1ecc 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -135,7 +135,7 @@ void LLVOGrass::initClass() F32 F32_val; LLUUID id; - BOOL success = TRUE; + bool success{ true }; S32 species; static LLStdStringHandle species_id_string = LLXmlTree::addAttributeString("species_id"); @@ -188,7 +188,7 @@ void LLVOGrass::initClass() } } - BOOL have_all_grass = TRUE; + bool have_all_grass{ true }; std::string err; for (S32 i=0;i<sMaxGrassSpecies;++i) @@ -196,7 +196,7 @@ void LLVOGrass::initClass() if (!sSpeciesTable.count(i)) { err.append(llformat(" %d",i)); - have_all_grass = FALSE; + have_all_grass = false; } } diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 575b1dbe7e..cf7206d2da 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -135,10 +135,7 @@ void LLVOTree::initClass() LLUUID id; S32 S32_val; - BOOL success = TRUE; - - - + bool success{ true }; S32 species; static LLStdStringHandle species_id_string = LLXmlTree::addAttributeString("species_id"); if (!tree_def->getFastAttributeS32(species_id_string, species)) @@ -250,7 +247,7 @@ void LLVOTree::initClass() } } - BOOL have_all_trees = TRUE; + bool have_all_trees {true}; std::string err; for (S32 i=0;i<sMaxTreeSpecies;++i) @@ -258,7 +255,7 @@ void LLVOTree::initClass() if (!sSpeciesTable.count(i)) { err.append(llformat(" %d",i)); - have_all_trees = FALSE; + have_all_trees = false; } } |