Correct signed/unsigned comparison in wxGridBagSizer code.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 19 Feb 2011 12:32:53 +0000 (12:32 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 19 Feb 2011 12:32:53 +0000 (12:32 +0000)
commit16c7d85b34b9b7b79f5f38aa671dac6e769326fd
tree828666e7c0a47e97cd6b65c3421cb443856bfa10
parent1b3b63ed5b05e7fc0f0d88ccdaa4c087c53bfa04
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