Commit c9a917ee authored by jean-pierre charras's avatar jean-pierre charras

3d viewer: fix a few warning coverity (and a potential bug). fp libs wizard:...

3d viewer: fix a few warning coverity (and a potential bug). fp libs wizard: make it internationalized, and replace an untranslatable string created by grouping 3 strings by one translatable string.
parent 9a6deaeb
...@@ -73,6 +73,8 @@ BEGIN_EVENT_TABLE( EDA_3D_CANVAS, wxGLCanvas ) ...@@ -73,6 +73,8 @@ BEGIN_EVENT_TABLE( EDA_3D_CANVAS, wxGLCanvas )
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END, EDA_3D_CANVAS::OnPopUpMenu ) EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END, EDA_3D_CANVAS::OnPopUpMenu )
END_EVENT_TABLE() END_EVENT_TABLE()
// Define an invalid value for some unsigned int indexes
#define INVALID_INDEX GL_INVALID_VALUE
EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) : EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
wxGLCanvas( parent, wxID_ANY, attribList, wxDefaultPosition, wxDefaultSize, wxGLCanvas( parent, wxID_ANY, attribList, wxDefaultPosition, wxDefaultSize,
...@@ -83,11 +85,10 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) : ...@@ -83,11 +85,10 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
m_shadow_init = false; m_shadow_init = false;
// set an invalide value to not yet initialized indexes managing // set an invalide value to not yet initialized indexes managing
// textures created to enhance 3D rendering // textures created to enhance 3D rendering
// (they are dummy values but we do not want uninitialized values) m_text_pcb = m_text_silk = INVALID_INDEX;
m_text_pcb = m_text_silk = -1; m_text_fake_shadow_front = INVALID_INDEX;
m_text_fake_shadow_front = -1; m_text_fake_shadow_back = INVALID_INDEX;
m_text_fake_shadow_back = -1; m_text_fake_shadow_board = INVALID_INDEX;
m_text_fake_shadow_board = -1;
// position of the front and back layers // position of the front and back layers
// (will be initialized to a better value later) // (will be initialized to a better value later)
...@@ -117,7 +118,7 @@ EDA_3D_CANVAS::~EDA_3D_CANVAS() ...@@ -117,7 +118,7 @@ EDA_3D_CANVAS::~EDA_3D_CANVAS()
for( unsigned int i = 0; i < m_model_parsers_list.size(); i++ ) for( unsigned int i = 0; i < m_model_parsers_list.size(); i++ )
if( m_model_parsers_list[i] ) if( m_model_parsers_list[i] )
delete m_model_parsers_list[i]; delete m_model_parsers_list[i];
} }
...@@ -141,13 +142,15 @@ void EDA_3D_CANVAS::ClearLists( int aGlList ) ...@@ -141,13 +142,15 @@ void EDA_3D_CANVAS::ClearLists( int aGlList )
m_glLists[ii] = 0; m_glLists[ii] = 0;
} }
if( m_text_fake_shadow_front >= 0 ) // When m_text_fake_shadow_??? is set to INVALID_INDEX, textures are no yet
// created.
if( m_text_fake_shadow_front != INVALID_INDEX )
glDeleteTextures( 1, &m_text_fake_shadow_front ); glDeleteTextures( 1, &m_text_fake_shadow_front );
if( m_text_fake_shadow_back >= 0 ) if( m_text_fake_shadow_back != INVALID_INDEX )
glDeleteTextures( 1, &m_text_fake_shadow_back ); glDeleteTextures( 1, &m_text_fake_shadow_back );
if( m_text_fake_shadow_board >= 0 ) if( m_text_fake_shadow_board != INVALID_INDEX )
glDeleteTextures( 1, &m_text_fake_shadow_board ); glDeleteTextures( 1, &m_text_fake_shadow_board );
m_shadow_init = false; m_shadow_init = false;
......
...@@ -85,7 +85,7 @@ int ParseVertex( FILE* File, glm::vec3 &dst_vertex ); ...@@ -85,7 +85,7 @@ int ParseVertex( FILE* File, glm::vec3 &dst_vertex );
* parse a float value * parse a float value
* @param File file to read from * @param File file to read from
* @param dst_float destination float * @param dst_float destination float
* @return int - Return the number of floats readed * @return int - Return the number of floats readed (0 or 1)
*/ */
int ParseFloat( FILE* File, float *dst_float ); int ParseFloat( FILE* File, float *dst_float );
......
...@@ -61,6 +61,7 @@ VRML2_MODEL_PARSER::VRML2_MODEL_PARSER( S3D_MODEL_PARSER* aModelParser ) ...@@ -61,6 +61,7 @@ VRML2_MODEL_PARSER::VRML2_MODEL_PARSER( S3D_MODEL_PARSER* aModelParser )
m_debugSpacer = ""; m_debugSpacer = "";
m_counter_DEF_GROUP = 0; m_counter_DEF_GROUP = 0;
m_counter_USE_GROUP = 0; m_counter_USE_GROUP = 0;
m_discardLastGeometry = false;
} }
...@@ -228,7 +229,7 @@ int VRML2_MODEL_PARSER::loadFileModel( S3D_MESH *aTransformationModel ) ...@@ -228,7 +229,7 @@ int VRML2_MODEL_PARSER::loadFileModel( S3D_MESH *aTransformationModel )
else if( strcmp( text, "Shape" ) == 0 ) else if( strcmp( text, "Shape" ) == 0 )
{ {
m_model = new S3D_MESH(); m_model = new S3D_MESH();
S3D_MESH* save_ptr = m_model; S3D_MESH* save_ptr = m_model;
if( read_Shape() == 0 ) if( read_Shape() == 0 )
...@@ -279,7 +280,7 @@ int VRML2_MODEL_PARSER::loadFileModel( S3D_MESH *aTransformationModel ) ...@@ -279,7 +280,7 @@ int VRML2_MODEL_PARSER::loadFileModel( S3D_MESH *aTransformationModel )
{ {
wxString groupName = groupIt->first; wxString groupName = groupIt->first;
S3D_MESH* ptrModel = groupIt->second; S3D_MESH* ptrModel = groupIt->second;
if( ((ptrModel->m_Point.size() == 0) || (ptrModel->m_CoordIndex.size() == 0)) && if( ((ptrModel->m_Point.size() == 0) || (ptrModel->m_CoordIndex.size() == 0)) &&
(ptrModel->childs.size() == 0) ) (ptrModel->childs.size() == 0) )
...@@ -304,7 +305,7 @@ int VRML2_MODEL_PARSER::loadFileModel( S3D_MESH *aTransformationModel ) ...@@ -304,7 +305,7 @@ int VRML2_MODEL_PARSER::loadFileModel( S3D_MESH *aTransformationModel )
int VRML2_MODEL_PARSER::read_Transform() int VRML2_MODEL_PARSER::read_Transform()
{ {
wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "read_Transform" ) ); wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "read_Transform" ) );
debug_enter(); debug_enter();
char text[BUFLINE_SIZE]; char text[BUFLINE_SIZE];
...@@ -326,7 +327,7 @@ int VRML2_MODEL_PARSER::read_Transform() ...@@ -326,7 +327,7 @@ int VRML2_MODEL_PARSER::read_Transform()
if( strcmp( text, "Transform" ) == 0 ) if( strcmp( text, "Transform" ) == 0 )
{ {
m_model = new S3D_MESH(); m_model = new S3D_MESH();
S3D_MESH* save_ptr = m_model; S3D_MESH* save_ptr = m_model;
if( read_Transform() == 0 ) if( read_Transform() == 0 )
...@@ -357,7 +358,7 @@ int VRML2_MODEL_PARSER::read_Transform() ...@@ -357,7 +358,7 @@ int VRML2_MODEL_PARSER::read_Transform()
else if( strcmp( text, "translation" ) == 0 ) else if( strcmp( text, "translation" ) == 0 )
{ {
ParseVertex( m_file, m_model->m_translation ); ParseVertex( m_file, m_model->m_translation );
wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "translation (%f,%f,%f)" ), wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "translation (%f,%f,%f)" ),
m_model->m_translation.x, m_model->m_translation.x,
m_model->m_translation.y, m_model->m_translation.y,
...@@ -550,7 +551,7 @@ int VRML2_MODEL_PARSER::read_Transform() ...@@ -550,7 +551,7 @@ int VRML2_MODEL_PARSER::read_Transform()
} }
else else
{ {
m_counter_USE_GROUP++; m_counter_USE_GROUP++;
wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "read_Transform: USE %s Add child model with %lu points, %lu coordIndex, %lu childs." ), wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "read_Transform: USE %s Add child model with %lu points, %lu coordIndex, %lu childs." ),
...@@ -622,25 +623,25 @@ int VRML2_MODEL_PARSER::read_Inline() ...@@ -622,25 +623,25 @@ int VRML2_MODEL_PARSER::read_Inline()
} }
else else
{ {
wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "URL Failed to open file as a full path: \"%s\", will try now a relative path..." ), filename ); wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "URL Failed to open file as a full path: \"%s\", will try now a relative path..." ), filename );
#ifdef __WINDOWS__ #ifdef __WINDOWS__
filename = m_Filename.GetPath() + '\\' + filename; filename = m_Filename.GetPath() + '\\' + filename;
#else #else
filename = m_Filename.GetPath() + '/' + filename; filename = m_Filename.GetPath() + '/' + filename;
#endif #endif
if( wxFileName::FileExists( filename ) ) if( wxFileName::FileExists( filename ) )
{ {
fileExists = true; fileExists = true;
} }
else else
{ {
wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "URL Failed to open file: \"%s\"" ), filename ); wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "URL Failed to open file: \"%s\"" ), filename );
} }
} }
if( fileExists ) if( fileExists )
{ {
// Will now create a new parser and set the default // Will now create a new parser and set the default
...@@ -651,7 +652,7 @@ int VRML2_MODEL_PARSER::read_Inline() ...@@ -651,7 +652,7 @@ int VRML2_MODEL_PARSER::read_Inline()
} }
else else
{ {
wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "URL Failed to open file: %s" ), text ); wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "URL Failed to open file: %s" ), text );
} }
} }
else else
...@@ -808,7 +809,7 @@ int VRML2_MODEL_PARSER::read_DEF() ...@@ -808,7 +809,7 @@ int VRML2_MODEL_PARSER::read_DEF()
} }
else else
{ {
delete m_model; delete m_model;
} }
m_model = parent; m_model = parent;
......
This diff is collapsed.
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015) // C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
...@@ -17,14 +18,15 @@ ...@@ -17,14 +18,15 @@
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/radiobut.h> #include <wx/radiobut.h>
#include <wx/sizer.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/hyperlink.h> #include <wx/sizer.h>
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/image.h> #include <wx/image.h>
#include <wx/icon.h> #include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/hyperlink.h>
#include <wx/dirctrl.h> #include <wx/dirctrl.h>
#include <wx/checklst.h> #include <wx/checklst.h>
#include <wx/srchctrl.h> #include <wx/srchctrl.h>
...@@ -52,9 +54,8 @@ class WIZARD_FPLIB_TABLE_BASE : public wxWizard ...@@ -52,9 +54,8 @@ class WIZARD_FPLIB_TABLE_BASE : public wxWizard
wxStaticText* m_downloadDir; wxStaticText* m_downloadDir;
wxButton* m_btnBrowse; wxButton* m_btnBrowse;
wxStaticText* m_invalidDir; wxStaticText* m_invalidDir;
wxStaticText* m_staticText8; wxStaticBitmap* m_bitmapRepo;
wxHyperlinkCtrl* m_hyperlink1; wxHyperlinkCtrl* m_hyperlinkGithubKicad;
wxStaticText* m_staticText9;
wxStaticText* m_staticText7; wxStaticText* m_staticText7;
wxGenericDirCtrl* m_filePicker; wxGenericDirCtrl* m_filePicker;
wxStaticText* m_staticText112; wxStaticText* m_staticText112;
...@@ -84,7 +85,7 @@ class WIZARD_FPLIB_TABLE_BASE : public wxWizard ...@@ -84,7 +85,7 @@ class WIZARD_FPLIB_TABLE_BASE : public wxWizard
public: public:
WIZARD_FPLIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Add Footprint Libraries Wizard"), const wxBitmap& bitmap = wxArtProvider::GetBitmap( wxART_HELP_BOOK, wxART_FRAME_ICON ), const wxPoint& pos = wxDefaultPosition, long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER ); WIZARD_FPLIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Add Footprint Libraries Wizard"), const wxBitmap& bitmap = wxArtProvider::GetBitmap( wxART_HELP_BOOK, wxART_FRAME_ICON ), const wxPoint& pos = wxDefaultPosition, long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER );
WizardPages m_pages; WizardPages m_pages;
~WIZARD_FPLIB_TABLE_BASE(); ~WIZARD_FPLIB_TABLE_BASE();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment