Fix Coverity warnings.
This commit is contained in:
parent
ee92ace419
commit
6a0db3e7e2
|
@ -78,6 +78,7 @@ int CLI::EXPORT_PCB_SVG_COMMAND::Perform( KIWAY& aKiway ) const
|
|||
if( !wxFile::Exists( svgJob->m_filename ) )
|
||||
{
|
||||
wxFprintf( stderr, _( "Board file does not exist or is not accessible\n" ) );
|
||||
delete svgJob;
|
||||
return EXIT_CODES::ERR_INVALID_INPUT_FILE;
|
||||
}
|
||||
|
||||
|
@ -89,5 +90,7 @@ int CLI::EXPORT_PCB_SVG_COMMAND::Perform( KIWAY& aKiway ) const
|
|||
|
||||
int exitCode = aKiway.ProcessJob( KIWAY::FACE_PCB, svgJob );
|
||||
|
||||
delete svgJob;
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -446,6 +446,8 @@ void SCH_LABEL_BASE::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
|
|||
|
||||
void SCH_LABEL_BASE::GetIntersheetRefs( std::vector<std::pair<wxString, wxString>>* pages )
|
||||
{
|
||||
wxCHECK( pages, /* void */ );
|
||||
|
||||
if( Schematic() )
|
||||
{
|
||||
auto it = Schematic()->GetPageRefsMap().find( GetText() );
|
||||
|
|
|
@ -159,7 +159,7 @@ public:
|
|||
IBIS_CORNER m_Cpin = IBIS_CORNER::TYP;
|
||||
IBIS_CORNER m_Ccomp = IBIS_CORNER::TYP;
|
||||
IBIS_CORNER m_supply = IBIS_CORNER::TYP;
|
||||
KIBIS_WAVEFORM* m_waveform;
|
||||
KIBIS_WAVEFORM* m_waveform = nullptr;
|
||||
KIBIS_ACCURACY m_accuracy = KIBIS_ACCURACY::LEVEL_2;
|
||||
|
||||
void SetCornerFromString( IBIS_CORNER& aCorner, std::string aString );
|
||||
|
|
|
@ -81,7 +81,10 @@ public:
|
|||
}
|
||||
|
||||
|
||||
const PARAM& GetParam( unsigned aParamIndex ) const override { return m_params.at( aParamIndex ); };
|
||||
const PARAM& GetParam( unsigned aParamIndex ) const override
|
||||
{
|
||||
return m_params.at( aParamIndex );
|
||||
};
|
||||
|
||||
/** @brief update the list of available models based on the pin number.
|
||||
* */
|
||||
|
@ -93,8 +96,10 @@ public:
|
|||
bool CanDifferential() { return m_enableDiff; };
|
||||
bool m_enableDiff;
|
||||
|
||||
void ReadDataSchFields( unsigned aSymbolPinCount, const std::vector<SCH_FIELD>* aFields ) override;
|
||||
void ReadDataLibFields( unsigned aSymbolPinCount, const std::vector<LIB_FIELD>* aFields ) override;
|
||||
void ReadDataSchFields( unsigned aSymbolPinCount,
|
||||
const std::vector<SCH_FIELD>* aFields ) override;
|
||||
void ReadDataLibFields( unsigned aSymbolPinCount,
|
||||
const std::vector<LIB_FIELD>* aFields ) override;
|
||||
|
||||
protected:
|
||||
void CreatePins( unsigned aSymbolPinCount ) override;
|
||||
|
|
|
@ -2077,8 +2077,11 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
|
|||
if( SCH_LABEL_BASE* label = dynamic_cast<SCH_LABEL_BASE*>( item ) )
|
||||
bbox.Inflate( -label->GetLabelBoxExpansion() );
|
||||
|
||||
EDA_TEXT* textItem = dynamic_cast<EDA_TEXT*>( item );
|
||||
wxCHECK(textItem, 0 );
|
||||
|
||||
// Careful: GetTextMargin() is dependent on font size...
|
||||
new_textbox->SetTextSize( dynamic_cast<EDA_TEXT*>( item )->GetTextSize() );
|
||||
new_textbox->SetTextSize( textItem->GetTextSize() );
|
||||
|
||||
int margin = new_textbox->GetTextMargin();
|
||||
bbox.Inflate( margin );
|
||||
|
|
|
@ -331,6 +331,7 @@ bool isMaskAperture( BOARD_ITEM* aItem )
|
|||
return maskLayers.count() > 0 && otherLayers.count() == 0;
|
||||
}
|
||||
|
||||
|
||||
bool DRC_TEST_PROVIDER_SOLDER_MASK::checkMaskAperture( BOARD_ITEM* aMaskItem, BOARD_ITEM* aTestItem,
|
||||
PCB_LAYER_ID aTestLayer, int aTestNet,
|
||||
BOARD_ITEM** aCollidingItem )
|
||||
|
@ -373,7 +374,9 @@ bool DRC_TEST_PROVIDER_SOLDER_MASK::checkItemMask( BOARD_ITEM* aMaskItem, int aT
|
|||
{
|
||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( aMaskItem->GetParentFootprint() );
|
||||
|
||||
if( fp && ( fp->GetAttributes() & FP_ALLOW_SOLDERMASK_BRIDGES ) > 0 )
|
||||
wxCHECK( fp, false );
|
||||
|
||||
if( ( fp->GetAttributes() & FP_ALLOW_SOLDERMASK_BRIDGES ) > 0 )
|
||||
{
|
||||
// If we're allowing bridges then we're allowing bridges. Nothing to check.
|
||||
return false;
|
||||
|
|
|
@ -155,6 +155,8 @@ public:
|
|||
void FOOTPRINT_EDIT_FRAME::UpdateLibraryTree( const wxDataViewItem& aTreeItem,
|
||||
FOOTPRINT* aFootprint )
|
||||
{
|
||||
wxCHECK( aFootprint, /* void */ );
|
||||
|
||||
BASIC_FOOTPRINT_INFO footprintInfo( aFootprint );
|
||||
|
||||
if( aTreeItem.IsOk() ) // Can be not found in tree if the current footprint is imported
|
||||
|
|
|
@ -2163,8 +2163,12 @@ static void updateArcFromConstructionMgr( const KIGFX::PREVIEW::ARC_GEOM_MANAGER
|
|||
bool DRAWING_TOOL::drawArc( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
|
||||
std::optional<VECTOR2D> aStartingPoint )
|
||||
{
|
||||
wxCHECK( aGraphic, false );
|
||||
|
||||
PCB_SHAPE*& graphic = *aGraphic;
|
||||
|
||||
wxCHECK( graphic, false );
|
||||
|
||||
if( m_layer != m_frame->GetActiveLayer() )
|
||||
{
|
||||
m_layer = m_frame->GetActiveLayer();
|
||||
|
|
|
@ -264,8 +264,8 @@ VECTOR2I PCB_GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, const LSET& a
|
|||
|
||||
//Respect limits of coordinates representation
|
||||
BOX2I bb;
|
||||
bb.SetOrigin( GetClampedCoords<double, int>( VECTOR2D( aOrigin ) - snapRange / 2 ) );
|
||||
bb.SetEnd( GetClampedCoords<double, int>( VECTOR2D( aOrigin ) + snapRange / 2 ) );
|
||||
bb.SetOrigin( GetClampedCoords<double, int>( VECTOR2D( aOrigin ) - snapRange / 2.0 ) );
|
||||
bb.SetEnd( GetClampedCoords<double, int>( VECTOR2D( aOrigin ) + snapRange / 2.0 ) );
|
||||
|
||||
clearAnchors();
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -77,7 +77,8 @@ const static std::vector<EXPR_TO_TEST> introspectionExpressions = {
|
|||
{ "A.Width > B.Width", false, VAL( 0.0 ) },
|
||||
{ "A.Width + B.Width", false, VAL( pcbIUScale.MilsToIU(10) + pcbIUScale.MilsToIU(20) ) },
|
||||
{ "A.Netclass", false, VAL( "HV" ) },
|
||||
{ "(A.Netclass == 'HV') && (B.netclass == 'otherClass') && (B.netclass != 'F.Cu')", false, VAL( 1.0 ) },
|
||||
{ "(A.Netclass == 'HV') && (B.netclass == 'otherClass') && (B.netclass != 'F.Cu')", false,
|
||||
VAL( 1.0 ) },
|
||||
{ "A.Netclass + 1.0", false, VAL( 1.0 ) },
|
||||
{ "A.type == 'Track' && B.type == 'Track' && A.layer == 'F.Cu'", false, VAL( 1.0 ) },
|
||||
{ "(A.type == 'Track') && (B.type == 'Track') && (A.layer == 'F.Cu')", false, VAL( 1.0 ) },
|
||||
|
@ -85,7 +86,7 @@ const static std::vector<EXPR_TO_TEST> introspectionExpressions = {
|
|||
};
|
||||
|
||||
|
||||
static bool testEvalExpr( const wxString& expr, LIBEVAL::VALUE expectedResult,
|
||||
static bool testEvalExpr( const wxString& expr, const LIBEVAL::VALUE& expectedResult,
|
||||
bool expectError = false, BOARD_ITEM* itemA = nullptr,
|
||||
BOARD_ITEM* itemB = nullptr )
|
||||
{
|
||||
|
@ -123,7 +124,6 @@ static bool testEvalExpr( const wxString& expr, LIBEVAL::VALUE expectedResult,
|
|||
ok = ( result.EqualTo( &context, &expectedResult ) );
|
||||
}
|
||||
|
||||
|
||||
if( expectedResult.GetType() == LIBEVAL::VT_NUMERIC )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( result.AsDouble(), expectedResult.AsDouble() );
|
||||
|
@ -133,10 +133,10 @@ static bool testEvalExpr( const wxString& expr, LIBEVAL::VALUE expectedResult,
|
|||
BOOST_CHECK_EQUAL( result.AsString(), expectedResult.AsString() );
|
||||
}
|
||||
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( SimpleExpressions )
|
||||
{
|
||||
for( const auto& expr : simpleExpressions )
|
||||
|
@ -145,6 +145,7 @@ BOOST_AUTO_TEST_CASE( SimpleExpressions )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( IntrospectedProperties )
|
||||
{
|
||||
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
||||
|
|
Loading…
Reference in New Issue