summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-07-06 19:36:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-07 22:01:01 +0200
commitc5e4534808c03ce30c7b3e4bbed38ed5fca2d77f (patch)
treede059f4b070448e25f0f6e75d86618b307ebde6e /comphelper
parent6c4224b7ac9d8b016759ae8b5c0afdbef473a16f (diff)
remove nullptr checks on STL search result iterators
results are in the range of first_iterator to last_iterator. If one of those is nullptr the algorithm would fail anyway. This removes some impossible checks in sw/source/core/unocore/unochart.cxx: SwChartDataProvider::detectArguments. A sorted range still holds the same values and has the same length as the original range. Replacing raw pointers eases reading this code. Change-Id: If96bd11e9167488346a57e9e08507ac42338d3cd Reviewed-on: https://gerrit.libreoffice.org/39683 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/property/property.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/comphelper/source/property/property.cxx b/comphelper/source/property/property.cxx
index d5ddc9a9ab7b..a0083908246f 100644
--- a/comphelper/source/property/property.cxx
+++ b/comphelper/source/property/property.cxx
@@ -149,7 +149,7 @@ void RemoveProperty(Sequence<Property>& _rProps, const OUString& _rPropName)
Property aNameProp(_rPropName, 0, Type(), 0);
const Property* pResult = std::lower_bound(pProperties, pProperties + nLen, aNameProp, PropertyCompareByName());
- if ( pResult && (pResult != pProperties + nLen) && (pResult->Name == _rPropName) )
+ if ( pResult != _rProps.end() && pResult->Name == _rPropName )
{
OSL_ENSURE(pResult->Name.equals(_rPropName), "::RemoveProperty Properties not sorted");
removeElementAt(_rProps, pResult - pProperties);
@@ -166,7 +166,7 @@ void ModifyPropertyAttributes(Sequence<Property>& seqProps, const OUString& sPro
Property aNameProp(sPropName, 0, Type(), 0);
Property* pResult = std::lower_bound(pProperties, pProperties + nLen, aNameProp, PropertyCompareByName());
- if ( pResult && (pResult != pProperties + nLen) && (pResult->Name == sPropName) )
+ if ( (pResult != seqProps.end()) && (pResult->Name == sPropName) )
{
pResult->Attributes |= nAddAttrib;
pResult->Attributes &= ~nRemoveAttrib;