From b806edf4ac47d18e1a43fb8dbb5fbcad8d13192f Mon Sep 17 00:00:00 2001
From: Bryan O'Sullivan <bos@lindenlab.com>
Date: Wed, 4 Nov 2009 14:59:23 -0800
Subject: Redo Bao's broken merge

---
 indra/llinventory/llinventory.cpp              | 62 +++++++-------------------
 indra/llinventory/llinventory.h                | 13 +++---
 indra/llinventory/llinventorytype.cpp          | 34 --------------
 indra/llinventory/llinventorytype.h            |  3 +-
 indra/llinventory/tests/inventorymisc_test.cpp |  4 +-
 5 files changed, 24 insertions(+), 92 deletions(-)

(limited to 'indra/llinventory')

diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 5d3fbe5128..d665deb605 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -1324,7 +1324,7 @@ BOOL item_date_sort( LLInventoryItem* a, LLInventoryItem* b )
 LLInventoryCategory::LLInventoryCategory(
 	const LLUUID& uuid,
 	const LLUUID& parent_uuid,
-	LLAssetType::EType preferred_type,
+	LLFolderType::EType preferred_type,
 	const std::string& name) :
 	LLInventoryObject(uuid, parent_uuid, LLAssetType::AT_CATEGORY, name),
 	mPreferredType(preferred_type)
@@ -1332,7 +1332,7 @@ LLInventoryCategory::LLInventoryCategory(
 }
 
 LLInventoryCategory::LLInventoryCategory() :
-	mPreferredType(LLAssetType::AT_NONE)
+	mPreferredType(LLFolderType::FT_NONE)
 {
 	mType = LLAssetType::AT_CATEGORY;
 }
@@ -1354,12 +1354,12 @@ void LLInventoryCategory::copyCategory(const LLInventoryCategory* other)
 	mPreferredType = other->mPreferredType;
 }
 
-LLAssetType::EType LLInventoryCategory::getPreferredType() const
+LLFolderType::EType LLInventoryCategory::getPreferredType() const
 {
 	return mPreferredType;
 }
 
-void LLInventoryCategory::setPreferredType(LLAssetType::EType type)
+void LLInventoryCategory::setPreferredType(LLFolderType::EType type)
 {
 	mPreferredType = type;
 }
@@ -1405,13 +1405,13 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd)
     if (sd.has(w))
     {
         S8 type = (U8)sd[w].asInteger();
-        mPreferredType = static_cast<LLAssetType::EType>(type);
+        mPreferredType = static_cast<LLFolderType::EType>(type);
     }
 	w = INV_ASSET_TYPE_LABEL_WS;
 	if (sd.has(w))
 	{
 		S8 type = (U8)sd[w].asInteger();
-        mPreferredType = static_cast<LLAssetType::EType>(type);
+        mPreferredType = static_cast<LLFolderType::EType>(type);
 	}
 
     w = INV_NAME_LABEL;
@@ -1433,7 +1433,7 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg,
 	msg->getUUIDFast(block, _PREHASH_ParentID, mParentUUID, block_num);
 	S8 type;
 	msg->getS8Fast(block, _PREHASH_Type, type, block_num);
-	mPreferredType = static_cast<LLAssetType::EType>(type);
+	mPreferredType = static_cast<LLFolderType::EType>(type);
 	msg->getStringFast(block, _PREHASH_Name, mName, block_num);
 	LLStringUtil::replaceNonstandardASCII(mName, ' ');
 }
@@ -1482,7 +1482,7 @@ BOOL LLInventoryCategory::importFile(LLFILE* fp)
 		}
 		else if(0 == strcmp("pref_type", keyword))
 		{
-			mPreferredType = LLAssetType::lookup(valuestr);
+			mPreferredType = LLFolderType::lookup(valuestr);
 		}
 		else if(0 == strcmp("name", keyword))
 		{
@@ -1514,7 +1514,7 @@ BOOL LLInventoryCategory::exportFile(LLFILE* fp, BOOL) const
 	mParentUUID.toString(uuid_str);
 	fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str());
 	fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType));
