diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-06-13 12:44:45 +0100 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-06-13 12:44:45 +0100 |
commit | d3418e5e65f7845f89b5ce2019bd635861573ed3 (patch) | |
tree | d56a1e629858cb89775c84c2a34b2282d29b2955 /indra/llinventory | |
parent | 818e970b3efe65f6e471d071ae5f01603f61da79 (diff) | |
parent | d50a34e6e37c34fb84ad232aad7b3bf2a3b3b408 (diff) |
merge
Diffstat (limited to 'indra/llinventory')
-rw-r--r-- | indra/llinventory/llinventory.cpp | 27 | ||||
-rw-r--r-- | indra/llinventory/llinventory.h | 6 |
2 files changed, 18 insertions, 15 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 2c767a4857..53830b1a14 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -85,10 +85,7 @@ LLInventoryObject::LLInventoryObject(const LLUUID& uuid, mType(type), mName(name) { - LLStringUtil::replaceNonstandardASCII(mName, ' '); - LLStringUtil::replaceChar(mName, '|', ' '); - LLStringUtil::trim(mName); - LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN); + correctInventoryName(mName); } LLInventoryObject::LLInventoryObject() : @@ -155,12 +152,8 @@ void LLInventoryObject::setUUID(const LLUUID& new_uuid) void LLInventoryObject::rename(const std::string& n) { std::string new_name(n); - LLStringUtil::replaceNonstandardASCII(new_name, ' '); - LLStringUtil::replaceChar(new_name, '|', ' '); - LLStringUtil::trim(new_name); - LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN); - - if( new_name != mName ) + correctInventoryName(new_name); + if( !new_name.empty() && new_name != mName ) { mName = new_name; } @@ -221,10 +214,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); - LLStringUtil::replaceNonstandardASCII(mName, ' '); - LLStringUtil::replaceChar(mName, '|', ' '); - LLStringUtil::trim(mName); - LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN); + correctInventoryName(mName); } else { @@ -284,6 +274,15 @@ void LLInventoryObject::updateServer(BOOL) const llwarns << "LLInventoryObject::updateServer() called. Doesn't do anything." << llendl; } +inline +void LLInventoryObject::correctInventoryName(std::string& name) +{ + LLStringUtil::replaceNonstandardASCII(name, ' '); + LLStringUtil::replaceChar(name, '|', ' '); + LLStringUtil::trim(name); + LLStringUtil::truncate(name, DB_INV_ITEM_NAME_STR_LEN); +} + ///---------------------------------------------------------------------------- /// Class LLInventoryItem diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index b083e305b1..4c6ac83ab8 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -92,9 +92,13 @@ public: void setParent(const LLUUID& new_parent); void setType(LLAssetType::EType type); +private: + // in place correction for inventory name string + void correctInventoryName(std::string& name); + //-------------------------------------------------------------------- // File Support - // Implemented here so that a minimal information set can be transmitted + // Implemented here so that a minimal information set can be transmitted // between simulator and viewer. //-------------------------------------------------------------------- public: |