summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
authorJosh Bell <josh@lindenlab.com>2007-03-14 23:03:50 +0000
committerJosh Bell <josh@lindenlab.com>2007-03-14 23:03:50 +0000
commit00dbacb215da8d6b6739b4bcefebee552de89a9c (patch)
treee1256e1fa3b195a1128bb152a876729c7f9a163d /indra/llinventory
parentcf405184285c25723249d5a023b28d9498cf0c3f (diff)
svn merge svn+ssh://svn.lindenlab.com/svn/linden/release@59161 svn+ssh://svn.lindenlab.com/svn/linden/branches/release-candidate@59163 --> release
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llinventory.cpp60
-rw-r--r--indra/llinventory/llnotecard.cpp5
-rw-r--r--indra/llinventory/llnotecard.h15
3 files changed, 44 insertions, 36 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 0bc3f19cdf..c392d23d22 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -23,6 +23,24 @@
#include "llsdutil.h"
///----------------------------------------------------------------------------
+/// exported functions
+///----------------------------------------------------------------------------
+
+static const std::string INV_ITEM_ID_LABEL("item_id");
+static const std::string INV_FOLDER_ID_LABEL("folder_id");
+static const std::string INV_PARENT_ID_LABEL("parent_id");
+static const std::string INV_ASSET_TYPE_LABEL("type");
+static const std::string INV_PREFERRED_TYPE_LABEL("preferred_type");
+static const std::string INV_INVENTORY_TYPE_LABEL("inv_type");
+static const std::string INV_NAME_LABEL("name");
+static const std::string INV_DESC_LABEL("desc");
+static const std::string INV_PERMISSIONS_LABEL("permissions");
+static const std::string INV_ASSET_ID_LABEL("asset_id");
+static const std::string INV_SALE_INFO_LABEL("sale_info");
+static const std::string INV_FLAGS_LABEL("flags");
+static const std::string INV_CREATION_DATE_LABEL("created_at");
+
+///----------------------------------------------------------------------------
/// Local function declarations, constants, enums, and typedefs
///----------------------------------------------------------------------------
@@ -1113,24 +1131,24 @@ bool LLInventoryItem::fromLLSD(LLSD& sd)
{
mInventoryType = LLInventoryType::IT_NONE;
mAssetUUID.setNull();
- const char *w;
+ std::string w;
- w = "item_id";
+ w = INV_ITEM_ID_LABEL;
if (sd.has(w))
{
mUUID = sd[w];
}
- w = "parent_id";
+ w = INV_PARENT_ID_LABEL;
if (sd.has(w))
{
mParentUUID = sd[w];
}
- w = "permissions";
+ w = INV_PERMISSIONS_LABEL;
if (sd.has(w))
{
mPermissions = ll_permissions_from_sd(sd[w]);
}
- w = "sale_info";
+ w = INV_SALE_INFO_LABEL;
if (sd.has(w))
{
// Sale info used to contain next owner perm. It is now in
@@ -1164,40 +1182,40 @@ bool LLInventoryItem::fromLLSD(LLSD& sd)
LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES);
cipher.decrypt(mAssetUUID.mData, UUID_BYTES);
}
- w = "asset_id";
+ w = INV_ASSET_ID_LABEL;
if (sd.has(w))
{
mAssetUUID = sd[w];
}
- w = "type";
+ w = INV_ASSET_TYPE_LABEL;
if (sd.has(w))
{
mType = LLAssetType::lookup(sd[w].asString().c_str());
}
- w = "inv_type";
+ w = INV_INVENTORY_TYPE_LABEL;
if (sd.has(w))
{
mInventoryType = LLInventoryType::lookup(sd[w].asString().c_str());
}
- w = "flags";
+ w = INV_FLAGS_LABEL;
if (sd.has(w))
{
mFlags = ll_U32_from_sd(sd[w]);
}
- w = "name";
+ w = INV_NAME_LABEL;
if (sd.has(w))
{
mName = sd[w].asString();
LLString::replaceNonstandardASCII(mName, ' ');
LLString::replaceChar(mName, '|', ' ');
}
- w = "desc";
+ w = INV_DESC_LABEL;
if (sd.has(w))
{
mDescription = sd[w].asString();
LLString::replaceNonstandardASCII(mDescription, ' ');
}
- w = "creation_date";
+ w = INV_CREATION_DATE_LABEL;
if (sd.has(w))
{
mCreationDate = sd[w];
@@ -1720,24 +1738,6 @@ bool inventory_and_asset_types_match(
return rv;
}
-///----------------------------------------------------------------------------
-/// exported functions
-///----------------------------------------------------------------------------
-
-static const std::string INV_ITEM_ID_LABEL("item_id");
-static const std::string INV_FOLDER_ID_LABEL("folder_id");
-static const std::string INV_PARENT_ID_LABEL("parent_id");
-static const std::string INV_ASSET_TYPE_LABEL("type");
-static const std::string INV_PREFERRED_TYPE_LABEL("preferred_type");
-static const std::string INV_INVENTORY_TYPE_LABEL("inv_type");
-static const std::string INV_NAME_LABEL("name");
-static const std::string INV_DESC_LABEL("desc");
-static const std::string INV_PERMISSIONS_LABEL("permissions");
-static const std::string INV_ASSET_ID_LABEL("asset_id");
-static const std::string INV_SALE_INFO_LABEL("sale_info");
-static const std::string INV_FLAGS_LABEL("flags");
-static const std::string INV_CREATION_DATE_LABEL("created_at");
-
LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item)
{
LLSD rv;
diff --git a/indra/llinventory/llnotecard.cpp b/indra/llinventory/llnotecard.cpp
index 79545874b4..96ee7ff800 100644
--- a/indra/llinventory/llnotecard.cpp
+++ b/indra/llinventory/llnotecard.cpp
@@ -7,11 +7,10 @@
*/
#include "linden_common.h"
-#include "llinventory.h"
#include "llnotecard.h"
#include "llstreamtools.h"
-LLNotecard::LLNotecard(U32 max_text)
+LLNotecard::LLNotecard(S32 max_text)
: mMaxText(max_text)
{
}
@@ -179,7 +178,7 @@ bool LLNotecard::importStream(std::istream& str)
}
line_buf[STD_STRING_STR_LEN] = '\0';
- U32 text_len = 0;
+ S32 text_len = 0;
if( 1 != sscanf(line_buf, "Text length %d", &text_len) )
{
llwarns << "Invalid Linden text length field" << llendl;
diff --git a/indra/llinventory/llnotecard.h b/indra/llinventory/llnotecard.h
index 5f510a674f..04fe666562 100644
--- a/indra/llinventory/llnotecard.h
+++ b/indra/llinventory/llnotecard.h
@@ -9,12 +9,21 @@
#ifndef LL_NOTECARD_H
#define LL_NOTECARD_H
-const S32 MAX_NOTECARD_SIZE = 65536;
+#include "llmemory.h"
+#include "llinventory.h"
class LLNotecard
{
public:
- LLNotecard(U32 max_text);
+ /**
+ * @brief anonymous enumeration to set max size.
+ */
+ enum
+ {
+ MAX_SIZE = 65536
+ };
+
+ LLNotecard(S32 max_text = LLNotecard::MAX_SIZE);
virtual ~LLNotecard();
bool importStream(std::istream& str);
@@ -33,7 +42,7 @@ private:
bool exportEmbeddedItemsStream(std::ostream& str);
std::vector<LLPointer<LLInventoryItem> > mItems;
LLString mText;
- U32 mMaxText;
+ S32 mMaxText;
S32 mVersion;
S32 mEmbeddedVersion;
};