← Back to team overview

kicad-developers team mailing list archive

PATCH: 3D coverity issue + minor fixes

 

The attached patch fixes a problem reported by coverity (thanks to Mario
for the fix):

* CID 143740:  Null pointer dereferences  (NULL_RETURNS)
/plugins/3d/vrml/x3d/x3d_appearance.cpp: 122 in
X3DAPP::readFields(wxXmlNode *)()

A few minor cut/paste and style issues in the 3D code are also fixed.

- Cirilo
=== modified file '3d-viewer/3d_cache/dialogs/panel_prev_model.cpp'
--- 3d-viewer/3d_cache/dialogs/panel_prev_model.cpp	2016-03-21 07:39:25 +0000
+++ 3d-viewer/3d_cache/dialogs/panel_prev_model.cpp	2016-04-07 22:05:23 +0000
@@ -123,9 +123,7 @@
     zoff = NULL;
 
     wxBoxSizer* mainBox = new wxBoxSizer( wxVERTICAL );
-
-    wxStaticBoxSizer* vbox = new wxStaticBoxSizer( wxVERTICAL, this, _( "3D Model Orientation" ) );
-
+    wxStaticBoxSizer* vbox = new wxStaticBoxSizer( wxVERTICAL, this, _( "3D Preview" ) );
     m_FileTree = NULL;
 
     if( NULL != aParent )

=== modified file '3d-viewer/common_ogl/cogl_att_list.cpp'
--- 3d-viewer/common_ogl/cogl_att_list.cpp	2015-12-08 07:31:57 +0000
+++ 3d-viewer/common_ogl/cogl_att_list.cpp	2016-04-07 22:24:17 +0000
@@ -56,7 +56,8 @@
 
 
 int COGL_ATT_LIST::m_openGL_AttributesList_toUse[
-                      sizeof( COGL_ATT_LIST::m_openGL_AttributesList )] = { 0 };
+    sizeof( COGL_ATT_LIST::m_openGL_AttributesList ) /
+    sizeof( COGL_ATT_LIST::m_openGL_AttributesList[0] ) ] = { 0 };
 
 
 const int *COGL_ATT_LIST::GetAttributesList( bool aUseAntiAliasing )

=== modified file 'include/plugins/3d/3d_plugin.h'
--- include/plugins/3d/3d_plugin.h	2015-12-14 03:51:28 +0000
+++ include/plugins/3d/3d_plugin.h	2016-04-07 22:04:26 +0000
@@ -43,7 +43,7 @@
 #define REVISION 0
 #define PATCH 0
 
-#include "../kicad_plugin.h"
+#include "plugins/kicad_plugin.h"
 
 
 KICAD_PLUGIN_EXPORT char const* GetKicadPluginClass( void )

=== modified file 'include/plugins/3dapi/ifsg_colors.h'
--- include/plugins/3dapi/ifsg_colors.h	2016-01-06 04:34:14 +0000
+++ include/plugins/3dapi/ifsg_colors.h	2016-04-07 22:04:26 +0000
@@ -35,7 +35,7 @@
 
 
 /**
- * Class IFSG_INDEX
+ * Class IFSG_COLORS
  * is the wrapper for SGCOLORS
  */
 class SGLIB_API IFSG_COLORS : public IFSG_NODE

=== modified file 'include/plugins/3dapi/ifsg_coords.h'
--- include/plugins/3dapi/ifsg_coords.h	2015-12-09 07:30:48 +0000
+++ include/plugins/3dapi/ifsg_coords.h	2016-04-07 22:04:26 +0000
@@ -34,7 +34,7 @@
 
 
 /**
- * Class IFSG_INDEX
+ * Class IFSG_COORDS
  * is the wrapper for SGCOORDS
  */
 class SGLIB_API IFSG_COORDS : public IFSG_NODE

=== modified file 'include/plugins/3dapi/ifsg_node.h'
--- include/plugins/3dapi/ifsg_node.h	2015-12-09 07:30:48 +0000
+++ include/plugins/3dapi/ifsg_node.h	2016-04-07 22:04:26 +0000
@@ -53,14 +53,6 @@
  */
 class SGLIB_API IFSG_NODE
 {
-private:
-    // hide the copy constructors and assignment operator to avoid accidental misuse
-    IFSG_NODE( const IFSG_NODE& aParent );
-    IFSG_NODE( IFSG_NODE& aParent );
-    IFSG_NODE( volatile const IFSG_NODE& aParent );
-    IFSG_NODE( volatile IFSG_NODE& aParent );
-    IFSG_NODE& operator= ( const IFSG_NODE& );
-
 protected:
     SGNODE* m_node;
 
@@ -68,6 +60,13 @@
     IFSG_NODE();
     virtual ~IFSG_NODE();
 
+    // deleted operators
+    IFSG_NODE( const IFSG_NODE& aParent ) = delete;
+    IFSG_NODE( IFSG_NODE& aParent ) = delete;
+    IFSG_NODE( volatile const IFSG_NODE& aParent ) = delete;
+    IFSG_NODE( volatile IFSG_NODE& aParent ) = delete;
+    IFSG_NODE& operator= ( const IFSG_NODE& ) = delete;
+
     /**
      * Function Destroy
      * deletes the object held by this wrapper


Follow ups