Correct signed/unsigned comparison in wxGridBagSizer code.

Casting a signed value to unsigned type is a recipe for disaster if it
actually turns out to be negative because the comparison remains always false
and the loop becomes practically infinite. So cast the unsigned value to
signed int instead, this should be perfectly safe as the number of columns or
rows in a sizer can't exceed INT_MAX anyhow.

Notice that after the changes of the previous revision the signed value
should actually be always positive so this change is not strictly needed but
it is still safer to write the comparison like this.

See #12934.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66965 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2011-02-19 12:32:53 +00:00
parent 1b3b63ed5b
commit 16c7d85b34

View File

@ -473,9 +473,9 @@ wxSize wxGridBagSizer::CalcMin()
item->GetEndPos(endrow, endcol);
// fill heights and widths upto this item if needed
while ( m_rowHeights.GetCount() <= (size_t)endrow )
while ( (int)m_rowHeights.GetCount() <= endrow )
m_rowHeights.Add(m_emptyCellSize.GetHeight());
while ( m_colWidths.GetCount() <= (size_t)endcol )
while ( (int)m_colWidths.GetCount() <= endcol )
m_colWidths.Add(m_emptyCellSize.GetWidth());
// See if this item increases the size of its row(s) or col(s)