diff --git a/pcbnew/drc/drc_cache_generator.cpp b/pcbnew/drc/drc_cache_generator.cpp index a00625b3dc..1b94c77d08 100644 --- a/pcbnew/drc/drc_cache_generator.cpp +++ b/pcbnew/drc/drc_cache_generator.cpp @@ -148,7 +148,7 @@ bool DRC_CACHE_GENERATOR::Run() while( status != std::future_status::ready ) { - m_drcEngine->ReportProgress( static_cast( done ) / count ); + reportProgress( done, count ); status = retn.wait_for( std::chrono::milliseconds( 250 ) ); } @@ -204,7 +204,7 @@ bool DRC_CACHE_GENERATOR::Run() while( status != std::future_status::ready ) { - m_drcEngine->ReportProgress( static_cast( done ) / allZones.size() ); + reportProgress( done, allZones.size() ); status = ret.wait_for( std::chrono::milliseconds( 250 ) ); } } diff --git a/pcbnew/drc/drc_test_provider.cpp b/pcbnew/drc/drc_test_provider.cpp index c30ed07397..db8f35284d 100644 --- a/pcbnew/drc/drc_test_provider.cpp +++ b/pcbnew/drc/drc_test_provider.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2024 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 @@ -84,11 +84,11 @@ void DRC_TEST_PROVIDER::reportViolation( std::shared_ptr& item, } -bool DRC_TEST_PROVIDER::reportProgress( int aCount, int aSize, int aDelta ) +bool DRC_TEST_PROVIDER::reportProgress( size_t aCount, size_t aSize, size_t aDelta ) { if( ( aCount % aDelta ) == 0 || aCount == aSize - 1 ) { - if( !m_drcEngine->ReportProgress( (double) aCount / (double) aSize ) ) + if( !m_drcEngine->ReportProgress( static_cast( aCount ) / aSize ) ) return false; } diff --git a/pcbnew/drc/drc_test_provider.h b/pcbnew/drc/drc_test_provider.h index 208e6a5d29..a584bcddd5 100644 --- a/pcbnew/drc/drc_test_provider.h +++ b/pcbnew/drc/drc_test_provider.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-2024 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 @@ -110,7 +110,7 @@ protected: virtual void reportViolation( std::shared_ptr& item, const VECTOR2I& aMarkerPos, int aMarkerLayer ); - virtual bool reportProgress( int aCount, int aSize, int aDelta ); + virtual bool reportProgress( size_t aCount, size_t aSize, size_t aDelta = 1 ); virtual bool reportPhase( const wxString& aStageName ); virtual void reportRuleStatistics(); diff --git a/pcbnew/drc/drc_test_provider_connection_width.cpp b/pcbnew/drc/drc_test_provider_connection_width.cpp index 2b05ae87df..ab9eacef3a 100644 --- a/pcbnew/drc/drc_test_provider_connection_width.cpp +++ b/pcbnew/drc/drc_test_provider_connection_width.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2022 KiCad Developers. + * Copyright (C) 2022-2024 KiCad Developers. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -844,7 +844,7 @@ bool DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run() while( status != std::future_status::ready ) { - m_drcEngine->ReportProgress( static_cast( done ) / total_effort ); + reportProgress( done, total_effort ); status = ret.wait_for( std::chrono::milliseconds( 250 ) ); } } @@ -864,7 +864,7 @@ bool DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run() while( status != std::future_status::ready ) { - m_drcEngine->ReportProgress( static_cast( done ) / total_effort ); + reportProgress( done, total_effort ); status = ret.wait_for( std::chrono::milliseconds( 250 ) ); } } diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index 1d717768f5..ae2f4b559a 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2024 KiCad Developers. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -676,7 +676,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances() while( done < count ) { - m_drcEngine->ReportProgress( static_cast( done ) / count ); + reportProgress( done, count ); if( m_drcEngine->IsCancelled() ) { @@ -1005,7 +1005,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances( ) while( status != std::future_status::ready ) { - m_drcEngine->ReportProgress( static_cast( done ) / count ); + reportProgress( done, count ); status = retn.wait_for( std::chrono::milliseconds( 250 ) ); } } @@ -1157,7 +1157,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testGraphicClearances( ) while( status != std::future_status::ready ) { - m_drcEngine->ReportProgress( static_cast( done ) / count ); + reportProgress( done, count ); status = retn.wait_for( std::chrono::milliseconds( 250 ) ); } } @@ -1333,7 +1333,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones() { result = task.wait_for( std::chrono::milliseconds( 250 ) ); - m_drcEngine->ReportProgress( static_cast( done ) / count ); + reportProgress( done, count ); if( m_drcEngine->IsCancelled() ) break; diff --git a/pcbnew/drc/drc_test_provider_disallow.cpp b/pcbnew/drc/drc_test_provider_disallow.cpp index 31a667a0f2..5052022b0e 100644 --- a/pcbnew/drc/drc_test_provider_disallow.cpp +++ b/pcbnew/drc/drc_test_provider_disallow.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2024 KiCad Developers. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -176,7 +176,7 @@ bool DRC_TEST_PROVIDER_DISALLOW::Run() while( status != std::future_status::ready ) { - m_drcEngine->ReportProgress( static_cast( done ) / toCache.size() ); + reportProgress( done, toCache.size() ); status = ret.wait_for( std::chrono::milliseconds( 250 ) ); } } diff --git a/pcbnew/drc/drc_test_provider_sliver_checker.cpp b/pcbnew/drc/drc_test_provider_sliver_checker.cpp index 5057aeb690..344de09212 100644 --- a/pcbnew/drc/drc_test_provider_sliver_checker.cpp +++ b/pcbnew/drc/drc_test_provider_sliver_checker.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2021-2022 KiCad Developers. + * Copyright (C) 2021-2024 KiCad Developers. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -174,8 +174,7 @@ bool DRC_TEST_PROVIDER_SLIVER_CHECKER::Run() while( status != std::future_status::ready ) { - m_drcEngine->ReportProgress( static_cast( zoneLayerCount ) / done ); - + reportProgress( zoneLayerCount, done ); status = ret.wait_for( std::chrono::milliseconds( 250 ) ); } } diff --git a/pcbnew/drc/drc_test_provider_zone_connections.cpp b/pcbnew/drc/drc_test_provider_zone_connections.cpp index 515732a1d5..e4a758b9fb 100644 --- a/pcbnew/drc/drc_test_provider_zone_connections.cpp +++ b/pcbnew/drc/drc_test_provider_zone_connections.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2021-2023 KiCad Developers. + * Copyright (C) 2021-2024 KiCad Developers. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -287,7 +287,7 @@ bool DRC_TEST_PROVIDER_ZONE_CONNECTIONS::Run() while( status != std::future_status::ready ) { - m_drcEngine->ReportProgress( static_cast( done ) / total_effort ); + reportProgress( done, total_effort ); status = ret.wait_for( std::chrono::milliseconds( 250 ) ); } }