summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-21 14:58:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-10-21 22:27:31 +0200
commit7623f0f1afcdcb2ed63cea5220e10f7619ad53f1 (patch)
tree2b40976405bef892bf3853ea331831a67ad993c2
parentc2145978f64d24260df88b7ebf86f5fc48149914 (diff)
pvs-studio: V590 The expression is excessive or contains a misprint
Change-Id: Ibe61e593b7f0fb3abc033132450ce620ee3294c9 Reviewed-on: https://gerrit.libreoffice.org/62136 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/core/unocore/unoobj.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 6594a6d00d96..4e2907dcafa2 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -1848,6 +1848,14 @@ void SwUnoCursorHelper::SetPropertyValues(
throw beans::PropertyVetoException(aPropertyVetoExMsg, static_cast<cppu::OWeakObject *>(nullptr));
}
+namespace
+{
+ bool NotInRange(sal_uInt16 nWID, sal_uInt16 nStart, sal_uInt16 nEnd)
+ {
+ return nWID < nStart || nWID > nEnd;
+ }
+}
+
uno::Sequence< beans::PropertyState >
SwUnoCursorHelper::GetPropertyStates(
SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
@@ -1889,10 +1897,8 @@ SwUnoCursorHelper::GetPropertyStates(
}
if (((SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION == eCaller) ||
(SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT == eCaller)) &&
- pEntry->nWID < FN_UNO_RANGE_BEGIN &&
- pEntry->nWID > FN_UNO_RANGE_END &&
- pEntry->nWID < RES_CHRATR_BEGIN &&
- pEntry->nWID > RES_TXTATR_END )
+ NotInRange(pEntry->nWID, FN_UNO_RANGE_BEGIN, FN_UNO_RANGE_END) &&
+ NotInRange(pEntry->nWID, RES_CHRATR_BEGIN, RES_TXTATR_END) )
{
pStates[i] = beans::PropertyState_DEFAULT_VALUE;
}