Kaydet (Commit) 380d6afe authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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 4e7ffc0a "Avoid compiler eliding#redundant dynamic_cast".)

Change-Id: I21185e49bc4fa1803d46e086d863d47eda330acf
üst 4e7ffc0a
...@@ -118,13 +118,11 @@ namespace ...@@ -118,13 +118,11 @@ namespace
{ {
bool lcl_IsContent(const SvTreeListEntry* pEntry) 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; return static_cast<const SwTypeNumber*>(pEntry->GetUserData())->GetTypeId() == CTYPE_CNT;
} }
bool lcl_IsContentType(const SvTreeListEntry* pEntry) 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; return static_cast<const SwTypeNumber*>(pEntry->GetUserData())->GetTypeId() == CTYPE_CTT;
} }
...@@ -1385,7 +1383,6 @@ void SwContentTree::RequestingChildren( SvTreeListEntry* pParent ) ...@@ -1385,7 +1383,6 @@ void SwContentTree::RequestingChildren( SvTreeListEntry* pParent )
) )
{ {
pChild = Prev(pChild); pChild = Prev(pChild);
assert(!pChild || dynamic_cast<SwTypeNumber*>(static_cast<SwTypeNumber*>(pChild->GetUserData())));
} }
if(pChild) if(pChild)
pChild = InsertEntry(sEntry, pChild, pChild = InsertEntry(sEntry, pChild,
...@@ -1447,7 +1444,6 @@ SdrObject* SwContentTree::GetDrawingObjectsByContent(const SwContent *pCnt) ...@@ -1447,7 +1444,6 @@ SdrObject* SwContentTree::GetDrawingObjectsByContent(const SwContent *pCnt)
bool SwContentTree::Expand( SvTreeListEntry* pParent ) bool SwContentTree::Expand( SvTreeListEntry* pParent )
{ {
assert(!m_bIsRoot || dynamic_cast<SwTypeNumber*>(static_cast<SwTypeNumber*>(pParent->GetUserData())));
if (!m_bIsRoot if (!m_bIsRoot
|| (lcl_IsContentType(pParent) && static_cast<SwContentType*>(pParent->GetUserData())->GetType() == ContentTypeId::OUTLINE) || (lcl_IsContentType(pParent) && static_cast<SwContentType*>(pParent->GetUserData())->GetType() == ContentTypeId::OUTLINE)
|| (m_nRootType == ContentTypeId::OUTLINE)) || (m_nRootType == ContentTypeId::OUTLINE))
...@@ -1506,7 +1502,6 @@ bool SwContentTree::Expand( SvTreeListEntry* pParent ) ...@@ -1506,7 +1502,6 @@ bool SwContentTree::Expand( SvTreeListEntry* pParent )
bool SwContentTree::Collapse( SvTreeListEntry* pParent ) bool SwContentTree::Collapse( SvTreeListEntry* pParent )
{ {
assert(!m_bIsRoot || dynamic_cast<SwTypeNumber*>(static_cast<SwTypeNumber*>(pParent->GetUserData())));
if (!m_bIsRoot if (!m_bIsRoot
|| (lcl_IsContentType(pParent) && static_cast<SwContentType*>(pParent->GetUserData())->GetType() == ContentTypeId::OUTLINE) || (lcl_IsContentType(pParent) && static_cast<SwContentType*>(pParent->GetUserData())->GetType() == ContentTypeId::OUTLINE)
|| (m_nRootType == ContentTypeId::OUTLINE)) || (m_nRootType == ContentTypeId::OUTLINE))
...@@ -2428,7 +2423,6 @@ void SwContentTree::ExecCommand(const OUString& rCmd, bool bOutlineWithChildren) ...@@ -2428,7 +2423,6 @@ void SwContentTree::ExecCommand(const OUString& rCmd, bool bOutlineWithChildren)
if (nActLevel >= static_cast<SwOutlineContent*>(pEntry->GetUserData())->GetOutlineLevel()) if (nActLevel >= static_cast<SwOutlineContent*>(pEntry->GetUserData())->GetOutlineLevel())
break; break;
pEntry = Next(pEntry); pEntry = Next(pEntry);
assert(pEntry == nullptr || dynamic_cast<SwTypeNumber*>(static_cast<SwTypeNumber*>(pEntry->GetUserData())));
nActEndPos++; nActEndPos++;
} }
if (nDir == 1) if (nDir == 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment