Avoid nonstandard variable length array

This commit is contained in:
Simon Richter 2017-12-06 03:42:35 +01:00 committed by Wayne Stambaugh
parent abd0d7fb58
commit 2f8e60352b
2 changed files with 5 additions and 5 deletions

View File

@ -942,7 +942,7 @@ void SHAPE_POLY_SET::unfractureSingle( SHAPE_POLY_SET::POLYGON& aPoly )
auto lc = aPoly[0]; auto lc = aPoly[0];
lc.Simplify(); lc.Simplify();
EDGE_LIST_ENTRY edgeList[ lc.SegmentCount() ]; auto edgeList = std::make_unique<EDGE_LIST_ENTRY []>( lc.SegmentCount() );
for( int i = 0; i < lc.SegmentCount(); i++ ) for( int i = 0; i < lc.SegmentCount(); i++ )
{ {
@ -1004,7 +1004,7 @@ void SHAPE_POLY_SET::unfractureSingle( SHAPE_POLY_SET::POLYGON& aPoly )
queue.insert( &edgeList[i] ); queue.insert( &edgeList[i] );
} }
EDGE_LIST_ENTRY* edgeBuf[ lc.SegmentCount() ]; auto edgeBuf = std::make_unique<EDGE_LIST_ENTRY* []>( lc.SegmentCount() );
int n = 0; int n = 0;
int outline = -1; int outline = -1;

View File

@ -33,7 +33,7 @@
#include <profile.h> #include <profile.h>
#include <unordered_set> #include <unordered_set>
#include <utility>
void unfracture( SHAPE_POLY_SET::POLYGON* aPoly, SHAPE_POLY_SET::POLYGON* aResult ) void unfracture( SHAPE_POLY_SET::POLYGON* aPoly, SHAPE_POLY_SET::POLYGON* aResult )
@ -88,7 +88,7 @@ void unfracture( SHAPE_POLY_SET::POLYGON* aPoly, SHAPE_POLY_SET::POLYGON* aResul
auto lc = (*aPoly)[0]; auto lc = (*aPoly)[0];
lc.Simplify(); lc.Simplify();
EDGE_LIST_ENTRY edgeList[ lc.SegmentCount() ]; auto edgeList = std::make_unique<EDGE_LIST_ENTRY []>( lc.SegmentCount() );
for(int i = 0; i < lc.SegmentCount(); i++) for(int i = 0; i < lc.SegmentCount(); i++)
{ {
@ -149,7 +149,7 @@ void unfracture( SHAPE_POLY_SET::POLYGON* aPoly, SHAPE_POLY_SET::POLYGON* aResul
//printf("Skip %d\n", i); //printf("Skip %d\n", i);
} }
EDGE_LIST_ENTRY* edgeBuf[ lc.SegmentCount() ]; auto edgeBuf = std::make_unique<EDGE_LIST_ENTRY* []>( lc.SegmentCount() );
int n = 0; int n = 0;
int outline = -1; int outline = -1;