Browse Source

Minor code clean, standard "new" does not need to be null checked

Because it will bad_alloc exception you instead :D
Silence PVS Studio V668 Warnings
6.0.7
Marek Roszko 5 years ago
parent
commit
2370ca1b0e
  1. 8
      3d-viewer/3d_cache/sg/ifsg_api.cpp
  2. 37
      3d-viewer/3d_cache/sg/ifsg_appearance.cpp
  3. 39
      3d-viewer/3d_cache/sg/ifsg_colors.cpp
  4. 3
      3d-viewer/3d_cache/sg/ifsg_coordindex.cpp
  5. 37
      3d-viewer/3d_cache/sg/ifsg_coords.cpp
  6. 37
      3d-viewer/3d_cache/sg/ifsg_faceset.cpp
  7. 37
      3d-viewer/3d_cache/sg/ifsg_normals.cpp
  8. 37
      3d-viewer/3d_cache/sg/ifsg_shape.cpp
  9. 20
      3d-viewer/3d_cache/sg/ifsg_transform.cpp

8
3d-viewer/3d_cache/sg/ifsg_api.cpp

@ -234,14 +234,6 @@ SGNODE* S3D::ReadCache( const char* aFileName, void* aPluginMgr,
SGNODE* np = new SCENEGRAPH( nullptr );
if( nullptr == np )
{
wxLogTrace( MASK_3D_SG, "%s:%s:%d * [INFO] failed to instantiate SCENEGRAPH",
__FILE__, __FUNCTION__, __LINE__ );
return nullptr;
}
OPEN_ISTREAM( file, aFileName );
if( file.fail() )

37
3d-viewer/3d_cache/sg/ifsg_appearance.cpp

@ -43,8 +43,7 @@ IFSG_APPEARANCE::IFSG_APPEARANCE( bool create )
m_node = new SGAPPEARANCE( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
m_node->AssociateWrapper( &m_node );
}
@ -52,20 +51,17 @@ IFSG_APPEARANCE::IFSG_APPEARANCE( SGNODE* aParent )
{
m_node = new SGAPPEARANCE( nullptr );
if( m_node )
if( !m_node->SetParent( aParent ) )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
m_node = nullptr;
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
delete m_node;
m_node = nullptr;
return;
}
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
m_node->AssociateWrapper( &m_node );
return;
}
m_node->AssociateWrapper( &m_node );
}
@ -82,20 +78,17 @@ IFSG_APPEARANCE::IFSG_APPEARANCE( IFSG_NODE& aParent )
m_node = new SGAPPEARANCE( nullptr );
if( m_node )
if( !m_node->SetParent( pp ) )
{
if( !m_node->SetParent( pp ) )
{
delete m_node;
m_node = nullptr;
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
delete m_node;
m_node = nullptr;
return;
}
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
m_node->AssociateWrapper( &m_node );
return;
}
m_node->AssociateWrapper( &m_node );
}

39
3d-viewer/3d_cache/sg/ifsg_colors.cpp

@ -43,8 +43,7 @@ IFSG_COLORS::IFSG_COLORS( bool create )
m_node = new SGCOLORS( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
m_node->AssociateWrapper( &m_node );
}
@ -52,20 +51,17 @@ IFSG_COLORS::IFSG_COLORS( SGNODE* aParent )
{
m_node = new SGCOLORS( nullptr );
if( m_node )
if( !m_node->SetParent( aParent ) )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
m_node = nullptr;
wxLogTrace( MASK_3D_SG, "%s:%s:%d", __FILE__, __FUNCTION__, __LINE__ );
delete m_node;
m_node = nullptr;
return;
}
wxLogTrace( MASK_3D_SG, "%s:%s:%d", __FILE__, __FUNCTION__, __LINE__ );
m_node->AssociateWrapper( &m_node );
return;
}
m_node->AssociateWrapper( &m_node );
}
@ -83,21 +79,18 @@ IFSG_COLORS::IFSG_COLORS( IFSG_NODE& aParent )
m_node = new SGCOLORS( nullptr );
if( m_node )
if( !m_node->SetParent( pp ) )
{
if( !m_node->SetParent( pp ) )
{
delete m_node;
m_node = nullptr;
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__,
WrongParent );
delete m_node;
m_node = nullptr;
return;
}
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__,
WrongParent );
m_node->AssociateWrapper( &m_node );
return;
}
m_node->AssociateWrapper( &m_node );
}

3
3d-viewer/3d_cache/sg/ifsg_coordindex.cpp

@ -44,8 +44,7 @@ IFSG_COORDINDEX::IFSG_COORDINDEX( bool create )
m_node = new SGCOORDINDEX( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
m_node->AssociateWrapper( &m_node );
}

37
3d-viewer/3d_cache/sg/ifsg_coords.cpp

