fix some Coverity and compil warnings.

This commit is contained in:
jean-pierre charras 2023-09-05 20:17:53 +02:00
parent 679733cc42
commit cbcaaa001c
5 changed files with 24 additions and 24 deletions

View File

@ -43,6 +43,9 @@ EDA_SHAPE::EDA_SHAPE( SHAPE_T aType, int aLineWidth, FILL_T aFill ) :
m_stroke( aLineWidth, PLOT_DASH_TYPE::DEFAULT, COLOR4D::UNSPECIFIED ),
m_fill( aFill ),
m_fillColor( COLOR4D::UNSPECIFIED ),
m_rectangleHeight( 0 ),
m_rectangleWidth( 0 ),
m_segmentLength( 0 ),
m_editState( 0 ),
m_annotationProxy( false )
{
@ -143,7 +146,7 @@ long long int EDA_SHAPE::GetRectangleHeight() const
{
case SHAPE_T::RECTANGLE: return GetEndY() - GetStartY();
default:
default:
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
return 0;
}
@ -155,7 +158,7 @@ long long int EDA_SHAPE::GetRectangleWidth() const
{
case SHAPE_T::RECTANGLE: return GetEndX() - GetStartX();
default:
default:
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
return 0;
}
@ -167,7 +170,7 @@ void EDA_SHAPE::SetLength( const double& aLength )
{
case SHAPE_T::SEGMENT: m_segmentLength = aLength; break;
default:
default:
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
}
}
@ -1769,8 +1772,8 @@ static struct EDA_SHAPE_DESC
angle->SetAvailableFunc(
[=]( INSPECTABLE* aItem ) -> bool
{
if( EDA_SHAPE* shape = dynamic_cast<EDA_SHAPE*>( aItem ) )
return shape->GetShape() == SHAPE_T::ARC;
if( EDA_SHAPE* curr_shape = dynamic_cast<EDA_SHAPE*>( aItem ) )
return curr_shape->GetShape() == SHAPE_T::ARC;
return false;
} );

View File

@ -691,11 +691,11 @@ void mpScaleX::recalculateTicks( wxDC& dc, mpWindow& w )
}
double numberSteps = floor( ( maxVvis - minVvis ) / bestStep );
// Half the number of ticks according to window size.
// The value 96 is used to have only 4 ticks when m_scrX is 268.
// For each 96 device context units, is possible to add a new tick.
while( numberSteps - 2 >= m_scrX/96 )
while( numberSteps - 2.0 >= m_scrX/96.0 )
{
bestStep *= 2;
numberSteps = floor( ( maxVvis - minVvis ) / bestStep );
@ -883,7 +883,7 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w )
// Half the number of ticks according to window size.
// For each 32 device context units, is possible to add a new tick.
while( numberSteps >= m_scrY/32 )
while( numberSteps >= m_scrY/32.0 )
{
bestStep *= 2;
numberSteps = floor( ( maxVvis - minVvis ) / bestStep );

View File

@ -134,7 +134,6 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
return CLI::EXIT_CODES::ERR_UNKNOWN;
SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aPlotJob->m_filename, SCH_IO_MGR::SCH_KICAD );
sch->Prj().ApplyTextVars( aJob->GetVarOverrides() );
if( sch == nullptr )
{
@ -142,6 +141,8 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
return CLI::EXIT_CODES::ERR_INVALID_INPUT_FILE;
}
sch->Prj().ApplyTextVars( aJob->GetVarOverrides() );
std::unique_ptr<KIGFX::SCH_RENDER_SETTINGS> renderSettings =
std::make_unique<KIGFX::SCH_RENDER_SETTINGS>();
InitRenderSettings( renderSettings.get(), aPlotJob->settings.m_theme, sch, aPlotJob->m_drawingSheet );
@ -267,7 +268,6 @@ int EESCHEMA_JOBS_HANDLER::JobExportBom( JOB* aJob )
return CLI::EXIT_CODES::ERR_UNKNOWN;
SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aBomJob->m_filename, SCH_IO_MGR::SCH_KICAD );
sch->Prj().ApplyTextVars( aJob->GetVarOverrides() );
if( sch == nullptr )
{
@ -275,6 +275,8 @@ int EESCHEMA_JOBS_HANDLER::JobExportBom( JOB* aJob )
return CLI::EXIT_CODES::ERR_INVALID_INPUT_FILE;
}
sch->Prj().ApplyTextVars( aJob->GetVarOverrides() );
// Annotation warning check
SCH_REFERENCE_LIST referenceList;
sch->GetSheets().GetSymbols( referenceList, false, false );
@ -741,7 +743,6 @@ int EESCHEMA_JOBS_HANDLER::JobSchErc( JOB* aJob )
return CLI::EXIT_CODES::ERR_UNKNOWN;
SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( ercJob->m_filename, SCH_IO_MGR::SCH_KICAD );
sch->Prj().ApplyTextVars( aJob->GetVarOverrides() );
if( sch == nullptr )
{
@ -749,6 +750,8 @@ int EESCHEMA_JOBS_HANDLER::JobSchErc( JOB* aJob )
return CLI::EXIT_CODES::ERR_INVALID_INPUT_FILE;
}
sch->Prj().ApplyTextVars( aJob->GetVarOverrides() );
if( ercJob->m_outputFile.IsEmpty() )
{
wxFileName fn = sch->GetFileName();

View File

@ -29,7 +29,13 @@
CLI::COMMAND::COMMAND( const std::string& aName ) :
m_name( aName ),
m_argParser( aName, "", argparse::default_arguments::none )
m_argParser( aName, "", argparse::default_arguments::none ),
m_hasInputArg( false ),
m_hasOutputArg( false ),
m_hasDrawingSheetArg( false ),
m_hasDefineArg( false ),
m_outputArgExpectsDir( false )
{
m_argParser.add_argument( ARG_HELP_SHORT, ARG_HELP )
.default_value( false )

View File

@ -716,15 +716,6 @@ void DIALOG_PAD_PROPERTIES::initValues()
}
// A small helper function, to display coordinates:
static wxString formatCoord( EDA_UNITS aUnits, const VECTOR2I& aCoord )
{
return wxString::Format( wxT( "(X:%s Y:%s)" ),
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, aUnits, aCoord.x ),
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, aUnits, aCoord.y ) );
}
void DIALOG_PAD_PROPERTIES::OnResize( wxSizeEvent& event )
{
redraw();
@ -849,9 +840,6 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
m_offsetCtrls->Show( m_offsetShapeOpt->GetValue() );
m_offsetShapeOptLabel->Show( m_offsetShapeOpt->GetValue() );
bool is_custom = m_PadShapeSelector->GetSelection() == CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR
|| m_PadShapeSelector->GetSelection() == CHOICE_SHAPE_CUSTOM_RECT_ANCHOR;
if( transferDataToPad( m_previewPad ) )
updateRoundRectCornerValues();