From 7623f0f1afcdcb2ed63cea5220e10f7619ad53f1 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 21 Oct 2018 14:58:15 +0100 Subject: pvs-studio: V590 The expression is excessive or contains a misprint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ibe61e593b7f0fb3abc033132450ce620ee3294c9 Reviewed-on: https://gerrit.libreoffice.org/62136 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/source/core/unocore/unoobj.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'sw') 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(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; } -- cgit