diff options
author | Merov Linden <merov@lindenlab.com> | 2014-04-22 20:57:49 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-04-22 20:57:49 -0700 |
commit | d22944da00a5ade5eb97aa109bac624967ead94c (patch) | |
tree | 48f2cef6f7c25b95912b5a0d4d68d74d9fac9da0 /indra/newview | |
parent | 277539e5624f9a71186568d4a2d506033f76e312 (diff) |
DD-58 : Forced listing ID to be an integer throughout. Verify we get an integer when using the associate UI.
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloatermarketplacelistings.cpp | 7 | ||||
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 24 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.h | 12 |
4 files changed, 24 insertions, 21 deletions
diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 39df5f4abe..fcf2b74dd6 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -563,8 +563,11 @@ void LLFloaterAssociateListing::apply() { if (mUUID.notNull()) { - const std::string& id = getChild<LLUICtrl>("listing_id")->getValue().asString(); - LLMarketplaceData::instance().associateListing(mUUID,id); + S32 id = (S32)getChild<LLUICtrl>("listing_id")->getValue().asInteger(); + if (id > 0) + { + LLMarketplaceData::instance().associateListing(mUUID,id); + } } closeFloater(); } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index d02ea949a8..e6ecd4e96e 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2057,7 +2057,7 @@ std::string LLFolderBridge::getLabelSuffix() const // Listing folder case if (LLMarketplaceData::instance().isListed(getUUID())) { - suffix = LLMarketplaceData::instance().getListingID(getUUID()); + suffix = llformat("%d",LLMarketplaceData::instance().getListingID(getUUID())); if (suffix.empty()) { suffix = LLTrans::getString("MarketplaceNoID"); diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 3fa2c58cba..40417bf77b 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -549,7 +549,7 @@ void LLMarketplaceInventoryImporter::updateImport() // Tuple == Item LLMarketplaceTuple::LLMarketplaceTuple() : mListingFolderId(), - mListingId(""), + mListingId(0), mVersionFolderId(), mIsActive(false) { @@ -557,13 +557,13 @@ LLMarketplaceTuple::LLMarketplaceTuple() : LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id) : mListingFolderId(folder_id), - mListingId(""), + mListingId(0), mVersionFolderId(), mIsActive(false) { } -LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, std::string listing_id, const LLUUID& version_id, bool is_listed) : +LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed) : mListingFolderId(folder_id), mListingId(listing_id), mVersionFolderId(version_id), @@ -590,14 +590,14 @@ bool LLMarketplaceData::addListing(const LLUUID& folder_id) // *TODO : Create the listing on SLM and get the ID (blocking?) // For the moment, we use that wonky test ID generator... - std::string listing_id = llformat ("%d", LLMarketplaceData::instance().getTestMarketplaceID()); + S32 listing_id = LLMarketplaceData::instance().getTestMarketplaceID(); setListingID(folder_id,listing_id); update_marketplace_category(folder_id); return true; } -bool LLMarketplaceData::associateListing(const LLUUID& folder_id, std::string listing_id) +bool LLMarketplaceData::associateListing(const LLUUID& folder_id, S32 listing_id) { if (isListed(folder_id)) { @@ -653,10 +653,10 @@ bool LLMarketplaceData::getActivationState(const LLUUID& folder_id) return false; } -std::string LLMarketplaceData::getListingID(const LLUUID& folder_id) +S32 LLMarketplaceData::getListingID(const LLUUID& folder_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); - return (it == mMarketplaceItems.end() ? "" : (it->second).mListingId); + return (it == mMarketplaceItems.end() ? 0 : (it->second).mListingId); } LLUUID LLMarketplaceData::getVersionFolderID(const LLUUID& folder_id) @@ -666,7 +666,7 @@ LLUUID LLMarketplaceData::getVersionFolderID(const LLUUID& folder_id) } // Reverse lookup : find the listing folder id from the listing id -LLUUID LLMarketplaceData::getListingFolder(std::string listing_id) +LLUUID LLMarketplaceData::getListingFolder(S32 listing_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.begin(); while (it != mMarketplaceItems.end()) @@ -708,17 +708,17 @@ std::string LLMarketplaceData::getListingURL(const LLUUID& folder_id) S32 depth = depth_nesting_in_marketplace(folder_id); LLUUID listing_uuid = nested_parent_id(folder_id, depth); - std::string listing_id = getListingID(listing_uuid); + S32 listing_id = getListingID(listing_uuid); - if (!listing_id.empty()) + if (listing_id != 0) { - marketplace_url += "p/listing/" + listing_id; + marketplace_url += llformat("p/listing/%d",listing_id); } return marketplace_url; } // Modifiers -bool LLMarketplaceData::setListingID(const LLUUID& folder_id, std::string listing_id) +bool LLMarketplaceData::setListingID(const LLUUID& folder_id, S32 listing_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); if (it == mMarketplaceItems.end()) diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index f279c24fb2..a587419323 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -125,12 +125,12 @@ public: LLMarketplaceTuple(); LLMarketplaceTuple(const LLUUID& folder_id); - LLMarketplaceTuple(const LLUUID& folder_id, std::string listing_id, const LLUUID& version_id, bool is_listed = false); + LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed = false); private: // Representation of a marketplace item in the Marketplace DB (well, what we know of it...) LLUUID mListingFolderId; - std::string mListingId; + S32 mListingId; LLUUID mVersionFolderId; bool mIsActive; }; @@ -153,18 +153,18 @@ public: // Create/Delete Marketplace data set : each method returns true if the function succeeds, false if error bool addListing(const LLUUID& folder_id); - bool associateListing(const LLUUID& folder_id, std::string listing_id); + bool associateListing(const LLUUID& folder_id, S32 listing_id); bool deleteListing(const LLUUID& folder_id); // Access Marketplace data set : each method returns a default value if the folder_id can't be found bool getActivationState(const LLUUID& folder_id); - std::string getListingID(const LLUUID& folder_id); + S32 getListingID(const LLUUID& folder_id); LLUUID getVersionFolderID(const LLUUID& folder_id); std::string getListingURL(const LLUUID& folder_id); - LLUUID getListingFolder(std::string listing_id); + LLUUID getListingFolder(S32 listing_id); // Modify Marketplace data set : each method returns true if the function succeeds, false if error - bool setListingID(const LLUUID& folder_id, std::string listing_id); + bool setListingID(const LLUUID& folder_id, S32 listing_id); bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id); bool setActivation(const LLUUID& folder_id, bool activate); |