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 )
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END, EDA_3D_CANVAS::OnPopUpMenu )
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 ) :
wxGLCanvas( parent, wxID_ANY, attribList, wxDefaultPosition, wxDefaultSize,
......@@ -83,11 +85,10 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
m_shadow_init = false;
// set an invalide value to not yet initialized indexes managing
// textures created to enhance 3D rendering
// (they are dummy values but we do not want uninitialized values)
m_text_pcb = m_text_silk = -1;
m_text_fake_shadow_front = -1;
m_text_fake_shadow_back = -1;
m_text_fake_shadow_board = -1;
m_text_pcb = m_text_silk = INVALID_INDEX;
m_text_fake_shadow_front = INVALID_INDEX;
m_text_fake_shadow_back = INVALID_INDEX;
m_text_fake_shadow_board = INVALID_INDEX;
// position of the front and back layers
// (will be initialized to a better value later)
......@@ -117,7 +118,7 @@ EDA_3D_CANVAS::~EDA_3D_CANVAS()
for( unsigned int i = 0; i < m_model_parsers_list.size(); i++ )
if( m_model_parsers_list[i] )
delete m_model_parsers_list[i];
}
......@@ -141,13 +142,15 @@ void EDA_3D_CANVAS::ClearLists( int aGlList )
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 );
if( m_text_fake_shadow_back >= 0 )
if( m_text_fake_shadow_back != INVALID_INDEX )
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 );
m_shadow_init = false;
......
......@@ -85,7 +85,7 @@ int ParseVertex( FILE* File, glm::vec3 &dst_vertex );
* parse a float value
* @param File file to read from
* @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 );
......
......@@ -61,6 +61,7 @@ VRML2_MODEL_PARSER::VRML2_MODEL_PARSER( S3D_MODEL_PARSER* aModelParser )
m_debugSpacer = "";
m_counter_DEF_GROUP = 0;
m_counter_USE_GROUP = 0;
m_discardLastGeometry = false;
}
......@@ -228,7 +229,7 @@ int VRML2_MODEL_PARSER::loadFileModel( S3D_MESH *aTransformationModel )
else if( strcmp( text, "Shape" ) == 0 )
{
m_model = new S3D_MESH();
S3D_MESH* save_ptr = m_model;
if( read_Shape() == 0 )
......@@ -279,7 +280,7 @@ int VRML2_MODEL_PARSER::loadFileModel( S3D_MESH *aTransformationModel )
{
wxString groupName = groupIt->first;
S3D_MESH* ptrModel = groupIt->second;
if( ((ptrModel->m_Point.size() == 0) || (ptrModel->m_CoordIndex.size() == 0)) &&
(ptrModel->childs.size() == 0) )
......@@ -304,7 +305,7 @@ int VRML2_MODEL_PARSER::loadFileModel( S3D_MESH *aTransformationModel )
int VRML2_MODEL_PARSER::read_Transform()
{
wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "read_Transform" ) );
debug_enter();
char text[BUFLINE_SIZE];
......@@ -326,7 +327,7 @@ int VRML2_MODEL_PARSER::read_Transform()
if( strcmp( text, "Transform" ) == 0 )
{
m_model = new S3D_MESH();
S3D_MESH* save_ptr = m_model;
if( read_Transform() == 0 )
......@@ -357,7 +358,7 @@ int VRML2_MODEL_PARSER::read_Transform()
else if( strcmp( text, "translation" ) == 0 )
{
ParseVertex( m_file, m_model->m_translation );
wxLogTrace( traceVrmlV2Parser, m_debugSpacer + wxT( "translation (%f,%f,%f)" ),
m_model->m_translation.x,
m_model->m_translation.y,
......@@ -550,7 +551,7 @@ int VRML2_MODEL_PARSER::read_Transform()
}
else
{
m_counter_USE_GROUP++;
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()
}
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__
filename = m_Filename.GetPath() + '\\' + filename;
#else
filename = m_Filename.GetPath() + '/' + filename;
#endif
if( wxFileName::FileExists( filename ) )
{
fileExists = true;
}
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 )
{
// Will now create a new parser and set the default
......@@ -651,7 +652,7 @@ int VRML2_MODEL_PARSER::read_Inline()
}
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
......@@ -808,7 +809,7 @@ int VRML2_MODEL_PARSER::read_DEF()
}
else
{
delete m_model;
delete m_model;
}
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/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -10,6 +10,7 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
......@@ -17,14 +18,15 @@
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/radiobut.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/hyperlink.h>
#include <wx/sizer.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/hyperlink.h>
#include <wx/dirctrl.h>
#include <wx/checklst.h>
#include <wx/srchctrl.h>
......@@ -52,9 +54,8 @@ class WIZARD_FPLIB_TABLE_BASE : public wxWizard
wxStaticText* m_downloadDir;
wxButton* m_btnBrowse;
wxStaticText* m_invalidDir;
wxStaticText* m_staticText8;
wxHyperlinkCtrl* m_hyperlink1;
wxStaticText* m_staticText9;
wxStaticBitmap* m_bitmapRepo;
wxHyperlinkCtrl* m_hyperlinkGithubKicad;
wxStaticText* m_staticText7;
wxGenericDirCtrl* m_filePicker;
wxStaticText* m_staticText112;
......@@ -84,7 +85,7 @@ class WIZARD_FPLIB_TABLE_BASE : public wxWizard
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;
~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