From 9efc91c1075ea39c0e82a0f0ad9c39bef57b9caa Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 22 Sep 2020 16:50:15 +0200 Subject: [PATCH] fix 2 minor compil warnings and make a sentence more easily translatable --- pcbnew/drc/drc_engine.cpp | 9 ++++----- pcbnew/drc/drc_test_provider_annulus.cpp | 20 +++++++++++++------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index 60ce644d82..34cb493861 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -172,15 +172,14 @@ void DRC_ENGINE::loadImplicitRules() if( !isDefault ) { expr = wxString::Format( "A.NetClass == '%s' || B.NetClass == '%s'", - className, - className ); + className, className ); } DRC_RULE_CONDITION* inNetclassCondition = new DRC_RULE_CONDITION ( expr ); - DRC_RULE* rule = createImplicitRule( wxString::Format( _( "netclass '%s'" ), + DRC_RULE* nc_rule = createImplicitRule( wxString::Format( _( "netclass '%s'" ), className )); - rule->m_Condition = inNetclassCondition; + nc_rule->m_Condition = inNetclassCondition; // Only add netclass clearances if they're larger than board minimums. That way // board minimums will still enforce a global minimum. @@ -189,7 +188,7 @@ void DRC_ENGINE::loadImplicitRules() { DRC_CONSTRAINT ncClearanceConstraint( DRC_CONSTRAINT_TYPE_CLEARANCE ); ncClearanceConstraint.Value().SetMin( nc->GetClearance() ); - rule->AddConstraint( ncClearanceConstraint ); + nc_rule->AddConstraint( ncClearanceConstraint ); } ruleCount++; diff --git a/pcbnew/drc/drc_test_provider_annulus.cpp b/pcbnew/drc/drc_test_provider_annulus.cpp index f441628d77..1d4452ba1b 100644 --- a/pcbnew/drc/drc_test_provider_annulus.cpp +++ b/pcbnew/drc/drc_test_provider_annulus.cpp @@ -85,8 +85,8 @@ bool DRC_TEST_PROVIDER_ANNULUS::Run() if( m_drcEngine->IsErrorLimitExceeded( DRCE_ANNULUS ) ) return false; - int v_min; - int v_max; + int v_min = 0; + int v_max = 0; VIA* via = dyn_cast( item ); // fixme: check minimum IAR/OAR ring for THT pads too @@ -117,11 +117,17 @@ bool DRC_TEST_PROVIDER_ANNULUS::Run() { std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_ANNULUS ); - m_msg.Printf( drcItem->GetErrorText() + _( " (%s %s annulus %s; actual %s)" ), - constraint.GetName(), - fail_min ? _( "min" ) : _( "max" ), - MessageTextFromValue( userUnits(), annulus, true ), - MessageTextFromValue( userUnits(), fail_min ? v_min : v_max, true ) ); + if( fail_min ) + m_msg.Printf( drcItem->GetErrorText() + _( " (%s min annulus %s; actual %s)" ), + constraint.GetName(), + MessageTextFromValue( userUnits(), annulus, true ), + MessageTextFromValue( userUnits(), v_min, true ) ); + + if( fail_max ) + m_msg.Printf( drcItem->GetErrorText() + _( " (%s max annulus %s; actual %s)" ), + constraint.GetName(), + MessageTextFromValue( userUnits(), annulus, true ), + MessageTextFromValue( userUnits(), v_max, true ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( item );