From f496c2b164a100836d74909c3e27adcdf98018f0 Mon Sep 17 00:00:00 2001 From: Kent Quirk Date: Tue, 1 Dec 2009 20:59:08 -0500 Subject: 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/llui/llflatlistview.cpp | 10 +++++----- indra/llui/llfloaterreglistener.cpp | 2 +- indra/llui/llnotifications.cpp | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index ddfb0f8534..f4a5f1c990 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -39,8 +39,8 @@ static const LLDefaultChildRegistry::Register 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 029d3b6810..082d7c1573 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 05f2d3a9cf..86989012ee 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); } } -- cgit v1.2.3