-	fprintf(fp, "\t\tpref_type\t%s\n", LLAssetType::lookup(mPreferredType));
+	fprintf(fp, "\t\tpref_type\t%s\n", LLFolderType::lookup(mPreferredType).c_str());
 	fprintf(fp, "\t\tname\t%s|\n", mName.c_str());
 	fprintf(fp,"\t}\n");
 	return TRUE;
@@ -1561,7 +1561,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
 		}
 		else if(0 == strcmp("pref_type", keyword))
 		{
-			mPreferredType = LLAssetType::lookup(valuestr);
+			mPreferredType = LLFolderType::lookup(valuestr);
 		}
 		else if(0 == strcmp("name", keyword))
 		{
@@ -1593,7 +1593,7 @@ BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL)
 	mParentUUID.toString(uuid_str);
 	output_stream << "\t\tparent_id\t" << uuid_str << "\n";
 	output_stream << "\t\ttype\t" << LLAssetType::lookup(mType) << "\n";
-	output_stream << "\t\tpref_type\t" << LLAssetType::lookup(mPreferredType) << "\n";
+	output_stream << "\t\tpref_type\t" << LLFolderType::lookup(mPreferredType) << "\n";
 	output_stream << "\t\tname\t" << mName.c_str() << "|\n";
 	output_stream << "\t}\n";
 	return TRUE;
@@ -1629,38 +1629,6 @@ LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item)
 	return rv;
 }
 
-/* deprecated, use LLInventoryItem::fromLLSD() instead
-LLPointer<LLInventoryItem> ll_create_item_from_sd(const LLSD& sd_item)
-{
-	LLPointer<LLInventoryItem> rv = new LLInventoryItem;
-	rv->setUUID(sd_item[INV_ITEM_ID_LABEL].asUUID());
-	rv->setParent(sd_item[INV_PARENT_ID_LABEL].asUUID());
-	rv->rename(sd_item[INV_NAME_LABEL].asString());
-	rv->setType(
-		LLAssetType::lookup(sd_item[INV_ASSET_TYPE_LABEL].asString()));
-	if (sd_item.has("shadow_id"))
-	{
-		LLUUID asset_id = sd_item["shadow_id"];
-		LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES);
-		cipher.decrypt(asset_id.mData, UUID_BYTES);
-		rv->setAssetUUID(asset_id);
-	}
-	if (sd_item.has(INV_ASSET_ID_LABEL))
-	{
-		rv->setAssetUUID(sd_item[INV_ASSET_ID_LABEL].asUUID());
-	}
-	rv->setDescription(sd_item[INV_DESC_LABEL].asString());
-	rv->setSaleInfo(ll_sale_info_from_sd(sd_item[INV_SALE_INFO_LABEL]));
-	rv->setPermissions(ll_permissions_from_sd(sd_item[INV_PERMISSIONS_LABEL]));
-	rv->setInventoryType(
-		LLInventoryType::lookup(
-			sd_item[INV_INVENTORY_TYPE_LABEL].asString()));
-	rv->setFlags((U32)(sd_item[INV_FLAGS_LABEL].asInteger()));
-	rv->setCreationDate(sd_item[INV_CREATION_DATE_LABEL].asInteger());
-	return rv;
-}
-*/
-
 LLSD ll_create_sd_from_inventory_category(LLPointer<LLInventoryCategory> cat)
 {
 	LLSD rv;
@@ -1675,10 +1643,10 @@ LLSD ll_create_sd_from_inventory_category(LLPointer<LLInventoryCategory> cat)
 	rv[INV_PARENT_ID_LABEL] = cat->getParentUUID();
 	rv[INV_NAME_LABEL] = cat->getName();
 	rv[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(cat->getType());
-	if(LLAssetType::lookupIsProtectedCategoryType(cat->getPreferredType()))
+	if(LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
 	{
 		rv[INV_PREFERRED_TYPE_LABEL] =
-			LLAssetType::lookup(cat->getPreferredType());
+			LLFolderType::lookup(cat->getPreferredType()).c_str();
 	}
 	return rv;
 }
@@ -1692,7 +1660,7 @@ LLPointer<LLInventoryCategory> ll_create_category_from_sd(const LLSD& sd_cat)
 	rv->setType(
 		LLAssetType::lookup(sd_cat[INV_ASSET_TYPE_LABEL].asString()));
 	rv->setPreferredType(
-		LLAssetType::lookup(
-			sd_cat[INV_PREFERRED_TYPE_LABEL].asString()));
+			LLFolderType::lookup(
+				sd_cat[INV_PREFERRED_TYPE_LABEL].asString()));
 	return rv;
 }
diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h
index bd581e860f..3de9d14f54 100644
--- a/indra/llinventory/llinventory.h
+++ b/indra/llinventory/llinventory.h
@@ -37,6 +37,7 @@
 
 #include "llassetstorage.h"
 #include "lldarray.h"
+#include "llfoldertype.h"
 #include "llinventorytype.h"
 #include "llmemtype.h"
 #include "llpermissions.h"
@@ -321,15 +322,15 @@ protected:
 public:
 	MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
 	LLInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid,
-						LLAssetType::EType preferred_type,
+						LLFolderType::EType preferred_type,
 						const std::string& name);
 	LLInventoryCategory();
 	LLInventoryCategory(const LLInventoryCategory* other);
 	void copyCategory(const LLInventoryCategory* other); // LLRefCount requires custom copy
 
 	// accessors and mutators
-	LLAssetType::EType getPreferredType() const;
-	void setPreferredType(LLAssetType::EType type);
+	LLFolderType::EType getPreferredType() const;
+	void setPreferredType(LLFolderType::EType type);
 	// For messaging system support
 	virtual void packMessage(LLMessageSystem* msg) const;
 	virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
@@ -345,10 +346,8 @@ public:
 	virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
 
 protected:
-	// The type of asset that this category was "meant" to hold
-	// (although it may in fact hold any type).
-	LLAssetType::EType	mPreferredType;		
-
+	// May be the type that this category was "meant" to hold (although it may hold any type).	
+	LLFolderType::EType	mPreferredType;		
 };
 
 
diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp
index a445466b26..0e71c0d12d 100644
--- a/indra/llinventory/llinventorytype.cpp
+++ b/indra/llinventory/llinventorytype.cpp
@@ -79,24 +79,16 @@ LLInventoryDictionary::LLInventoryDictionary()
 	addEntry(LLInventoryType::IT_SOUND,               new InventoryEntry("sound",     "sound",         1, LLAssetType::AT_SOUND));
 	addEntry(LLInventoryType::IT_CALLINGCARD,         new InventoryEntry("callcard",  "calling card",  1, LLAssetType::AT_CALLINGCARD));
 	addEntry(LLInventoryType::IT_LANDMARK,            new InventoryEntry("landmark",  "landmark",      1, LLAssetType::AT_LANDMARK));
-	//addEntry(LLInventoryType::IT_SCRIPT,            new InventoryEntry(NULL,NULL));
-	//addEntry(LLInventoryType::IT_CLOTHING,          new InventoryEntry(NULL,NULL));
 	addEntry(LLInventoryType::IT_OBJECT,              new InventoryEntry("object",    "object",        1, LLAssetType::AT_OBJECT));
 	addEntry(LLInventoryType::IT_NOTECARD,            new InventoryEntry("notecard",  "note card",     1, LLAssetType::AT_NOTECARD));
 	addEntry(LLInventoryType::IT_CATEGORY,            new InventoryEntry("category",  "folder"         ));
 	addEntry(LLInventoryType::IT_ROOT_CATEGORY,       new InventoryEntry("root",      "root"           ));
 	addEntry(LLInventoryType::IT_LSL,                 new InventoryEntry("script",    "script",        2, LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE));
