summaryrefslogtreecommitdiff
path: root/indra/llinventory/llinventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llinventory/llinventory.cpp')
-rw-r--r--indra/llinventory/llinventory.cpp225
1 files changed, 3 insertions, 222 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 6164dae22f..36b7ab0680 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -20,8 +20,6 @@
#include "llsdutil.h"
-#include "llsdutil.h"
-
///----------------------------------------------------------------------------
/// exported functions
///----------------------------------------------------------------------------
@@ -47,187 +45,8 @@ static const std::string INV_CREATION_DATE_LABEL("created_at");
const U8 TASK_INVENTORY_ITEM_KEY = 0;
const U8 TASK_INVENTORY_ASSET_KEY = 1;
-const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730");
-
-// helper function which returns true if inventory type and asset type
-// are potentially compatible. For example, an attachment must be an
-// object, but a wearable can be a bodypart or clothing asset.
-bool inventory_and_asset_types_match(
- LLInventoryType::EType inventory_type,
- LLAssetType::EType asset_type);
-
+const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730");
-///----------------------------------------------------------------------------
-/// Class LLInventoryType
-///----------------------------------------------------------------------------
-
-// Unlike asset type names, not limited to 8 characters.
-// Need not match asset type names.
-static const char* INVENTORY_TYPE_NAMES[LLInventoryType::IT_COUNT] =
-{
- "texture", // 0
- "sound",
- "callcard",
- "landmark",
- NULL,
- NULL, // 5
- "object",
- "notecard",
- "category",
- "root",
- "script", // 10
- NULL,
- NULL,
- NULL,
- NULL,
- "snapshot", // 15
- NULL,
- "attach",
- "wearable",
- "animation",
- "gesture", // 20
-};
-
-// This table is meant for decoding to human readable form. Put any
-// and as many printable characters you want in each one.
-// See also LLAssetType::mAssetTypeHumanNames
-static const char* INVENTORY_TYPE_HUMAN_NAMES[LLInventoryType::IT_COUNT] =
-{
- "texture", // 0
- "sound",
- "calling card",
- "landmark",
- NULL,
- NULL, // 5
- "object",
- "note card",
- "folder",
- "root",
- "script", // 10
- NULL,
- NULL,
- NULL,
- NULL,
- "snapshot", // 15
- NULL,
- "attachment",
- "wearable",
- "animation",
- "gesture", // 20
-};
-
-// Maps asset types to the default inventory type for that kind of asset.
-// Thus, "Lost and Found" is a "Category"
-static const LLInventoryType::EType
-DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
-{
- LLInventoryType::IT_TEXTURE, // AT_TEXTURE
- LLInventoryType::IT_SOUND, // AT_SOUND
- LLInventoryType::IT_CALLINGCARD, // AT_CALLINGCARD
- LLInventoryType::IT_LANDMARK, // AT_LANDMARK
- LLInventoryType::IT_LSL, // AT_SCRIPT
- LLInventoryType::IT_WEARABLE, // AT_CLOTHING
- LLInventoryType::IT_OBJECT, // AT_OBJECT
- LLInventoryType::IT_NOTECARD, // AT_NOTECARD
- LLInventoryType::IT_CATEGORY, // AT_CATEGORY
- LLInventoryType::IT_ROOT_CATEGORY, // AT_ROOT_CATEGORY
- LLInventoryType::IT_LSL, // AT_LSL_TEXT
- LLInventoryType::IT_LSL, // AT_LSL_BYTECODE
- LLInventoryType::IT_TEXTURE, // AT_TEXTURE_TGA
- LLInventoryType::IT_WEARABLE, // AT_BODYPART
- LLInventoryType::IT_CATEGORY, // AT_TRASH
- LLInventoryType::IT_CATEGORY, // AT_SNAPSHOT_CATEGORY
- LLInventoryType::IT_CATEGORY, // AT_LOST_AND_FOUND
- LLInventoryType::IT_SOUND, // AT_SOUND_WAV
- LLInventoryType::IT_NONE, // AT_IMAGE_TGA
- LLInventoryType::IT_NONE, // AT_IMAGE_JPEG
- LLInventoryType::IT_ANIMATION, // AT_ANIMATION
- LLInventoryType::IT_GESTURE, // AT_GESTURE
-};
-
-static const int MAX_POSSIBLE_ASSET_TYPES = 2;
-static const LLAssetType::EType
-INVENTORY_TO_ASSET_TYPE[LLInventoryType::IT_COUNT][MAX_POSSIBLE_ASSET_TYPES] =
-{
- { LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_TEXTURE
- { LLAssetType::AT_SOUND, LLAssetType::AT_NONE }, // IT_SOUND
- { LLAssetType::AT_CALLINGCARD, LLAssetType::AT_NONE }, // IT_CALLINGCARD
- { LLAssetType::AT_LANDMARK, LLAssetType::AT_NONE }, // IT_LANDMARK
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_OBJECT
- { LLAssetType::AT_NOTECARD, LLAssetType::AT_NONE }, // IT_NOTECARD
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_CATEGORY
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_ROOT_CATEGORY
- { LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE }, // IT_LSL
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_SNAPSHOT
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_ATTACHMENT
- { LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART }, // IT_WEARABLE
- { LLAssetType::AT_ANIMATION, LLAssetType::AT_NONE }, // IT_ANIMATION
- { LLAssetType::AT_GESTURE, LLAssetType::AT_NONE }, // IT_GESTURE
-};
-
-// static
-const char* LLInventoryType::lookup(EType type)
-{
- if((type >= 0) && (type < IT_COUNT))
- {
- return INVENTORY_TYPE_NAMES[S32(type)];
- }
- else
- {
- return NULL;
- }
-}
-
-// static
-LLInventoryType::EType LLInventoryType::lookup(const char* name)
-{
- for(S32 i = 0; i < IT_COUNT; ++i)
- {
- if((INVENTORY_TYPE_NAMES[i])
- && (0 == strcmp(name, INVENTORY_TYPE_NAMES[i])))
- {
- // match
- return (EType)i;
- }
- }
- return IT_NONE;
-}
-
-// XUI:translate
-// translation from a type to a human readable form.
-// static
-const char* LLInventoryType::lookupHumanReadable(EType type)
-{
- if((type >= 0) && (type < IT_COUNT))
- {
- return INVENTORY_TYPE_HUMAN_NAMES[S32(type)];
- }
- else
- {
- return NULL;
- }
-}
-
-// return the default inventory for the given asset type.
-// static
-LLInventoryType::EType LLInventoryType::defaultForAssetType(LLAssetType::EType asset_type)
-{
- if((asset_type >= 0) && (asset_type < LLAssetType::AT_COUNT))
- {
- return DEFAULT_ASSET_FOR_INV_TYPE[S32(asset_type)];
- }
- else
- {
- return IT_NONE;
- }
-}
///----------------------------------------------------------------------------
/// Class LLInventoryObject
@@ -331,10 +150,6 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
{
input_stream.getline(buffer, MAX_STRING);
sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */
- if(!keyword)
- {
- continue;
- }
if(0 == strcmp("{",keyword))
{
continue;
@@ -702,10 +517,6 @@ BOOL LLInventoryItem::importFile(FILE* fp)
{
fgets(buffer, MAX_STRING, fp);
sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */
- if(!keyword)
- {
- continue;
- }
if(0 == strcmp("{",keyword))
{
continue;
@@ -907,10 +718,6 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
buffer,
" %254s %254s",
keyword, valuestr);
- if(!keyword)
- {
- continue;
- }
if(0 == strcmp("{",keyword))
{
continue;
@@ -1399,7 +1206,8 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
}
else
{
- llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
+ llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
+ delete[] item_buffer;
return;
}
item_buffer[bin_bucket_size] = '\0';
@@ -1568,10 +1376,6 @@ BOOL LLInventoryCategory::importFile(FILE* fp)
buffer,
" %254s %254s",
keyword, valuestr);
- if(!keyword)
- {
- continue;
- }
if(0 == strcmp("{",keyword))
{
continue;
@@ -1651,10 +1455,6 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
buffer,
" %254s %254s",
keyword, valuestr);
- if(!keyword)
- {
- continue;
- }
if(0 == strcmp("{",keyword))
{
continue;
@@ -1719,25 +1519,6 @@ BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL)
/// Local function definitions
///----------------------------------------------------------------------------
-bool inventory_and_asset_types_match(
- LLInventoryType::EType inventory_type,
- LLAssetType::EType asset_type)
-{
- bool rv = false;
- if((inventory_type >= 0) && (inventory_type < LLInventoryType::IT_COUNT))
- {
- for(S32 i = 0; i < MAX_POSSIBLE_ASSET_TYPES; ++i)
- {
- if(INVENTORY_TO_ASSET_TYPE[inventory_type][i] == asset_type)
- {
- rv = true;
- break;
- }
- }
- }
- return rv;
-}
-
LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item)
{
LLSD rv;