sw/source/core/txtnode/ndtxt.cxx |   20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

New commits:
commit cd9aa5bc508244082b4baf4a3094875bf2c6f992
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sat Oct 20 10:38:32 2018 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Oct 22 10:39:15 2018 +0200

    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 <[email protected]>

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();
     }
 }
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to