-	//addEntry(LLInventoryType::IT_LSL_BYTECODE,      new InventoryEntry(NULL,NULL));
-	//addEntry(LLInventoryType::IT_TEXTURE_TGA,       new InventoryEntry(NULL,NULL));
-	//addEntry(LLInventoryType::IT_BODYPART,          new InventoryEntry(NULL,NULL));
-	//addEntry(LLInventoryType::IT_TRASH,             new InventoryEntry(NULL,NULL));
 	addEntry(LLInventoryType::IT_SNAPSHOT,            new InventoryEntry("snapshot",  "snapshot",      1, LLAssetType::AT_TEXTURE));
-	//addEntry(LLInventoryType::IT_LOST_AND_FOUND,    new InventoryEntry(NULL,NULL, ));
 	addEntry(LLInventoryType::IT_ATTACHMENT,          new InventoryEntry("attach",    "attachment",    1, LLAssetType::AT_OBJECT));
 	addEntry(LLInventoryType::IT_WEARABLE,            new InventoryEntry("wearable",  "wearable",      2, LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART));
 	addEntry(LLInventoryType::IT_ANIMATION,           new InventoryEntry("animation", "animation",     1, LLAssetType::AT_ANIMATION));  
 	addEntry(LLInventoryType::IT_GESTURE,             new InventoryEntry("gesture",   "gesture",       1, LLAssetType::AT_GESTURE)); 
-	addEntry(LLInventoryType::IT_FAVORITE,            new InventoryEntry("favorite",  "favorite",      1, LLAssetType::AT_FAVORITE)); 
 }
 
 
@@ -128,35 +120,9 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
 	LLInventoryType::IT_ANIMATION,		// AT_ANIMATION
 	LLInventoryType::IT_GESTURE,		// AT_GESTURE
 	LLInventoryType::IT_NONE,			// AT_SIMSTATE
-	LLInventoryType::IT_FAVORITE,		// AT_FAVORITE
 
 	LLInventoryType::IT_NONE,			// AT_LINK
 	LLInventoryType::IT_NONE,			// AT_LINK_FOLDER
-
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-	LLInventoryType::IT_CATEGORY,		// AT_ENSEMBLE
-
-	LLInventoryType::IT_CATEGORY,		// AT_CURRENT_OUTFIT
-	LLInventoryType::IT_CATEGORY,		// AT_OUTFIT
-	LLInventoryType::IT_CATEGORY,		// AT_MY_OUTFITS
 };
 
 // static
diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h
index 14b28bfe4b..e515b8a304 100644
--- a/indra/llinventory/llinventorytype.h
+++ b/indra/llinventory/llinventorytype.h
@@ -67,8 +67,7 @@ public:
 		IT_WEARABLE = 18,
 		IT_ANIMATION = 19,
 		IT_GESTURE = 20,
-		IT_FAVORITE = 21,
-		IT_COUNT = 22,
+		IT_COUNT = 21,
 
 		IT_NONE = -1
 	};
diff --git a/indra/llinventory/tests/inventorymisc_test.cpp b/indra/llinventory/tests/inventorymisc_test.cpp
index 770594dc9d..c797a70c50 100644
--- a/indra/llinventory/tests/inventorymisc_test.cpp
+++ b/indra/llinventory/tests/inventorymisc_test.cpp
@@ -94,7 +94,7 @@ LLPointer<LLInventoryCategory> create_random_inventory_cat()
 	LLPointer<LLInventoryCategory> cat = new LLInventoryCategory(
 		item_id,
 		parent_id,
-		LLAssetType::AT_NONE,
+		LLFolderType::FT_NONE,
 		std::string("Sample category"));
 	return cat;
 }
@@ -452,7 +452,7 @@ namespace tut
 		ensure_equals("4.type::getType() failed", dst->getType(), src->getType());
 		ensure_equals("5.preferred type::getPreferredType() failed", dst->getPreferredType(), src->getPreferredType());
 
-		src->setPreferredType( LLAssetType::AT_TEXTURE);
+		src->setPreferredType( LLFolderType::FT_TEXTURE);
 		sd = ll_create_sd_from_inventory_category(src);
 		dst = ll_create_category_from_sd(sd);
 		ensure_equals("6.preferred type::getPreferredType() failed", dst->getPreferredType(), src->getPreferredType());
-- 
cgit v1.2.3