From df29825ec68c7cdba90a85fff49ac969522a43f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 21 Oct 2013 09:53:30 +0100 Subject: [PATCH] drop StringCompare from vcl Change-Id: If41503f382115affb42068d9a441241543197147 --- vcl/source/control/ilstbox.cxx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index a5bc8bfd80ec..fa9c2773657a 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -184,12 +184,10 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry try { - // XXX even though XCollator::compareString returns a sal_Int32 the only - // defined values are {-1, 0, 1} which is compatible with StringCompare - StringCompare eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr); + sal_Int32 nComp = rSorter.compare(rStr, pTemp->maStr); // fast insert for sorted data - if ( eComp != COMPARE_LESS ) + if ( nComp >= 0 ) { insPos = maEntries.size(); maEntries.push_back(pNewEntry); @@ -199,8 +197,8 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry nLow = mnMRUCount; pTemp = (ImplEntryType*)GetEntry( (sal_uInt16)nLow ); - eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr); - if ( eComp != COMPARE_GREATER ) + nComp = rSorter.compare(rStr, pTemp->maStr); + if ( nComp <= 0 ) { insPos = 0; maEntries.insert(maEntries.begin(),pNewEntry); @@ -214,13 +212,13 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry nMid = (nLow + nHigh) / 2; pTemp = (ImplEntryType*)GetEntry( nMid ); - eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr); + nComp = rSorter.compare(rStr, pTemp->maStr); - if ( eComp == COMPARE_LESS ) + if ( nComp < 0 ) nHigh = nMid-1; else { - if ( eComp == COMPARE_GREATER ) + if ( nComp > 0 ) nLow = nMid + 1; else break; @@ -228,7 +226,7 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry } while ( nLow <= nHigh ); - if ( eComp != COMPARE_LESS ) + if ( nComp >= 0 ) nMid++; insPos = nMid;