diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2017-07-06 19:36:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-07 22:01:01 +0200 |
commit | c5e4534808c03ce30c7b3e4bbed38ed5fca2d77f (patch) | |
tree | de059f4b070448e25f0f6e75d86618b307ebde6e /connectivity | |
parent | 6c4224b7ac9d8b016759ae8b5c0afdbef473a16f (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 'connectivity')
-rw-r--r-- | connectivity/source/commontools/dbtools.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/commontools/dbtools2.cxx | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 109217552183..23905d80f14a 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -962,8 +962,8 @@ try Property* pResult = std::lower_bound( pNewProps, pNewProps + nNewLen, pOldProps[i], ::comphelper::PropertyCompareByName()); - if ( pResult - && ( pResult != pNewProps + nNewLen && pResult->Name == pOldProps[i].Name ) + if ( ( pResult != aNewProperties.end() ) + && ( pResult->Name == pOldProps[i].Name ) && ( (pResult->Attributes & PropertyAttribute::READONLY) == 0 ) && ( pResult->Type.equals(pOldProps[i].Type)) ) { // Attributes match and the property is not read-only diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index c732d84fcf53..6f829f4f272b 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -641,7 +641,7 @@ bool isDataSourcePropertyEnabled(const Reference<XInterface>& _xProp, const OUSt aInfo.end(), [&_sProperty](const PropertyValue& lhs) { return lhs.Name == _sProperty; }); - if ( pValue && pValue != (aInfo.getConstArray() + aInfo.getLength()) ) + if ( pValue != aInfo.end() ) pValue->Value >>= bEnabled; } } |