Coverity fixes.

This commit is contained in:
Wayne Stambaugh 2022-10-17 09:19:39 -04:00
parent bd145a4904
commit 598b09821a
12 changed files with 283 additions and 237 deletions

View File

@ -91,7 +91,7 @@ CLI::EXPORT_STEP_COMMAND::EXPORT_STEP_COMMAND() : COMMAND( "step" )
int CLI::EXPORT_STEP_COMMAND::Perform( KIWAY& aKiway ) const int CLI::EXPORT_STEP_COMMAND::Perform( KIWAY& aKiway ) const
{ {
JOB_EXPORT_STEP* step = new JOB_EXPORT_STEP( true ); std::unique_ptr<JOB_EXPORT_STEP> step( new JOB_EXPORT_STEP( true ) );
step->m_useDrillOrigin = m_argParser.get<bool>( ARG_DRILL_ORIGIN ); step->m_useDrillOrigin = m_argParser.get<bool>( ARG_DRILL_ORIGIN );
step->m_useGridOrigin = m_argParser.get<bool>( ARG_GRID_ORIGIN ); step->m_useGridOrigin = m_argParser.get<bool>( ARG_GRID_ORIGIN );
@ -168,7 +168,7 @@ int CLI::EXPORT_STEP_COMMAND::Perform( KIWAY& aKiway ) const
} }
} }
int exitCode = aKiway.ProcessJob( KIWAY::FACE_PCB, step ); int exitCode = aKiway.ProcessJob( KIWAY::FACE_PCB, step.get() );
return exitCode; return exitCode;
} }

View File

