From f496c2b164a100836d74909c3e27adcdf98018f0 Mon Sep 17 00:00:00 2001
From: Kent Quirk <q@lindenlab.com>
Date: Tue, 1 Dec 2009 20:59:08 -0500
Subject: [PATCH] DEV-43622 : API change (no functionality change) to fix a
 design error in LLSD

I made it about a year and a half ago; Zero found it while reading code. I had added a return value to LLSD::insert(), but a) did it wrong, and b) broke the STL-like semantics of insert(). So I've put insert() back to returning void and created LLSD::with(), which does what my earlier insert() did. The compiler then caught all the cases where insert()'s return value were being used, and I changed those to use with() instead.
---
 indra/llcommon/llsd.cpp                   | 32 +++++++----------------
 indra/llcommon/llsd.h                     |  6 +++--
 indra/llmessage/llareslistener.cpp        |  2 +-
 indra/llui/llflatlistview.cpp             | 10 +++----
 indra/llui/llfloaterreglistener.cpp       |  2 +-
 indra/llui/llnotifications.cpp            | 12 ++++-----
 indra/newview/llavatarlistitem.cpp        |  2 +-
 indra/newview/llchathistory.cpp           |  6 ++---
 indra/newview/lleventnotifier.cpp         |  2 +-
 indra/newview/llfloaterabout.cpp          |  2 +-
 indra/newview/llfloatertestinspectors.cpp |  4 +--
 indra/newview/llgroupactions.cpp          |  2 +-
 indra/newview/llgrouplist.cpp             |  2 +-
 indra/newview/lllocationinputctrl.cpp     |  8 +++---
 indra/newview/llnavigationbar.cpp         |  2 +-
 indra/newview/llpanelblockedlist.cpp      |  2 +-
 indra/newview/llpanellandmarks.cpp        |  4 +--
 indra/newview/llpanelpeople.cpp           |  2 +-
 indra/newview/llpanelprofile.cpp          |  2 +-
 indra/newview/llstartup.cpp               |  6 ++---
 indra/newview/lluilistener.cpp            |  2 +-
 indra/newview/llviewermenu.cpp            |  2 +-
 indra/newview/llworldmapview.cpp          |  6 ++---
 23 files changed, 55 insertions(+), 65 deletions(-)

diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp
index 9140ebb3f33..c863d4e266b 100644
--- a/indra/llcommon/llsd.cpp
+++ b/indra/llcommon/llsd.cpp
@@ -355,7 +355,7 @@ namespace
 		using LLSD::Impl::erase; // Unhiding erase(LLSD::Integer)
 		using LLSD::Impl::ref; // Unhiding ref(LLSD::Integer)
 		virtual LLSD get(const LLSD::String&) const; 
-		        LLSD& insert(const LLSD::String& k, const LLSD& v);
+		void insert(const LLSD::String& k, const LLSD& v);
 		virtual void erase(const LLSD::String&);
 		              LLSD& ref(const LLSD::String&);
 		virtual const LLSD& ref(const LLSD::String&) const;
@@ -394,14 +394,9 @@ namespace
 		return (i != mData.end()) ? i->second : LLSD();
 	}
 	
-	LLSD& ImplMap::insert(const LLSD::String& k, const LLSD& v)
+	void ImplMap::insert(const LLSD::String& k, const LLSD& v)
 	{
 		mData.insert(DataMap::value_type(k, v));
-		#ifdef LL_MSVC7
-			return *((LLSD*)this);
-		#else
-			return *dynamic_cast<LLSD*>(this);
-		#endif
 	}
 	
 	void ImplMap::erase(const LLSD::String& k)
@@ -450,7 +445,7 @@ namespace
 		virtual int size() const; 
 		virtual LLSD get(LLSD::Integer) const;
 		        void set(LLSD::Integer, const LLSD&);
-		        LLSD& insert(LLSD::Integer, const LLSD&);
+		        void insert(LLSD::Integer, const LLSD&);
 		        void append(const LLSD&);
 		virtual void erase(LLSD::Integer);
 		              LLSD& ref(LLSD::Integer);
@@ -499,14 +494,10 @@ namespace
 		mData[index] = v;
 	}
 	
