Remove negative index access from CPoint

Callers should be responsible for index count and/or use iterators
This commit is contained in:
Seth Hillbrand
2025-08-08 10:46:45 -07:00
parent 5df10e23b9
commit b207ec8817
28 changed files with 93 additions and 92 deletions
+2 -2
View File
@@ -1090,7 +1090,7 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int
}
// If the polygon is not closed, close it:
if( aPoly.CPoint( 0 ) != aPoly.CPoint( -1 ) )
if( aPoly.CPoint( 0 ) != aPoly.CLastPoint() )
FinishTo( VECTOR2I( aPoly.CPoint( 0 ) ) );
fmt::println( m_outputFile, "G37*" );
@@ -1124,7 +1124,7 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int
// Ensure the thick outline is closed for filled polygons
// (if not filled, could be only a polyline)
if( ( aPoly.CPoint( 0 ) != aPoly.CPoint( -1 ) ) && ( aPoly.IsClosed() || aFill != FILL_T::NO_FILL ) )
if( ( aPoly.CPoint( 0 ) != aPoly.CLastPoint() ) && ( aPoly.IsClosed() || aFill != FILL_T::NO_FILL ) )
LineTo( VECTOR2I( aPoly.CPoint( 0 ) ) );
PenFinish();