@ -42,6 +42,7 @@
#include <plotters/plotters_pslike.h> #include <plotters/plotters_pslike.h>
std::string PDF_PLOTTER::encodeStringForPlotter( const wxString& aText ) std::string PDF_PLOTTER::encodeStringForPlotter( const wxString& aText )
{ {
// returns a string compatible with PDF string convention from a unicode string. // returns a string compatible with PDF string convention from a unicode string.
@ -250,7 +251,8 @@ void PDF_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T aFill, int w
double magic = radius * 0.551784; // You don't want to know where this come from double magic = radius * 0.551784; // You don't want to know where this come from
// This is the convex hull for the bezier approximated circle // This is the convex hull for the bezier approximated circle
fprintf( m_workFile, "%g %g m " fprintf( m_workFile,
"%g %g m "
"%g %g %g %g %g %g c " "%g %g %g %g %g %g c "
"%g %g %g %g %g %g c " "%g %g %g %g %g %g c "
"%g %g %g %g %g %g c " "%g %g %g %g %g %g c "
@ -812,6 +814,7 @@ void PDF_PLOTTER::ClosePage()
m_pageStreamHandle = 0; m_pageStreamHandle = 0;
wxString pageOutlineName = wxEmptyString; wxString pageOutlineName = wxEmptyString;
if( m_pageName.IsEmpty() ) if( m_pageName.IsEmpty() )
{ {
pageOutlineName = wxString::Format( _( "Page %s" ), m_pageNumbers.back() ); pageOutlineName = wxString::Format( _( "Page %s" ), m_pageNumbers.back() );
@ -852,7 +855,6 @@ void PDF_PLOTTER::ClosePage()
} ); } );
} }
// Clean up // Clean up
m_hyperlinksInPage.clear(); m_hyperlinksInPage.clear();
m_hyperlinkMenusInPage.clear(); m_hyperlinkMenusInPage.clear();
@ -866,10 +868,9 @@ bool PDF_PLOTTER::StartPlot( const wxString& aPageNumber )
} }
bool PDF_PLOTTER::StartPlot( const wxString& aPageNumber, bool PDF_PLOTTER::StartPlot( const wxString& aPageNumber, const wxString& aPageName )
const wxString& aPageName )
{ {
wxASSERT(m_outputFile); wxASSERT( m_outputFile );
// First things first: the customary null object // First things first: the customary null object
m_xrefTable.clear(); m_xrefTable.clear();
@ -879,7 +880,6 @@ bool PDF_PLOTTER::StartPlot( const wxString& aPageNumber,
m_hyperlinkHandles.clear(); m_hyperlinkHandles.clear();
m_hyperlinkMenuHandles.clear(); m_hyperlinkMenuHandles.clear();
m_bookmarksInPage.clear(); m_bookmarksInPage.clear();
m_outlineRoot.release();
m_totalOutlineNodes = 0; m_totalOutlineNodes = 0;
m_outlineRoot = std::make_unique<OUTLINE_NODE>(); m_outlineRoot = std::make_unique<OUTLINE_NODE>();
@ -899,7 +899,7 @@ bool PDF_PLOTTER::StartPlot( const wxString& aPageNumber,
/* Now, the PDF is read from the end, (more or less)... so we start /* Now, the PDF is read from the end, (more or less)... so we start
with the page stream for page 1. Other more important stuff is written with the page stream for page 1. Other more important stuff is written
at the end */ at the end */
StartPage(aPageNumber, aPageName); StartPage( aPageNumber, aPageName );
return true; return true;
} }
@ -941,9 +941,9 @@ void PDF_PLOTTER::emitOutlineNode( OUTLINE_NODE* node, int parentHandle, int nex
int prevNode ) int prevNode )
{ {
int nodeHandle = node->entryHandle; int nodeHandle = node->entryHandle;
int prevHandle = -1; int prevHandle = -1;
int nextHandle = -1; int nextHandle = -1;
for( std::vector<OUTLINE_NODE*>::iterator it = node->children.begin(); for( std::vector<OUTLINE_NODE*>::iterator it = node->children.begin();
it != node->children.end(); it++ ) it != node->children.end(); it++ )
{ {
@ -961,7 +961,8 @@ void PDF_PLOTTER::emitOutlineNode( OUTLINE_NODE* node, int parentHandle, int nex
prevHandle = ( *it )->entryHandle; prevHandle = ( *it )->entryHandle;
} }
if( parentHandle != -1 ) // -1 for parentHandle is the outline root itself which is handed elsewhere // -1 for parentHandle is the outline root itself which is handed elsewhere.
if( parentHandle != -1 )
{ {
startPdfObject( nodeHandle ); startPdfObject( nodeHandle );
@ -1039,6 +1040,7 @@ int PDF_PLOTTER::emitOutline()
return -1; return -1;
} }
bool PDF_PLOTTER::EndPlot() bool PDF_PLOTTER::EndPlot()
{ {
wxASSERT( m_outputFile ); wxASSERT( m_outputFile );
@ -1256,8 +1258,8 @@ bool PDF_PLOTTER::EndPlot()
if( m_title.IsEmpty() ) if( m_title.IsEmpty() )
{ {
// Windows uses '\' and other platforms use '/' as separator // Windows uses '\' and other platforms use '/' as separator
m_title = m_filename.AfterLast( '\\'); m_title = m_filename.AfterLast( '\\' );
m_title = m_title.AfterLast( '/'); m_title = m_title.AfterLast( '/' );
} }
fprintf( m_outputFile, fprintf( m_outputFile,
@ -1278,6 +1280,7 @@ bool PDF_PLOTTER::EndPlot()
// The catalog, at last // The catalog, at last
int catalogHandle = startPdfObject(); int catalogHandle = startPdfObject();
if( outlineHandle > 0 ) if( outlineHandle > 0 )
{ {
fprintf( m_outputFile, fprintf( m_outputFile,
@ -1304,6 +1307,7 @@ bool PDF_PLOTTER::EndPlot()
">>\n", ">>\n",
m_pageTreeHandle ); m_pageTreeHandle );
} }
closePdfObject(); closePdfObject();
/* Emit the xref table (format is crucial to the byte, each entry must /* Emit the xref table (format is crucial to the byte, each entry must
@ -1405,7 +1409,8 @@ void PDF_PLOTTER::HyperlinkMenu( const BOX2I& aBox, const std::vector<wxString>&
} }
void PDF_PLOTTER::Bookmark( const BOX2I& aLocation, const wxString& aSymbolReference, const wxString &aGroupName ) void PDF_PLOTTER::Bookmark( const BOX2I& aLocation, const wxString& aSymbolReference,
const wxString &aGroupName )
{ {
m_bookmarksInPage[aGroupName].push_back( std::make_pair( aLocation, aSymbolReference ) ); m_bookmarksInPage[aGroupName].push_back( std::make_pair( aLocation, aSymbolReference ) );

View File

@ -256,6 +256,8 @@ void DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable( REPORTER& aReporter )
{ {
symbol = dynamic_cast<SCH_SYMBOL*>( item ); symbol = dynamic_cast<SCH_SYMBOL*>( item );
wxCHECK2( symbol, continue );
if( !remapSymbolToLibTable( symbol ) ) if( !remapSymbolToLibTable( symbol ) )
{ {
msg.Printf( _( "No symbol %s found in symbol library table." ), msg.Printf( _( "No symbol %s found in symbol library table." ),

View File

@ -92,6 +92,7 @@ void SCH_LEGACY_PLUGIN::init( SCHEMATIC* aSchematic, const PROPERTIES* aProperti
{ {
m_version = 0; m_version = 0;
m_rootSheet = nullptr; m_rootSheet = nullptr;
m_currentSheet = nullptr;
m_schematic = aSchematic; m_schematic = aSchematic;
m_cache = nullptr; m_cache = nullptr;
m_out = nullptr; m_out = nullptr;
@ -845,6 +846,7 @@ SCH_LINE* SCH_LEGACY_PLUGIN::loadWire( LINE_READER& aReader )
} }
int prm_count = ( keyword == T_COLORA ) ? 4 : 3; int prm_count = ( keyword == T_COLORA ) ? 4 : 3;
// fix opacity to 1.0 or 255, when not exists in file // fix opacity to 1.0 or 255, when not exists in file
color[3] = 255; color[3] = 255;
@ -925,6 +927,7 @@ SCH_BUS_ENTRY_BASE* SCH_LEGACY_PLUGIN::loadBusEntry( LINE_READER& aReader )
return busEntry.release(); return busEntry.release();
} }
// clang-format off // clang-format off
const std::map<LABEL_FLAG_SHAPE, const char*> sheetLabelNames const std::map<LABEL_FLAG_SHAPE, const char*> sheetLabelNames
{ {
@ -1875,14 +1878,16 @@ void SCH_LEGACY_PLUGIN::saveBusEntry( SCH_BUS_ENTRY_BASE* aBusEntry )
m_out->Print( 0, "Entry Wire Line\n\t%-4d %-4d %-4d %-4d\n", m_out->Print( 0, "Entry Wire Line\n\t%-4d %-4d %-4d %-4d\n",
schIUScale.IUToMils( aBusEntry->GetPosition().x ), schIUScale.IUToMils( aBusEntry->GetPosition().x ),
schIUScale.IUToMils( aBusEntry->GetPosition().y ), schIUScale.IUToMils( aBusEntry->GetPosition().y ),
schIUScale.IUToMils( aBusEntry->GetEnd().x ), schIUScale.IUToMils( aBusEntry->GetEnd().y ) ); schIUScale.IUToMils( aBusEntry->GetEnd().x ),
schIUScale.IUToMils( aBusEntry->GetEnd().y ) );
} }
else else
{ {
m_out->Print( 0, "Entry Bus Bus\n\t%-4d %-4d %-4d %-4d\n", m_out->Print( 0, "Entry Bus Bus\n\t%-4d %-4d %-4d %-4d\n",
schIUScale.IUToMils( aBusEntry->GetPosition().x ), schIUScale.IUToMils( aBusEntry->GetPosition().x ),
schIUScale.IUToMils( aBusEntry->GetPosition().y ), schIUScale.IUToMils( aBusEntry->GetPosition().y ),
schIUScale.IUToMils( aBusEntry->GetEnd().x ), schIUScale.IUToMils( aBusEntry->GetEnd().y ) ); schIUScale.IUToMils( aBusEntry->GetEnd().x ),
schIUScale.IUToMils( aBusEntry->GetEnd().y ) );
} }
} }
@ -1920,8 +1925,10 @@ void SCH_LEGACY_PLUGIN::saveLine( SCH_LINE* aLine )
m_out->Print( 0, "\n" ); m_out->Print( 0, "\n" );
m_out->Print( 0, "\t%-4d %-4d %-4d %-4d", m_out->Print( 0, "\t%-4d %-4d %-4d %-4d",
schIUScale.IUToMils( aLine->GetStartPoint().x ), schIUScale.IUToMils( aLine->GetStartPoint().y ), schIUScale.IUToMils( aLine->GetStartPoint().x ),
schIUScale.IUToMils( aLine->GetEndPoint().x ), schIUScale.IUToMils( aLine->GetEndPoint().y ) ); schIUScale.IUToMils( aLine->GetStartPoint().y ),
schIUScale.IUToMils( aLine->GetEndPoint().x ),
schIUScale.IUToMils( aLine->GetEndPoint().y ) );
m_out->Print( 0, "\n"); m_out->Print( 0, "\n");
} }
@ -1977,7 +1984,8 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
spinStyle = 0; spinStyle = 0;
m_out->Print( 0, "Text %s %-4d %-4d %-4d %-4d %s %d\n%s\n", textType, m_out->Print( 0, "Text %s %-4d %-4d %-4d %-4d %s %d\n%s\n", textType,
schIUScale.IUToMils( aText->GetPosition().x ), schIUScale.IUToMils( aText->GetPosition().y ), schIUScale.IUToMils( aText->GetPosition().x ),
schIUScale.IUToMils( aText->GetPosition().y ),
spinStyle, spinStyle,
schIUScale.IUToMils( aText->GetTextWidth() ), schIUScale.IUToMils( aText->GetTextWidth() ),
italics, schIUScale.IUToMils( aText->GetTextThickness() ), TO_UTF8( text ) ); italics, schIUScale.IUToMils( aText->GetTextThickness() ), TO_UTF8( text ) );
@ -1990,7 +1998,8 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
wxCHECK_RET( shapeLabelIt != sheetLabelNames.end(), "Shape not found in names list" ); wxCHECK_RET( shapeLabelIt != sheetLabelNames.end(), "Shape not found in names list" );
m_out->Print( 0, "Text %s %-4d %-4d %-4d %-4d %s %s %d\n%s\n", textType, m_out->Print( 0, "Text %s %-4d %-4d %-4d %-4d %s %s %d\n%s\n", textType,
schIUScale.IUToMils( aText->GetPosition().x ), schIUScale.IUToMils( aText->GetPosition().y ), schIUScale.IUToMils( aText->GetPosition().x ),
schIUScale.IUToMils( aText->GetPosition().y ),
static_cast<int>( aText->GetTextSpinStyle() ), static_cast<int>( aText->GetTextSpinStyle() ),
schIUScale.IUToMils( aText->GetTextWidth() ), schIUScale.IUToMils( aText->GetTextWidth() ),
shapeLabelIt->second, shapeLabelIt->second,

View File

@ -5,7 +5,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2016 CERN * Copyright (C) 2016 CERN
* Copyright (C) 2016-2021 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2016-2022 KiCad Developers, see change_log.txt for contributors.
* *
* @author Wayne Stambaugh <stambaughw@gmail.com> * @author Wayne Stambaugh <stambaughw@gmail.com>
* *

View File

@ -47,6 +47,7 @@ SCH_VIEW::SCH_VIEW( bool aIsDynamic, SCH_BASE_FRAME* aFrame ) :
VIEW( aIsDynamic ) VIEW( aIsDynamic )
{ {
m_frame = aFrame; m_frame = aFrame;
// Set m_boundary to define the max working area size. The default value is acceptable for // Set m_boundary to define the max working area size. The default value is acceptable for
// Pcbnew and Gerbview, but too large for Eeschema due to very different internal units. // Pcbnew and Gerbview, but too large for Eeschema due to very different internal units.
// A full size = 3 * MAX_PAGE_SIZE_MILS size allows a wide margin around the drawing-sheet. // A full size = 3 * MAX_PAGE_SIZE_MILS size allows a wide margin around the drawing-sheet.
@ -109,6 +110,9 @@ void SCH_VIEW::DisplaySheet( const SCH_SCREEN *aScreen )
if( m_frame && m_frame->IsType( FRAME_SCH ) ) if( m_frame && m_frame->IsType( FRAME_SCH ) )
{ {
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ); SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
wxCHECK( editFrame, /* void */ );
wxString sheetName = editFrame->GetCurrentSheet().Last()->GetName(); wxString sheetName = editFrame->GetCurrentSheet().Last()->GetName();
wxString sheetPath = editFrame->GetCurrentSheet().PathHumanReadable(); wxString sheetPath = editFrame->GetCurrentSheet().PathHumanReadable();
m_drawingSheet->SetSheetName( TO_UTF8( sheetName ) ); m_drawingSheet->SetSheetName( TO_UTF8( sheetName ) );

View File

@ -292,6 +292,9 @@ void SYMBOL_LIBRARY_MANAGER::SetSymbolModified( const wxString& aAlias,
const LIB_BUFFER& buf = libIt->second; const LIB_BUFFER& buf = libIt->second;
std::shared_ptr<SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER> symbolBuf = buf.GetBuffer( aAlias ); std::shared_ptr<SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER> symbolBuf = buf.GetBuffer( aAlias );
wxCHECK( symbolBuf, /* void */ );
symbolBuf->GetScreen()->SetContentModified(); symbolBuf->GetScreen()->SetContentModified();
} }

View File

@ -619,6 +619,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
if( line->HasFlag( STARTPOINT ) == line->HasFlag( ENDPOINT ) ) if( line->HasFlag( STARTPOINT ) == line->HasFlag( ENDPOINT ) )
{ {
line->SetFlags( STARTPOINT | ENDPOINT ); line->SetFlags( STARTPOINT | ENDPOINT );
// When we allow off grid items, the rotPoint should be set to the midpoint // When we allow off grid items, the rotPoint should be set to the midpoint
// of the line to allow rotation around the center, and the next if // of the line to allow rotation around the center, and the next if
// should become an else-if // should become an else-if
@ -1133,7 +1134,8 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
{ {
static_cast<SCH_SYMBOL*>( newItem )->ClearAnnotation( nullptr, false ); static_cast<SCH_SYMBOL*>( newItem )->ClearAnnotation( nullptr, false );
NULL_REPORTER reporter; NULL_REPORTER reporter;
m_frame->AnnotateSymbols( ANNOTATE_SELECTION, (ANNOTATE_ORDER_T) annotate.sort_order, m_frame->AnnotateSymbols( ANNOTATE_SELECTION,
(ANNOTATE_ORDER_T) annotate.sort_order,
(ANNOTATE_ALGO_T) annotate.method, annotate.recursive, (ANNOTATE_ALGO_T) annotate.method, annotate.recursive,
annotateStartNum, false, false, reporter, appendUndo ); annotateStartNum, false, false, reporter, appendUndo );
} }
@ -1368,7 +1370,8 @@ void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField )
if( parentType == SCH_SYMBOL_T && aField->GetId() < MANDATORY_FIELDS ) if( parentType == SCH_SYMBOL_T && aField->GetId() < MANDATORY_FIELDS )
{ {
wxString translated_fieldname; wxString translated_fieldname;
translated_fieldname = TEMPLATE_FIELDNAME::GetDefaultFieldName( aField->GetId(), DO_TRANSLATE ); translated_fieldname = TEMPLATE_FIELDNAME::GetDefaultFieldName( aField->GetId(),
DO_TRANSLATE );
caption.Printf( _( "Edit %s Field" ), TitleCaps( translated_fieldname ) ); caption.Printf( _( "Edit %s Field" ), TitleCaps( translated_fieldname ) );
} }
else if( parentType == SCH_SHEET_T && aField->GetId() < SHEET_MANDATORY_FIELDS ) else if( parentType == SCH_SHEET_T && aField->GetId() < SHEET_MANDATORY_FIELDS )
@ -1932,7 +1935,9 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
|| convertTo == SCH_HIER_LABEL_T || convertTo == SCH_HIER_LABEL_T
|| convertTo == SCH_GLOBAL_LABEL_T ) || convertTo == SCH_GLOBAL_LABEL_T )
{ {
int textSize = dynamic_cast<EDA_TEXT*>( item )->GetTextSize().y; EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( item );
wxCHECK( text, 0 );
int textSize = text->GetTextSize().y;
bbox.Inflate( item->Schematic()->Settings().m_LabelSizeRatio * textSize ); bbox.Inflate( item->Schematic()->Settings().m_LabelSizeRatio * textSize );
} }
@ -2129,6 +2134,8 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
EDA_TEXT* eda_text = dynamic_cast<EDA_TEXT*>( item ); EDA_TEXT* eda_text = dynamic_cast<EDA_TEXT*>( item );
EDA_TEXT* new_eda_text = dynamic_cast<EDA_TEXT*>( newtext ); EDA_TEXT* new_eda_text = dynamic_cast<EDA_TEXT*>( newtext );
wxCHECK2( eda_text && new_eda_text, continue );
new_eda_text->SetFont( eda_text->GetFont() ); new_eda_text->SetFont( eda_text->GetFont() );
new_eda_text->SetTextSize( eda_text->GetTextSize() ); new_eda_text->SetTextSize( eda_text->GetTextSize() );
new_eda_text->SetTextThickness( eda_text->GetTextThickness() ); new_eda_text->SetTextThickness( eda_text->GetTextThickness() );

View File

@ -172,6 +172,8 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
bool solderMaskDirty = false; bool solderMaskDirty = false;
bool autofillZones = false; bool autofillZones = false;
wxCHECK( frame && selTool, /* void */ );
std::vector<BOARD_ITEM*> bulkAddedItems; std::vector<BOARD_ITEM*> bulkAddedItems;
std::vector<BOARD_ITEM*> bulkRemovedItems; std::vector<BOARD_ITEM*> bulkRemovedItems;
std::vector<BOARD_ITEM*> itemsChanged; std::vector<BOARD_ITEM*> itemsChanged;
@ -392,6 +394,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
bulkRemovedItems.push_back( footprint ); bulkRemovedItems.push_back( footprint );
} }
} }
break; break;
case PCB_GROUP_T: case PCB_GROUP_T:
@ -408,6 +411,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
bulkRemovedItems.push_back( boardItem ); bulkRemovedItems.push_back( boardItem );
} }
} }
break; break;
// Metadata items // Metadata items

