diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 5850e28da..6976f0050 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -4184,7 +4184,7 @@ LLUUID LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, L // 2) Stuff with requests via makeLink and makeCopy // 3) Call dispatch() // 4) Let the LLPointer go out of scope. -class LLCreateLegacyOutfit : public LLBoostFuncInventoryCallbackFireOnce +class LLCreateLegacyOutfit final : public LLBoostFuncInventoryCallbackFireOnce { public: LLCreateLegacyOutfit(const LLUUID& folder_id, inventory_func_type fire_func, nullary_func_type destroy_func = no_op) : diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 4a7dea11f..3d020e9d4 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -34,6 +34,7 @@ #include "llagent.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llavatarnamecache.h" #include "llinventoryclipboard.h" #include "llinventorypanel.h" #include "llinventorybridge.h" @@ -67,7 +68,7 @@ #endif // Increment this if the inventory contents change in a non-backwards-compatible way. -// For viewers with link items support, former caches are incorrect. +// For viewer 2, the addition of link items makes a pre-viewer-2 cache incorrect. const S32 LLInventoryModel::sCurrentInvCacheVersion = 2; BOOL LLInventoryModel::sFirstTimeInViewer2 = TRUE; @@ -91,8 +92,8 @@ class LLCanCache : public LLInventoryCollectFunctor { public: LLCanCache(LLInventoryModel* model) : mModel(model) {} - virtual ~LLCanCache() {} - virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item); + virtual ~LLCanCache() = default; + bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) override; protected: LLInventoryModel* mModel; uuid_set_t mCachedCatIDs; @@ -136,7 +137,6 @@ LLInventoryModel gInventory; // Default constructor LLInventoryModel::LLInventoryModel() : // These are now ordered, keep them that way. - mBacklinkMMap(), mIsAgentInvUsable(false), mRootFolderID(), mLibraryRootFolderID(), @@ -145,7 +145,8 @@ LLInventoryModel::LLInventoryModel() mItemMap(), mParentChildCategoryTree(), mParentChildItemTree(), - mLastItem(NULL), + mBacklinkMMap(), + mLastItem(nullptr), mIsNotifyObservers(FALSE), mModifyMask(LLInventoryObserver::ALL), mChangedItemIDs(), @@ -184,7 +185,7 @@ BOOL LLInventoryModel::isObjectDescendentOf(const LLUUID& obj_id, if (obj_id == cat_id) return TRUE; //The while loop will ALWAYS return false if parent_id is null, regardless of cat_id being null too. Don't bother trying. if(cat_id.isNull()) return FALSE; - LLInventoryObject* obj = getObject(obj_id); + const LLInventoryObject* obj = getObject(obj_id); int depthCounter = 0; while(obj) { @@ -224,7 +225,11 @@ BOOL LLInventoryModel::isObjectDescendentOf(const LLUUID& obj_id, const LLViewerInventoryCategory *LLInventoryModel::getFirstNondefaultParent(const LLUUID& obj_id) const { const LLInventoryObject* obj = getObject(obj_id); - + if(!obj) + { + LL_WARNS(LOG_INV) << "Non-existent object [ id: " << obj_id << " ] " << LL_ENDL; + return nullptr; + } // Search up the parent chain until we get to root or an acceptable folder. // This assumes there are no cycles in the tree else we'll get a hang. LLUUID parent_id = obj->getParentUUID(); @@ -241,7 +246,7 @@ const LLViewerInventoryCategory *LLInventoryModel::getFirstNondefaultParent(cons } parent_id = cat->getParentUUID(); } - return NULL; + return nullptr; } // @@ -251,17 +256,17 @@ const LLViewerInventoryCategory* LLInventoryModel::getFirstDescendantOf(const LL { if (master_parent_id == obj_id) { - return NULL; + return nullptr; } const LLViewerInventoryCategory* current_cat = getCategory(obj_id); - if (current_cat == NULL) + if (current_cat == nullptr) { current_cat = getCategory(getObject(obj_id)->getParentUUID()); } - while (current_cat != NULL) + while (current_cat != nullptr) { const LLUUID& current_parent_id = current_cat->getParentUUID(); @@ -273,7 +278,7 @@ const LLViewerInventoryCategory* LLInventoryModel::getFirstDescendantOf(const LL current_cat = getCategory(current_parent_id); } - return NULL; + return nullptr; } bool LLInventoryModel::getObjectTopmostAncestor(const LLUUID& object_id, LLUUID& result) const @@ -306,21 +311,21 @@ LLInventoryObject* LLInventoryModel::getObject(const LLUUID& id) const { return item; } - return NULL; + return nullptr; } // Get the item by id. Returns NULL if not found. LLViewerInventoryItem* LLInventoryModel::getItem(const LLUUID& id) const { - LLViewerInventoryItem* item = NULL; + LLViewerInventoryItem* item = nullptr; if(mLastItem.notNull() && mLastItem->getUUID() == id) { item = mLastItem; } else { - item_map_t::const_iterator iter = mItemMap.find(id); - if (iter != mItemMap.end()) + const auto iter = mItemMap.find(id); + if (iter != mItemMap.cend()) { item = iter->second; mLastItem = item; @@ -332,13 +337,12 @@ LLViewerInventoryItem* LLInventoryModel::getItem(const LLUUID& id) const // Get the category by id. Returns NULL if not found LLViewerInventoryCategory* LLInventoryModel::getCategory(const LLUUID& id) const { - LLViewerInventoryCategory* category = NULL; - cat_map_t::const_iterator iter = mCategoryMap.find(id); - if (iter != mCategoryMap.end()) + const auto iter = mCategoryMap.find(id); + if (iter != mCategoryMap.cend()) { - category = iter->second; + return iter->second; } - return category; + return nullptr; } S32 LLInventoryModel::getItemCount() const @@ -384,7 +388,7 @@ LLMD5 LLInventoryModel::hashDirectDescendentNames(const LLUUID& cat_id) const } for (LLInventoryModel::item_array_t::const_iterator iter = item_array->begin(); iter != item_array->end(); - iter++) + ++iter) { const LLViewerInventoryItem *item = (*iter); if (!item) @@ -421,9 +425,9 @@ void LLInventoryModel::consolidateForType(const LLUUID& main_id, LLFolderType::E { // Make a list of folders that are not "main_id" and are of "type" uuid_vec_t folder_ids; - for (cat_map_t::iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit) + for (const auto& cat_pair : mCategoryMap) { - LLViewerInventoryCategory* cat = cit->second; + LLViewerInventoryCategory* cat = cat_pair.second; if ((cat->getPreferredType() == type) && (cat->getUUID() != main_id)) { folder_ids.push_back(cat->getUUID()); @@ -431,10 +435,8 @@ void LLInventoryModel::consolidateForType(const LLUUID& main_id, LLFolderType::E } // Iterate through those folders - for (auto folder_ids_it = folder_ids.begin(); folder_ids_it != folder_ids.end(); ++folder_ids_it) + for (LLUUID const& folder_id: folder_ids) { - LLUUID folder_id = (*folder_ids_it); - // Get the content of this folder cat_array_t* cats; item_array_t* items; @@ -477,6 +479,8 @@ void LLInventoryModel::consolidateForType(const LLUUID& main_id, LLFolderType::E } } + + const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot( LLFolderType::EType preferred_type, bool create_folder, @@ -489,7 +493,7 @@ const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot( } else if (root_id.notNull()) { - cat_array_t* cats = NULL; + cat_array_t* cats = nullptr; cats = get_ptr_in_map(mParentChildCategoryTree, root_id); if(cats) { @@ -554,7 +558,7 @@ LLUUID LLInventoryModel::findCategoryByName(std::string name) return LLUUID::null; } -class LLCreateInventoryCategoryResponder : public LLHTTPClient::ResponderWithResult +class LLCreateInventoryCategoryResponder final : public LLHTTPClient::ResponderWithResult { LOG_CLASS(LLCreateInventoryCategoryResponder); public: @@ -566,12 +570,12 @@ public: } protected: - virtual void httpFailure() + void httpFailure() override { LL_WARNS(LOG_INV) << dumpResponse() << LL_ENDL; } - virtual void httpSuccess() + void httpSuccess() override { //Server has created folder. const LLSD& content = getContent(); @@ -602,7 +606,7 @@ protected: } } - /*virtual*/ char const* getName(void) const { return "LLCreateInventoryCategoryResponder"; } + char const* getName(void) const override { return "LLCreateInventoryCategoryResponder"; } private: boost::optional mCallback; @@ -671,10 +675,15 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, return LLUUID::null; } + if (!gMessageSystem) + { + return LLUUID::null; + } + // Add the category to the internal representation LLPointer cat = new LLViewerInventoryCategory(id, parent_id, preferred_type, name, gAgent.getID()); - cat->setVersion(LLViewerInventoryCategory::VERSION_INITIAL); + cat->setVersion(LLViewerInventoryCategory::VERSION_INITIAL - 1); // accountForUpdate() will icrease version by 1 cat->setDescendentCount(0); LLCategoryUpdate update(cat->getParentUUID(), 1); accountForUpdate(update); @@ -709,7 +718,7 @@ bool LLInventoryModel::hasMatchingDirectDescendent(const LLUUID& cat_id, for (LLInventoryModel::cat_array_t::const_iterator it = cats->begin(); it != cats->end(); ++it) { - if (filter(*it,NULL)) + if (filter(*it, nullptr)) { return true; } @@ -720,7 +729,7 @@ bool LLInventoryModel::hasMatchingDirectDescendent(const LLUUID& cat_id, for (LLInventoryModel::item_array_t::const_iterator it = items->begin(); it != items->end(); ++it) { - if (filter(NULL,*it)) + if (filter(nullptr, *it)) { return true; } @@ -751,9 +760,10 @@ bool LLInventoryModel::hasMatchingDirectDescendent(const LLUUID& cat_id, class LLAlwaysCollect : public LLInventoryCollectFunctor { public: - virtual ~LLAlwaysCollect() {} - virtual bool operator()(LLInventoryCategory* cat, - LLInventoryItem* item) + virtual ~LLAlwaysCollect() = default; + + bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item) override { return TRUE; } @@ -796,7 +806,7 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, for(S32 i = 0; i < count; ++i) { LLViewerInventoryCategory* cat = cat_array->at(i); - if(add(cat,NULL)) + if(add(cat, nullptr)) { cats.push_back(cat); } @@ -807,7 +817,7 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, } } - LLViewerInventoryItem* item = NULL; + LLViewerInventoryItem* item = nullptr; item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, id); // Move onto items @@ -817,7 +827,7 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, for(S32 i = 0; i < count; ++i) { item = item_array->at(i); - if(add(NULL, item)) + if(add(nullptr, item)) { items.push_back(item); } @@ -870,11 +880,9 @@ void LLInventoryModel::addChangedMaskForLinks(const LLUUID& object_id, U32 mask) return; LLInventoryModel::item_array_t item_array = collectLinksTo(object_id); - for (LLInventoryModel::item_array_t::iterator iter = item_array.begin(); - iter != item_array.end(); - iter++) + for (auto& iter : item_array) { - LLViewerInventoryItem *linked_item = (*iter); + LLViewerInventoryItem *linked_item = iter; addChangedMask(mask, linked_item->getUUID()); }; } @@ -949,14 +957,6 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask) return mask; } - // We're hiding mesh types -#if 0 - if (item->getType() == LLAssetType::AT_MESH) - { - return mask; - } -#endif - LLPointer old_item = getItem(item->getUUID()); LLPointer new_item; if(old_item) @@ -965,12 +965,23 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask) new_item = old_item; LLUUID old_parent_id = old_item->getParentUUID(); LLUUID new_parent_id = item->getParentUUID(); + bool update_parent_on_server = false; + + if (new_parent_id.isNull()) + { + // item with null parent will end in random location and then in Lost&Found, + // either move to default folder as if it is new item or don't move at all + LL_WARNS(LOG_INV) << "Update attempts to reparent item " << item->getUUID() + << " to null folder. Moving to Lost&Found. Old item name: " << old_item->getName() + << ". New name: " << item->getName() + << "." << LL_ENDL; + new_parent_id = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); + update_parent_on_server = true; + } if(old_parent_id != new_parent_id) { - // need to update the parent-child tree - item_array_t* item_array; - item_array = get_ptr_in_map(mParentChildItemTree, old_parent_id); + item_array_t * item_array = get_ptr_in_map(mParentChildItemTree, old_parent_id); if(item_array) { vector_replace_with_last(*item_array, old_item); @@ -978,6 +989,11 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask) item_array = get_ptr_in_map(mParentChildItemTree, new_parent_id); if(item_array) { + if (update_parent_on_server) + { + LLInventoryModel::LLCategoryUpdate update(new_parent_id, 1); + gInventory.accountForUpdate(update); + } item_array->push_back(old_item); } mask |= LLInventoryObserver::STRUCTURE; @@ -991,6 +1007,12 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask) mask |= LLInventoryObserver::DESCRIPTION; } old_item->copyViewerItem(item); + if (update_parent_on_server) + { + // Parent id at server is null, so update server even if item already is in the same folder + old_item->setParent(new_parent_id); + new_item->updateParentOnServer(FALSE); + } mask |= LLInventoryObserver::INTERNAL; } else @@ -1006,8 +1028,11 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask) item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, category_id); if( item_array ) { + LLInventoryModel::LLCategoryUpdate update(category_id, 1); + gInventory.accountForUpdate(update); + // *FIX: bit of a hack to call update server from here... - new_item->updateServer(TRUE); + new_item->updateParentOnServer(FALSE); item_array->push_back(new_item); } else @@ -1048,9 +1073,11 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask) item_array = get_ptr_in_map(mParentChildItemTree, parent_id); if(item_array) { + LLInventoryModel::LLCategoryUpdate update(parent_id, 1); + gInventory.accountForUpdate(update); // *FIX: bit of a hack to call update server from // here... - new_item->updateServer(TRUE); + new_item->updateParentOnServer(FALSE); item_array->push_back(new_item); } else @@ -1073,19 +1100,17 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask) { // Valid UUID; set the item UUID and rename it new_item->setCreator(id); - std::string avatar_name; + LLAvatarName av_name; - if (gCacheName->getFullName(id, avatar_name)) + if (LLAvatarNameCache::get(id, &av_name)) { - new_item->rename(avatar_name); + new_item->rename(av_name.getLegacyName()); mask |= LLInventoryObserver::LABEL; } else { // Fetch the current name - gCacheName->get(id, FALSE, - boost::bind(&LLViewerInventoryItem::onCallingCardNameLookup, new_item.get(), - _1, _2, _3)); + LLAvatarNameCache::get(id, boost::bind(&LLViewerInventoryItem::onCallingCardNameLookup, new_item.get(), _1, _2)); } } @@ -1137,14 +1162,12 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat, U32 if(old_cat) { // We already have an old category, modify its values - U32 mask = LLInventoryObserver::NONE; LLUUID old_parent_id = old_cat->getParentUUID(); LLUUID new_parent_id = cat->getParentUUID(); if(old_parent_id != new_parent_id) { // need to update the parent-child tree - cat_array_t* cat_array; - cat_array = getUnlockedCatArray(old_parent_id); + cat_array_t* cat_array = getUnlockedCatArray(old_parent_id); if(cat_array) { vector_replace_with_last(*cat_array, old_cat); @@ -1178,8 +1201,7 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat, U32 addCategory(new_cat); // make sure this category is correctly referenced by its parent. - cat_array_t* cat_array; - cat_array = getUnlockedCatArray(cat->getParentUUID()); + cat_array_t* cat_array = getUnlockedCatArray(cat->getParentUUID()); if(cat_array) { cat_array->push_back(new_cat); @@ -1192,7 +1214,8 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat, U32 item_array_t* itemsp = new item_array_t; mParentChildCategoryTree[new_cat->getUUID()] = catsp; mParentChildItemTree[new_cat->getUUID()] = itemsp; - addChangedMask(LLInventoryObserver::ADD, cat->getUUID()); + mask |= LLInventoryObserver::ADD; + addChangedMask(mask, cat->getUUID()); } } @@ -1214,8 +1237,7 @@ void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id) LLPointer cat = getCategory(object_id); if(cat && (cat->getParentUUID() != cat_id)) { - cat_array_t* cat_array; - cat_array = getUnlockedCatArray(cat->getParentUUID()); + cat_array_t* cat_array = getUnlockedCatArray(cat->getParentUUID()); if(cat_array) vector_replace_with_last(*cat_array, cat); cat_array = getUnlockedCatArray(cat_id); cat->setParent(cat_id); @@ -1226,8 +1248,7 @@ void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id) LLPointer item = getItem(object_id); if(item && (item->getParentUUID() != cat_id)) { - item_array_t* item_array; - item_array = getUnlockedItemArray(item->getParentUUID()); + item_array_t* item_array = getUnlockedItemArray(item->getParentUUID()); if(item_array) vector_replace_with_last(*item_array, item); item_array = getUnlockedItemArray(cat_id); item->setParent(cat_id); @@ -1445,7 +1466,7 @@ void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id, bo if (getCategory(uu_id)) { cat_array_t* cat_list = getUnlockedCatArray(uu_id); - if (!cat_list || (cat_list->size() == 0)) + if (!cat_list || (cat_list->empty())) { deleteObject(uu_id, fix_broken_links); deleted_count++; @@ -1504,7 +1525,7 @@ void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links, boo } LL_DEBUGS(LOG_INV) << "Deleting inventory object " << id << LL_ENDL; - mLastItem = NULL; + mLastItem = nullptr; LLUUID parent_id = obj->getParentUUID(); mCategoryMap.erase(id); mItemMap.erase(id); @@ -1529,7 +1550,7 @@ void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links, boo item_list = getUnlockedItemArray(id); if(item_list) { - if (item_list->size()) + if (!item_list->empty()) { LL_WARNS(LOG_INV) << "Deleting cat " << id << " while it still has child items" << LL_ENDL; } @@ -1539,7 +1560,7 @@ void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links, boo cat_list = getUnlockedCatArray(id); if(cat_list) { - if (cat_list->size()) + if (!cat_list->empty()) { LL_WARNS(LOG_INV) << "Deleting cat " << id << " while it still has child cats" << LL_ENDL; } @@ -1561,7 +1582,7 @@ void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links, boo { updateLinkedObjectsFromPurge(id); } - obj = NULL; // delete obj + obj = nullptr; // delete obj if (do_notify_observers) { notifyObservers(); @@ -1574,12 +1595,12 @@ void LLInventoryModel::updateLinkedObjectsFromPurge(const LLUUID &baseobj_id) // REBUILD is expensive, so clear the current change list first else // everything else on the changelist will also get rebuilt. - if (item_array.size() > 0) + if (!item_array.empty()) { notifyObservers(); for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin(); iter != item_array.end(); - iter++) + ++iter) { const LLViewerInventoryItem *linked_item = (*iter); const LLUUID &item_id = linked_item->getUUID(); @@ -1609,7 +1630,7 @@ BOOL LLInventoryModel::containsObserver(LLInventoryObserver* observer) const void LLInventoryModel::idleNotifyObservers() { - if (mModifyMask == LLInventoryObserver::NONE && (mChangedItemIDs.size() == 0)) + if (mModifyMask == LLInventoryObserver::NONE && (mChangedItemIDs.empty())) { return; } @@ -1731,7 +1752,7 @@ void LLInventoryModel::cache( item_array_t items; LLCanCache can_cache(this); - can_cache(root_cat, NULL); + can_cache(root_cat, nullptr); collectDescendentsIf( parent_folder_id, categories, @@ -1780,8 +1801,7 @@ void LLInventoryModel::addCategory(LLViewerInventoryCategory* category) bool LLInventoryModel::hasBacklinkInfo(const LLUUID& link_id, const LLUUID& target_id) const { - std::pair range; - range = mBacklinkMMap.equal_range(target_id); + std::pair range = mBacklinkMMap.equal_range(target_id); for (backlink_mmap_t::const_iterator it = range.first; it != range.second; ++it) { if (it->second == link_id) @@ -1802,8 +1822,7 @@ void LLInventoryModel::addBacklinkInfo(const LLUUID& link_id, const LLUUID& targ void LLInventoryModel::removeBacklinkInfo(const LLUUID& link_id, const LLUUID& target_id) { - std::pair range; - range = mBacklinkMMap.equal_range(target_id); + std::pair range = mBacklinkMMap.equal_range(target_id); for (backlink_mmap_t::iterator it = range.first; it != range.second; ) { if (it->second == link_id) @@ -1824,11 +1843,7 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) llassert(item); if(item) { - // This can happen if assettype enums from llassettype.h ever change. - // For example, there is a known backwards compatibility issue in some viewer prototypes prior to when - // the AT_LINK enum changed from 23 to 24. - if ((item->getType() == LLAssetType::AT_NONE) - || LLAssetType::lookup(item->getType()) == LLAssetType::badLookup()) + if (item->getType() <= LLAssetType::AT_NONE) { LL_WARNS(LOG_INV) << "Got bad asset type for item [ name: " << item->getName() << " type: " << item->getType() @@ -1836,6 +1851,23 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) return; } + if (LLAssetType::lookup(item->getType()) == LLAssetType::badLookup()) + { + if (item->getType() >= LLAssetType::AT_COUNT) + { + // Not yet supported. + LL_DEBUGS(LOG_INV) << "Got unknown asset type for item [ name: " << item->getName() + << " type: " << item->getType() + << " inv-type: " << item->getInventoryType() << " ]." << LL_ENDL; + } + else + { + LL_WARNS(LOG_INV) << "Got unknown asset type for item [ name: " << item->getName() + << " type: " << item->getType() + << " inv-type: " << item->getInventoryType() << " ]." << LL_ENDL; + } + } + // This condition means that we tried to add a link without the baseobj being in memory. // The item will show up as a broken link. if (item->getIsBrokenLink()) @@ -1858,7 +1890,7 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) // Empty the entire contents void LLInventoryModel::empty() { -// LL_INFOS(LOG_INV) << "LLInventoryModel::empty()" << LL_ENDL; + // LL_INFOS(LOG_INV) << "LLInventoryModel::empty()" << LL_ENDL; std::for_each( mParentChildCategoryTree.begin(), mParentChildCategoryTree.end(), @@ -1917,8 +1949,7 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const } } -void LLInventoryModel::accountForUpdate( - const LLInventoryModel::update_list_t& update) +void LLInventoryModel::accountForUpdate(const LLInventoryModel::update_list_t& update) { update_list_t::const_iterator it = update.begin(); update_list_t::const_iterator end = update.end(); @@ -1928,8 +1959,7 @@ void LLInventoryModel::accountForUpdate( } } -void LLInventoryModel::accountForUpdate( - const LLInventoryModel::update_map_t& update) +void LLInventoryModel::accountForUpdate(const LLInventoryModel::update_map_t& update) { LLCategoryUpdate up; update_map_t::const_iterator it = update.begin(); @@ -1942,8 +1972,7 @@ void LLInventoryModel::accountForUpdate( } } -LLInventoryModel::EHasChildren LLInventoryModel::categoryHasChildren( - const LLUUID& cat_id) const +LLInventoryModel::EHasChildren LLInventoryModel::categoryHasChildren(const LLUUID& cat_id) const { LLViewerInventoryCategory* cat = getCategory(cat_id); if(!cat) return CHILDREN_NO; @@ -1962,13 +1991,13 @@ LLInventoryModel::EHasChildren LLInventoryModel::categoryHasChildren( } // Shouldn't have to run this, but who knows. - parent_cat_map_t::const_iterator cat_it = mParentChildCategoryTree.find(cat->getUUID()); - if (cat_it != mParentChildCategoryTree.end() && cat_it->second->size() > 0) + const auto cat_it = mParentChildCategoryTree.find(cat->getUUID()); + if (cat_it != mParentChildCategoryTree.cend() && !cat_it->second->empty()) { return CHILDREN_YES; } - parent_item_map_t::const_iterator item_it = mParentChildItemTree.find(cat->getUUID()); - if (item_it != mParentChildItemTree.end() && item_it->second->size() > 0) + const auto item_it = mParentChildItemTree.find(cat->getUUID()); + if (item_it != mParentChildItemTree.cend() && !item_it->second->empty()) { return CHILDREN_YES; } @@ -2044,6 +2073,7 @@ bool LLInventoryModel::loadSkeleton( update_map_t child_counts; cat_array_t categories; item_array_t items; + changed_items_t categories_to_update; item_array_t possible_broken_links; cat_set_t invalid_categories; // Used to mark categories that weren't successfully loaded. std::string owner_id_str; @@ -2056,11 +2086,11 @@ bool LLInventoryModel::loadSkeleton( gzip_filename.append(".gz"); LLFILE* fp = LLFile::fopen(gzip_filename, "rb"); bool remove_inventory_file = false; - if (fp) + if(fp) { fclose(fp); - fp = NULL; - if (gunzip_file(gzip_filename, inventory_filename)) + fp = nullptr; + if(gunzip_file(gzip_filename, inventory_filename)) { // we only want to remove the inventory file if it was // gzipped before we loaded, and we successfully @@ -2073,7 +2103,7 @@ bool LLInventoryModel::loadSkeleton( } } bool is_cache_obsolete = false; - if(loadFromFile(inventory_filename, categories, items, is_cache_obsolete)) + if (loadFromFile(inventory_filename, categories, items, categories_to_update, is_cache_obsolete)) { // We were able to find a cache of files. So, use what we // found to generate a set of categories we should add. We @@ -2092,6 +2122,12 @@ bool LLInventoryModel::loadSkeleton( } LLViewerInventoryCategory* tcat = *cit; + if (categories_to_update.find(tcat->getUUID()) != categories_to_update.end()) + { + tcat->setVersion(NO_VERSION); + LL_WARNS() << "folder to update: " << tcat->getName() << LL_ENDL; + } + // we can safely ignore anything loaded from file, but // not sent down in the skeleton. Must have been removed from inventory. if (cit == not_cached) @@ -2105,11 +2141,6 @@ bool LLInventoryModel::loadSkeleton( // correct contents the next time the viewer opens the folder. tcat->setVersion(NO_VERSION); } - else if (tcat->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) - { - // Do not trust stock folders being updated - tcat->setVersion(NO_VERSION); - } else { cached_ids.insert(tcat->getUUID()); @@ -2119,18 +2150,18 @@ bool LLInventoryModel::loadSkeleton( // go ahead and add the cats returned during the download auto not_cached_id = cached_ids.end(); cached_category_count = cached_ids.size(); - for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) + for (const auto& temp_cat : temp_cats) { - if (cached_ids.find((*it)->getUUID()) == not_cached_id) + if(cached_ids.find(temp_cat->getUUID()) == not_cached_id) { // this check is performed so that we do not // mark new folders in the skeleton (and not in cache) // as being cached. - LLViewerInventoryCategory *llvic = (*it); + LLViewerInventoryCategory *llvic = temp_cat; llvic->setVersion(NO_VERSION); } - addCategory(*it); - ++child_counts[(*it)->getParentUUID()]; + addCategory(temp_cat); + ++child_counts[temp_cat->getParentUUID()]; } // Add all the items loaded which are parented to a @@ -2138,14 +2169,13 @@ bool LLInventoryModel::loadSkeleton( S32 bad_link_count = 0; S32 good_link_count = 0; S32 recovered_link_count = 0; - cat_map_t::iterator unparented = mCategoryMap.end(); + const auto unparented = mCategoryMap.cend(); for(item_array_t::const_iterator item_iter = items.begin(); item_iter != items.end(); ++item_iter) { LLViewerInventoryItem *item = (*item_iter).get(); - const cat_map_t::iterator cit = mCategoryMap.find(item->getParentUUID()); - + const auto cit = mCategoryMap.find(item->getParentUUID()); if(cit != unparented) { const LLViewerInventoryCategory* cat = cit->second.get(); @@ -2162,7 +2192,7 @@ bool LLInventoryModel::loadSkeleton( possible_broken_links.push_back(item); continue; } - else if (item->getIsLinkType()) + if (item->getIsLinkType()) { good_link_count++; } @@ -2172,14 +2202,14 @@ bool LLInventoryModel::loadSkeleton( } } } - if (possible_broken_links.size() > 0) + if (!possible_broken_links.empty()) { for(item_array_t::const_iterator item_iter = possible_broken_links.begin(); item_iter != possible_broken_links.end(); ++item_iter) { LLViewerInventoryItem *item = (*item_iter).get(); - const cat_map_t::iterator cit = mCategoryMap.find(item->getParentUUID()); + const auto cit = mCategoryMap.find(item->getParentUUID()); const LLViewerInventoryCategory* cat = cit->second.get(); if (item->getIsBrokenLink()) { @@ -2209,21 +2239,19 @@ bool LLInventoryModel::loadSkeleton( { // go ahead and add everything after stripping the version // information. - for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) + for (const auto& temp_cat : temp_cats) { - LLViewerInventoryCategory *llvic = (*it); + LLViewerInventoryCategory *llvic = temp_cat; llvic->setVersion(NO_VERSION); - addCategory(*it); + addCategory(temp_cat); } } // Invalidate all categories that failed fetching descendents for whatever // reason (e.g. one of the descendents was a broken link). - for (cat_set_t::iterator invalid_cat_it = invalid_categories.begin(); - invalid_cat_it != invalid_categories.end(); - invalid_cat_it++) + for (const auto& invalid_categorie : invalid_categories) { - LLViewerInventoryCategory* cat = (*invalid_cat_it).get(); + LLViewerInventoryCategory* cat = invalid_categorie.get(); cat->setVersion(NO_VERSION); LL_DEBUGS(LOG_INV) << "Invalidating category name: " << cat->getName() << " UUID: " << cat->getUUID() << " due to invalid descendents cache" << LL_ENDL; } @@ -2233,9 +2261,9 @@ bool LLInventoryModel::loadSkeleton( // category which successfully cached so that we do not // needlessly fetch descendents for categories which we have. update_map_t::const_iterator no_child_counts = child_counts.end(); - for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) + for (const auto& temp_cat : temp_cats) { - LLViewerInventoryCategory* cat = (*it).get(); + LLViewerInventoryCategory* cat = temp_cat.get(); if(cat->getVersion() != NO_VERSION) { update_map_t::const_iterator the_count = child_counts.find(cat->getUUID()); @@ -2251,7 +2279,7 @@ bool LLInventoryModel::loadSkeleton( } } - if (remove_inventory_file) + if(remove_inventory_file) { // clean up the gunzipped file. LLFile::remove(inventory_filename); @@ -2291,9 +2319,9 @@ void LLInventoryModel::buildParentChildMap() cat_array_t* catsp; item_array_t* itemsp; - for(cat_map_t::iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit) + for (auto& cit : mCategoryMap) { - LLViewerInventoryCategory* cat = cit->second; + LLViewerInventoryCategory* cat = cit.second; cats.push_back(cat); if (mParentChildCategoryTree.count(cat->getUUID()) == 0) { @@ -2382,7 +2410,11 @@ void LLInventoryModel::buildParentChildMap() } // FIXME note that updateServer() fails with protected // types, so this will not work as intended in that case. - cat->updateServer(TRUE); + // UpdateServer uses AIS, AIS cat move is not implemented yet + // cat->updateServer(TRUE); + + // MoveInventoryFolder message, intentionally per item + cat->updateParentOnServer(FALSE); catsp = getUnlockedCatArray(cat->getParentUUID()); if(catsp) { @@ -2404,10 +2436,9 @@ void LLInventoryModel::buildParentChildMap() item_array_t items; if(!mItemMap.empty()) { - LLPointer item; - for(item_map_t::iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit) + for (auto& iit : mItemMap) { - item = (*iit).second; + LLPointer item = iit.second; items.push_back(item); } } @@ -2416,8 +2447,7 @@ void LLInventoryModel::buildParentChildMap() uuid_vec_t lost_item_ids; for(i = 0; i < count; ++i) { - LLPointer item; - item = items.at(i); + LLPointer item = items.at(i); itemsp = getUnlockedItemArray(item->getParentUUID()); if(itemsp) { @@ -2466,7 +2496,7 @@ void LLInventoryModel::buildParentChildMap() msg->nextBlockFast(_PREHASH_InventoryData); msg->addUUIDFast(_PREHASH_ItemID, (*it)); msg->addUUIDFast(_PREHASH_FolderID, lnf); - msg->addString("NewName", NULL); + msg->addString("NewName", nullptr); if(msg->isSendFull(NULL)) { start_new_message = TRUE; @@ -2479,16 +2509,16 @@ void LLInventoryModel::buildParentChildMap() } } - const LLUUID& agent_inv_root_id = gInventory.getRootFolderID(); + const LLUUID &agent_inv_root_id = gInventory.getRootFolderID(); if (agent_inv_root_id.notNull()) { cat_array_t* catsp = get_ptr_in_map(mParentChildCategoryTree, agent_inv_root_id); if(catsp) { // *HACK - fix root inventory folder - // some accounts has pbroken inventory root folders + // some accounts has broken inventory root folders - std::string name = "My Inventory"; + static const std::string name = "My Inventory"; LLUUID prev_root_id = mRootFolderID; for (parent_cat_map_t::const_iterator it = mParentChildCategoryTree.begin(), it_end = mParentChildCategoryTree.end(); it != it_end; ++it) @@ -2541,7 +2571,7 @@ void LLInventoryModel::createCommonSystemCategories() struct LLUUIDAndName { - LLUUIDAndName() {} + LLUUIDAndName() = default; LLUUIDAndName(const LLUUID& id, const std::string& name); bool operator==(const LLUUIDAndName& rhs) const; bool operator<(const LLUUIDAndName& rhs) const; @@ -2575,6 +2605,7 @@ bool LLUUIDAndName::operator>(const LLUUIDAndName& rhs) const bool LLInventoryModel::loadFromFile(const std::string& filename, LLInventoryModel::cat_array_t& categories, LLInventoryModel::item_array_t& items, + LLInventoryModel::changed_items_t& cats_to_update, bool &is_cache_obsolete) { if(filename.empty()) @@ -2597,7 +2628,7 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, while(!feof(file) && fgets(buffer, MAX_STRING, file)) { sscanf(buffer, " %126s %126s", keyword, value); /* Flawfinder: ignore */ - if (0 == strcmp("inv_cache_version", keyword)) + if(0 == strcmp("inv_cache_version", keyword)) { S32 version; int succ = sscanf(value,"%d",&version); @@ -2649,7 +2680,14 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, } else { - items.push_back(inv_item); + if (inv_item->getType() == LLAssetType::AT_UNKNOWN) + { + cats_to_update.insert(inv_item->getParentUUID()); + } + else + { + items.push_back(inv_item); + } } } else @@ -2688,8 +2726,7 @@ bool LLInventoryModel::saveToFile(const std::string& filename, return false; } - fprintf(file, "\tinv_cache_version\t%d\n", sCurrentInvCacheVersion); - + fprintf(file, "\tinv_cache_version\t%d\n",sCurrentInvCacheVersion); S32 count = categories.size(); S32 i; for(i = 0; i < count; ++i) @@ -2797,7 +2834,6 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, U32 item_array_t items; update_map_t update; S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData); - LLUUID folder_id; // Does this loop ever execute more than once? for(S32 i = 0; i < count; ++i) { @@ -2824,10 +2860,6 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, U32 { ++update[titem->getParentUUID()]; } - if (folder_id.isNull()) - { - folder_id = titem->getParentUUID(); - } } if(account) { @@ -2840,9 +2872,9 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, U32 mask |= LLInventoryObserver::CREATE; } //as above, this loop never seems to loop more than once per call - for (item_array_t::iterator it = items.begin(); it != items.end(); ++it) + for (auto& item : items) { - changes |= gInventory.updateItem(*it, mask); + changes |= gInventory.updateItem(item, mask); } gInventory.notifyObservers(); gViewerWindow->getWindow()->decBusyCount(); @@ -2874,10 +2906,10 @@ void LLInventoryModel::removeInventoryItem(LLUUID agent_id, LLMessageSystem* msg } } gInventory.accountForUpdate(update); - for(uuid_vec_t::iterator it = item_ids.begin(); it != item_ids.end(); ++it) + for (auto& item_id : item_ids) { - LL_DEBUGS(LOG_INV) << "Calling deleteObject " << *it << LL_ENDL; - gInventory.deleteObject(*it); + LL_DEBUGS(LOG_INV) << "Calling deleteObject " << item_id << LL_ENDL; + gInventory.deleteObject(item_id); } } @@ -2885,7 +2917,7 @@ void LLInventoryModel::removeInventoryItem(LLUUID agent_id, LLMessageSystem* msg void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**) { LL_DEBUGS(LOG_INV) << "LLInventoryModel::processRemoveInventoryItem()" << LL_ENDL; - LLUUID agent_id, item_id; + LLUUID agent_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) { @@ -2902,7 +2934,7 @@ void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg, void**) { LL_DEBUGS(LOG_INV) << "LLInventoryModel::processUpdateInventoryFolder()" << LL_ENDL; - LLUUID agent_id, folder_id, parent_id; + LLUUID agent_id; //char name[DB_INV_ITEM_NAME_BUF_SIZE]; msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) @@ -2943,9 +2975,9 @@ void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg, } } gInventory.accountForUpdate(update); - for (cat_array_t::iterator it = folders.begin(); it != folders.end(); ++it) + for (auto& folder : folders) { - gInventory.updateCategory(*it); + gInventory.updateCategory(folder); } gInventory.notifyObservers(); @@ -2958,8 +2990,7 @@ void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg, } // static -void LLInventoryModel::removeInventoryFolder(LLUUID agent_id, - LLMessageSystem* msg) +void LLInventoryModel::removeInventoryFolder(LLUUID agent_id, LLMessageSystem* msg) { LLUUID folder_id; uuid_vec_t folder_ids; @@ -2976,15 +3007,14 @@ void LLInventoryModel::removeInventoryFolder(LLUUID agent_id, } } gInventory.accountForUpdate(update); - for(uuid_vec_t::iterator it = folder_ids.begin(); it != folder_ids.end(); ++it) + for (auto& folder_id : folder_ids) { - gInventory.deleteObject(*it); + gInventory.deleteObject(folder_id); } } // static -void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg, - void**) +void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg, void**) { LL_DEBUGS() << "LLInventoryModel::processRemoveInventoryFolder()" << LL_ENDL; LLUUID agent_id, session_id; @@ -3001,8 +3031,7 @@ void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg, } // static -void LLInventoryModel::processRemoveInventoryObjects(LLMessageSystem* msg, - void**) +void LLInventoryModel::processRemoveInventoryObjects(LLMessageSystem* msg, void**) { LL_DEBUGS() << "LLInventoryModel::processRemoveInventoryObjects()" << LL_ENDL; LLUUID agent_id, session_id; @@ -3020,8 +3049,7 @@ void LLInventoryModel::processRemoveInventoryObjects(LLMessageSystem* msg, } // static -void LLInventoryModel::processSaveAssetIntoInventory(LLMessageSystem* msg, - void**) +void LLInventoryModel::processSaveAssetIntoInventory(LLMessageSystem* msg, void**) { LLUUID agent_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); @@ -3093,9 +3121,8 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) update_map_t update; cat_array_t folders; - S32 count; S32 i; - count = msg->getNumberOfBlocksFast(_PREHASH_FolderData); + S32 count = msg->getNumberOfBlocksFast(_PREHASH_FolderData); for(i = 0; i < count; ++i) { LLPointer tfolder = new LLViewerInventoryCategory(gAgent.getID()); @@ -3174,7 +3201,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) if(titem->getUUID().notNull() ) // && callback_id.notNull() ) { items.push_back(titem); - cblist.push_back(InventoryCallbackInfo(callback_id, titem->getUUID())); + cblist.emplace_back(callback_id, titem->getUUID()); if (titem->getInventoryType() == LLInventoryType::IT_WEARABLE) { wearable_ids.push_back(titem->getUUID()); @@ -3204,18 +3231,18 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) } else { - cblist.push_back(InventoryCallbackInfo(callback_id, LLUUID::null)); + cblist.emplace_back(callback_id, LLUUID::null); } } gInventory.accountForUpdate(update); - for (cat_array_t::iterator cit = folders.begin(); cit != folders.end(); ++cit) + for (auto& folder : folders) { - gInventory.updateCategory(*cit); + gInventory.updateCategory(folder); } - for (item_array_t::iterator iit = items.begin(); iit != items.end(); ++iit) + for (auto& item : items) { - gInventory.updateItem(*iit); + gInventory.updateItem(item); } gInventory.notifyObservers(); @@ -3233,23 +3260,21 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) count = wearable_ids.size(); for (i = 0; i < count; ++i) { - LLViewerInventoryItem* wearable_item; - wearable_item = gInventory.getItem(wearable_ids[i]); + LLViewerInventoryItem * wearable_item = gInventory.getItem(wearable_ids[i]); LLAppearanceMgr::instance().wearItemOnAvatar(wearable_item->getUUID(), true, true); } } - std::list::iterator inv_it; - for (inv_it = cblist.begin(); inv_it != cblist.end(); ++inv_it) + for (auto& inv_it : cblist) { - InventoryCallbackInfo cbinfo = (*inv_it); + InventoryCallbackInfo cbinfo = inv_it; gInventoryCallbacks.fire(cbinfo.mCallback, cbinfo.mInvID); } //gInventory.validate(); // Don't show the inventory. We used to call showAgentInventory here. - //LLPanelMainInventory* view = LLPanelMainInventory::getActiveInventory(); + //LLFloaterInventory* view = LLFloaterInventory::getActiveInventory(); //if(view) //{ // const BOOL take_keyboard_focus = FALSE; @@ -3259,10 +3284,10 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) // // HACK to open inventory offers that are accepted. This information // // really needs to flow through the instant messages and inventory // // transfer/update messages. - // if (LLPanelMainInventory::sOpenNextNewItem) + // if (LLFloaterInventory::sOpenNextNewItem) // { // view->openSelected(); - // LLPanelMainInventory::sOpenNextNewItem = FALSE; + // LLFloaterInventory::sOpenNextNewItem = FALSE; // } // // // restore keyboard focus @@ -3393,7 +3418,7 @@ bool LLInventoryModel::callbackEmptyFolderType(const LLSD& notification, const L if (option == 0) // YES { const LLUUID folder_id = findCategoryUUIDForType(preferred_type); - purge_descendents_of(folder_id, NULL); + purge_descendents_of(folder_id, nullptr); } return false; } @@ -3408,7 +3433,7 @@ void LLInventoryModel::emptyFolderType(const std::string notification, LLFolderT else { const LLUUID folder_id = findCategoryUUIDForType(preferred_type); - purge_descendents_of(folder_id, NULL); + purge_descendents_of(folder_id, nullptr); } } @@ -3470,6 +3495,11 @@ void LLInventoryModel::removeCategory(const LLUUID& category_id) void LLInventoryModel::removeObject(const LLUUID& object_id) { + if(object_id.isNull()) + { + return; + } + LLInventoryObject* obj = getObject(object_id); if (dynamic_cast(obj)) { @@ -3664,9 +3694,9 @@ void LLInventoryModel::dumpInventory() const { LL_INFOS() << "\nBegin Inventory Dump\n**********************:" << LL_ENDL; LL_INFOS() << "mCategory[] contains " << mCategoryMap.size() << " items." << LL_ENDL; - for(cat_map_t::const_iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit) + for (const auto& cit : mCategoryMap) { - const LLViewerInventoryCategory* cat = cit->second; + const LLViewerInventoryCategory* cat = cit.second; if(cat) { LL_INFOS() << " " << cat->getUUID() << " '" << cat->getName() << "' " @@ -3680,9 +3710,9 @@ void LLInventoryModel::dumpInventory() const } } LL_INFOS() << "mItemMap[] contains " << mItemMap.size() << " items." << LL_ENDL; - for(item_map_t::const_iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit) + for (const auto& iit : mItemMap) { - const LLViewerInventoryItem* item = iit->second; + const LLViewerInventoryItem* item = iit.second; if(item) { LL_INFOS() << " " << item->getUUID() << " " @@ -3724,10 +3754,10 @@ bool LLInventoryModel::validate() const S32 item_lock = 0; S32 desc_unknown_count = 0; S32 version_unknown_count = 0; - for(cat_map_t::const_iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit) + for (const auto& cit : mCategoryMap) { - const LLUUID& cat_id = cit->first; - const LLViewerInventoryCategory *cat = cit->second; + const LLUUID& cat_id = cit.first; + const LLViewerInventoryCategory *cat = cit.second; if (!cat) { LL_WARNS() << "invalid cat" << LL_ENDL; @@ -3861,9 +3891,9 @@ bool LLInventoryModel::validate() const else { bool found = false; - for (U32 i = 0; isize(); i++) + for (auto& i : *cats) { - LLViewerInventoryCategory *kid_cat = cats->at(i); + LLViewerInventoryCategory *kid_cat = i; if (kid_cat == cat) { found = true; @@ -3879,10 +3909,10 @@ bool LLInventoryModel::validate() const } } - for(item_map_t::const_iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit) + for (const auto& iit : mItemMap) { - const LLUUID& item_id = iit->first; - LLViewerInventoryItem *item = iit->second; + const LLUUID& item_id = iit.first; + LLViewerInventoryItem *item = iit.second; if (item->getUUID() != item_id) { LL_WARNS() << "item_id " << item_id << " does not match " << item->getUUID() << LL_ENDL; @@ -3907,9 +3937,9 @@ bool LLInventoryModel::validate() const else { bool found = false; - for (U32 i=0; isize(); ++i) + for (auto& i : *items) { - if (items->at(i) == item) + if (i == item) { found = true; break; @@ -4010,7 +4040,7 @@ BOOL decompress_file(const char* src_filename, const char* dst_filename) S32 bytes = 0; const S32 DECOMPRESS_BUFFER_SIZE = 32000; - // open the files +// open the files #if LL_WINDOWS src = gzopen_w(utf8str_to_utf16str(src_filename).c_str(), "rb"); #else @@ -4020,7 +4050,7 @@ BOOL decompress_file(const char* src_filename, const char* dst_filename) dst = LLFile::fopen(dst_filename, "wb"); if(!dst) goto err_decompress; - // decompress. +// decompress. buffer = new U8[DECOMPRESS_BUFFER_SIZE + 1]; do @@ -4034,7 +4064,7 @@ BOOL decompress_file(const char* src_filename, const char* dst_filename) fwrite(buffer, bytes, 1, dst); } while(gzeof(src) == 0); - // success +// success rv = TRUE; err_decompress: @@ -4082,7 +4112,7 @@ void LLInventoryModel::FetchItemHttpHandler::httpSuccess() if (itemp) { - if(titem->getParentUUID() == itemp->getParentUUID()) + if (titem->getParentUUID() == itemp->getParentUUID()) { update[titem->getParentUUID()]; } @@ -4105,9 +4135,9 @@ void LLInventoryModel::FetchItemHttpHandler::httpSuccess() // as above, this loop never seems to loop more than once per call U32 changes(0U); - for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); ++it) + for (auto& item : items) { - changes |= gInventory.updateItem(*it); + changes |= gInventory.updateItem(item); } // *HUH: Have computed 'changes', nothing uses it. diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index f8c5e81f3..d81fe7b97 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -192,14 +192,14 @@ private: **/ //-------------------------------------------------------------------- - // Descendents + // Descendants //-------------------------------------------------------------------- public: - // Make sure we have the descendents in the structure. Returns true + // Make sure we have the descendants in the structure. Returns true // if a fetch was performed. bool fetchDescendentsOf(const LLUUID& folder_id) const; - // Return the direct descendents of the id provided.Set passed + // Return the direct descendants of the id provided.Set passed // in values to NULL if the call fails. // NOTE: The array provided points straight into the guts of // this object, and should only be used for read operations, since @@ -211,10 +211,10 @@ public: void getDirectDescendentsOf(const LLUUID& cat_id, cat_array_t*& categories) const; - // Compute a hash of direct descendent names (for detecting child name changes) + // Compute a hash of direct descendant names (for detecting child name changes) LLMD5 hashDirectDescendentNames(const LLUUID& cat_id) const; - // Starting with the object specified, add its descendents to the + // Starting with the object specified, add its descendants to the // array provided, but do not add the inventory object specified // by id. There is no guaranteed order. // NOTE: Neither array will be erased before adding objects to it. @@ -340,7 +340,7 @@ public: U32 updateItem(const LLViewerInventoryItem* item, U32 mask = 0); // Change an existing item with the matching id or add - // the category. No notifcation will be sent to observers. This + // the category. No notification will be sent to observers. This // method will only generate network traffic if the item had to be // reparented. // NOTE: In usage, you will want to perform cache accounting @@ -378,7 +378,7 @@ public: bool update_parent_version = true, bool do_notify_observers = true); - // Update model after all descendents removed from server. + // Update model after all descendants removed from server. void onDescendentsPurgedFromServer(const LLUUID& object_id, bool fix_broken_links = true); // Update model after an existing item gets updated on server. @@ -499,10 +499,12 @@ public: // Call to explicitly update everyone on a new state. void notifyObservers(); + // Allows outsiders to tell the inventory if something has // been changed 'under the hood', but outside the control of the // inventory. The next notify will include that notification. void addChangedMask(U32 mask, const LLUUID& referent); + const changed_items_t& getChangedIDs() const { return mChangedItemIDs; } const changed_items_t& getAddedIDs() const { return mAddedItemIDs; } protected: @@ -556,6 +558,7 @@ protected: static bool loadFromFile(const std::string& filename, cat_array_t& categories, item_array_t& items, + changed_items_t& cats_to_update, bool& is_cache_obsolete); static bool saveToFile(const std::string& filename, const cat_array_t& categories, diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index f5e9c666c..db781e6b5 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -4,7 +4,7 @@ * * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2014, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -84,20 +84,44 @@ static const char * const LOG_INV("Inventory"); static const char * const LOG_LOCAL("InventoryLocalize"); static const char * const LOG_NOTECARD("copy_inventory_from_notecard"); +#if 1 +// *TODO$: LLInventoryCallback should be deprecated to conform to the new boost::bind/coroutine model. +// temp code in transition void doInventoryCb(LLPointer cb, LLUUID id) { if (cb.notNull()) cb->fire(id); } +#endif ///---------------------------------------------------------------------------- /// Helper class to store special inventory item names and their localized values. ///---------------------------------------------------------------------------- -class LLLocalizedInventoryItemsDictionary : public LLSingleton +class LLLocalizedInventoryItemsDictionary final : public LLSingleton { public: std::map mInventoryItemsDict; + /** + * Finds passed name in dictionary and replaces it with found localized value. + * + * @param object_name - string to be localized. + * @return true if passed name was found and localized, false otherwise. + */ + bool localizeInventoryObjectName(std::string& object_name) + { + LL_DEBUGS(LOG_LOCAL) << "Searching for localization: " << object_name << LL_ENDL; + + std::map::const_iterator dictionary_iter = mInventoryItemsDict.find(object_name); + + bool found = dictionary_iter != mInventoryItemsDict.end(); + if(found) + { + object_name = dictionary_iter->second; + LL_DEBUGS(LOG_LOCAL) << "Found, new name is: " << object_name << LL_ENDL; + } + return found; + } LLLocalizedInventoryItemsDictionary() { mInventoryItemsDict["New Shape"] = LLTrans::getString("New Shape"); @@ -196,27 +220,6 @@ public: mInventoryItemsDict["dance7"] = LLTrans::getString("dance7"); mInventoryItemsDict["dance8"] = LLTrans::getString("dance8"); } - - /** - * Finds passed name in dictionary and replaces it with found localized value. - * - * @param object_name - string to be localized. - * @return true if passed name was found and localized, false otherwise. - */ - bool localizeInventoryObjectName(std::string& object_name) - { - LL_DEBUGS(LOG_LOCAL) << "Searching for localization: " << object_name << LL_ENDL; - - std::map::const_iterator dictionary_iter = mInventoryItemsDict.find(object_name); - - bool found = dictionary_iter != mInventoryItemsDict.end(); - if(found) - { - object_name = dictionary_iter->second; - LL_DEBUGS(LOG_LOCAL) << "Found, new name is: " << object_name << LL_ENDL; - } - return found; - } }; @@ -324,6 +327,7 @@ void LLViewerInventoryItem::updateServer(BOOL is_new) const if(!mIsComplete) { // *FIX: deal with this better. + // If we're crashing here then the UI is incorrectly enabled. LL_ERRS(LOG_INV) << "LLViewerInventoryItem::updateServer() - for incomplete item" << LL_ENDL; LLNotificationsUtil::add("IncompleteInventoryItem"); @@ -455,7 +459,7 @@ void LLViewerInventoryItem::setTransactionID(const LLTransactionID& transaction_ { mTransactionID = transaction_id; } -// virtual + void LLViewerInventoryItem::packMessage(LLMessageSystem* msg) const { msg->addUUIDFast(_PREHASH_ItemID, mUUID); @@ -474,6 +478,7 @@ void LLViewerInventoryItem::packMessage(LLMessageSystem* msg) const U32 crc = getCRC32(); msg->addU32Fast(_PREHASH_CRC, crc); } + // virtual BOOL LLViewerInventoryItem::importFile(LLFILE* fp) { @@ -621,7 +626,7 @@ void LLViewerInventoryCategory::updateServer(BOOL is_new) const if (AISAPI::isAvailable()) { LLSD new_llsd = asLLSD(); - AISAPI::completion_t cr = boost::bind(&doInventoryCb, (LLPointer)NULL, _1); + AISAPI::completion_t cr = boost::bind(&doInventoryCb, LLPointer(NULL), _1); AISAPI::UpdateCategory(getUUID(), new_llsd, cr); } else @@ -833,7 +838,7 @@ bool LLViewerInventoryCategory::acceptItem(LLInventoryItem* inv_item) LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(getUUID(),cat_array,item_array); // Destination stock folder must be empty OR types of incoming and existing items must be identical and have the same permissions - accept = (!item_array->size() || + accept = (item_array->empty() || ((item_array->at(0)->getInventoryType() == inv_item->getInventoryType()) && (item_array->at(0)->getPermissions().getMaskNextOwner() == inv_item->getPermissions().getMaskNextOwner()))); } @@ -981,10 +986,10 @@ void LLInventoryCallbackManager::destroyClass() { if (sInstance) { - for (callback_map_t::iterator it = sInstance->mMap.begin(), end_it = sInstance->mMap.end(); it != end_it; ++it) + for (auto& it : sInstance->mMap) { // drop LLPointer reference to callback - it->second = NULL; + it.second = NULL; } sInstance->mMap.clear(); } @@ -1020,7 +1025,7 @@ void LLInventoryCallbackManager::fire(U32 callback_id, const LLUUID& item_id) } //void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp) -// [SL:KB] - Patch: Appearance-DnDWear | Checked: 2010-09-28 (Catznip-3.0.0a) | Added: Catznip-2.2.0a +// [SL:KB] - Patch: Appearance-DnDWear | Checked: 2010-09-28 (Catznip-3.4) void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp, bool replace) // [/SL:KB] { @@ -1107,6 +1112,7 @@ void create_gesture_cb(const LLUUID& inv_item) } } + void create_notecard_cb(const LLUUID& inv_item) { if (!inv_item.isNull()) @@ -1173,10 +1179,10 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, void create_inventory_callingcard(const LLUUID& avatar_id, const LLUUID& parent /*= LLUUID::null*/, LLPointer cb/*=NULL*/) { std::string item_desc = avatar_id.asString(); - std::string item_name; - gCacheName->getFullName(avatar_id, item_name); + LLAvatarName av_name; + LLAvatarNameCache::get(avatar_id, &av_name); create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - parent, LLTransactionID::tnull, item_name, item_desc, LLAssetType::AT_CALLINGCARD, + parent, LLTransactionID::tnull, av_name.getLegacyName(), item_desc, LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, NOT_WEARABLE, PERM_MOVE | PERM_TRANSFER, cb); } @@ -1432,11 +1438,6 @@ void update_inventory_item( const LLSD& updates, LLPointer cb) { - //Singu Note: - // There was some rlva-specific code here, however it adversely affected serverside - // baking when using AISv3. Its omission looks likeley to be inconsequental, but if that's incorrect - // any bugs introduced by its removal are minor compared to non-functional serverside baking. - if (AISAPI::isAvailable()) { AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); @@ -1466,7 +1467,6 @@ void update_inventory_item( LLInventoryModel::LLCategoryUpdate up(new_item->getParentUUID(), 0); gInventory.accountForUpdate(up); gInventory.updateItem(new_item); - if (cb) { cb->fire(item_id); @@ -1525,11 +1525,9 @@ void remove_inventory_items( LLPointer cb ) { - for (LLInventoryObject::object_list_t::iterator it = items_to_kill.begin(); - it != items_to_kill.end(); - ++it) + for (auto& it : items_to_kill) { - remove_inventory_item(*it, cb); + remove_inventory_item(it, cb); } } @@ -1603,7 +1601,7 @@ public: mCB(cb) { } - /* virtual */ void fire(const LLUUID& item_id) {} + /* virtual */ void fire(const LLUUID& item_id) override {} ~LLRemoveCategoryOnDestroy() { LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(mID); @@ -1629,6 +1627,10 @@ void remove_inventory_category( LLPointer obj = gInventory.getCategory(cat_id); if(obj) { + if (!gInventory.isCategoryComplete(cat_id)) + { + LL_WARNS() << "Removing (purging) incomplete category " << obj->getName() << LL_ENDL; + } if(LLFolderType::lookupIsProtectedType(obj->getPreferredType())) { LLNotificationsUtil::add("CannotRemoveProtectedCategories"); @@ -1849,9 +1851,9 @@ void create_new_item(const std::string& name, LLViewerAssetType::generateDescriptionFor(asset_type, desc); next_owner_perm = (next_owner_perm) ? next_owner_perm : PERM_MOVE | PERM_TRANSFER; - LLPointer cb = NULL; + LLPointer cb = nullptr; - switch(inv_type) + switch (inv_type) { case LLInventoryType::IT_LSL: { @@ -2003,9 +2005,9 @@ void remove_folder_contents(const LLUUID& category, bool keep_outfit_links, LLInventoryModel::item_array_t items; gInventory.collectDescendents(category, cats, items, LLInventoryModel::EXCLUDE_TRASH); - for (U32 i = 0; i < items.size(); ++i) + for (auto& i : items) { - LLViewerInventoryItem *item = items.at(i); + LLViewerInventoryItem *item = i; if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER)) continue; if (item->getIsLinkType()) @@ -2084,7 +2086,7 @@ const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probabl } else { - LL_WARNS() << "Can't create unrecognized type " << type_name << LL_ENDL; + LL_WARNS(LOG_INV) << "Can't create unrecognized type " << type_name << LL_ENDL; } } root->setNeedsAutoRename(TRUE); @@ -2371,9 +2373,9 @@ PermissionMask LLViewerInventoryItem::getPermissionMask() const //---------- -void LLViewerInventoryItem::onCallingCardNameLookup(const LLUUID& id, const std::string& name, bool is_group) +void LLViewerInventoryItem::onCallingCardNameLookup(const LLUUID& id, const LLAvatarName& name) { - rename(name); + rename(name.getLegacyName()); gInventory.addChangedMask(LLInventoryObserver::LABEL, getUUID()); gInventory.notifyObservers(); } @@ -2382,9 +2384,10 @@ class LLRegenerateLinkCollector : public LLInventoryCollectFunctor { public: LLRegenerateLinkCollector(const LLViewerInventoryItem *target_item) : mTargetItem(target_item) {} - virtual ~LLRegenerateLinkCollector() {} - virtual bool operator()(LLInventoryCategory* cat, - LLInventoryItem* item) + virtual ~LLRegenerateLinkCollector() = default; + + bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item) override { if (item) { @@ -2412,11 +2415,8 @@ LLUUID find_possible_item_for_regeneration(const LLViewerInventoryItem *target_i items, LLInventoryModel::EXCLUDE_TRASH, candidate_matches); - for (LLViewerInventoryItem::item_array_t::const_iterator item_iter = items.begin(); - item_iter != items.end(); - ++item_iter) + for (const LLViewerInventoryItem* item : items) { - const LLViewerInventoryItem *item = (*item_iter); if(item) return item->getUUID(); } @@ -2438,11 +2438,9 @@ BOOL LLViewerInventoryItem::regenerateLink() items, LLInventoryModel::EXCLUDE_TRASH, asset_id_matches); - for (LLViewerInventoryItem::item_array_t::iterator item_iter = items.begin(); - item_iter != items.end(); - item_iter++) + for (auto& item_iter : items) { - LLViewerInventoryItem *item = (*item_iter); + LLViewerInventoryItem *item = item_iter; item->setAssetUUID(target_item_id); item->updateServer(FALSE); gInventory.addChangedMask(LLInventoryObserver::REBUILD, item->getUUID()); diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 8825b0417..e24beb89a 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -42,6 +42,7 @@ class LLFolderView; class LLFolderBridge; class LLViewerInventoryCategory; +class LLAvatarName; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLViewerInventoryItem @@ -50,7 +51,7 @@ class LLViewerInventoryCategory; // their inventory. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLViewerInventoryItem : public LLInventoryItem, public boost::signals2::trackable +class LLViewerInventoryItem final : public LLInventoryItem, public boost::signals2::trackable { public: typedef std::vector > item_array_t; @@ -59,24 +60,24 @@ protected: ~LLViewerInventoryItem( void ); // ref counted public: - virtual LLAssetType::EType getType() const; - virtual const LLUUID& getAssetUUID() const; + LLAssetType::EType getType() const override; + const LLUUID& getAssetUUID() const override; virtual const LLUUID& getProtectedAssetUUID() const; // returns LLUUID::null if current agent does not have permission to expose this asset's UUID to the user - virtual const std::string& getName() const; + const std::string& getName() const override; virtual S32 getSortField() const; //virtual void setSortField(S32 sortField); virtual void getSLURL(); //Caches SLURL for landmark. //*TODO: Find a better way to do it and remove this method from here. - virtual const LLPermissions& getPermissions() const; + const LLPermissions& getPermissions() const override; virtual const bool getIsFullPerm() const; // 'fullperm' in the popular sense: modify-ok & copy-ok & transfer-ok, no special god rules applied - virtual const LLUUID& getCreatorUUID() const; - virtual const std::string& getDescription() const; - virtual const LLSaleInfo& getSaleInfo() const; - virtual LLInventoryType::EType getInventoryType() const; + const LLUUID& getCreatorUUID() const override; + const std::string& getDescription() const override; + const LLSaleInfo& getSaleInfo() const override; + LLInventoryType::EType getInventoryType() const override; virtual bool isWearableType() const; virtual LLWearableType::EType getWearableType() const; - virtual U32 getFlags() const; - virtual time_t getCreationDate() const; - virtual U32 getCRC32() const; // really more of a checksum. + U32 getFlags() const override; + time_t getCreationDate() const override; + U32 getCRC32() const override; // really more of a checksum. static BOOL extractSortFieldAndDisplayName(const std::string& name, S32* sortField, std::string* displayName); @@ -112,7 +113,7 @@ public: LLViewerInventoryItem(const LLInventoryItem* other); void copyViewerItem(const LLViewerInventoryItem* other); - /*virtual*/ void copyItem(const LLInventoryItem* other); + /*virtual*/ void copyItem(const LLInventoryItem* other) override; // construct a new clone of this item - it creates a new viewer // inventory item using the copy constructor, and returns it. @@ -120,15 +121,15 @@ public: void cloneViewerItem(LLPointer& newitem) const; // virtual methods - virtual void updateParentOnServer(BOOL restamp) const; - virtual void updateServer(BOOL is_new) const; + void updateParentOnServer(BOOL restamp) const override; + void updateServer(BOOL is_new) const override; void fetchFromServer(void) const; - virtual void packMessage(LLMessageSystem* msg) const; - virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); + void packMessage(LLMessageSystem* msg) const override; + BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0) override; virtual BOOL unpackMessage(const LLSD& item); - virtual BOOL importFile(LLFILE* fp); - virtual BOOL importLegacyStream(std::istream& input_stream); + BOOL importFile(LLFILE* fp) override; + BOOL importLegacyStream(std::istream& input_stream) override; // file handling on the viewer. These are not meant for anything // other than cacheing. @@ -160,7 +161,7 @@ public: PermissionMask getPermissionMask() const; // callback - void onCallingCardNameLookup(const LLUUID& id, const std::string& name, bool is_group); + void onCallingCardNameLookup(const LLUUID& id, const LLAvatarName& name); // If this is a broken link, try to fix it and any other identical link. BOOL regenerateLink(); @@ -184,7 +185,7 @@ public: // new ones as needed. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLViewerInventoryCategory : public LLInventoryCategory +class LLViewerInventoryCategory final : public LLInventoryCategory { public: typedef std::vector > cat_array_t; @@ -204,10 +205,10 @@ public: LLViewerInventoryCategory(const LLViewerInventoryCategory* other); void copyViewerCategory(const LLViewerInventoryCategory* other); - virtual void updateParentOnServer(BOOL restamp_children) const; - virtual void updateServer(BOOL is_new) const; + void updateParentOnServer(BOOL restamp_children) const override; + void updateServer(BOOL is_new) const override; - virtual void packMessage(LLMessageSystem* msg) const; + void packMessage(LLMessageSystem* msg) const override; const LLUUID& getOwnerID() const { return mOwnerID; } @@ -234,7 +235,7 @@ public: bool importFileLocal(LLFILE* fp); void determineFolderType(); void changeType(LLFolderType::EType new_folder_type); - virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); + void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0) override; virtual BOOL unpackMessage(const LLSD& category); // returns true if the category object will accept the incoming item @@ -259,37 +260,37 @@ public: class LLViewerJointAttachment; -//void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp); -// [SL:KB] - Patch: Appearance-DnDWear | Checked: 2010-09-28 (Catznip-3.0.0a) | Added: Catznip-2.2.0a +// [SL:KB] - Patch: Appearance-DnDWear | Checked: 2010-09-28 (Catznip-3.4) void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp, bool replace = false); // [/SL:KB] +//void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp); void activate_gesture_cb(const LLUUID& inv_item); void create_gesture_cb(const LLUUID& inv_item); -class AddFavoriteLandmarkCallback : public LLInventoryCallback +class AddFavoriteLandmarkCallback final : public LLInventoryCallback { public: AddFavoriteLandmarkCallback() : mTargetLandmarkId(LLUUID::null) {} void setTargetLandmarkId(const LLUUID& target_uuid) { mTargetLandmarkId = target_uuid; } private: - void fire(const LLUUID& inv_item); + void fire(const LLUUID& inv_item) override; LLUUID mTargetLandmarkId; }; -typedef boost::function inventory_func_type; -typedef boost::function llsd_func_type; -typedef boost::function nullary_func_type; +typedef std::function inventory_func_type; +typedef std::function llsd_func_type; +typedef std::function nullary_func_type; void no_op_inventory_func(const LLUUID&); // A do-nothing inventory_func void no_op_llsd_func(const LLSD&); // likewise for LLSD void no_op(); // A do-nothing nullary func. // Shim between inventory callback and boost function/callable -class LLBoostFuncInventoryCallback: public LLInventoryCallback +class LLBoostFuncInventoryCallback : public LLInventoryCallback { public: @@ -301,7 +302,7 @@ public: } // virtual - void fire(const LLUUID& item_id) + void fire(const LLUUID& item_id) override { mFireFunc(item_id); }