From 4dae8061888504ac2cc7b596110fdd8d04163a0b Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 17 Jul 2020 14:38:43 +0200 Subject: [PATCH] PVS: V572 It is odd that the object which was created using 'new' operator is immediately cast to another type --- src/Gui/SoFCUnifiedSelection.cpp | 4 ++++ src/Gui/WorkbenchFactory.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Gui/SoFCUnifiedSelection.cpp b/src/Gui/SoFCUnifiedSelection.cpp index a8fda6a694..86edb0a44b 100644 --- a/src/Gui/SoFCUnifiedSelection.cpp +++ b/src/Gui/SoFCUnifiedSelection.cpp @@ -129,6 +129,10 @@ SoFCUnifiedSelection::SoFCUnifiedSelection() : pcDocument(0) SO_NODE_DEFINE_ENUM_VALUE(HighlightModes, OFF); SO_NODE_SET_SF_ENUM_TYPE (highlightMode, HighlightModes); + // Documentation of SoFullPath: + // Since the SoFullPath is derived from SoPath and contains no private data, you can cast SoPath instances to the SoFullPath type. + // This will allow you to examine hidden children. Actually, you are not supposed to allocate instances of this class at all. + // It is only available as an "extended interface" into the superclass SoPath. detailPath = static_cast(new SoPath(20)); detailPath->ref(); diff --git a/src/Gui/WorkbenchFactory.h b/src/Gui/WorkbenchFactory.h index 3a8f885f94..e137a8e8bf 100644 --- a/src/Gui/WorkbenchFactory.h +++ b/src/Gui/WorkbenchFactory.h @@ -84,7 +84,7 @@ public: virtual void* Produce () const { - return (void*)(new CLASS); + return (new CLASS); } };