Commit b0ad779e authored by Maciej Suminski's avatar Maciej Suminski

Calming down the Coverity report.

parent d819a380
...@@ -492,7 +492,14 @@ public: ...@@ -492,7 +492,14 @@ public:
{ {
wxASSERT( aLayer < (int) m_layers.size() ); wxASSERT( aLayer < (int) m_layers.size() );
return m_layers.at( aLayer ).target == TARGET_CACHED; try
{
return m_layers.at( aLayer ).target == TARGET_CACHED;
}
catch( std::out_of_range )
{
return false;
}
} }
/** /**
......
...@@ -82,6 +82,8 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() : ...@@ -82,6 +82,8 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_PcbTextSize = wxSize( DEFAULT_TEXT_PCB_SIZE, m_PcbTextSize = wxSize( DEFAULT_TEXT_PCB_SIZE,
DEFAULT_TEXT_PCB_SIZE ); // current Pcb (not module) Text size DEFAULT_TEXT_PCB_SIZE ); // current Pcb (not module) Text size
m_useCustomTrackVia = false;
m_customTrackWidth = DMils2iu( 100 );
m_TrackMinWidth = DMils2iu( 100 ); // track min value for width (min copper size value) m_TrackMinWidth = DMils2iu( 100 ); // track min value for width (min copper size value)
m_ViasMinSize = DMils2iu( 350 ); // vias (not micro vias) min diameter m_ViasMinSize = DMils2iu( 350 ); // vias (not micro vias) min diameter
m_ViasMinDrill = DMils2iu( 200 ); // vias (not micro vias) min drill diameter m_ViasMinDrill = DMils2iu( 200 ); // vias (not micro vias) min drill diameter
......
...@@ -800,14 +800,21 @@ EDA_ITEM* MODULE::Clone() const ...@@ -800,14 +800,21 @@ EDA_ITEM* MODULE::Clone() const
void MODULE::RunOnChildren( boost::function<void (BOARD_ITEM*)> aFunction ) void MODULE::RunOnChildren( boost::function<void (BOARD_ITEM*)> aFunction )
{ {
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) try
aFunction( static_cast<BOARD_ITEM*>( pad ) ); {
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
aFunction( static_cast<BOARD_ITEM*>( pad ) );
for( BOARD_ITEM* drawing = m_Drawings; drawing; drawing = drawing->Next() ) for( BOARD_ITEM* drawing = m_Drawings; drawing; drawing = drawing->Next() )
aFunction( drawing ); aFunction( drawing );
aFunction( static_cast<BOARD_ITEM*>( m_Reference ) ); aFunction( static_cast<BOARD_ITEM*>( m_Reference ) );
aFunction( static_cast<BOARD_ITEM*>( m_Value ) ); aFunction( static_cast<BOARD_ITEM*>( m_Value ) );
}
catch( boost::bad_function_call& e )
{
DisplayError( NULL, wxT( "Error running MODULE::RunOnChildren" ) );
}
} }
......
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
#include <class_module.h> #include <class_module.h>
DRAWING_TOOL::DRAWING_TOOL() : DRAWING_TOOL::DRAWING_TOOL() :
TOOL_INTERACTIVE( "pcbnew.InteractiveDrawing" ), m_editModules( false ) TOOL_INTERACTIVE( "pcbnew.InteractiveDrawing" ), m_view( NULL ),
m_controls( NULL ), m_board( NULL ), m_frame( NULL ), m_editModules( false ), m_lineWidth( 1 )
{ {
} }
...@@ -901,7 +902,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic, ...@@ -901,7 +902,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
// Init the new item attributes // Init the new item attributes
aGraphic->SetShape( (STROKE_T) aShape ); aGraphic->SetShape( (STROKE_T) aShape );
aGraphic->SetWidth( lineWidth ); aGraphic->SetWidth( m_lineWidth );
aGraphic->SetStart( wxPoint( aStartingPoint->x, aStartingPoint->y ) ); aGraphic->SetStart( wxPoint( aStartingPoint->x, aStartingPoint->y ) );
aGraphic->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) ); aGraphic->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) );
aGraphic->SetLayer( layer ); aGraphic->SetLayer( layer );
...@@ -963,8 +964,8 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic, ...@@ -963,8 +964,8 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
{ {
// Init the new item attributes // Init the new item attributes
aGraphic->SetShape( (STROKE_T) aShape ); aGraphic->SetShape( (STROKE_T) aShape );
lineWidth = getSegmentWidth( layer ); m_lineWidth = getSegmentWidth( layer );
aGraphic->SetWidth( lineWidth ); aGraphic->SetWidth( m_lineWidth );
aGraphic->SetStart( wxPoint( cursorPos.x, cursorPos.y ) ); aGraphic->SetStart( wxPoint( cursorPos.x, cursorPos.y ) );
aGraphic->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) ); aGraphic->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) );
aGraphic->SetLayer( layer ); aGraphic->SetLayer( layer );
...@@ -1012,17 +1013,17 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic, ...@@ -1012,17 +1013,17 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
else if( evt->IsAction( &COMMON_ACTIONS::incWidth ) ) else if( evt->IsAction( &COMMON_ACTIONS::incWidth ) )
{ {
lineWidth += WIDTH_STEP; m_lineWidth += WIDTH_STEP;
aGraphic->SetWidth( lineWidth ); aGraphic->SetWidth( m_lineWidth );
updatePreview = true; updatePreview = true;
} }
else if( evt->IsAction( &COMMON_ACTIONS::decWidth ) ) else if( evt->IsAction( &COMMON_ACTIONS::decWidth ) )
{ {
if( lineWidth > (unsigned) WIDTH_STEP ) if( m_lineWidth > (unsigned) WIDTH_STEP )
{ {
lineWidth -= WIDTH_STEP; m_lineWidth -= WIDTH_STEP;
aGraphic->SetWidth( lineWidth ); aGraphic->SetWidth( m_lineWidth );
updatePreview = true; updatePreview = true;
} }
} }
......
...@@ -203,7 +203,7 @@ private: ...@@ -203,7 +203,7 @@ private:
bool m_editModules; bool m_editModules;
/// Stores the current line width for multisegment drawing. /// Stores the current line width for multisegment drawing.
unsigned int lineWidth; unsigned int m_lineWidth;
// How does line width change after one -/+ key press. // How does line width change after one -/+ key press.
static const int WIDTH_STEP = 100000; static const int WIDTH_STEP = 100000;
......
...@@ -43,7 +43,8 @@ ...@@ -43,7 +43,8 @@
#include "edit_tool.h" #include "edit_tool.h"
EDIT_TOOL::EDIT_TOOL() : EDIT_TOOL::EDIT_TOOL() :
TOOL_INTERACTIVE( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ), m_editModules( false ) TOOL_INTERACTIVE( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ),
m_dragging( false ), m_editModules( false ), m_updateFlag( KIGFX::VIEW_ITEM::NONE )
{ {
} }
...@@ -51,6 +52,7 @@ EDIT_TOOL::EDIT_TOOL() : ...@@ -51,6 +52,7 @@ EDIT_TOOL::EDIT_TOOL() :
void EDIT_TOOL::Reset( RESET_REASON aReason ) void EDIT_TOOL::Reset( RESET_REASON aReason )
{ {
m_dragging = false; m_dragging = false;
m_updateFlag = KIGFX::VIEW_ITEM::NONE;
} }
......
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
#include <wx/defs.h> #include <wx/defs.h>
MODULE_TOOLS::MODULE_TOOLS() : MODULE_TOOLS::MODULE_TOOLS() :
TOOL_INTERACTIVE( "pcbnew.ModuleEditor" ) TOOL_INTERACTIVE( "pcbnew.ModuleEditor" ), m_view( NULL ), m_controls( NULL ),
m_board( NULL ), m_frame( NULL )
{ {
} }
......
...@@ -47,7 +47,7 @@ public: ...@@ -47,7 +47,7 @@ public:
PCB_EDITOR_CONTROL::PCB_EDITOR_CONTROL() : PCB_EDITOR_CONTROL::PCB_EDITOR_CONTROL() :
TOOL_INTERACTIVE( "pcbnew.EditorControl" ) TOOL_INTERACTIVE( "pcbnew.EditorControl" ), m_frame( NULL )
{ {
} }
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
PCBNEW_CONTROL::PCBNEW_CONTROL() : PCBNEW_CONTROL::PCBNEW_CONTROL() :
TOOL_INTERACTIVE( "pcbnew.Control" ) TOOL_INTERACTIVE( "pcbnew.Control" ), m_frame( NULL )
{ {
} }
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
PLACEMENT_TOOL::PLACEMENT_TOOL() : PLACEMENT_TOOL::PLACEMENT_TOOL() :
TOOL_INTERACTIVE( "pcbnew.Placement" ) TOOL_INTERACTIVE( "pcbnew.Placement" ), m_selectionTool( NULL )
{ {
} }
......
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