Skip to content

Commit

Permalink
STYLE: Replace postfix with prefix decrement (--)
Browse files Browse the repository at this point in the history
Applied to the root of ITK source tree, at the GNU bash prompt:

    find . \( -iname itk*.cxx -or -iname itk*.hxx -or -iname itk*.h \) -exec perl -pi -w -e 's/  (\w+)\-\-;/  --$1;/g;' {} \;
  • Loading branch information
N-Dekker committed Jul 11, 2022
1 parent ff9d37d commit 2021f7c
Show file tree
Hide file tree
Showing 27 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkConceptChecking.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ struct IncrementDecrementOperators
constraints()
{
++a;
a--;
--a;
++a;
--a;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class ITK_TEMPLATE_EXPORT ConstShapedNeighborhoodIterator : private Neighborhood
void
operator--(int)
{
m_ListIterator--;
--m_ListIterator;
}

const ConstIterator &
Expand All @@ -160,7 +160,7 @@ class ITK_TEMPLATE_EXPORT ConstShapedNeighborhoodIterator : private Neighborhood
const ConstIterator &
operator--()
{
m_ListIterator--;
--m_ListIterator;
return *this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class ITK_TEMPLATE_EXPORT ImageRandomConstIteratorWithIndex : public ImageConstI
operator--()
{
this->RandomJump();
m_NumberOfSamplesDone--;
--m_NumberOfSamplesDone;
return *this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class ITK_TEMPLATE_EXPORT ImageRandomConstIteratorWithOnlyIndex : public ImageCo
operator--()
{
this->RandomJump();
m_NumberOfSamplesDone--;
--m_NumberOfSamplesDone;
return *this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class ITK_TEMPLATE_EXPORT ImageRandomNonRepeatingConstIteratorWithIndex : public
Self &
operator--()
{
m_NumberOfSamplesDone--;
--m_NumberOfSamplesDone;
this->UpdatePosition();
return *this;
}
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkShapedNeighborhoodIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ namespace itk
*
\code
i = it.End();
i--;
--i;
while (i != it.Begin())
{
i.Set(i.Get() + 1.0);
i--;
--i;
}
i.Set(i.Get() + 1.0);
\endcode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ RayCastHelper<TInputImage, TCoordRep>::AdjustRayLength()
m_RayVoxelStartPosition[1] += m_VoxelIncrement[1];
m_RayVoxelStartPosition[2] += m_VoxelIncrement[2];

m_TotalRayVoxelPlanes--;
--m_TotalRayVoxelPlanes;
}

Istart[0] = static_cast<int>(std::floor(m_RayVoxelStartPosition[0] + m_TotalRayVoxelPlanes * m_VoxelIncrement[0]));
Expand All @@ -978,7 +978,7 @@ RayCastHelper<TInputImage, TCoordRep>::AdjustRayLength()
}
else
{
m_TotalRayVoxelPlanes--;
--m_TotalRayVoxelPlanes;
}
} while ((!(startOK && endOK)) && (m_TotalRayVoxelPlanes > 1));

Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Mesh/include/itkBinaryMask3DMeshSource.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -2539,7 +2539,7 @@ BinaryMask3DMeshSource<TInputImage, TOutputMesh>::AddNodes(int ind
if (m_PointFound == 0)
{
m_AvailableNodes[nodesid[i]] = 1;
i--;
--i;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/QuadEdgeMesh/include/itkGeometricalQuadEdge.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ GeometricalQuadEdge<TVRef, TFRef, TPrimalData, TDualData, PrimalDual>::SetLnextR
{
it.Value()->SetLeft(faceGeom);
++it;
maxSize--;
--maxSize;
}

return (true);
Expand Down Expand Up @@ -199,7 +199,7 @@ GeometricalQuadEdge<TVRef, TFRef, TPrimalData, TDualData, PrimalDual>::IsLnextSh
return (false);
}
++it;
maxSize--;
--maxSize;
}

if (it != this->EndGeomLnext())
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ QuadEdgeMesh<TPixel, VDimension, TTraits>::FindFirstUnusedPointIndex() -> PointI
if (pid != 0)
{
PointsContainerConstIterator last = this->GetPoints()->End();
last--;
--last;
pid = last.Index() + 1;
}
}
Expand Down Expand Up @@ -600,7 +600,7 @@ QuadEdgeMesh<TPixel, VDimension, TTraits>::FindFirstUnusedCellIndex() -> CellIde
if (cid != 0)
{
CellsContainerIterator last = this->GetCells()->End();
last--;
--last;
cid = last.Index() + 1;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ TubeSpatialObject<TDimension, TTubePointType>::IsInsideInObjectSpace(const Point
++it2;
auto end = this->m_Points.end();
auto last = end;
last--;
--last;

PointType firstP = first->GetPositionInObjectSpace();
double firstR = first->GetRadiusInObjectSpace();
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Transform/include/itkCompositeTransform.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ CompositeTransform<TParametersValueType, VDimension>::SetParameters(const Parame

do
{
it--;
--it;
/* If inputParams is same object as m_Parameters, we just pass
* each sub-transforms own m_Parameters in. This is needed to
* avoid unnecessary copying of parameters in the sub-transforms,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ SignedMaurerDistanceMapImageFilter<TInputImage, TOutputImage>::Voronoi(unsigned
{
while ((l >= 1) && this->Remove(g(l - 1), g(l), di, h(l - 1), h(l), iw))
{
l--;
--l;
}
++l;
g(l) = di;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ MaskFeaturePointSelectionFilter<TImage, TMask, TFeatures>::GenerateData()
if (itk::Math::abs(trace) < TRACE_EPSILON)
{
++rit;
numberOfPointsInserted--;
--numberOfPointsInserted;
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ LabelStatisticsImageFilter<TInputImage, TLabelImage>::GetMedian(LabelPixelType l
total += (*mapIt).second.m_Histogram->GetFrequency(index);
++bin;
}
bin--;
--bin;
index[0] = bin;

// return center of bin range
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ class VectorMorphologicalGradientHistogram
RemovePixel(const TInputPixel & p)
{
m_Vector[p - NumericTraits<TInputPixel>::NonpositiveMin()]--;
m_Count--;
--m_Count;
if (m_Count > 0)
{
while (m_Vector[m_Max - NumericTraits<TInputPixel>::NonpositiveMin()] == 0)
{
m_Max--;
--m_Max;
}
while (m_Vector[m_Min - NumericTraits<TInputPixel>::NonpositiveMin()] == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ ContourExtractor2DImageFilter<TInputImage>::FillOutputs(
ContourConstIterator itC{ (*it).cend() };
do
{
itC--;
--itC;
path->push_back(*itC);
} while (itC != (*it).cbegin());
}
Expand Down
10 changes: 5 additions & 5 deletions Modules/IO/BMP/src/itkBMPImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ BMPImageIO::Read(void * buffer)
if (byte2 == 0)
{
// End of line
line--;
--line;
posLine = 0;
continue;
}
Expand Down Expand Up @@ -887,9 +887,9 @@ BMPImageIO::Write(const void * buffer)
{
ptr += 2;
m_Ofstream.write(ptr, sizeof(char)); // blue
ptr--;
--ptr;
m_Ofstream.write(ptr, sizeof(char)); // green
ptr--;
--ptr;
m_Ofstream.write(ptr, sizeof(char)); // red
ptr += 3;
}
Expand All @@ -904,9 +904,9 @@ BMPImageIO::Write(const void * buffer)
{
ptr += 2;
m_Ofstream.write(ptr, sizeof(char)); // blue
ptr--;
--ptr;
m_Ofstream.write(ptr, sizeof(char)); // green
ptr--;
--ptr;
m_Ofstream.write(ptr, sizeof(char)); // red
ptr += 3;
m_Ofstream.write(ptr, sizeof(char)); // alpha
Expand Down
2 changes: 1 addition & 1 deletion Modules/IO/GE/src/itkGE4ImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ GE4ImageIO ::MvtSunf(int numb)
int sun_exp = 4 * (dg_exp - 64);
while ((dg_mantissa & signbit) == 0 && dg_mantissa != 0)
{
sun_exp--;
--sun_exp;
dg_mantissa = dg_mantissa << 1;
}
sun_exp += 126;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ ParticleSwarmOptimizerBase::RandomInitialization()
if (this->m_Particles[i].m_CurrentParameters[j] < parameterBounds[j].first ||
this->m_Particles[i].m_CurrentParameters[j] > parameterBounds[j].second)
{
j--;
--j;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ QuasiNewtonOptimizerv4Template<TInternalComputationValueType>::EstimateNewtonSte
// we assign this ending block of local parameters to thread_(i+1) .
if ((subrange[1] + 1) % numLocalPara != 0)
{
high--;
--high;
}

for (IndexValueType loc = low; loc <= high; ++loc)
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Statistics/include/itkHistogram.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ Histogram<TMeasurement, TFrequencyContainer>::Quantile(unsigned int dimension, d
cumulated += f_n;
p_n_prev = p_n;
p_n = 1.0 - cumulated / totalFrequency;
n--;
--n;
++m;
} while (m < size && p_n > p);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Partition(TSubsample * sample,
{
break;
}
moveToBackIndex--;
--moveToBackIndex;
}

//
Expand Down Expand Up @@ -113,7 +113,7 @@ Partition(TSubsample * sample,
{
break;
}
moveToBackIndex--;
--moveToBackIndex;
}

//
Expand Down Expand Up @@ -157,7 +157,7 @@ Partition(TSubsample * sample,
{
break;
}
moveToBackIndex--;
--moveToBackIndex;
}

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ KLMRegionGrowImageFilter<TInputImage, TOutputImage>::MergeRegions()
m_BordersDynamicPointer.erase(m_BordersDynamicPointer.end() - 1);

// Decrement for the one deleted border and a deleted region
m_NumberOfRegions--;
--m_NumberOfRegions;
if (m_BordersDynamicPointer.empty())
{
itkExceptionMacro(<< "KLM algorithm error");
Expand Down Expand Up @@ -714,7 +714,7 @@ KLMRegionGrowImageFilter<TInputImage, TOutputImage>::ResolveRegions()
while (regionsPointerIt != regionsPointerItEnd)
{
RegionLabelType origLabel = iregion;
iregion--;
--iregion;
RegionLabelType currLabel = m_RegionsPointer[iregion]->GetRegionLabel();

// Unresolved chain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::GreyScalarBoundary(LabelledI
const auto difference = static_cast<LabelType>(itk::Math::abs(m_LowPoint[rgb] - neighbors[i]));
if (difference > m_BoundaryGradient)
{
numx--;
--numx;
x -= neighbors[i];
signs[i]--;
++change;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ VoronoiDiagram2DGenerator<TCoordRepType>::ConstructDiagram()
auto maxStop = static_cast<int>(rawEdges[i].size());
while (!(rawEdges[i].empty()))
{
maxStop--;
--maxStop;
curr = rawEdges[i].front();
rawEdges[i].pop_front();
frontbnd = Pointonbnd(front[0]);
Expand Down Expand Up @@ -519,7 +519,7 @@ VoronoiDiagram2DGenerator<TCoordRepType>::deletePQ(FortuneHalfEdge * task)
last = last->m_Next;
}
last->m_Next = (task->m_Next);
m_PQcount--;
--m_PQcount;
task->m_Vert = nullptr;
}
}
Expand Down Expand Up @@ -812,7 +812,7 @@ VoronoiDiagram2DGenerator<TCoordRepType>::getPQmin() -> FortuneHalfEdge *
FortuneHalfEdge * curr = m_PQHash[m_PQmin].m_Next;

m_PQHash[m_PQmin].m_Next = curr->m_Next;
m_PQcount--;
--m_PQcount;
return (curr);
}

Expand Down
Loading

0 comments on commit 2021f7c

Please sign in to comment.