From a3f3ab7e113e44309461b26399d627814f0ce4f9 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Thu, 17 Apr 2008 02:56:14 +0000 Subject: QAR-449 Viewer 1.20 RC 1 merge Branch_1-20-Viewer -r 84432 : 84760 -> release --- indra/llui/llscrolllistctrl.cpp | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'indra/llui/llscrolllistctrl.cpp') diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 87929b10b4..eb244a6f82 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -69,37 +69,26 @@ struct SortScrollListItem bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2) { - if ( mSortOrders.empty() ) return true; - - const LLScrollListCell *cell1 = NULL; - const LLScrollListCell *cell2 = NULL; - - sort_order_t::const_reverse_iterator end_it = mSortOrders.rend(); - sort_order_t::const_reverse_iterator it; + if ( mSortOrders.empty() ) + return i1 < i2; // sort over all columns in order specified by mSortOrders S32 sort_result = 0; - for (it = mSortOrders.rbegin(); it != end_it; ++it) + for (sort_order_t::const_reverse_iterator it = mSortOrders.rbegin(); + it != mSortOrders.rend(); ++it) { S32 col_idx = it->first; BOOL sort_ascending = it->second; - cell1 = i1->getColumn(col_idx); - cell2 = i2->getColumn(col_idx); - // ascending or descending sort for this column? - S32 order = 1; - if (!sort_ascending) - { - order = -1; - } - + const LLScrollListCell *cell1 = i1->getColumn(col_idx); + const LLScrollListCell *cell2 = i2->getColumn(col_idx); + S32 order = sort_ascending ? 1 : -1; // ascending or descending sort for this column? if (cell1 && cell2) { - sort_result = (order * LLString::compareDict(cell1->getValue().asString(), cell2->getValue().asString())); + sort_result = order * LLString::compareDict(cell1->getValue().asString(), cell2->getValue().asString()); if (sort_result != 0) { - // we have a sort order! - break; + break; // we have a sort order! } } } -- cgit v1.2.3