Use resize() instead of reserve()/fill() so hardeners don't choke.

Fixes: lp:1789283
* https://bugs.launchpad.net/kicad/+bug/1789283
This commit is contained in:
Jeff Young 2018-09-16 23:58:08 +01:00
parent a40ab768fc
commit a53b163456
1 changed files with 4 additions and 5 deletions

View File

@ -224,8 +224,7 @@ int AR_AUTOPLACER::propagate()
const uint32_t NO_CELL_ZONE = CELL_IS_HOLE | CELL_IS_EDGE | CELL_IS_ZONE; const uint32_t NO_CELL_ZONE = CELL_IS_HOLE | CELL_IS_EDGE | CELL_IS_ZONE;
pt_cell_V.reserve( std::max( m_matrix.m_Nrows, m_matrix.m_Ncols ) ); pt_cell_V.resize( std::max( m_matrix.m_Nrows, m_matrix.m_Ncols ), CELL_IS_EMPTY );
fill( pt_cell_V.begin(), pt_cell_V.end(), 0 );
// Search from left to right and top to bottom. // Search from left to right and top to bottom.
for( row = 0; row < m_matrix.m_Nrows; row++ ) for( row = 0; row < m_matrix.m_Nrows; row++ )
@ -251,7 +250,7 @@ int AR_AUTOPLACER::propagate()
} }
// Search from right to left and top to bottom/ // Search from right to left and top to bottom/
fill( pt_cell_V.begin(), pt_cell_V.end(), 0 ); fill( pt_cell_V.begin(), pt_cell_V.end(), CELL_IS_EMPTY );
for( row = 0; row < m_matrix.m_Nrows; row++ ) for( row = 0; row < m_matrix.m_Nrows; row++ )
{ {
@ -276,7 +275,7 @@ int AR_AUTOPLACER::propagate()
} }
// Search from bottom to top and right to left. // Search from bottom to top and right to left.
fill( pt_cell_V.begin(), pt_cell_V.end(), 0 ); fill( pt_cell_V.begin(), pt_cell_V.end(), CELL_IS_EMPTY );
for( col = m_matrix.m_Ncols - 1; col >= 0; col-- ) for( col = m_matrix.m_Ncols - 1; col >= 0; col-- )
{ {
@ -301,7 +300,7 @@ int AR_AUTOPLACER::propagate()
} }
// Search from bottom to top and left to right. // Search from bottom to top and left to right.
fill( pt_cell_V.begin(), pt_cell_V.end(), 0 ); fill( pt_cell_V.begin(), pt_cell_V.end(), CELL_IS_EMPTY );
for( col = 0; col < m_matrix.m_Ncols; col++ ) for( col = 0; col < m_matrix.m_Ncols; col++ )
{ {