fix comparison of std::lower_bound result
turns out using a compare operator that takes something other than the element type as a parameter is really hard to get right. The changes in: basic/source/classes/propacc.cxx comphelper/source/property/propagg.cxx vcl/source/font/font.cxx are a regression from commit35e80e9726
Date: Fri Oct 19 16:01:19 2018 +0200 when calling std::lower_bound The change in toolkit/source/awt/vclxtoolkit.cxx is a regression from commit76dd28afc9
Date: Tue Oct 9 16:27:11 2018 +0200 loplugin:staticvar in various Change-Id: Icf6db22e1fc091517a53dd3624913c8c2071c106 Reviewed-on: https://gerrit.libreoffice.org/67954 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -80,7 +80,7 @@ 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(*it, rPropName))
|
||||
if (it == m_aPropVals.end() || it->Name != rPropName)
|
||||
{
|
||||
throw beans::UnknownPropertyException(
|
||||
"Property not found: " + rPropName,
|
||||
|
@@ -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() && !PropertyCompareByName()(*findIter, aNameProp))
|
||||
if ( findIter != m_aProperties.end() && findIter->Name == pReqProps[i] )
|
||||
{
|
||||
_pHandles[i] = findIter->Handle;
|
||||
nHitCount++;
|
||||
|
@@ -791,7 +791,8 @@ WindowType ImplGetComponentType( const OUString& rServiceName )
|
||||
|
||||
auto it = std::lower_bound( std::begin(aComponentInfos), std::end(aComponentInfos), sSearch,
|
||||
ComponentInfoFindCompare );
|
||||
if (it != std::end(aComponentInfos) && !ComponentInfoFindCompare(*it, sSearch) )
|
||||
if (it != std::end(aComponentInfos) &&
|
||||
rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(sSearch.pData->buffer, sSearch.pData->length, it->sName.data, it->sName.size) == 0)
|
||||
return it->nWinType;
|
||||
return WindowType::NONE;
|
||||
}
|
||||
|
@@ -611,7 +611,8 @@ namespace
|
||||
aEnt.string_len = (pClose-pOpen)-1;
|
||||
aEnt.weight = WEIGHT_NORMAL;
|
||||
WeightSearchEntry const * pFound = std::lower_bound( std::begin(weight_table), std::end(weight_table), aEnt );
|
||||
if( pFound != std::end(weight_table) && !(*pFound < aEnt))
|
||||
if( pFound != std::end(weight_table) &&
|
||||
rtl_str_compareIgnoreAsciiCase_WithLength( pFound->string, pFound->string_len, aEnt.string, aEnt.string_len) == 0 )
|
||||
o_rResult.SetWeight( pFound->weight );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user