Browse Source

Calming down the Coverity report.

pull/2/head
Maciej Suminski 11 years ago
parent
commit
b0ad779ee4
  1. 9
      include/view/view.h
  2. 2
      pcbnew/class_board_design_settings.cpp
  3. 19
      pcbnew/class_module.cpp
  4. 19
      pcbnew/tools/drawing_tool.cpp
  5. 2
      pcbnew/tools/drawing_tool.h
  6. 4
      pcbnew/tools/edit_tool.cpp
  7. 3
      pcbnew/tools/module_tools.cpp
  8. 2
      pcbnew/tools/pcb_editor_control.cpp
  9. 2
      pcbnew/tools/pcbnew_control.cpp
  10. 2
      pcbnew/tools/placement_tool.cpp

9
include/view/view.h

@ -492,7 +492,14 @@ public:
{
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;
}
}
/**

2
pcbnew/class_board_design_settings.cpp

@ -82,6 +82,8 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_PcbTextSize = wxSize( DEFAULT_TEXT_PCB_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_ViasMinSize = DMils2iu( 350 ); // vias (not micro vias) min diameter
m_ViasMinDrill = DMils2iu( 200 ); // vias (not micro vias) min drill diameter

19
pcbnew/class_module.cpp

@ -800,14 +800,21 @@ EDA_ITEM* MODULE::Clone() const
void MODULE::RunOnChildren( boost::function<void (BOARD_ITEM*)> aFunction )
{
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
aFunction( static_cast<BOARD_ITEM*>( pad ) );
try
{
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() )
aFunction( drawing );
for( BOARD_ITEM* drawing = m_Drawings; drawing; drawing = drawing->Next() )
aFunction( drawing );
aFunction( static_cast<BOARD_ITEM*>( m_Reference ) );
aFunction( static_cast<BOARD_ITEM*>( m_Value ) );
aFunction( static_cast<BOARD_ITEM*>( m_Reference ) );
aFunction( static_cast<BOARD_ITEM*>( m_Value ) );
}
catch( boost::bad_function_call& e )
{
DisplayError( NULL, wxT( "Error running MODULE::RunOnChildren" ) );
}
}

19
pcbnew/tools/drawing_tool.cpp

@ -52,7 +52,8 @@
#include <class_module.h>
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,
// Init the new item attributes
aGraphic->SetShape( (STROKE_T) aShape );
aGraphic->SetWidth( lineWidth );
aGraphic->SetWidth( m_lineWidth );
aGraphic->SetStart( wxPoint( aStartingPoint->x, aStartingPoint->y ) );
aGraphic->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) );
aGraphic->SetLayer( layer );
@ -963,8 +964,8 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
{
// Init the new item attributes
aGraphic->SetShape( (STROKE_T) aShape );
lineWidth = getSegmentWidth( layer );
aGraphic->SetWidth( lineWidth );
m_lineWidth = getSegmentWidth( layer );
aGraphic->SetWidth( m_lineWidth );
aGraphic->SetStart( wxPoint( cursorPos.x, cursorPos.y ) );
aGraphic->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) );
aGraphic->SetLayer( layer );
@ -1012,17 +1013,17 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
else if( evt->IsAction( &COMMON_ACTIONS::incWidth ) )
{
lineWidth += WIDTH_STEP;
aGraphic->SetWidth( lineWidth );
m_lineWidth += WIDTH_STEP;
aGraphic->SetWidth( m_lineWidth );
updatePreview = true;
}
else if( evt->IsAction( &COMMON_ACTIONS::decWidth ) )
{
if( lineWidth > (unsigned) WIDTH_STEP )
if( m_lineWidth > (unsigned) WIDTH_STEP )
{
lineWidth -= WIDTH_STEP;
aGraphic->SetWidth( lineWidth );
m_lineWidth -= WIDTH_STEP;
aGraphic->SetWidth( m_lineWidth );
updatePreview = true;
}
}

2
pcbnew/tools/drawing_tool.h

@ -203,7 +203,7 @@ private:
bool m_editModules;
/// Stores the current line width for multisegment drawing.
unsigned int lineWidth;
unsigned int m_lineWidth;
// How does line width change after one -/+ key press.
static const int WIDTH_STEP = 100000;

4
pcbnew/tools/edit_tool.cpp

@ -43,7 +43,8 @@
#include "edit_tool.h"
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() :
void EDIT_TOOL::Reset( RESET_REASON aReason )
{
m_dragging = false;
m_updateFlag = KIGFX::VIEW_ITEM::NONE;
}

3
pcbnew/tools/module_tools.cpp

@ -47,7 +47,8 @@
#include <wx/defs.h>
MODULE_TOOLS::MODULE_TOOLS() :
TOOL_INTERACTIVE( "pcbnew.ModuleEditor" )
TOOL_INTERACTIVE( "pcbnew.ModuleEditor" ), m_view( NULL ), m_controls( NULL ),
m_board( NULL ), m_frame( NULL )
{
}

2
pcbnew/tools/pcb_editor_control.cpp

@ -47,7 +47,7 @@ public:
PCB_EDITOR_CONTROL::PCB_EDITOR_CONTROL() :
TOOL_INTERACTIVE( "pcbnew.EditorControl" )
TOOL_INTERACTIVE( "pcbnew.EditorControl" ), m_frame( NULL )
{
}

2
pcbnew/tools/pcbnew_control.cpp

@ -41,7 +41,7 @@
PCBNEW_CONTROL::PCBNEW_CONTROL() :
TOOL_INTERACTIVE( "pcbnew.Control" )
TOOL_INTERACTIVE( "pcbnew.Control" ), m_frame( NULL )
{
}

2
pcbnew/tools/placement_tool.cpp

@ -34,7 +34,7 @@
#include <boost/foreach.hpp>
PLACEMENT_TOOL::PLACEMENT_TOOL() :
TOOL_INTERACTIVE( "pcbnew.Placement" )
TOOL_INTERACTIVE( "pcbnew.Placement" ), m_selectionTool( NULL )
{
}

Loading…
Cancel
Save