-	LLSD& ImplArray::insert(LLSD::Integer i, const LLSD& v)
+	void ImplArray::insert(LLSD::Integer i, const LLSD& v)
 	{
 		if (i < 0) {
-			#ifdef LL_MSVC7
-				return *((LLSD*)this);
-			#else
-				return *dynamic_cast<LLSD*>(this);
-			#endif
+			return;
 		}
 		DataVector::size_type index = i;
 		
@@ -516,11 +507,6 @@ namespace
 		}
 		
 		mData.insert(mData.begin() + index, v);
-		#ifdef LL_MSVC7
-			return *((LLSD*)this);
-		#else
-			return *dynamic_cast<LLSD*>(this);
-		#endif
 	}
 	
 	void ImplArray::append(const LLSD& v)
@@ -763,11 +749,12 @@ LLSD LLSD::emptyMap()
 
 bool LLSD::has(const String& k) const	{ return safe(impl).has(k); }
 LLSD LLSD::get(const String& k) const	{ return safe(impl).get(k); } 
+void LLSD::insert(const String& k, const LLSD& v) {	makeMap(impl).insert(k, v); }
 
-LLSD& LLSD::insert(const String& k, const LLSD& v)
+LLSD& LLSD::with(const String& k, const LLSD& v)
 										{ 
 											makeMap(impl).insert(k, v); 
-											return *dynamic_cast<LLSD*>(this);
+											return *this;
 										}
 void LLSD::erase(const String& k)		{ makeMap(impl).erase(k); }
 
@@ -788,8 +775,9 @@ int LLSD::size() const					{ return safe(impl).size(); }
  
 LLSD LLSD::get(Integer i) const			{ return safe(impl).get(i); } 
 void LLSD::set(Integer i, const LLSD& v){ makeArray(impl).set(i, v); }
+void LLSD::insert(Integer i, const LLSD& v) { makeArray(impl).insert(i, v); }
 
-LLSD& LLSD::insert(Integer i, const LLSD& v)
+LLSD& LLSD::with(Integer i, const LLSD& v)
 										{ 
 											makeArray(impl).insert(i, v); 
 											return *this;
diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h
index 552bb57498e..135133c19c4 100644
--- a/indra/llcommon/llsd.h
+++ b/indra/llcommon/llsd.h
@@ -223,8 +223,9 @@ class LL_COMMON_API LLSD
 		
 		bool has(const String&) const;
 		LLSD get(const String&) const;
-		LLSD& insert(const String&, const LLSD&);
+		void insert(const String&, const LLSD&);
 		void erase(const String&);
+		LLSD& with(const String&, const LLSD&);
 		
 		LLSD& operator[](const String&);
 		LLSD& operator[](const char* c)			{ return (*this)[String(c)]; }
@@ -238,9 +239,10 @@ class LL_COMMON_API LLSD
 		
 		LLSD get(Integer) const;
 		void set(Integer, const LLSD&);
-		LLSD& insert(Integer, const LLSD&);
+		void insert(Integer, const LLSD&);
 		void append(const LLSD&);
 		void erase(Integer);
+		LLSD& with(Integer, const LLSD&);
 		
 		const LLSD& operator[](Integer) const;
 		LLSD& operator[](Integer);
diff --git a/indra/llmessage/llareslistener.cpp b/indra/llmessage/llareslistener.cpp
index 7db3675b774..97efa96d539 100644
--- a/indra/llmessage/llareslistener.cpp
+++ b/indra/llmessage/llareslistener.cpp
@@ -34,7 +34,7 @@ LLAresListener::LLAresListener(LLAres* llares):
         "On failure, returns an array containing only the original URI, so\n"
         "failure case can be processed like success case.",
         &LLAresListener::rewriteURI,
-        LLSD().insert("uri", LLSD()).insert("reply", LLSD()));
+        LLSD().with("uri", LLSD()).with("reply", LLSD()));
 }
 
 /// This UriRewriteResponder subclass packages returned URIs as an LLSD
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index ddfb0f85347..f4a5f1c9902 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -39,8 +39,8 @@
 
 static const LLDefaultChildRegistry::Register<LLFlatListView> flat_list_view("flat_list_view");
 
