summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-10-20 10:38:32 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-10-22 10:39:15 +0200
commitcd9aa5bc508244082b4baf4a3094875bf2c6f992 (patch)
treeba893a9f0dad14f846a03827dd95d48fa8a59308
parent92b849b9297cbf78bddf5e48bdbd44303a7021db (diff)
tdf#120703 (PVS): redundant comparisons, dynamic_cast<T&> in dtor
V560 A part of conditional expression is always true: (nHintStart >= nStartIdx) V509 The 'dynamic_cast' operator should be located inside the try..catch block, as it could potentially generate an exception. Raising exception inside the destructor is illegal. V560 A part of conditional expression is always true: pHint. Change-Id: Icfb9a2961f5db034fd19f4665fe3ceaae6232350 Reviewed-on: https://gerrit.libreoffice.org/62039 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx20
1 files changed, 13 insertions, 7 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 30bfd26ac35f..cb3bfa5686b7 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2706,8 +2706,7 @@ void SwTextNode::EraseText(const SwIndex &rIdx, const sal_Int32 nCount,
{
// attribute with neither end nor CH_TXTATR?
assert(pHt->HasDummyChar());
- if (isTXTATR(nWhich) &&
- (nHintStart >= nStartIdx) && (nHintStart < nEndIdx))
+ if (isTXTATR(nWhich) && (nHintStart < nEndIdx))
{
m_pSwpHints->DeleteAtPos(i);
DestroyAttr( pHt );
@@ -5082,10 +5081,17 @@ namespace {
}
// #i70748#
// #i105562#
- else if ( mrTextNode.GetpSwAttrSet() &&
- dynamic_cast<const SfxUInt16Item &>(mrTextNode.GetAttr( RES_PARATR_OUTLINELEVEL, false )).GetValue() > 0 )
+ else
{
- mrTextNode.SetEmptyListStyleDueToSetOutlineLevelAttr();
+ assert(!mrTextNode.GetpSwAttrSet()
+ || dynamic_cast<const SfxUInt16Item*>(
+ &mrTextNode.GetAttr(RES_PARATR_OUTLINELEVEL, false)));
+ if (mrTextNode.GetpSwAttrSet()
+ && static_cast<const SfxUInt16Item&>(
+ mrTextNode.GetAttr(RES_PARATR_OUTLINELEVEL, false)).GetValue() > 0)
+ {
+ mrTextNode.SetEmptyListStyleDueToSetOutlineLevelAttr();
+ }
}
}
@@ -5319,9 +5325,9 @@ void SwTextNode::SwClientNotify( const SwModify& rModify, const SfxHint& rHint )
SetXParagraph(css::uno::Reference<css::text::XTextContent>(nullptr));
}
}
- else if (auto pHint = dynamic_cast<const SwAttrHint*>(&rHint))
+ else if (dynamic_cast<const SwAttrHint*>(&rHint))
{
- if ( pHint && &rModify == GetRegisteredIn() )
+ if (&rModify == GetRegisteredIn())
ChkCondColl();
}
}