diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index 458dae0417..14f54ca5d4 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -35,7 +35,7 @@ #include #include #include -#include // for ID_POPUP_SCH_SELECT_UNIT_CMP_MAX and ID_POPUP_SCH_SELECT_UNIT1 +#include // for MAX_UNIT_COUNT_PER_PACKAGE definition #include @@ -158,7 +158,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel() if( m_Parent->GetShowDeMorgan() ) m_AsConvertButt->SetValue( true ); - int maxUnits = ID_POPUP_SCH_SELECT_UNIT_CMP_MAX - ID_POPUP_SCH_SELECT_UNIT1; + int maxUnits = MAX_UNIT_COUNT_PER_PACKAGE; m_SelNumberOfUnits->SetRange (1, maxUnits ); m_staticTextNbUnits->SetLabel( wxString::Format( diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp index 7571cd998b..9db0ec62f3 100644 --- a/eeschema/sch_legacy_plugin.cpp +++ b/eeschema/sch_legacy_plugin.cpp @@ -57,6 +57,7 @@ #include #include #include +#include // for MAX_UNIT_COUNT_PER_PACKAGE definition // Must be the first line of part library document (.dcm) files. @@ -1397,7 +1398,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( FILE_LINE_READER& aReader ) if( !unit.ToLong( &tmp, 10 ) ) SCH_PARSE_ERROR( "expected integer value", aReader, line ); - if( tmp < 0 || tmp > 26 ) + if( tmp < 0 || tmp > MAX_UNIT_COUNT_PER_PACKAGE ) SCH_PARSE_ERROR( "unit value out of range", aReader, line ); component->AddHierarchicalReference( path, reference, (int)tmp );