-const LLSD SELECTED_EVENT	= LLSD().insert("selected", true);
-const LLSD UNSELECTED_EVENT	= LLSD().insert("selected", false);
+const LLSD SELECTED_EVENT	= LLSD().with("selected", true);
+const LLSD UNSELECTED_EVENT	= LLSD().with("selected", false);
 
 static const std::string COMMENT_TEXTBOX = "comment_text";
 
@@ -530,7 +530,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
 			if ( !selectNextItemPair(true, reset_selection) && reset_selection)
 			{
 				// If case we are in accordion tab notify parent to go to the previous accordion
-				notifyParent(LLSD().insert("action","select_prev"));
+				notifyParent(LLSD().with("action","select_prev"));
 			}
 			break;
 		}
@@ -539,7 +539,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
 			if ( !selectNextItemPair(false, reset_selection) && reset_selection)
 			{
 				// If case we are in accordion tab notify parent to go to the next accordion
-				notifyParent(LLSD().insert("action","select_next"));
+				notifyParent(LLSD().with("action","select_next"));
 			}
 			break;
 		}
@@ -570,7 +570,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
 		// In case we are in accordion tab notify parent to show selected rectangle
 		LLRect screen_rc;
 		localRectToScreen(selected_rc, &screen_rc);
-		notifyParent(LLSD().insert("scrollToShowRect",screen_rc.getValue()));
+		notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));
 		handled = TRUE;
 	}
 
diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp
index 029d3b68103..082d7c1573d 100644
--- a/indra/llui/llfloaterreglistener.cpp
+++ b/indra/llui/llfloaterreglistener.cpp
@@ -28,7 +28,7 @@ LLFloaterRegListener::LLFloaterRegListener():
     add("getBuildMap",
         "Return on [\"reply\"] data about all registered LLFloaterReg floater names",
         &LLFloaterRegListener::getBuildMap,
-        LLSD().insert("reply", LLSD()));
+        LLSD().with("reply", LLSD()));
     LLSD requiredName;
     requiredName["name"] = LLSD();
     add("showInstance",
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 05f2d3a9cfd..86989012ee4 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -711,7 +711,7 @@ LLBoundListener LLNotificationChannelBase::connectChangedImpl(const LLEventListe
 	// only about new notifications
 	for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it)
 	{
-		slot(LLSD().insert("sigtype", "load").insert("id", (*it)->id()));
+		slot(LLSD().with("sigtype", "load").with("id", (*it)->id()));
 	}
 	// and then connect the signal so that all future notifications will also be
 	// forwarded.
@@ -722,7 +722,7 @@ LLBoundListener LLNotificationChannelBase::connectAtFrontChangedImpl(const LLEve
 {
 	for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it)
 	{
-		slot(LLSD().insert("sigtype", "load").insert("id", (*it)->id()));
+		slot(LLSD().with("sigtype", "load").with("id", (*it)->id()));
 	}
 	return mChanged.connect(slot, boost::signals2::at_front);
 }
@@ -907,7 +907,7 @@ void LLNotificationChannel::setComparator(LLNotificationComparator comparator)
 	mItems.swap(s2);
 	
 	// notify clients that we've been resorted
-	mChanged(LLSD().insert("sigtype", "sort")); 
+	mChanged(LLSD().with("sigtype", "sort")); 
 }
 
 bool LLNotificationChannel::isEmpty() const
@@ -1443,7 +1443,7 @@ void LLNotifications::add(const LLNotificationPtr pNotif)
 		llerrs << "Notification added a second time to the master notification channel." << llendl;
 	}
 
-	updateItem(LLSD().insert("sigtype", "add").insert("id", pNotif->id()), pNotif);
+	updateItem(LLSD().with("sigtype", "add").with("id", pNotif->id()), pNotif);
 }
 
 void LLNotifications::cancel(LLNotificationPtr pNotif)
@@ -1454,7 +1454,7 @@ void LLNotifications::cancel(LLNotificationPtr pNotif)
 		llerrs << "Attempted to delete nonexistent notification " << pNotif->getName() << llendl;
 	}
 	pNotif->cancel();
