3D: fix issues reported by Coverity scan
*** CID 143752: Incorrect expression (USELESS_CALL) *** CID 143751: Incorrect expression (UNUSED_VALUE) *** CID 143749: Uninitialized members (UNINIT_CTOR) *** CID 143748: Uninitialized members (UNINIT_CTOR) *** CID 143747: Uninitialized members (UNINIT_CTOR) *** CID 143746: Uninitialized members (UNINIT_CTOR) *** CID 143745: Uninitialized members (UNINIT_CTOR) *** CID 143744: Uninitialized members (UNINIT_CTOR) *** CID 143740: Null pointer dereferences (NULL_RETURNS) *** CID 143739: Memory - corruptions (MISMATCHED_ITERATOR) *** CID 143735: Integer handling issues (CONSTANT_EXPRESSION_RESULT) *** CID 143734: Error handling issues (CHECKED_RETURN)
This commit is contained in:
parent
e1b308b3b1
commit
c2a60d14d7
|
@ -175,7 +175,7 @@ bool DLG_SELECT_3DMODEL::TransferDataFromWindow()
|
||||||
m_model->rotation.z = 0.0;
|
m_model->rotation.z = 0.0;
|
||||||
|
|
||||||
m_model->offset = m_model->rotation;
|
m_model->offset = m_model->rotation;
|
||||||
m_model->filename.empty();
|
m_model->filename.clear();
|
||||||
|
|
||||||
wxString fname = m_FileTree->GetFilePath();
|
wxString fname = m_FileTree->GetFilePath();
|
||||||
|
|
||||||
|
|
|
@ -133,8 +133,19 @@ void SCENEGRAPH::unlinkNode( const SGNODE* aNode, bool isChild )
|
||||||
if( NULL == aNode )
|
if( NULL == aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
switch( aNode->GetNodeType() )
|
||||||
|
{
|
||||||
|
case S3D::SGTYPE_TRANSFORM:
|
||||||
UNLINK_NODE( S3D::SGTYPE_TRANSFORM, SCENEGRAPH, aNode, m_Transforms, m_RTransforms, isChild );
|
UNLINK_NODE( S3D::SGTYPE_TRANSFORM, SCENEGRAPH, aNode, m_Transforms, m_RTransforms, isChild );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case S3D::SGTYPE_SHAPE:
|
||||||
UNLINK_NODE( S3D::SGTYPE_SHAPE, SGSHAPE, aNode, m_Shape, m_RShape, isChild );
|
UNLINK_NODE( S3D::SGTYPE_SHAPE, SGSHAPE, aNode, m_Shape, m_RShape, isChild );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -82,8 +82,8 @@ class SGCOORDINDEX;
|
||||||
std::vector< aType* >::iterator eL; \
|
std::vector< aType* >::iterator eL; \
|
||||||
if( isChild ) { \
|
if( isChild ) { \
|
||||||
oSL = &aOwnedList; \
|
oSL = &aOwnedList; \
|
||||||
sL = aOwnedList.begin(); \
|
sL = oSL->begin(); \
|
||||||
eL = aOwnedList.end(); \
|
eL = oSL->end(); \
|
||||||
while( sL != eL ) { \
|
while( sL != eL ) { \
|
||||||
if( (SGNODE*)*sL == aNode ) { \
|
if( (SGNODE*)*sL == aNode ) { \
|
||||||
oSL->erase( sL ); \
|
oSL->erase( sL ); \
|
||||||
|
@ -93,8 +93,8 @@ class SGCOORDINDEX;
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
oSL = &aRefList; \
|
oSL = &aRefList; \
|
||||||
sL = aRefList.begin(); \
|
sL = oSL->begin(); \
|
||||||
eL = aRefList.end(); \
|
eL = oSL->end(); \
|
||||||
while( sL != eL ) { \
|
while( sL != eL ) { \
|
||||||
if( (SGNODE*)*sL == aNode ) { \
|
if( (SGNODE*)*sL == aNode ) { \
|
||||||
delNodeRef( this ); \
|
delNodeRef( this ); \
|
||||||
|
|
|
@ -91,6 +91,7 @@ C3D_MODEL_VIEWER::C3D_MODEL_VIEWER( wxWindow *aParent,
|
||||||
m_reload_is_needed = false;
|
m_reload_is_needed = false;
|
||||||
m_ogl_3dmodel = NULL;
|
m_ogl_3dmodel = NULL;
|
||||||
m_3d_model = NULL;
|
m_3d_model = NULL;
|
||||||
|
m_BiuTo3Dunits = 1.0;
|
||||||
|
|
||||||
// Explicitly create a new rendering context instance for this canvas.
|
// Explicitly create a new rendering context instance for this canvas.
|
||||||
m_glRC = new wxGLContext( this );
|
m_glRC = new wxGLContext( this );
|
||||||
|
|
|
@ -42,6 +42,7 @@ C3D_RENDER_OGL_LEGACY::C3D_RENDER_OGL_LEGACY( CINFO3D_VISU &aSettings,
|
||||||
m_ogl_disp_lists_layers.clear();
|
m_ogl_disp_lists_layers.clear();
|
||||||
m_triangles.clear();
|
m_triangles.clear();
|
||||||
m_ogl_disp_list_board = 0;
|
m_ogl_disp_list_board = 0;
|
||||||
|
m_ogl_circle_texture = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ C_OGL_3DMODEL::C_OGL_3DMODEL( const S3DMODEL &a3DModel )
|
||||||
{
|
{
|
||||||
m_ogl_idx_list_opaque = 0;
|
m_ogl_idx_list_opaque = 0;
|
||||||
m_ogl_idx_list_transparent = 0;
|
m_ogl_idx_list_transparent = 0;
|
||||||
|
m_ogl_idx_list_meshes = 0;
|
||||||
m_nr_meshes = 0;
|
m_nr_meshes = 0;
|
||||||
m_meshs_bbox = NULL;
|
m_meshs_bbox = NULL;
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ WRL1SHAPEHINTS::WRL1SHAPEHINTS( NAMEREGISTER* aDictionary ) : WRL1NODE( aDiction
|
||||||
{
|
{
|
||||||
m_order = ORD_UNKNOWN;
|
m_order = ORD_UNKNOWN;
|
||||||
m_Type = WRL1_SHAPEHINTS;
|
m_Type = WRL1_SHAPEHINTS;
|
||||||
m_crease = 0.5;
|
|
||||||
m_crease = 0.733; // approx 42 degrees; this is larger than VRML spec.
|
m_crease = 0.733; // approx 42 degrees; this is larger than VRML spec.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -47,6 +46,7 @@ WRL1SHAPEHINTS::WRL1SHAPEHINTS( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
||||||
{
|
{
|
||||||
m_order = ORD_UNKNOWN;
|
m_order = ORD_UNKNOWN;
|
||||||
m_Type = WRL1_SHAPEHINTS;
|
m_Type = WRL1_SHAPEHINTS;
|
||||||
|
m_crease = 0.733; // approx 42 degrees; this is larger than VRML spec.
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( NULL != m_Parent )
|
||||||
|
|
|
@ -52,6 +52,7 @@ WRLPROC::WRLPROC( LINE_READER* aLineReader )
|
||||||
m_eof = false;
|
m_eof = false;
|
||||||
m_fileline = 0;
|
m_fileline = 0;
|
||||||
m_bufpos = 0;
|
m_bufpos = 0;
|
||||||
|
m_file = aLineReader;
|
||||||
|
|
||||||
if( NULL == aLineReader )
|
if( NULL == aLineReader )
|
||||||
{
|
{
|
||||||
|
@ -60,8 +61,6 @@ WRLPROC::WRLPROC( LINE_READER* aLineReader )
|
||||||
}
|
}
|
||||||
|
|
||||||
m_error.clear();
|
m_error.clear();
|
||||||
m_file = aLineReader;
|
|
||||||
|
|
||||||
wxString tname = m_file->GetSource();
|
wxString tname = m_file->GetSource();
|
||||||
m_filename = tname.ToUTF8();
|
m_filename = tname.ToUTF8();
|
||||||
wxFileName fn( tname );
|
wxFileName fn( tname );
|
||||||
|
@ -166,7 +165,7 @@ bool WRLPROC::getRawLine( void )
|
||||||
|
|
||||||
while( sS != eS )
|
while( sS != eS )
|
||||||
{
|
{
|
||||||
if( '\xff' == ((*sS) & 0x80) )
|
if( ((*sS) & 0x80) )
|
||||||
{
|
{
|
||||||
m_error = " non-ASCII character sequence in VRML1 file";
|
m_error = " non-ASCII character sequence in VRML1 file";
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -117,11 +117,11 @@ void X3DAPP::readFields( wxXmlNode* aNode )
|
||||||
m_MatName = prop->GetValue();
|
m_MatName = prop->GetValue();
|
||||||
m_Dict->AddName( m_MatName, this );
|
m_Dict->AddName( m_MatName, this );
|
||||||
}
|
}
|
||||||
if( pname == "USE" )
|
else if( pname == "USE" )
|
||||||
{
|
{
|
||||||
X3DNODE* np = m_Dict->FindName( prop->GetValue() );
|
X3DNODE* np = m_Dict->FindName( prop->GetValue() );
|
||||||
|
|
||||||
if( np->GetNodeType() == X3D_APPEARANCE )
|
if( NULL != np && np->GetNodeType() == X3D_APPEARANCE )
|
||||||
{
|
{
|
||||||
X3DAPP* ap = (X3DAPP*) np;
|
X3DAPP* ap = (X3DAPP*) np;
|
||||||
diffuseColor = ap->diffuseColor;
|
diffuseColor = ap->diffuseColor;
|
||||||
|
|
|
@ -280,7 +280,6 @@ bool DXF2IDF::WriteOutline( FILE* aFile, bool isInch )
|
||||||
void DXF2IDF::addHeader( const DRW_Header* data )
|
void DXF2IDF::addHeader( const DRW_Header* data )
|
||||||
{
|
{
|
||||||
std::map<std::string, DRW_Variant*>::const_iterator it;
|
std::map<std::string, DRW_Variant*>::const_iterator it;
|
||||||
m_scale = 1.0; // assume no scale factor
|
|
||||||
|
|
||||||
for( it = data->vars.begin(); it != data->vars.end(); ++it )
|
for( it = data->vars.begin(); it != data->vars.end(); ++it )
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,6 +38,7 @@ private:
|
||||||
void insertArc( const IDF_POINT& aSegStart, const IDF_POINT& aSegEnd, double aBulge );
|
void insertArc( const IDF_POINT& aSegStart, const IDF_POINT& aSegEnd, double aBulge );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
DXF2IDF() : m_scale( 1.0 ) {};
|
||||||
~DXF2IDF();
|
~DXF2IDF();
|
||||||
|
|
||||||
bool ReadDxf( const std::string aFile );
|
bool ReadDxf( const std::string aFile );
|
||||||
|
|
Loading…
Reference in New Issue