diff options
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-06-15 10:46:15 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2018-06-18 12:27:01 +0000 |
| commit | f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43 (patch) | |
| tree | 7c6044fd3a17a2665841959dac9b3b2110b27924 /src/livarot | |
| parent | Run clang-tidy’s modernize-use-override pass. (diff) | |
| download | inkscape-f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43.tar.gz inkscape-f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43.zip | |
Run clang-tidy’s modernize-use-nullptr pass.
This replaces all NULL or 0 with nullptr when assigned to or returned as
a pointer.
Diffstat (limited to 'src/livarot')
| -rw-r--r-- | src/livarot/AVL.cpp | 62 | ||||
| -rw-r--r-- | src/livarot/AlphaLigne.cpp | 4 | ||||
| -rw-r--r-- | src/livarot/PathConversion.cpp | 2 | ||||
| -rw-r--r-- | src/livarot/PathCutting.cpp | 24 | ||||
| -rw-r--r-- | src/livarot/PathOutline.cpp | 6 | ||||
| -rw-r--r-- | src/livarot/PathSimplify.cpp | 6 | ||||
| -rw-r--r-- | src/livarot/PathStroke.cpp | 2 | ||||
| -rw-r--r-- | src/livarot/Shape.cpp | 26 | ||||
| -rw-r--r-- | src/livarot/Shape.h | 4 | ||||
| -rw-r--r-- | src/livarot/ShapeMisc.cpp | 28 | ||||
| -rw-r--r-- | src/livarot/ShapeRaster.cpp | 48 | ||||
| -rw-r--r-- | src/livarot/ShapeSweep.cpp | 128 | ||||
| -rw-r--r-- | src/livarot/int-line.cpp | 8 | ||||
| -rw-r--r-- | src/livarot/sweep-event.cpp | 8 | ||||
| -rw-r--r-- | src/livarot/sweep-tree-list.cpp | 6 | ||||
| -rw-r--r-- | src/livarot/sweep-tree.cpp | 30 |
16 files changed, 196 insertions, 196 deletions
diff --git a/src/livarot/AVL.cpp b/src/livarot/AVL.cpp index 17af5ee66..8c36283a6 100644 --- a/src/livarot/AVL.cpp +++ b/src/livarot/AVL.cpp @@ -27,11 +27,11 @@ void AVLTree::MakeNew() { for (int i = 0; i < 2; i++) { - elem[i] = NULL; - child[i] = NULL; + elem[i] = nullptr; + child[i] = nullptr; } - parent = NULL; + parent = nullptr; balance = 0; } @@ -41,13 +41,13 @@ void AVLTree::MakeDelete() if (elem[i]) { elem[i]->elem[1 - i] = elem[1 - i]; } - elem[i] = NULL; + elem[i] = nullptr; } } AVLTree *AVLTree::Leftmost() { - return leafFromParent(NULL, LEFT); + return leafFromParent(nullptr, LEFT); } AVLTree *AVLTree::leaf(AVLTree *from, Side s) @@ -66,7 +66,7 @@ AVLTree *AVLTree::leaf(AVLTree *from, Side s) } } - return NULL; + return nullptr; } AVLTree *AVLTree::leafFromParent(AVLTree */*from*/, Side s) @@ -81,7 +81,7 @@ AVLTree *AVLTree::leafFromParent(AVLTree */*from*/, Side s) int AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) { - if (from == NULL) + if (from == nullptr) { if (parent) return parent->RestoreBalances (this, racine); @@ -105,7 +105,7 @@ AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) balance = 0; return avl_no_err; } - if (child[LEFT] == NULL) + if (child[LEFT] == nullptr) { // cout << "mierda\n"; return avl_bal_err; @@ -147,7 +147,7 @@ AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) } else { - if (child[LEFT]->child[RIGHT] == NULL) + if (child[LEFT]->child[RIGHT] == nullptr) { // cout << "mierda\n"; return avl_bal_err; @@ -211,7 +211,7 @@ AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) balance = 0; return avl_no_err; } - if (child[RIGHT] == NULL) + if (child[RIGHT] == nullptr) { // cout << "mierda\n"; return avl_bal_err; @@ -252,7 +252,7 @@ AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) } else { - if (child[RIGHT]->child[LEFT] == NULL) + if (child[RIGHT]->child[LEFT] == nullptr) { // cout << "mierda\n"; return avl_bal_err; @@ -333,7 +333,7 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) } else if (diff > 0) { - if (child[LEFT] == NULL) + if (child[LEFT] == nullptr) { // cout << "un probleme\n"; return avl_bal_err; @@ -409,7 +409,7 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) } else if (e->balance < 0) { - if (child[LEFT]->child[RIGHT] == NULL) + if (child[LEFT]->child[RIGHT] == nullptr) { // cout << "un probleme\n"; return avl_bal_err; @@ -492,7 +492,7 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) { if (diff < 0) { - if (child[RIGHT] == NULL) + if (child[RIGHT] == nullptr) { // cout << "un probleme\n"; return avl_bal_err; @@ -568,7 +568,7 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) } else if (e->balance > 0) { - if (child[RIGHT]->child[LEFT] == NULL) + if (child[RIGHT]->child[LEFT] == nullptr) { // cout << "un probleme\n"; return avl_bal_err; @@ -656,7 +656,7 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) int AVLTree::Remove (AVLTree * &racine, bool rebalance) { - AVLTree *startNode = NULL; + AVLTree *startNode = nullptr; int remDiff = 0; int res = Remove (racine, startNode, remDiff); if (res == avl_no_err && rebalance && startNode) @@ -671,12 +671,12 @@ AVLTree::Remove (AVLTree * &racine, AVLTree * &startNode, int &diff) elem[LEFT]->elem[RIGHT] = elem[RIGHT]; if (elem[RIGHT]) elem[RIGHT]->elem[LEFT] = elem[LEFT]; - elem[LEFT] = elem[RIGHT] = NULL; + elem[LEFT] = elem[RIGHT] = nullptr; if (child[LEFT] && child[RIGHT]) { AVLTree *newMe = child[LEFT]->leafFromParent(this, RIGHT); - if (newMe == NULL || newMe->child[RIGHT]) + if (newMe == nullptr || newMe->child[RIGHT]) { // cout << "pas normal\n"; return avl_rm_err; @@ -785,14 +785,14 @@ AVLTree::Remove (AVLTree * &racine, AVLTree * &startNode, int &diff) if (parent) { if (parent->child[LEFT] == this) - parent->child[LEFT] = NULL; + parent->child[LEFT] = nullptr; if (parent->child[RIGHT] == this) - parent->child[RIGHT] = NULL; + parent->child[RIGHT] = nullptr; } if (racine == this) - racine = NULL; + racine = nullptr; } - parent = child[RIGHT] = child[LEFT] = NULL; + parent = child[RIGHT] = child[LEFT] = nullptr; balance = 0; return avl_no_err; } @@ -806,7 +806,7 @@ AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, { int res = Insert (racine, insertType, insertL, insertR); if (res == avl_no_err && rebalance) - res = RestoreBalances ((AVLTree *) NULL, racine); + res = RestoreBalances ((AVLTree *) nullptr, racine); return res; } @@ -814,7 +814,7 @@ int AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, AVLTree * insertR) { - if (racine == NULL) + if (racine == nullptr) { racine = this; return avl_no_err; @@ -828,7 +828,7 @@ AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, } else if (insertType == found_on_left) { - if (insertR == NULL || insertR->child[LEFT]) + if (insertR == nullptr || insertR->child[LEFT]) { // cout << "ngou?\n"; return avl_ins_err; @@ -839,7 +839,7 @@ AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, } else if (insertType == found_on_right) { - if (insertL == NULL || insertL->child[RIGHT]) + if (insertL == nullptr || insertL->child[RIGHT]) { // cout << "ngou?\n"; return avl_ins_err; @@ -850,18 +850,18 @@ AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, } else if (insertType == found_between) { - if (insertR == NULL || insertL == NULL - || (insertR->child[LEFT] != NULL && insertL->child[RIGHT] != NULL)) + if (insertR == nullptr || insertL == nullptr + || (insertR->child[LEFT] != nullptr && insertL->child[RIGHT] != nullptr)) { // cout << "ngou?\n"; return avl_ins_err; } - if (insertR->child[LEFT] == NULL) + if (insertR->child[LEFT] == nullptr) { insertR->child[LEFT] = this; parent = insertR; } - else if (insertL->child[RIGHT] == NULL) + else if (insertL->child[RIGHT] == nullptr) { insertL->child[RIGHT] = this; parent = insertL; @@ -870,7 +870,7 @@ AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, } else if (insertType == found_exact) { - if (insertL == NULL) + if (insertL == nullptr) { // cout << "ngou?\n"; return avl_ins_err; diff --git a/src/livarot/AlphaLigne.cpp b/src/livarot/AlphaLigne.cpp index 5b8321b72..c7e7487bd 100644 --- a/src/livarot/AlphaLigne.cpp +++ b/src/livarot/AlphaLigne.cpp @@ -19,7 +19,7 @@ AlphaLigne::AlphaLigne(int iMin,int iMax) min=iMin; max=iMax; if ( max < min+1 ) max=min+1; - steps=NULL; + steps=nullptr; nbStep=maxStep=0; before.x=min-1; before.delta=0; @@ -29,7 +29,7 @@ AlphaLigne::AlphaLigne(int iMin,int iMax) AlphaLigne::~AlphaLigne(void) { g_free(steps); - steps=NULL; + steps=nullptr; nbStep=maxStep=0; } void AlphaLigne::Affiche(void) diff --git a/src/livarot/PathConversion.cpp b/src/livarot/PathConversion.cpp index 30e21d546..b31cee14a 100644 --- a/src/livarot/PathConversion.cpp +++ b/src/livarot/PathConversion.cpp @@ -1271,7 +1271,7 @@ void Path::RecBezierTo(Geom::Point const &iP, Geom::Point const &iS,Geom::Point void Path::Fill(Shape* dest, int pathID, bool justAdd, bool closeIfNeeded, bool invert) { - if ( dest == NULL ) { + if ( dest == nullptr ) { return; } diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp index 086b30557..3c518c521 100644 --- a/src/livarot/PathCutting.cpp +++ b/src/livarot/PathCutting.cpp @@ -273,7 +273,7 @@ Geom::PathVector * Path::MakePathVector() { Geom::PathVector *pv = new Geom::PathVector(); - Geom::Path * currentpath = NULL; + Geom::Path * currentpath = nullptr; Geom::Point lastP,bezSt,bezEn; int bezNb=0; @@ -523,8 +523,8 @@ double Path::Surface() Path** Path::SubPaths(int &outNb,bool killNoSurf) { int nbRes=0; - Path** res=NULL; - Path* curAdd=NULL; + Path** res=nullptr; + Path* curAdd=nullptr; for (int i=0;i<int(descr_cmd.size());i++) { int const typ = descr_cmd[i]->getType(); @@ -543,7 +543,7 @@ Path** Path::SubPaths(int &outNb,bool killNoSurf) } else { delete curAdd; } - curAdd=NULL; + curAdd=nullptr; } curAdd=new Path; curAdd->SetBackData(false); @@ -605,7 +605,7 @@ Path** Path::SubPaths(int &outNb,bool killNoSurf) delete curAdd; } } - curAdd=NULL; + curAdd=nullptr; outNb=nbRes; return res; @@ -613,8 +613,8 @@ Path** Path::SubPaths(int &outNb,bool killNoSurf) Path** Path::SubPathsWithNesting(int &outNb,bool killNoSurf,int nbNest,int* nesting,int* conts) { int nbRes=0; - Path** res=NULL; - Path* curAdd=NULL; + Path** res=nullptr; + Path* curAdd=nullptr; bool increment=false; for (int i=0;i<int(descr_cmd.size());i++) { @@ -638,9 +638,9 @@ Path** Path::SubPathsWithNesting(int &outNb,bool killNoSurf,int nbNest,int* } else { delete curAdd; } - curAdd=NULL; + curAdd=nullptr; } - Path* hasParent=NULL; + Path* hasParent=nullptr; for (int j=0;j<nbNest;j++) { if ( conts[j] == i && nesting[j] >= 0 ) { int parentMvt=conts[nesting[j]]; @@ -719,7 +719,7 @@ Path** Path::SubPathsWithNesting(int &outNb,bool killNoSurf,int nbNest,int* delete curAdd; } } - curAdd=NULL; + curAdd=nullptr; outNb=nbRes; return res; @@ -883,12 +883,12 @@ static int CmpCurv(const void * p1, const void * p2) { Path::cut_position* Path::CurvilignToPosition(int nbCv, double *cvAbs, int &nbCut) { if ( nbCv <= 0 || pts.empty() || back == false ) { - return NULL; + return nullptr; } qsort(cvAbs, nbCv, sizeof(double), CmpCurv); - cut_position *res = NULL; + cut_position *res = nullptr; nbCut = 0; int curCv = 0; diff --git a/src/livarot/PathOutline.cpp b/src/livarot/PathOutline.cpp index c1a48d41f..c6d050f01 100644 --- a/src/livarot/PathOutline.cpp +++ b/src/livarot/PathOutline.cpp @@ -32,7 +32,7 @@ void Path::Outline(Path *dest, double width, JoinType join, ButtType butt, doubl if ( descr_cmd.size() <= 1 ) { return; } - if ( dest == NULL ) { + if ( dest == nullptr ) { return; } @@ -210,7 +210,7 @@ Path::OutsideOutline (Path * dest, double width, JoinType join, ButtType butt, CloseSubpath(); } if (int(descr_cmd.size()) <= 1) return; - if (dest == NULL) return; + if (dest == nullptr) return; dest->Reset (); dest->SetBackData (false); @@ -235,7 +235,7 @@ Path::InsideOutline (Path * dest, double width, JoinType join, ButtType butt, CloseSubpath(); } if (int(descr_cmd.size()) <= 1) return; - if (dest == NULL) return; + if (dest == nullptr) return; dest->Reset (); dest->SetBackData (false); diff --git a/src/livarot/PathSimplify.cpp b/src/livarot/PathSimplify.cpp index 81ddcd049..c142aae0a 100644 --- a/src/livarot/PathSimplify.cpp +++ b/src/livarot/PathSimplify.cpp @@ -158,9 +158,9 @@ void Path::DoSimplify(int off, int N, double treshhold) int curP = 0; fitting_tables data; - data.Xk = data.Yk = data.Qk = NULL; - data.tk = data.lk = NULL; - data.fk = NULL; + data.Xk = data.Yk = data.Qk = nullptr; + data.tk = data.lk = nullptr; + data.fk = nullptr; data.totLen = 0; data.nbPt = data.maxPt = data.inPt = 0; diff --git a/src/livarot/PathStroke.cpp b/src/livarot/PathStroke.cpp index 4cfeb887a..4b65463dd 100644 --- a/src/livarot/PathStroke.cpp +++ b/src/livarot/PathStroke.cpp @@ -41,7 +41,7 @@ static Geom::Point StrokeNormalize(const Geom::Point value, double length) { void Path::Stroke(Shape *dest, bool doClose, double width, JoinType join, ButtType butt, double miter, bool justAdd) { - if (dest == NULL) { + if (dest == nullptr) { return; } diff --git a/src/livarot/Shape.cpp b/src/livarot/Shape.cpp index 33b383947..87af8423d 100644 --- a/src/livarot/Shape.cpp +++ b/src/livarot/Shape.cpp @@ -23,12 +23,12 @@ Shape::Shape() : nbQRas(0), firstQRas(-1), lastQRas(-1), - qrsData(NULL), + qrsData(nullptr), nbInc(0), maxInc(0), - iData(NULL), - sTree(NULL), - sEvts(NULL), + iData(nullptr), + sTree(nullptr), + sEvts(nullptr), _need_points_sorting(false), _need_edges_sorting(false), _has_points_data(false), @@ -242,7 +242,7 @@ Shape::MakeVoronoiData (bool nVal) void Shape::Copy (Shape * who) { - if (who == NULL) + if (who == nullptr) { Reset (0, 0); return; @@ -256,9 +256,9 @@ Shape::Copy (Shape * who) MakeBackData (false); delete sTree; - sTree = NULL; + sTree = nullptr; delete sEvts; - sEvts = NULL; + sEvts = nullptr; Reset (who->numberOfPoints(), who->numberOfEdges()); type = who->type; @@ -342,7 +342,7 @@ Shape::AddPoint (const Geom::Point x) pData[n].pending = 0; pData[n].edgeOnLeft = -1; pData[n].nextLinkedPoint = -1; - pData[n].askForWindingS = NULL; + pData[n].askForWindingS = nullptr; pData[n].askForWindingB = -1; pData[n].rx[0] = Round(p.x[0]); pData[n].rx[1] = Round(p.x[1]); @@ -1163,7 +1163,7 @@ Shape::AddEdge (int st, int en) } if (_has_sweep_src_data) { - swsData[n].misc = NULL; + swsData[n].misc = nullptr; swsData[n].firstLinkedPoint = -1; } if (_has_back_data) @@ -1238,7 +1238,7 @@ Shape::AddEdge (int st, int en, int leF, int riF) } if (_has_sweep_src_data) { - swsData[n].misc = NULL; + swsData[n].misc = nullptr; swsData[n].firstLinkedPoint = -1; } if (_has_back_data) @@ -2151,11 +2151,11 @@ void Shape::initialiseEdgeData() eData[i].coEd = -eData[i].coEd; } - swsData[i].misc = NULL; + swsData[i].misc = nullptr; swsData[i].firstLinkedPoint = -1; swsData[i].stPt = swsData[i].enPt = -1; swsData[i].leftRnd = swsData[i].rightRnd = -1; - swsData[i].nextSh = NULL; + swsData[i].nextSh = nullptr; swsData[i].nextBo = -1; swsData[i].curPoint = -1; swsData[i].doneTo = -1; @@ -2166,7 +2166,7 @@ void Shape::initialiseEdgeData() void Shape::clearIncidenceData() { g_free(iData); - iData = NULL; + iData = nullptr; nbInc = maxInc = 0; } diff --git a/src/livarot/Shape.h b/src/livarot/Shape.h index 2651f4d7f..3c2fdd0a3 100644 --- a/src/livarot/Shape.h +++ b/src/livarot/Shape.h @@ -291,7 +291,7 @@ public: // create a graph that is an offseted version of the graph "of" // the offset is dec, with joins between edges of type "join" (see LivarotDefs.h) // the result is NOT a polygon; you need a subsequent call to ConvertToShape to get a real polygon - int MakeOffset(Shape *of, double dec, JoinType join, double miter, bool do_profile=false, double cx = 0, double cy = 0, double radius = 0, Geom::Affine *i2doc = NULL); + int MakeOffset(Shape *of, double dec, JoinType join, double miter, bool do_profile=false, double cx = 0, double cy = 0, double radius = 0, Geom::Affine *i2doc = nullptr); int MakeTweak (int mode, Shape *a, double dec, JoinType join, double miter, bool do_profile, Geom::Point c, Geom::Point vector, double radius, Geom::Affine *i2doc); @@ -498,7 +498,7 @@ private: void CheckEdges(int lastPointNo, int lastChgtPt, Shape *a, Shape *b, BooleanOp mod); void Avance(int lastPointNo, int lastChgtPt, Shape *iS, int iB, Shape *a, Shape *b, BooleanOp mod); void DoEdgeTo(Shape *iS, int iB, int iTo, bool direct, bool sens); - void GetWindings(Shape *a, Shape *b = NULL, BooleanOp mod = bool_op_union, bool brutal = false); + void GetWindings(Shape *a, Shape *b = nullptr, BooleanOp mod = bool_op_union, bool brutal = false); void Validate(); diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index 4f63007e7..f44a326ba 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -66,7 +66,7 @@ Shape::ConvertToForme (Path * dest) // suivParc: next in the stack for (int i = 0; i < numberOfEdges(); i++) { - swdData[i].misc = 0; + swdData[i].misc = nullptr; swdData[i].precParc = swdData[i].suivParc = -1; } @@ -83,7 +83,7 @@ Shape::ConvertToForme (Path * dest) int fi = 0; for (fi = lastPtUsed; fi < numberOfPoints(); fi++) { - if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == 0) + if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == nullptr) break; } lastPtUsed = fi + 1; @@ -128,7 +128,7 @@ Shape::ConvertToForme (Path * dest) if (nb < 0 || nb == curBord) break; } - while (swdData[nb].misc != 0 || getEdge(nb).st != cPt); + while (swdData[nb].misc != nullptr || getEdge(nb).st != cPt); if (nb < 0 || nb == curBord) { @@ -211,7 +211,7 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced) for (int i = 0; i < numberOfEdges(); i++) { - swdData[i].misc = 0; + swdData[i].misc = nullptr; swdData[i].precParc = swdData[i].suivParc = -1; } @@ -225,7 +225,7 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced) int fi = 0; for (fi = lastPtUsed; fi < numberOfPoints(); fi++) { - if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == 0) + if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == nullptr) break; } lastPtUsed = fi + 1; @@ -268,7 +268,7 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced) if (nb < 0 || nb == curBord) break; } - while (swdData[nb].misc != 0 || getEdge(nb).st != cPt); + while (swdData[nb].misc != nullptr || getEdge(nb).st != cPt); if (nb < 0 || nb == curBord) { @@ -329,8 +329,8 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced) void Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath*/,int &nbNest,int *&nesting,int *&contStart,bool splitWhenForced) { - nesting=NULL; - contStart=NULL; + nesting=nullptr; + contStart=nullptr; nbNest=0; if (numberOfPoints() <= 1 || numberOfEdges() <= 1) @@ -364,7 +364,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* for (int i = 0; i < numberOfEdges(); i++) { - swdData[i].misc = 0; + swdData[i].misc = nullptr; swdData[i].precParc = swdData[i].suivParc = -1; } @@ -381,7 +381,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* int fi = 0; for (fi = lastPtUsed; fi < numberOfPoints(); fi++) { - if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == 0) + if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == nullptr) break; } { @@ -439,7 +439,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* if (nb < 0 || nb == curBord) break; } - while (swdData[nb].misc != 0 || getEdge(nb).st != cPt); + while (swdData[nb].misc != nullptr || getEdge(nb).st != cPt); if (nb < 0 || nb == curBord) { @@ -896,7 +896,7 @@ Shape::AddContour (Path * dest, int nbP, Path * *orig, int startBord, int curBor int nPiece = ebData[bord].pieceID; int nPath = ebData[bord].pathID; - if (nPath < 0 || nPath >= nbP || orig[nPath] == NULL) + if (nPath < 0 || nPath >= nbP || orig[nPath] == nullptr) { // segment batard dest->LineTo (getPoint(getEdge(bord).en).x); @@ -1159,7 +1159,7 @@ Shape::ReFormeBezierTo (int bord, int /*curBord*/, Path * dest, Path * from) int inBezier = -1, nbInterm = -1; int typ; typ = from->descr_cmd[nPiece]->getType(); - PathDescrBezierTo *nBData = NULL; + PathDescrBezierTo *nBData = nullptr; if (typ == descr_bezierto) { nBData = dynamic_cast<PathDescrBezierTo *>(from->descr_cmd[nPiece]); @@ -1220,7 +1220,7 @@ Shape::ReFormeBezierTo (int bord, int /*curBord*/, Path * dest, Path * from) bord = swdData[bord].suivParc; } - g_return_val_if_fail(nBData != NULL, 0); + g_return_val_if_fail(nBData != nullptr, 0); if (pe == ps) { diff --git a/src/livarot/ShapeRaster.cpp b/src/livarot/ShapeRaster.cpp index 2b35c9666..4588fb722 100644 --- a/src/livarot/ShapeRaster.cpp +++ b/src/livarot/ShapeRaster.cpp @@ -34,10 +34,10 @@ void Shape::BeginRaster(float &pos, int &curPt) MakePointData(true); MakeEdgeData(true); - if (sTree == NULL) { + if (sTree == nullptr) { sTree = new SweepTreeList(numberOfEdges()); } - if (sEvts == NULL) { + if (sEvts == nullptr) { sEvts = new SweepEventQueue(numberOfEdges()); } @@ -55,7 +55,7 @@ void Shape::BeginRaster(float &pos, int &curPt) } for (int i = 0;i < numberOfEdges(); i++) { - swrData[i].misc = NULL; + swrData[i].misc = nullptr; eData[i].rdx=pData[getEdge(i).en].rx - pData[getEdge(i).st].rx; } } @@ -64,9 +64,9 @@ void Shape::BeginRaster(float &pos, int &curPt) void Shape::EndRaster() { delete sTree; - sTree = NULL; + sTree = nullptr; delete sEvts; - sEvts = NULL; + sEvts = nullptr; MakePointData(false); MakeEdgeData(false); @@ -95,7 +95,7 @@ void Shape::BeginQuickRaster(float &pos, int &curPt) initialisePointData(); for (int i=0;i<numberOfEdges();i++) { - swrData[i].misc = NULL; + swrData[i].misc = nullptr; qrsData[i].ind = -1; eData[i].rdx = pData[getEdge(i).en].rx - pData[getEdge(i).st].rx; } @@ -152,14 +152,14 @@ void Shape::Scan(float &pos, int &curP, float to, float step) if ( nbDn <= 0 ) { upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } } else { if ( nbUp <= 0 ) { dnNo = -1; } - if ( dnNo >= 0 && swrData[dnNo].misc == NULL ) { + if ( dnNo >= 0 && swrData[dnNo].misc == nullptr ) { dnNo = -1; } } @@ -178,7 +178,7 @@ void Shape::Scan(float &pos, int &curP, float to, float step) // but the other edge don't have this chance SweepTree *node = swrData[cb].misc; if ( node ) { - swrData[cb].misc = NULL; + swrData[cb].misc = nullptr; node->Remove(*sTree, *sEvts, true); } } @@ -189,13 +189,13 @@ void Shape::Scan(float &pos, int &curP, float to, float step) // if there is one edge going down and one edge coming from above, we don't Insert() the new edge, // but replace the upNo edge by the new one (faster) - SweepTree* insertionNode = NULL; + SweepTree* insertionNode = nullptr; if ( dnNo >= 0 ) { if ( upNo >= 0 ) { int rmNo=(d == DOWNWARDS) ? upNo:dnNo; int neNo=(d == DOWNWARDS) ? dnNo:upNo; SweepTree* node = swrData[rmNo].misc; - swrData[rmNo].misc = NULL; + swrData[rmNo].misc = nullptr; int const P = (d == DOWNWARDS) ? nPt : Other(nPt, neNo); node->ConvertTo(this, neNo, 1, P); @@ -304,7 +304,7 @@ void Shape::QuickScan(float &pos,int &curP, float to, bool /*doSort*/, float ste if ( nbDn <= 0 ) { upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } @@ -629,7 +629,7 @@ void Shape::DirectScan(float &pos, int &curP, float to, float step) for (int i=0;i<numberOfEdges();i++) { if ( swrData[i].misc ) { SweepTree* node = swrData[i].misc; - swrData[i].misc = NULL; + swrData[i].misc = nullptr; node->Remove(*sTree, *sEvts, true); } } @@ -664,7 +664,7 @@ void Shape::DirectScan(float &pos, int &curP, float to, float step) for (int i = 0; i < numberOfEdges(); i++) { if ( swrData[i].misc ) { SweepTree* node = swrData[i].misc; - swrData[i].misc = NULL; + swrData[i].misc = nullptr; node->Remove(*sTree, *sEvts, true); } } @@ -860,7 +860,7 @@ void Shape::Scan(float &pos, int &curP, float to, FloatLigne *line, bool exact, if ( nbDn <= 0 ) { upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } @@ -885,7 +885,7 @@ void Shape::Scan(float &pos, int &curP, float to, FloatLigne *line, bool exact, } // traitement du "upNo devient dnNo" - SweepTree *insertionNode = NULL; + SweepTree *insertionNode = nullptr; if ( dnNo >= 0 ) { if ( upNo >= 0 ) { SweepTree* node = swrData[upNo].misc; @@ -1037,7 +1037,7 @@ void Shape::Scan(float &pos, int &curP, float to, FillRule directed, BitLigne *l if ( nbDn <= 0 ) { upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } @@ -1060,7 +1060,7 @@ void Shape::Scan(float &pos, int &curP, float to, FillRule directed, BitLigne *l } // traitement du "upNo devient dnNo" - SweepTree* insertionNode = NULL; + SweepTree* insertionNode = nullptr; if ( dnNo >= 0 ) { if ( upNo >= 0 ) { SweepTree* node = swrData[upNo].misc; @@ -1146,7 +1146,7 @@ void Shape::Scan(float &pos, int &curP, float to, AlphaLigne *line, bool exact, if ( nbDn <= 0 ) { upNo=-1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo=-1; } @@ -1170,7 +1170,7 @@ void Shape::Scan(float &pos, int &curP, float to, AlphaLigne *line, bool exact, } // traitement du "upNo devient dnNo" - SweepTree* insertionNode = NULL; + SweepTree* insertionNode = nullptr; if ( dnNo >= 0 ) { if ( upNo >= 0 ) { SweepTree* node = swrData[upNo].misc; @@ -1298,7 +1298,7 @@ void Shape::QuickScan(float &pos, int &curP, float to, FloatLigne* line, float s if ( nbDn <= 0 ) { upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } @@ -1450,7 +1450,7 @@ void Shape::QuickScan(float &pos, int &curP, float to, FillRule directed, BitLig upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } @@ -1544,7 +1544,7 @@ void Shape::QuickScan(float &pos, int &curP, float to, AlphaLigne* line, float s if ( nbDn <= 0 ) { upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } @@ -1990,7 +1990,7 @@ void Shape::_updateIntersection(int e, int p) swrData[e].lastY = swrData[e].curY; swrData[e].curX = getPoint(p).x[0]; swrData[e].curY = getPoint(p).x[1]; - swrData[e].misc = NULL; + swrData[e].misc = nullptr; } diff --git a/src/livarot/ShapeSweep.cpp b/src/livarot/ShapeSweep.cpp index 1e6273964..4004f183d 100644 --- a/src/livarot/ShapeSweep.cpp +++ b/src/livarot/ShapeSweep.cpp @@ -119,7 +119,7 @@ Shape::Reoriente (Shape * a) SortPointsRounded (); _need_edges_sorting = true; - GetWindings (this, NULL, bool_op_union, true); + GetWindings (this, nullptr, bool_op_union, true); // Plot(341,56,8,400,400,true,true,false,true); for (int i = 0; i < numberOfEdges(); i++) @@ -179,10 +179,10 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) a->ResetSweep(); - if (sTree == NULL) { + if (sTree == nullptr) { sTree = new SweepTreeList(a->numberOfEdges()); } - if (sEvts == NULL) { + if (sEvts == nullptr) { sEvts = new SweepEventQueue(a->numberOfEdges()); } @@ -202,7 +202,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) double lastChange = a->pData[0].rx[1] - 1.0; int lastChgtPt = 0; int edgeHead = -1; - Shape *shapeHead = NULL; + Shape *shapeHead = nullptr; clearIncidenceData(); @@ -211,10 +211,10 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) while (curAPt < a->numberOfPoints() || sEvts->size() > 0) { Geom::Point ptX; double ptL, ptR; - SweepTree *intersL = NULL; - SweepTree *intersR = NULL; + SweepTree *intersL = nullptr; + SweepTree *intersR = nullptr; int nPt = -1; - Shape *ptSh = NULL; + Shape *ptSh = nullptr; bool isIntersection = false; if (sEvts->peek(intersL, intersR, ptX, ptL, ptR)) { @@ -308,7 +308,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) CheckAdjacencies (lastI, lastChgtPt, shapeHead, edgeHead); - CheckEdges (lastI, lastChgtPt, a, NULL, bool_op_union); + CheckEdges (lastI, lastChgtPt, a, nullptr, bool_op_union); for (int i = lastChgtPt; i < lastI; i++) { if (pData[i].askForWindingS) { @@ -330,7 +330,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) lastChange = rPtX[1]; chgts.clear(); edgeHead = -1; - shapeHead = NULL; + shapeHead = nullptr; } @@ -380,7 +380,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) { upNo = -1; } - if (upNo >= 0 && (SweepTree *) ptSh->swsData[upNo].misc == NULL) + if (upNo >= 0 && (SweepTree *) ptSh->swsData[upNo].misc == nullptr) { upNo = -1; } @@ -401,19 +401,19 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) { SweepTree *node = (SweepTree *) ptSh->swsData[cb].misc; - if (node == NULL) + if (node == nullptr) { } else { AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_REMOVED, node->src, node->bord, - NULL, -1); - ptSh->swsData[cb].misc = NULL; + nullptr, -1); + ptSh->swsData[cb].misc = nullptr; int onLeftB = -1, onRightB = -1; - Shape *onLeftS = NULL; - Shape *onRightS = NULL; + Shape *onLeftS = nullptr; + Shape *onRightS = nullptr; if (node->elem[LEFT]) { onLeftB = @@ -468,7 +468,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) } // traitement du "upNo devient dnNo" - SweepTree *insertionNode = NULL; + SweepTree *insertionNode = nullptr; if (dnNo >= 0) { if (upNo >= 0) @@ -476,9 +476,9 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) SweepTree *node = (SweepTree *) ptSh->swsData[upNo].misc; AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_REMOVED, - node->src, node->bord, NULL, -1); + node->src, node->bord, nullptr, -1); - ptSh->swsData[upNo].misc = NULL; + ptSh->swsData[upNo].misc = nullptr; node->RemoveEvents (*sEvts); node->ConvertTo (ptSh, dnNo, 1, lastPointNo); @@ -489,7 +489,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) ptSh->swsData[dnNo].curPoint = lastPointNo; AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_INSERTED, - node->src, node->bord, NULL, -1); + node->src, node->bord, nullptr, -1); } else { @@ -517,7 +517,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) ptSh->swsData[dnNo].curPoint = lastPointNo; AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_INSERTED, - node->src, node->bord, NULL, -1); + node->src, node->bord, nullptr, -1); } } @@ -559,7 +559,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) ptSh->swsData[cb].curPoint = lastPointNo; AddChgt (lastPointNo, lastChgtPt, shapeHead, - edgeHead, EDGE_INSERTED, node->src, node->bord, NULL, + edgeHead, EDGE_INSERTED, node->src, node->bord, nullptr, -1); } } @@ -617,7 +617,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) CheckAdjacencies (lastI, lastChgtPt, shapeHead, edgeHead); - CheckEdges (lastI, lastChgtPt, a, NULL, bool_op_union); + CheckEdges (lastI, lastChgtPt, a, nullptr, bool_op_union); for (int i = lastChgtPt; i < lastI; i++) { @@ -633,7 +633,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) _pts.resize(lastI); edgeHead = -1; - shapeHead = NULL; + shapeHead = nullptr; } chgts.clear(); @@ -818,9 +818,9 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) // Plot(200.0,200.0,2.0,400.0,400.0,true,true,true,true); delete sTree; - sTree = NULL; + sTree = nullptr; delete sEvts; - sEvts = NULL; + sEvts = nullptr; MakePointData (false); MakeEdgeData (false); @@ -837,7 +837,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) int Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) { - if (a == b || a == NULL || b == NULL) + if (a == b || a == nullptr || b == nullptr) return shape_input_err; Reset (0, 0); if (a->numberOfPoints() <= 1 || a->numberOfEdges() <= 1) @@ -856,10 +856,10 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) a->ResetSweep (); b->ResetSweep (); - if (sTree == NULL) { + if (sTree == nullptr) { sTree = new SweepTreeList(a->numberOfEdges() + b->numberOfEdges()); } - if (sEvts == NULL) { + if (sEvts == nullptr) { sEvts = new SweepEventQueue(a->numberOfEdges() + b->numberOfEdges()); } @@ -892,7 +892,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) b->pData[0].rx[1]) ? a->pData[0].rx[1] - 1.0 : b->pData[0].rx[1] - 1.0; int lastChgtPt = 0; int edgeHead = -1; - Shape *shapeHead = NULL; + Shape *shapeHead = nullptr; clearIncidenceData(); @@ -916,10 +916,10 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) Geom::Point ptX; double ptL, ptR; - SweepTree *intersL = NULL; - SweepTree *intersR = NULL; + SweepTree *intersL = nullptr; + SweepTree *intersR = nullptr; int nPt = -1; - Shape *ptSh = NULL; + Shape *ptSh = nullptr; bool isIntersection = false; if (sEvts->peek(intersL, intersR, ptX, ptL, ptR)) @@ -1135,7 +1135,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) lastChange = rPtX[1]; chgts.clear(); edgeHead = -1; - shapeHead = NULL; + shapeHead = nullptr; } @@ -1186,7 +1186,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) { upNo = -1; } - if (upNo >= 0 && (SweepTree *) ptSh->swsData[upNo].misc == NULL) + if (upNo >= 0 && (SweepTree *) ptSh->swsData[upNo].misc == nullptr) { upNo = -1; } @@ -1209,19 +1209,19 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) { SweepTree *node = (SweepTree *) ptSh->swsData[cb].misc; - if (node == NULL) + if (node == nullptr) { } else { AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_REMOVED, node->src, node->bord, - NULL, -1); - ptSh->swsData[cb].misc = NULL; + nullptr, -1); + ptSh->swsData[cb].misc = nullptr; int onLeftB = -1, onRightB = -1; - Shape *onLeftS = NULL; - Shape *onRightS = NULL; + Shape *onLeftS = nullptr; + Shape *onRightS = nullptr; if (node->elem[LEFT]) { onLeftB = @@ -1277,7 +1277,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) } // traitement du "upNo devient dnNo" - SweepTree *insertionNode = NULL; + SweepTree *insertionNode = nullptr; if (dnNo >= 0) { if (upNo >= 0) @@ -1285,9 +1285,9 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) SweepTree *node = (SweepTree *) ptSh->swsData[upNo].misc; AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_REMOVED, - node->src, node->bord, NULL, -1); + node->src, node->bord, nullptr, -1); - ptSh->swsData[upNo].misc = NULL; + ptSh->swsData[upNo].misc = nullptr; node->RemoveEvents (*sEvts); node->ConvertTo (ptSh, dnNo, 1, lastPointNo); @@ -1299,7 +1299,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) ptSh->swsData[dnNo].curPoint = lastPointNo; AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_INSERTED, - node->src, node->bord, NULL, -1); + node->src, node->bord, nullptr, -1); } else { @@ -1330,7 +1330,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) ptSh->swsData[dnNo].curPoint = lastPointNo; AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_INSERTED, - node->src, node->bord, NULL, -1); + node->src, node->bord, nullptr, -1); } } @@ -1376,7 +1376,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) ptSh->swsData[cb].curPoint = lastPointNo; AddChgt (lastPointNo, lastChgtPt, shapeHead, - edgeHead, EDGE_INSERTED, node->src, node->bord, NULL, + edgeHead, EDGE_INSERTED, node->src, node->bord, nullptr, -1); } } @@ -1451,7 +1451,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) _pts.resize(lastI); edgeHead = -1; - shapeHead = NULL; + shapeHead = nullptr; } chgts.clear(); @@ -1626,9 +1626,9 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) } delete sTree; - sTree = NULL; + sTree = nullptr; delete sEvts; - sEvts = NULL; + sEvts = nullptr; if ( mod == bool_op_cut ) { // on garde le askForWinding @@ -1656,7 +1656,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) void Shape::TesteIntersection(SweepTree *t, Side s, bool onlyDiff) { SweepTree *tt = static_cast<SweepTree*>(t->elem[s]); - if (tt == NULL) { + if (tt == nullptr) { return; } @@ -2124,7 +2124,7 @@ Shape::AssemblePoints (int st, int en) pData[i].pending = lastI++; if (i > st && getPoint(i - 1).x[0] == getPoint(i).x[0] && getPoint(i - 1).x[1] == getPoint(i).x[1]) { pData[i].pending = pData[i - 1].pending; - if (pData[pData[i].pending].askForWindingS == NULL) { + if (pData[pData[i].pending].askForWindingS == nullptr) { pData[pData[i].pending].askForWindingS = pData[i].askForWindingS; pData[pData[i].pending].askForWindingB = pData[i].askForWindingB; } else { @@ -2354,7 +2354,7 @@ Shape::GetWindings (Shape * /*a*/, Shape * /*b*/, BooleanOp /*mod*/, bool brutal // preparation du parcours for (int i = 0; i < numberOfEdges(); i++) { - swdData[i].misc = 0; + swdData[i].misc = nullptr; swdData[i].precParc = swdData[i].suivParc = -1; } @@ -2372,7 +2372,7 @@ Shape::GetWindings (Shape * /*a*/, Shape * /*b*/, BooleanOp /*mod*/, bool brutal int fi = 0; for (fi = lastPtUsed; fi < numberOfPoints(); fi++) { - if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == 0) + if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == nullptr) break; } lastPtUsed = fi + 1; @@ -2454,7 +2454,7 @@ Shape::GetWindings (Shape * /*a*/, Shape * /*b*/, BooleanOp /*mod*/, bool brutal } nb = nnb; } - while (nb >= 0 && nb != curBord && swdData[nb].misc != 0); + while (nb >= 0 && nb != curBord && swdData[nb].misc != nullptr); if (nb < 0 || nb == curBord) { // retour en arriere @@ -2830,10 +2830,10 @@ Shape::CheckAdjacencies (int lastPointNo, int lastChgtPt, Shape * /*shapeHead*/, { SweepTree *node = static_cast < SweepTree * >(nSrc->swsData[nBrd].misc); - if (node == NULL) + if (node == nullptr) break; node = static_cast < SweepTree * >(node->elem[LEFT]); - if (node == NULL) + if (node == nullptr) break; nSrc = node->src; nBrd = node->bord; @@ -2898,10 +2898,10 @@ Shape::CheckAdjacencies (int lastPointNo, int lastChgtPt, Shape * /*shapeHead*/, { SweepTree *node = static_cast < SweepTree * >(nSrc->swsData[nBrd].misc); - if (node == NULL) + if (node == nullptr) break; node = static_cast < SweepTree * >(node->elem[RIGHT]); - if (node == NULL) + if (node == nullptr) break; nSrc = node->src; nBrd = node->bord; @@ -2939,7 +2939,7 @@ void Shape::AddChgt(int lastPointNo, int lastChgtPt, Shape * &shapeHead, chgts[nCh].lSrc = llE->src; chgts[nCh].lBrd = llE->bord; } else { - chgts[nCh].lSrc = NULL; + chgts[nCh].lSrc = nullptr; chgts[nCh].lBrd = -1; } @@ -2971,7 +2971,7 @@ void Shape::AddChgt(int lastPointNo, int lastChgtPt, Shape * &shapeHead, chgts[nCh].rSrc = rrE->src; chgts[nCh].rBrd = rrE->bord; } else { - chgts[nCh].rSrc = NULL; + chgts[nCh].rSrc = nullptr; chgts[nCh].rBrd = -1; } @@ -3001,7 +3001,7 @@ void Shape::AddChgt(int lastPointNo, int lastChgtPt, Shape * &shapeHead, chgts[nCh].rSrc = rlE->src; chgts[nCh].rBrd = rlE->bord; } else { - chgts[nCh].rSrc = NULL; + chgts[nCh].rSrc = nullptr; chgts[nCh].rBrd = -1; } } @@ -3075,10 +3075,10 @@ Shape::CheckEdges (int lastPointNo, int lastChgtPt, Shape * a, Shape * b, SweepTree *node = static_cast < SweepTree * >(nSrc->swsData[nBrd].misc); - if (node == NULL) + if (node == nullptr) break; node = static_cast < SweepTree * >(node->elem[LEFT]); - if (node == NULL) + if (node == nullptr) break; nSrc = node->src; nBrd = node->bord; @@ -3095,10 +3095,10 @@ Shape::CheckEdges (int lastPointNo, int lastChgtPt, Shape * a, Shape * b, SweepTree *node = static_cast < SweepTree * >(nSrc->swsData[nBrd].misc); - if (node == NULL) + if (node == nullptr) break; node = static_cast < SweepTree * >(node->elem[RIGHT]); - if (node == NULL) + if (node == nullptr) break; nSrc = node->src; nBrd = node->bord; diff --git a/src/livarot/int-line.cpp b/src/livarot/int-line.cpp index 998f638e7..ff9e26790 100644 --- a/src/livarot/int-line.cpp +++ b/src/livarot/int-line.cpp @@ -22,10 +22,10 @@ IntLigne::IntLigne() { nbBord = maxBord = 0; - bords = NULL; + bords = nullptr; nbRun = maxRun = 0; - runs = NULL; + runs = nullptr; firstAc = lastAc = -1; } @@ -36,12 +36,12 @@ IntLigne::~IntLigne() if ( maxBord > 0 ) { g_free(bords); nbBord = maxBord = 0; - bords = NULL; + bords = nullptr; } if ( maxRun > 0 ) { g_free(runs); nbRun = maxRun = 0; - runs = NULL; + runs = nullptr; } } diff --git a/src/livarot/sweep-event.cpp b/src/livarot/sweep-event.cpp index 48354fc46..6b6e8f835 100644 --- a/src/livarot/sweep-event.cpp +++ b/src/livarot/sweep-event.cpp @@ -22,7 +22,7 @@ SweepEventQueue::~SweepEventQueue() SweepEvent *SweepEventQueue::add(SweepTree *iLeft, SweepTree *iRight, Geom::Point &px, double itl, double itr) { if (nbEvt > maxEvt) { - return NULL; + return nullptr; } int const n = nbEvt++; @@ -227,7 +227,7 @@ void SweepEventQueue::relocate(SweepEvent *e, int to) */ SweepEvent::SweepEvent() { - MakeNew (NULL, NULL, Geom::Point(0, 0), 0, 0); + MakeNew (nullptr, nullptr, Geom::Point(0, 0), 0, 0); } SweepEvent::~SweepEvent() @@ -257,8 +257,8 @@ void SweepEvent::MakeDelete() s->pData[n].pending--; } - sweep[i]->evt[1 - i] = NULL; - sweep[i] = NULL; + sweep[i]->evt[1 - i] = nullptr; + sweep[i] = nullptr; } } diff --git a/src/livarot/sweep-tree-list.cpp b/src/livarot/sweep-tree-list.cpp index ea9e9a5d2..020a4e110 100644 --- a/src/livarot/sweep-tree-list.cpp +++ b/src/livarot/sweep-tree-list.cpp @@ -7,7 +7,7 @@ SweepTreeList::SweepTreeList(int s) : nbTree(0), maxTree(s), trees((SweepTree *) g_malloc(s * sizeof(SweepTree))), - racine(NULL) + racine(nullptr) { /* FIXME: Use new[] for trees initializer above, but watch out for bad things happening when * SweepTree::~SweepTree is called. @@ -18,14 +18,14 @@ SweepTreeList::SweepTreeList(int s) : SweepTreeList::~SweepTreeList() { g_free(trees); - trees = NULL; + trees = nullptr; } SweepTree *SweepTreeList::add(Shape *iSrc, int iBord, int iWeight, int iStartPoint, Shape */*iDst*/) { if (nbTree >= maxTree) { - return NULL; + return nullptr; } int const n = nbTree++; diff --git a/src/livarot/sweep-tree.cpp b/src/livarot/sweep-tree.cpp index 1b9868f2e..6aec2a7f6 100644 --- a/src/livarot/sweep-tree.cpp +++ b/src/livarot/sweep-tree.cpp @@ -15,10 +15,10 @@ SweepTree::SweepTree() { - src = NULL; + src = nullptr; bord = -1; startPoint = -1; - evt[LEFT] = evt[RIGHT] = NULL; + evt[LEFT] = evt[RIGHT] = nullptr; sens = true; //invDirLength=1; } @@ -40,7 +40,7 @@ SweepTree::ConvertTo(Shape *iSrc, int iBord, int iWeight, int iStartPoint) { src = iSrc; bord = iBord; - evt[LEFT] = evt[RIGHT] = NULL; + evt[LEFT] = evt[RIGHT] = nullptr; startPoint = iStartPoint; if (src->getEdge(bord).st < src->getEdge(bord).en) { if (iWeight >= 0) @@ -62,9 +62,9 @@ void SweepTree::MakeDelete() { for (int i = 0; i < 2; i++) { if (evt[i]) { - evt[i]->sweep[1 - i] = NULL; + evt[i]->sweep[1 - i] = nullptr; } - evt[i] = NULL; + evt[i] = nullptr; } AVLTree::MakeDelete(); @@ -243,7 +243,7 @@ void SweepTree::RemoveEvent(SweepEventQueue &queue, Side s) { if (evt[s]) { queue.remove(evt[s]); - evt[s] = NULL; + evt[s] = nullptr; } } @@ -259,7 +259,7 @@ SweepTree::Remove(SweepTreeList &list, SweepEventQueue &queue, if (list.nbTree <= 1) { list.nbTree = 0; - list.racine = NULL; + list.racine = nullptr; } else { @@ -274,13 +274,13 @@ int SweepTree::Insert(SweepTreeList &list, SweepEventQueue &queue, Shape *iDst, int iAtPoint, bool rebalance, bool sweepSens) { - if (list.racine == NULL) + if (list.racine == nullptr) { list.racine = this; return avl_no_err; } - SweepTree *insertL = NULL; - SweepTree *insertR = NULL; + SweepTree *insertL = nullptr; + SweepTree *insertR = nullptr; int insertion = list.racine->Find(iDst->getPoint(iAtPoint).x, this, insertL, insertR, sweepSens); @@ -316,7 +316,7 @@ SweepTree::InsertAt(SweepTreeList &list, SweepEventQueue &queue, Shape */*iDst*/, SweepTree *insNode, int fromPt, bool rebalance, bool sweepSens) { - if (list.racine == NULL) + if (list.racine == nullptr) { list.racine = this; return avl_no_err; @@ -343,8 +343,8 @@ SweepTree::InsertAt(SweepTreeList &list, SweepEventQueue &queue, bNorm = -bNorm; } - SweepTree *insertL = NULL; - SweepTree *insertR = NULL; + SweepTree *insertL = nullptr; + SweepTree *insertR = nullptr; double ang = cross(bNorm, nNorm); if (ang == 0) { @@ -438,10 +438,10 @@ SweepTree::InsertAt(SweepTreeList &list, SweepEventQueue &queue, int insertion = found_between; - if (insertL == NULL) { + if (insertL == nullptr) { insertion = found_on_left; } - if (insertR == NULL) { + if (insertR == nullptr) { insertion = found_on_right; } |
