From 16c7d85b34b9b7b79f5f38aa671dac6e769326fd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 19 Feb 2011 12:32:53 +0000 Subject: [PATCH] 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 --- src/common/gbsizer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/gbsizer.cpp b/src/common/gbsizer.cpp index 66c27e8299..4a7bf43182 100644 --- a/src/common/gbsizer.cpp +++ b/src/common/gbsizer.cpp @@ -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) -- 2.45.2