Size conversion warning reduction.

This commit is contained in:
Jeff Young 2024-06-28 17:28:08 +01:00
parent 9e6884f656
commit a68b3a7778
2 changed files with 25 additions and 28 deletions

View File

@ -156,12 +156,11 @@ int ERC_TESTER::TestDuplicateSheetNames( bool aCreateMarker )
// We have found a second sheet: compare names // We have found a second sheet: compare names
// we are using case insensitive comparison to avoid mistakes between // we are using case insensitive comparison to avoid mistakes between
// similar names like Mysheet and mysheet // similar names like Mysheet and mysheet
if( sheet->GetShownName( false ).CmpNoCase( test_item->GetShownName( false ) ) == 0 ) if( sheet->GetShownName( false ).IsSameAs( test_item->GetShownName( false ), false ) )
{ {
if( aCreateMarker ) if( aCreateMarker )
{ {
std::shared_ptr<ERC_ITEM> ercItem = auto ercItem = ERC_ITEM::Create( ERCE_DUPLICATE_SHEET_NAME );
ERC_ITEM::Create( ERCE_DUPLICATE_SHEET_NAME );
ercItem->SetItems( sheet, test_item ); ercItem->SetItems( sheet, test_item );
SCH_MARKER* marker = new SCH_MARKER( ercItem, sheet->GetPosition() ); SCH_MARKER* marker = new SCH_MARKER( ercItem, sheet->GetPosition() );
@ -471,22 +470,22 @@ int ERC_TESTER::TestMultiunitFootprints()
wxString unitName; wxString unitName;
wxString unitFP; wxString unitFP;
for( unsigned i = 0; i < refList.GetCount(); ++i ) for( size_t ii = 0; ii < refList.GetCount(); ++ii )
{ {
SCH_SHEET_PATH sheetPath = refList.GetItem( i ).GetSheetPath(); SCH_SHEET_PATH sheetPath = refList.GetItem( ii ).GetSheetPath();
unitFP = refList.GetItem( i ).GetFootprint(); unitFP = refList.GetItem( ii ).GetFootprint();
if( !unitFP.IsEmpty() ) if( !unitFP.IsEmpty() )
{ {
unit = refList.GetItem( i ).GetSymbol(); unit = refList.GetItem( ii ).GetSymbol();
unitName = unit->GetRef( &sheetPath, true ); unitName = unit->GetRef( &sheetPath, true );
break; break;
} }
} }
for( unsigned i = 0; i < refList.GetCount(); ++i ) for( size_t ii = 0; ii < refList.GetCount(); ++ii )
{ {
SCH_REFERENCE& secondRef = refList.GetItem( i ); SCH_REFERENCE& secondRef = refList.GetItem( ii );
SCH_SYMBOL* secondUnit = secondRef.GetSymbol(); SCH_SYMBOL* secondUnit = secondRef.GetSymbol();
wxString secondName = secondUnit->GetRef( &secondRef.GetSheetPath(), true ); wxString secondName = secondUnit->GetRef( &secondRef.GetSheetPath(), true );
const wxString secondFp = secondRef.GetFootprint(); const wxString secondFp = secondRef.GetFootprint();
@ -535,8 +534,8 @@ int ERC_TESTER::TestMissingUnits()
std::set<int> instance_units; std::set<int> instance_units;
std::set<int> missing_units; std::set<int> missing_units;
auto report_missing = auto report =
[&]( std::set<int>& aMissingUnits, wxString aErrorMsg, int aErrorCode ) [&]( std::set<int>& aMissingUnits, const wxString& aErrorMsg, int aErrorCode )
{ {
wxString msg; wxString msg;
wxString missing_pin_units = wxS( "[ " ); wxString missing_pin_units = wxS( "[ " );
@ -580,8 +579,7 @@ int ERC_TESTER::TestMissingUnits()
if( !missing_units.empty() && m_settings.IsTestEnabled( ERCE_MISSING_UNIT ) ) if( !missing_units.empty() && m_settings.IsTestEnabled( ERCE_MISSING_UNIT ) )
{ {
report_missing( missing_units, _( "Symbol %s has unplaced units %s" ), report( missing_units, _( "Symbol %s has unplaced units %s" ), ERCE_MISSING_UNIT );
ERCE_MISSING_UNIT );
} }
std::set<int> missing_power; std::set<int> missing_power;
@ -625,23 +623,22 @@ int ERC_TESTER::TestMissingUnits()
if( !missing_power.empty() && m_settings.IsTestEnabled( ERCE_MISSING_POWER_INPUT_PIN ) ) if( !missing_power.empty() && m_settings.IsTestEnabled( ERCE_MISSING_POWER_INPUT_PIN ) )
{ {
report_missing( missing_power, report( missing_power,
_( "Symbol %s has input power pins in units %s that are not placed." ), _( "Symbol %s has input power pins in units %s that are not placed." ),
ERCE_MISSING_POWER_INPUT_PIN ); ERCE_MISSING_POWER_INPUT_PIN );
} }
if( !missing_input.empty() && m_settings.IsTestEnabled( ERCE_MISSING_INPUT_PIN ) ) if( !missing_input.empty() && m_settings.IsTestEnabled( ERCE_MISSING_INPUT_PIN ) )
{ {
report_missing( missing_input, report( missing_input,
_( "Symbol %s has input pins in units %s that are not placed." ), _( "Symbol %s has input pins in units %s that are not placed." ),
ERCE_MISSING_INPUT_PIN ); ERCE_MISSING_INPUT_PIN );
} }
if( !missing_bidi.empty() && m_settings.IsTestEnabled( ERCE_MISSING_BIDI_PIN ) ) if( !missing_bidi.empty() && m_settings.IsTestEnabled( ERCE_MISSING_BIDI_PIN ) )
{ {
report_missing( missing_bidi, report( missing_bidi,
_( "Symbol %s has bidirectional pins in units %s that are not " _( "Symbol %s has bidirectional pins in units %s that are not placed." ),
"placed." ),
ERCE_MISSING_BIDI_PIN ); ERCE_MISSING_BIDI_PIN );
} }
} }
@ -867,6 +864,7 @@ int ERC_TESTER::TestPinToPin()
} ); } );
ERC_SCH_PIN_CONTEXT needsDriver; ERC_SCH_PIN_CONTEXT needsDriver;
ELECTRICAL_PINTYPE needsDriverType;
bool hasDriver = false; bool hasDriver = false;
// We need different drivers for power nets and normal nets. // We need different drivers for power nets and normal nets.
@ -895,12 +893,11 @@ int ERC_TESTER::TestPinToPin()
// if this net needs a power driver // if this net needs a power driver
if( !needsDriver.Pin() if( !needsDriver.Pin()
|| ( !needsDriver.Pin()->IsVisible() && refPin.Pin()->IsVisible() ) || ( !needsDriver.Pin()->IsVisible() && refPin.Pin()->IsVisible() )
|| ( ispowerNet || ( ispowerNet != ( needsDriverType == ELECTRICAL_PINTYPE::PT_POWER_IN )
!= ( needsDriver.Pin()->GetType()
== ELECTRICAL_PINTYPE::PT_POWER_IN )
&& ispowerNet == ( refType == ELECTRICAL_PINTYPE::PT_POWER_IN ) ) ) && ispowerNet == ( refType == ELECTRICAL_PINTYPE::PT_POWER_IN ) ) )
{ {
needsDriver = refPin; needsDriver = refPin;
needsDriverType = needsDriver.Pin()->GetType();
} }
} }

View File

@ -291,8 +291,8 @@ public:
size_t GetCount() const { return m_flatList.size(); } size_t GetCount() const { return m_flatList.size(); }
SCH_REFERENCE& GetItem( int aIdx ) { return m_flatList[aIdx]; } SCH_REFERENCE& GetItem( size_t aIdx ) { return m_flatList[aIdx]; }
const SCH_REFERENCE& GetItem( int aIdx ) const { return m_flatList[aIdx]; } const SCH_REFERENCE& GetItem( size_t aIdx ) const { return m_flatList[aIdx]; }
void AddItem( const SCH_REFERENCE& aItem ) { m_flatList.push_back( aItem ); } void AddItem( const SCH_REFERENCE& aItem ) { m_flatList.push_back( aItem ); }