@ -43,8 +43,7 @@ IFSG_COORDS::IFSG_COORDS( bool create )
m_node = new SGCOORDS( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
m_node->AssociateWrapper( &m_node );
}
@ -52,20 +51,17 @@ IFSG_COORDS::IFSG_COORDS( SGNODE* aParent )
{
m_node = new SGCOORDS( nullptr );
if( m_node )
if( !m_node->SetParent( aParent ) )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
m_node = nullptr;
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
delete m_node;
m_node = nullptr;
return;
}
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
m_node->AssociateWrapper( &m_node );
return;
}
m_node->AssociateWrapper( &m_node );
}
@ -82,20 +78,17 @@ IFSG_COORDS::IFSG_COORDS( IFSG_NODE& aParent )
m_node = new SGCOORDS( nullptr );
if( m_node )
if( !m_node->SetParent( pp ) )
{
if( !m_node->SetParent( pp ) )
{
delete m_node;
m_node = nullptr;
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
delete m_node;
m_node = nullptr;
return;
}
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
m_node->AssociateWrapper( &m_node );
return;
}
m_node->AssociateWrapper( &m_node );
}

37
3d-viewer/3d_cache/sg/ifsg_faceset.cpp

@ -44,8 +44,7 @@ IFSG_FACESET::IFSG_FACESET( bool create )
m_node = new SGFACESET( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
m_node->AssociateWrapper( &m_node );
}
@ -53,20 +52,17 @@ IFSG_FACESET::IFSG_FACESET( SGNODE* aParent )
{
m_node = new SGFACESET( nullptr );
if( m_node )
if( !m_node->SetParent( aParent ) )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
m_node = nullptr;
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
delete m_node;
m_node = nullptr;
return;
}
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
m_node->AssociateWrapper( &m_node );
return;
}
m_node->AssociateWrapper( &m_node );
}
@ -83,20 +79,17 @@ IFSG_FACESET::IFSG_FACESET( IFSG_NODE& aParent )
m_node = new SGFACESET( nullptr );
if( m_node )
if( !m_node->SetParent( pp ) )
{
if( !m_node->SetParent( pp ) )
{
delete m_node;
m_node = nullptr;
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
delete m_node;
m_node = nullptr;
return;
}
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
m_node->AssociateWrapper( &m_node );
return;
}
m_node->AssociateWrapper( &m_node );
}

37
3d-viewer/3d_cache/sg/ifsg_normals.cpp

@ -44,8 +44,7 @@ IFSG_NORMALS::IFSG_NORMALS( bool create )
m_node = new SGNORMALS( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
m_node->AssociateWrapper( &m_node );
}
@ -53,20 +52,17 @@ IFSG_NORMALS::IFSG_NORMALS( SGNODE* aParent )
{
m_node = new SGNORMALS( nullptr );
if( m_node )
if( !m_node->SetParent( aParent ) )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
m_node = nullptr;
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
delete m_node;
m_node = nullptr;
return;
}
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
m_node->AssociateWrapper( &m_node );
return;
}
m_node->AssociateWrapper( &m_node );
}
@ -83,20 +79,17 @@ IFSG_NORMALS::IFSG_NORMALS( IFSG_NODE& aParent )
m_node = new SGNORMALS( nullptr );
if( m_node )
if( !m_node->SetParent( pp ) )
{
if( !m_node->SetParent( pp ) )
{
delete m_node;
m_node = nullptr;
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
delete m_node;
m_node = nullptr;
return;
}
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
m_node->AssociateWrapper( &m_node );
return;
}
m_node->AssociateWrapper( &m_node );
}

37
3d-viewer/3d_cache/sg/ifsg_shape.cpp

@ -44,8 +44,7 @@ IFSG_SHAPE::IFSG_SHAPE( bool create )
m_node = new SGSHAPE( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
m_node->AssociateWrapper( &m_node );
}
@ -53,20 +52,17 @@ IFSG_SHAPE::IFSG_SHAPE( SGNODE* aParent )
{
m_node = new SGSHAPE( nullptr );
if( m_node )
if( !m_node->SetParent( aParent ) )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
m_node = nullptr;
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
delete m_node;
m_node = nullptr;
return;
}
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
m_node->AssociateWrapper( &m_node );
return;
}
m_node->AssociateWrapper( &m_node );
}
@ -83,20 +79,17 @@ IFSG_SHAPE::IFSG_SHAPE( IFSG_NODE& aParent )
m_node = new SGSHAPE( nullptr );
if( m_node )
if( !m_node->SetParent( pp ) )
{
if( !m_node->SetParent( pp ) )
{
delete m_node;
m_node = nullptr;
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
delete m_node;
m_node = nullptr;
return;
}
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
m_node->AssociateWrapper( &m_node );
return;
}
m_node->AssociateWrapper( &m_node );
}

20
3d-viewer/3d_cache/sg/ifsg_transform.cpp

@ -43,8 +43,7 @@ IFSG_TRANSFORM::IFSG_TRANSFORM( bool create )
m_node = new SCENEGRAPH( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
m_node->AssociateWrapper( &m_node );
}
@ -52,20 +51,17 @@ IFSG_TRANSFORM::IFSG_TRANSFORM( SGNODE* aParent )
{
m_node = new SCENEGRAPH( nullptr );
if( m_node )
if( !m_node->SetParent( aParent ) )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
m_node = nullptr;
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
delete m_node;
m_node = nullptr;
return;
}
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, WrongParent );
m_node->AssociateWrapper( &m_node );
return;
}
m_node->AssociateWrapper( &m_node );
}

Loading…
Cancel
Save