Formatting.

This commit is contained in:
Jeff Young 2022-11-10 11:50:00 +00:00
parent 29bf96f7f0
commit 36eb853570
1 changed files with 54 additions and 48 deletions

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2011 Jean-Pierre Charras, <jp.charras@wanadoo.fr> * Copyright (C) 2011 Jean-Pierre Charras, <jp.charras@wanadoo.fr>
* Copyright (C) 2013-2016 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2013-2016 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -129,7 +129,7 @@ bool FOOTPRINT_LIST_IMPL::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxStri
} }
else else
{ {
for( auto const& nickname : aTable->GetLogicalLibs() ) for( const wxString& nickname : aTable->GetLogicalLibs() )
m_queue_in.push( nickname ); m_queue_in.push( nickname );
} }
@ -166,7 +166,8 @@ void FOOTPRINT_LIST_IMPL::loadLibs()
size_t num_returns = m_queue_in.size(); size_t num_returns = m_queue_in.size();
std::vector<std::future<size_t>> returns( num_returns ); std::vector<std::future<size_t>> returns( num_returns );
auto loader_job = [this]() -> size_t auto loader_job =
[this]() -> size_t
{ {
wxString nickname; wxString nickname;
size_t retval = 0; size_t retval = 0;
@ -222,36 +223,41 @@ void FOOTPRINT_LIST_IMPL::loadFootprints()
size_t num_elements = m_queue_out.size(); size_t num_elements = m_queue_out.size();
std::vector<std::future<size_t>> returns( num_elements ); std::vector<std::future<size_t>> returns( num_elements );
auto fp_thread = [ this, &queue_parsed ]() -> size_t auto fp_thread =
[ this, &queue_parsed ]() -> size_t
{ {
wxString nickname; wxString nickname;
if( m_queue_out.pop( nickname ) && !m_cancelled ) if( m_cancelled || !m_queue_out.pop( nickname ) )
{ return 0;
wxArrayString fpnames; wxArrayString fpnames;
if( !CatchErrors( [&]() if( !CatchErrors( [&]()
{ m_lib_table->FootprintEnumerate( fpnames, nickname, false ); } ) ) {
m_lib_table->FootprintEnumerate( fpnames, nickname, false );
} ) )
{ {
return 0; return 0;
} }
for( unsigned jj = 0; jj < fpnames.size() && !m_cancelled; ++jj ) for( wxString fpname : fpnames )
{ {
CatchErrors( [&]() CatchErrors(
[&]()
{ {
FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO_IMPL( this, nickname, fpnames[jj] ); auto* fpinfo = new FOOTPRINT_INFO_IMPL( this, nickname, fpname );
queue_parsed.move_push( std::unique_ptr<FOOTPRINT_INFO>( fpinfo ) ); queue_parsed.move_push( std::unique_ptr<FOOTPRINT_INFO>( fpinfo ) );
}); });
if( m_cancelled )
return 0;
} }
if( m_progress_reporter ) if( m_progress_reporter )
m_progress_reporter->AdvanceProgress(); m_progress_reporter->AdvanceProgress();
return 1; return 1;
}
return 0;
}; };
for( size_t ii = 0; ii < num_elements; ++ii ) for( size_t ii = 0; ii < num_elements; ++ii )