[Libreoffice-commits] core.git: sw/source

Stephan Bergmann sbergman at redhat.com
Sun Oct 22 09:57:53 UTC 2017


 sw/source/uibase/utlui/content.cxx |    6 ------
 1 file changed, 6 deletions(-)

New commits:
commit 380d6afe5fd691f6ad4b17fc38b79b9fca4ba906
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Oct 22 11:55:13 2017 +0200

    Remove redundant asserts involving dynamic_cast
    
    ...from SwTypeNumber to itself, which the compiler is free to elide anyway.
    (SwTypeNumber is a base class, so there's no way to hack this like was done with
    vcl::Window in 4e7ffc0a69dac31ca7e0f1649f1697a1ff8d6e5f "Avoid compiler eliding#redundant dynamic_cast".)
    
    Change-Id: I21185e49bc4fa1803d46e086d863d47eda330acf

diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index c07efed0fd54..4c932466493b 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -118,13 +118,11 @@ namespace
 {
     bool lcl_IsContent(const SvTreeListEntry* pEntry)
     {
-        assert(dynamic_cast<SwTypeNumber*>(static_cast<SwTypeNumber*>(pEntry->GetUserData())));
         return static_cast<const SwTypeNumber*>(pEntry->GetUserData())->GetTypeId() == CTYPE_CNT;
     }
 
     bool lcl_IsContentType(const SvTreeListEntry* pEntry)
     {
-        assert(dynamic_cast<SwTypeNumber*>(static_cast<SwTypeNumber*>(pEntry->GetUserData())));
         return static_cast<const SwTypeNumber*>(pEntry->GetUserData())->GetTypeId() == CTYPE_CTT;
     }
 
@@ -1385,7 +1383,6 @@ void SwContentTree::RequestingChildren( SvTreeListEntry* pParent )
                                     )
                                 {
                                     pChild = Prev(pChild);
-                                    assert(!pChild || dynamic_cast<SwTypeNumber*>(static_cast<SwTypeNumber*>(pChild->GetUserData())));
                                 }
                                 if(pChild)
                                     pChild = InsertEntry(sEntry, pChild,
@@ -1447,7 +1444,6 @@ SdrObject* SwContentTree::GetDrawingObjectsByContent(const SwContent *pCnt)
 
 bool  SwContentTree::Expand( SvTreeListEntry* pParent )
 {
-    assert(!m_bIsRoot || dynamic_cast<SwTypeNumber*>(static_cast<SwTypeNumber*>(pParent->GetUserData())));
     if (!m_bIsRoot
         || (lcl_IsContentType(pParent) && static_cast<SwContentType*>(pParent->GetUserData())->GetType() == ContentTypeId::OUTLINE)
         || (m_nRootType == ContentTypeId::OUTLINE))
@@ -1506,7 +1502,6 @@ bool  SwContentTree::Expand( SvTreeListEntry* pParent )
 
 bool  SwContentTree::Collapse( SvTreeListEntry* pParent )
 {
-    assert(!m_bIsRoot || dynamic_cast<SwTypeNumber*>(static_cast<SwTypeNumber*>(pParent->GetUserData())));
     if (!m_bIsRoot
         || (lcl_IsContentType(pParent) && static_cast<SwContentType*>(pParent->GetUserData())->GetType() == ContentTypeId::OUTLINE)
         || (m_nRootType == ContentTypeId::OUTLINE))
@@ -2428,7 +2423,6 @@ void SwContentTree::ExecCommand(const OUString& rCmd, bool bOutlineWithChildren)
                     if (nActLevel >= static_cast<SwOutlineContent*>(pEntry->GetUserData())->GetOutlineLevel())
                         break;
                     pEntry = Next(pEntry);
-                    assert(pEntry == nullptr || dynamic_cast<SwTypeNumber*>(static_cast<SwTypeNumber*>(pEntry->GetUserData())));
                     nActEndPos++;
                 }
                 if (nDir == 1)


More information about the Libreoffice-commits mailing list