diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx index 8cc697a76441b08dc7f1ebd4813a69f5f75f4313..a14465599e0a928a838f487283401e18fa214bc4 100644 --- a/basic/source/classes/propacc.cxx +++ b/basic/source/classes/propacc.cxx @@ -38,13 +38,10 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace cppu; -struct SbCompare_UString_PropertyValue_Impl +static bool SbCompare_UString_PropertyValue_Impl(PropertyValue const & lhs, const OUString& rhs) { - bool operator() (PropertyValue const & lhs, const OUString& rhs) - { - return lhs.Name.compareTo(rhs) < 0; - } -}; + return lhs.Name.compareTo(rhs) < 0; +} SbPropertyValues::SbPropertyValues() @@ -82,8 +79,8 @@ size_t SbPropertyValues::GetIndex_Impl( const OUString &rPropName ) const { SbPropertyValueArr_Impl::const_iterator it = std::lower_bound( m_aPropVals.begin(), m_aPropVals.end(), rPropName, - SbCompare_UString_PropertyValue_Impl() ); - if (it == m_aPropVals.end()) + SbCompare_UString_PropertyValue_Impl ); + if (it == m_aPropVals.end() || !SbCompare_UString_PropertyValue_Impl(*it, rPropName)) { throw beans::UnknownPropertyException( "Property not found: " + rPropName, diff --git a/comphelper/source/property/propagg.cxx b/comphelper/source/property/propagg.cxx index d1f6e3a76c17e24b929b140bcf79df6de32d39c6..1e618694f465b73afd2e56c2be270ab9f401bf36 100644 --- a/comphelper/source/property/propagg.cxx +++ b/comphelper/source/property/propagg.cxx @@ -239,7 +239,7 @@ sal_Int32 OPropertyArrayAggregationHelper::fillHandles( { aNameProp.Name = pReqProps[i]; auto findIter = std::lower_bound(m_aProperties.begin(), m_aProperties.end(), aNameProp, PropertyCompareByName()); - if ( findIter != m_aProperties.end() ) + if ( findIter != m_aProperties.end() && !PropertyCompareByName()(*findIter, aNameProp)) { _pHandles[i] = findIter->Handle; nHitCount++; diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx index 2265ffd6aa84d78838ff892edb8f8d637e55722d..8ffebc7cc27defffcadacdebff8cf7591d4b5074 100644 --- a/svx/source/smarttags/SmartTagMgr.cxx +++ b/svx/source/smarttags/SmartTagMgr.cxx @@ -180,7 +180,7 @@ OUString SmartTagMgr::GetSmartTagCaption( const OUString& rSmartTagType, const c { OUString aRet; - auto aLower = maSmartTagMap.lower_bound( rSmartTagType ); + auto aLower = maSmartTagMap.find( rSmartTagType ); if ( aLower != maSmartTagMap.end() ) { diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index 1cf88d394175f2af12ea79bba84bba196fbac40b..cd8ebb9b2a4b8b3bdafbdde24fb3ec818576ee7a 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -610,9 +610,8 @@ namespace aEnt.string = pOpen+1; aEnt.string_len = (pClose-pOpen)-1; aEnt.weight = WEIGHT_NORMAL; - const int nEnt = SAL_N_ELEMENTS( weight_table ); - WeightSearchEntry const * pFound = std::lower_bound( weight_table, weight_table+nEnt, aEnt ); - if( pFound != (weight_table+nEnt) ) + WeightSearchEntry const * pFound = std::lower_bound( std::begin(weight_table), std::end(weight_table), aEnt ); + if( pFound != std::end(weight_table) && !(*pFound < aEnt)) o_rResult.SetWeight( pFound->weight ); } } diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx index 65a80932e90dc36d940560d45cd7868639dd925c..5410b652fbe3316c29c49ebe016aabab26911416 100644 --- a/writerfilter/source/rtftok/rtftokenizer.cxx +++ b/writerfilter/source/rtftok/rtftokenizer.cxx @@ -247,10 +247,9 @@ bool RTFTokenizer::lookupMathKeyword(RTFMathSymbol& rSymbol) { auto low = std::lower_bound(s_aRTFMathControlWords.begin(), s_aRTFMathControlWords.end(), rSymbol); - int i = low - s_aRTFMathControlWords.begin(); if (low == s_aRTFMathControlWords.end() || rSymbol < *low) return false; - rSymbol = s_aRTFMathControlWords[i]; + rSymbol = *low; return true; }