View File

@ -415,6 +415,7 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
else else
m_layerCheckListBox->Check( i, false ); m_layerCheckListBox->Check( i, false );
} }
break; break;
case ID_SELECT_COPPER_LAYERS: case ID_SELECT_COPPER_LAYERS:
@ -423,6 +424,7 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
if( IsCopperLayer( m_layerList[i] ) ) if( IsCopperLayer( m_layerList[i] ) )
m_layerCheckListBox->Check( i, true ); m_layerCheckListBox->Check( i, true );
} }
break; break;
case ID_DESELECT_COPPER_LAYERS: case ID_DESELECT_COPPER_LAYERS:
@ -431,16 +433,19 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
if( IsCopperLayer( m_layerList[i] ) ) if( IsCopperLayer( m_layerList[i] ) )
m_layerCheckListBox->Check( i, false ); m_layerCheckListBox->Check( i, false );
} }
break; break;
case ID_SELECT_ALL_LAYERS: case ID_SELECT_ALL_LAYERS:
for( unsigned i = 0; i < m_layerList.size(); i++ ) for( unsigned i = 0; i < m_layerList.size(); i++ )
m_layerCheckListBox->Check( i, true ); m_layerCheckListBox->Check( i, true );
break; break;
case ID_DESELECT_ALL_LAYERS: case ID_DESELECT_ALL_LAYERS:
for( unsigned i = 0; i < m_layerList.size(); i++ ) for( unsigned i = 0; i < m_layerList.size(); i++ )
m_layerCheckListBox->Check( i, false ); m_layerCheckListBox->Check( i, false );
break; break;
default: default:
@ -885,6 +890,8 @@ void DIALOG_PLOT::applyPlotSettings()
wxClientData* tmp = m_plotAllLayersList->GetClientObject( index ); wxClientData* tmp = m_plotAllLayersList->GetClientObject( index );
PCB_LAYER_ID_CLIENT_DATA* layerId = dynamic_cast<PCB_LAYER_ID_CLIENT_DATA*>( tmp ); PCB_LAYER_ID_CLIENT_DATA* layerId = dynamic_cast<PCB_LAYER_ID_CLIENT_DATA*>( tmp );
wxCHECK2( layerId, continue );
plotOnAllLayers.set( layerId->GetData() ); plotOnAllLayers.set( layerId->GetData() );
} }

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -139,6 +139,8 @@ class BASIC_FOOTPRINT_INFO : public FOOTPRINT_INFO
public: public:
BASIC_FOOTPRINT_INFO( FOOTPRINT* aFootprint ) BASIC_FOOTPRINT_INFO( FOOTPRINT* aFootprint )
{ {
wxASSERT( aFootprint );
m_nickname = aFootprint->GetFPID().GetLibNickname().wx_str(); m_nickname = aFootprint->GetFPID().GetLibNickname().wx_str();
m_fpname = aFootprint->GetFPID().GetLibItemName().wx_str(); m_fpname = aFootprint->GetFPID().GetLibItemName().wx_str();
m_pad_count = aFootprint->GetPadCount( DO_NOT_INCLUDE_NPTH ); m_pad_count = aFootprint->GetPadCount( DO_NOT_INCLUDE_NPTH );

View File

@ -3063,6 +3063,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
track->SetEnd( *joint1 ); track->SetEnd( *joint1 );
PCB_TRACK* newTrack = dynamic_cast<PCB_TRACK*>( track->Clone() ); PCB_TRACK* newTrack = dynamic_cast<PCB_TRACK*>( track->Clone() );
wxCHECK( newTrack, /* void */ );
const_cast<KIID&>( newTrack->m_Uuid ) = KIID(); const_cast<KIID&>( newTrack->m_Uuid ) = KIID();
newTrack->SetStart( *joint1 ); newTrack->SetStart( *joint1 );
@ -3070,6 +3071,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
aCommit.Add( newTrack ); aCommit.Add( newTrack );
newTrack = dynamic_cast<PCB_TRACK*>( track->Clone() ); newTrack = dynamic_cast<PCB_TRACK*>( track->Clone() );
wxCHECK( newTrack, /* void */ );
const_cast<KIID&>( newTrack->m_Uuid ) = KIID(); const_cast<KIID&>( newTrack->m_Uuid ) = KIID();
newTrack->SetStart( viaPos ); newTrack->SetStart( viaPos );
@ -3077,6 +3079,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
aCommit.Add( newTrack ); aCommit.Add( newTrack );
newTrack = dynamic_cast<PCB_TRACK*>( track->Clone() ); newTrack = dynamic_cast<PCB_TRACK*>( track->Clone() );
wxCHECK( newTrack, /* void */ );
const_cast<KIID&>( newTrack->m_Uuid ) = KIID(); const_cast<KIID&>( newTrack->m_Uuid ) = KIID();
newTrack->SetStart( *joint2 ); newTrack->SetStart( *joint2 );