https://bugs.documentfoundation.org/show_bug.cgi?id=94814
Bug ID: 94814
Summary: Cleanup of static_cast's called immediately after a
dynamic_cast.
Product: LibreOffice
Version: 5.0.1.2 release
Hardware: Other
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: LibreOffice
Assignee: [email protected]
Reporter: [email protected]
The recent changes removing rtti.hxx have introduced a pattern like this:
if( dynamic_cast<const VclWindowEvent*>( &rEvent ) != nullptr )
{
VclWindowEvent* pWinEvent = static_cast<VclWindowEvent*>(&rEvent);
[...original code...]
}
When we have performed the dynamic_cast anyway, it would be more readable to
change it to:
VclWindowEvent* pWinEvent = dynamic_cast<VclWindowEvent*>(&rEvent);
if (pWinEvent)
{
[...original code...]
}
To find the places where this
if (dynamic_cast<Type*>(var) != nullptr)
{
Type* p = static_cast<Type*>(var);
pattern was introduced, just read through the following commits:
http://cgit.freedesktop.org/libreoffice/core/commit/?id=d3c7c9ea81ee7c617f8cee5b645621088aea215b
http://cgit.freedesktop.org/libreoffice/core/commit/?id=ac9671f94800b647f82b12e718968311a025e87e
http://cgit.freedesktop.org/libreoffice/core/commit/?id=85f93697defd9a812a0cda0bc4e9364e28c0339e
http://cgit.freedesktop.org/libreoffice/core/commit/?id=89d39bc100aabf5dccbe77c0b5c0c85736e85b39
and see where the "ISA(...)" was removed, it is very likely that such change
introduced the unwanted pattern.
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs