From b585ef67af07cf83d5b488103ba263124eba1b4d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 2 May 2022 21:52:25 +0100 Subject: [PATCH] Consistently write loops over wxRegionIterator in the same way Standardize on a single loop for all versions of it and prefer to use "for" loops with the iterator increment directly in the loop statement instead of using "while" loops with the increment somewhere inside the loop, where it could be possibly skipped by a "continue" statement. No real changes. --- src/generic/grid.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 10c72ef053..bf2ab8b934 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -3678,13 +3678,12 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) wxArrayInt wxGrid::CalcRowLabelsExposed( const wxRegion& reg, wxGridWindow *gridWindow ) const { - wxRegionIterator iter( reg ); wxRect r; wxArrayInt rowlabels; int top, bottom; - while ( iter ) + for ( wxRegionIterator iter( reg ); iter; ++iter ) { r = iter.GetRect(); r.Offset(GetGridWindowOffset(gridWindow)); @@ -3724,8 +3723,6 @@ wxArrayInt wxGrid::CalcRowLabelsExposed( const wxRegion& reg, wxGridWindow *grid rowlabels.Add( row ); } - - ++iter; } return rowlabels; @@ -3733,13 +3730,12 @@ wxArrayInt wxGrid::CalcRowLabelsExposed( const wxRegion& reg, wxGridWindow *grid wxArrayInt wxGrid::CalcColLabelsExposed( const wxRegion& reg, wxGridWindow *gridWindow ) const { - wxRegionIterator iter( reg ); wxRect r; wxArrayInt colLabels; int left, right; - while ( iter ) + for ( wxRegionIterator iter( reg ); iter; ++iter ) { r = iter.GetRect(); r.Offset( GetGridWindowOffset(gridWindow) ); @@ -3779,8 +3775,6 @@ wxArrayInt wxGrid::CalcColLabelsExposed( const wxRegion& reg, wxGridWindow *grid colLabels.Add( col ); } - - ++iter; } return colLabels;