Skip to content

Commit

Permalink
STYLE: Reduce scope of local for-loop index i in ImageRegion::Crop
Browse files Browse the repository at this point in the history
Following C++ Core Guidelines, October 12, 2023, "Keep scopes small"
http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-scope
  • Loading branch information
N-Dekker authored and dzenanz committed Nov 14, 2023
1 parent fc17f0b commit 6d86d1f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Modules/Core/Common/include/itkImageRegion.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,9 @@ bool
ImageRegion<VImageDimension>::Crop(const Self & region)
{
OffsetValueType crop;
unsigned int i;

// Can we crop?
for (i = 0; i < VImageDimension; ++i)
for (unsigned int i = 0; i < VImageDimension; ++i)
{
// Is the left edge of current region to the right of the right edge of the region to crop with? Or is the right
// edge of the current region to the left of the left edge of the region to crop with? (if so, we cannot crop)
Expand All @@ -204,7 +203,7 @@ ImageRegion<VImageDimension>::Crop(const Self & region)
}

// we can crop, so crop
for (i = 0; i < VImageDimension; ++i)
for (unsigned int i = 0; i < VImageDimension; ++i)
{
// first check the start index
if (m_Index[i] < region.m_Index[i])
Expand Down

0 comments on commit 6d86d1f

Please sign in to comment.