-	updateItem(LLSD().insert("sigtype", "delete").insert("id", pNotif->id()), pNotif);
+	updateItem(LLSD().with("sigtype", "delete").with("id", pNotif->id()), pNotif);
 }
 
 void LLNotifications::update(const LLNotificationPtr pNotif)
@@ -1462,7 +1462,7 @@ void LLNotifications::update(const LLNotificationPtr pNotif)
 	LLNotificationSet::iterator it=mItems.find(pNotif);
 	if (it != mItems.end())
 	{
-		updateItem(LLSD().insert("sigtype", "change").insert("id", pNotif->id()), pNotif);
+		updateItem(LLSD().with("sigtype", "change").with("id", pNotif->id()), pNotif);
 	}
 }
 
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index efc9538fa6d..3bee5c353fb 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -260,7 +260,7 @@ void LLAvatarListItem::setAvatarIconVisible(bool visible)
 
 void LLAvatarListItem::onInfoBtnClick()
 {
-	LLFloaterReg::showInstance("inspect_avatar", LLSD().insert("avatar_id", mAvatarId));
+	LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mAvatarId));
 
 	/* TODO fix positioning of inspector
 	localPointToScreen(mXPos, mYPos, &mXPos, &mYPos);
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 078c2518c6f..6e1bb961a5b 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -78,7 +78,7 @@ class LLChatHistoryHeader: public LLPanel
 		{
 			LLMuteList::getInstance()->add(LLMute(getAvatarId(), mFrom, LLMute::OBJECT));
 
-			LLSideTray::getInstance()->showPanel("panel_block_list_sidetray", LLSD().insert("blocked_to_select", getAvatarId()));
+			LLSideTray::getInstance()->showPanel("panel_block_list_sidetray", LLSD().with("blocked_to_select", getAvatarId()));
 		}
 	}
 
@@ -160,11 +160,11 @@ class LLChatHistoryHeader: public LLPanel
 	{
 		if (mSourceType == CHAT_SOURCE_OBJECT)
 		{
-			LLFloaterReg::showInstance("inspect_object", LLSD().insert("object_id", mAvatarID));
+			LLFloaterReg::showInstance("inspect_object", LLSD().with("object_id", mAvatarID));
 		}
 		else if (mSourceType == CHAT_SOURCE_AGENT)
 		{
-			LLFloaterReg::showInstance("inspect_avatar", LLSD().insert("avatar_id", mAvatarID));
+			LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mAvatarID));
 		}
 		//if chat source is system, you may add "else" here to define behaviour.
 	}
diff --git a/indra/newview/lleventnotifier.cpp b/indra/newview/lleventnotifier.cpp
index 9c8af16535c..b64799bd865 100644
--- a/indra/newview/lleventnotifier.cpp
+++ b/indra/newview/lleventnotifier.cpp
@@ -197,7 +197,7 @@ bool LLEventNotification::handleResponse(const LLSD& notification, const LLSD& r
 			break;
 		}
 	case 1:
-		LLFloaterReg::showInstance("search", LLSD().insert("category", "events").insert("id", S32(getEventID())));
+		LLFloaterReg::showInstance("search", LLSD().with("category", "events").with("id", S32(getEventID())));
 		break;
 	case 2:
 		break;
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index 58c0c197618..68fc69b4f78 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -312,7 +312,7 @@ class LLFloaterAboutListener: public LLEventAPI
 		add("getInfo",
             "Request an LLSD::Map containing information used to populate About box",
             &LLFloaterAboutListener::getInfo,
-            LLSD().insert("reply", LLSD()));
+            LLSD().with("reply", LLSD()));
 	}
 
 private:
diff --git a/indra/newview/llfloatertestinspectors.cpp b/indra/newview/llfloatertestinspectors.cpp
index 09996b0b92c..58d5197eaaa 100644
--- a/indra/newview/llfloatertestinspectors.cpp
+++ b/indra/newview/llfloatertestinspectors.cpp
@@ -82,12 +82,12 @@ void LLFloaterTestInspectors::showAvatarInspector(LLUICtrl*, const LLSD& avatar_
 		id = avatar_id.asUUID();
 	}
 	// spawns off mouse position automatically
-	LLFloaterReg::showInstance("inspect_avatar", LLSD().insert("avatar_id", id));
+	LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", id));
 }
 
 void LLFloaterTestInspectors::showObjectInspector(LLUICtrl*, const LLSD& object_id)
 {
-	LLFloaterReg::showInstance("inspect_object", LLSD().insert("object_id", object_id));
+	LLFloaterReg::showInstance("inspect_object", LLSD().with("object_id", object_id));
 }
 
 void LLFloaterTestInspectors::onClickAvatar2D()
diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index 6fe8ed0e4d2..4adefdfcaf2 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -113,7 +113,7 @@ LLGroupHandler gGroupHandler;
 // static
 void LLGroupActions::search()
 {
-	LLFloaterReg::showInstance("search", LLSD().insert("category", "groups"));
+	LLFloaterReg::showInstance("search", LLSD().with("category", "groups"));
 }
 
 // static
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index cdb85f5b1c2..97cf139f1d4 100644
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -329,7 +329,7 @@ void LLGroupListItem::setActive(bool active)
 
 void LLGroupListItem::onInfoBtnClick()
 {
-	LLFloaterReg::showInstance("inspect_group", LLSD().insert("group_id", mGroupID));
+	LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", mGroupID));
 }
 
 void LLGroupListItem::onProfileBtnClick()
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 9d4dc2b2857..d97f1d4d181 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -473,7 +473,7 @@ void LLLocationInputCtrl::draw()
 
 void LLLocationInputCtrl::onInfoButtonClicked()
 {
-	LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "agent"));
+	LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "agent"));
 }
 
 void LLLocationInputCtrl::onForSaleButtonClicked()
@@ -495,7 +495,7 @@ void LLLocationInputCtrl::onAddLandmarkButtonClicked()
 	}
 	else
 	{
-		LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark"));
+		LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark"));
 	}
 }
 
@@ -844,12 +844,12 @@ void LLLocationInputCtrl::onLocationContextMenuItemClicked(const LLSD& userdata)
 		
 		if(!landmark)
 		{
-			LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark"));
+			LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark"));
 		}
 		else
 		{
 			LLSideTray::getInstance()->showPanel("panel_places", 
-					LLSD().insert("type", "landmark").insert("id",landmark->getUUID()));
+					LLSD().with("type", "landmark").with("id",landmark->getUUID()));
 		}
 	}
 	else if (item == "cut")
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index 41376c4c097..e65b7d8a0c6 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -561,7 +561,7 @@ void LLNavigationBar::handleLoginComplete()
 
 void LLNavigationBar::invokeSearch(std::string search_text)
 {
-	LLFloaterReg::showInstance("search", LLSD().insert("category", "all").insert("id", LLSD(search_text)));
+	LLFloaterReg::showInstance("search", LLSD().with("category", "all").with("id", LLSD(search_text)));
 }
 
 void LLNavigationBar::clearHistoryCache()
diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp
index 73cffaa7ed8..ae703ebd8e8 100644
--- a/indra/newview/llpanelblockedlist.cpp
+++ b/indra/newview/llpanelblockedlist.cpp
@@ -104,7 +104,7 @@ void LLPanelBlockedList::selectBlocked(const LLUUID& mute_id)
 
 void LLPanelBlockedList::showPanelAndSelect(const LLUUID& idToSelect)
 {
-	LLSideTray::getInstance()->showPanel("panel_block_list_sidetray", LLSD().insert(BLOCKED_PARAM_NAME, idToSelect));
+	LLSideTray::getInstance()->showPanel("panel_block_list_sidetray", LLSD().with(BLOCKED_PARAM_NAME, idToSelect));
 }
 
 
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 413d8ed7567..3af18bb751b 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -596,11 +596,11 @@ void LLLandmarksPanel::onAddAction(const LLSD& userdata) const
 		if(landmark)
 		{
 			LLSideTray::getInstance()->showPanel("panel_places", 
-								LLSD().insert("type", "landmark").insert("id",landmark->getUUID()));
+								LLSD().with("type", "landmark").with("id",landmark->getUUID()));
 		}
 		else
 		{
-			LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark"));
+			LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark"));
 		}
 	} 
 	else if ("category" == command_name)
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 6771bb41700..1743df52fc6 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -1298,7 +1298,7 @@ void LLPanelPeople::notifyChildren(const LLSD& info)
 		if (container->getCurrentPanelIndex() > 0) 
 		{
 			// if not on the default panel, switch to it
-			container->onOpen(LLSD().insert(LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME, getName()));
+			container->onOpen(LLSD().with(LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME, getName()));
 		}
 		else
 			LLSideTray::getInstance()->collapseSideBar();
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 4d152a13f30..1830d00f683 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -68,7 +68,7 @@ class LLAgentHandler : public LLCommandHandler
 
 		if (verb == "inspect")
 		{
-			LLFloaterReg::showInstance("inspect_avatar", LLSD().insert("avatar_id", avatar_id));
+			LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", avatar_id));
 			return true;
 		}
 
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index db8bda008eb..50c20bc98f4 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -482,7 +482,7 @@ bool idle_startup()
 		{
 			std::string diagnostic = "Could not start address resolution system";
 			LL_WARNS("AppInit") << diagnostic << LL_ENDL;
-			LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().insert("DIAGNOSTIC", diagnostic));
+			LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().with("DIAGNOSTIC", diagnostic));
 		}
 		
 		//
@@ -553,7 +553,7 @@ bool idle_startup()
 			{
 				std::string diagnostic = llformat(" Error: %d", gMessageSystem->getErrorCode());
 				LL_WARNS("AppInit") << diagnostic << LL_ENDL;
-				LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().insert("DIAGNOSTIC", diagnostic));
+				LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().with("DIAGNOSTIC", diagnostic));
 			}
 
 			#if LL_WINDOWS
@@ -576,7 +576,7 @@ bool idle_startup()
 		}
 		else
 		{
-			LLAppViewer::instance()->earlyExit("MessageTemplateNotFound", LLSD().insert("PATH", message_template_path));
+			LLAppViewer::instance()->earlyExit("MessageTemplateNotFound", LLSD().with("PATH", message_template_path));
 		}
 
 		if(gMessageSystem && gMessageSystem->isOK())
diff --git a/indra/newview/lluilistener.cpp b/indra/newview/lluilistener.cpp
index 8b4cfa72481..3ad9887bec8 100644
--- a/indra/newview/lluilistener.cpp
+++ b/indra/newview/lluilistener.cpp
@@ -29,7 +29,7 @@ LLUIListener::LLUIListener():
         "Invoke the operation named by [\"function\"], passing [\"parameter\"],\n"
         "as if from a user gesture on a menu -- or a button click.",
         &LLUIListener::call,
-        LLSD().insert("function", LLSD()));
+        LLSD().with("function", LLSD()));
 }
 
 void LLUIListener::call(const LLSD& event) const
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 34d07f32842..0b40492391f 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -5360,7 +5360,7 @@ class LLWorldCreateLandmark : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
 	{
-		LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark"));
+		LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark"));
 
 		return true;
 	}
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index 60b1e596458..e6857ea7800 100644
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -1728,20 +1728,20 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask )
 				id.toString(uuid_str);
 				uuid_str = uuid_str.substr(28);
 				sscanf(uuid_str.c_str(), "%X", &event_id);
-				LLFloaterReg::showInstance("search", LLSD().insert("category", "events").insert("id", event_id));
+				LLFloaterReg::showInstance("search", LLSD().with("category", "events").with("id", event_id));
 				break;
 			}
 		case MAP_ITEM_LAND_FOR_SALE:
 		case MAP_ITEM_LAND_FOR_SALE_ADULT:
 			{
 				LLFloaterReg::hideInstance("world_map");
-				LLFloaterReg::showInstance("search", LLSD().insert("category", "destinations").insert("id", id));
+				LLFloaterReg::showInstance("search", LLSD().with("category", "destinations").with("id", id));
 				break;
 			}
 		case MAP_ITEM_CLASSIFIED:
 			{
 				LLFloaterReg::hideInstance("world_map");
-				LLFloaterReg::showInstance("search", LLSD().insert("category", "classifieds").insert("id", id));
+				LLFloaterReg::showInstance("search", LLSD().with("category", "classifieds").with("id", id));
 				break;
 			}
 		default:
-- 
GitLab