diff options
Diffstat (limited to 'mesalib/src/glu/sgi/libnurbs/nurbtess')
8 files changed, 36 insertions, 17 deletions
diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/directedLine.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/directedLine.cc index 74450352d..d942db728 100644 --- a/mesalib/src/glu/sgi/libnurbs/nurbtess/directedLine.cc +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/directedLine.cc @@ -309,6 +309,8 @@ directedLine::directedLine() nextPolygon = NULL; rootBit = 0;/*important to initilzae to 0 meaning not root yet*/ rootLink = NULL; + direction = INCREASING; + sline = NULL; } directedLine::~directedLine() @@ -791,22 +793,30 @@ directedLine* readAllPolygons(char* filename) { Int i,j; FILE* fp = fopen(filename, "r"); - assert(fp); Int nPolygons; - fscanf(fp, "%i", &nPolygons); + int result; + + assert(fp); + result = fscanf(fp, "%i", &nPolygons); + assert(result != EOF); directedLine *ret = NULL; for(i=0; i<nPolygons; i++) { Int nEdges; - fscanf(fp, "%i", &nEdges); - Real vert[2][2]; + result = fscanf(fp, "%i", &nEdges); + assert(result != EOF); + Real vert[2][2] = { { 0 } }; Real VV[2][2]; /*the first two vertices*/ - fscanf(fp, "%f", &(vert[0][0])); - fscanf(fp, "%f", &(vert[0][1])); - fscanf(fp, "%f", &(vert[1][0])); - fscanf(fp, "%f", &(vert[1][1])); + result = fscanf(fp, "%f", &(vert[0][0])); + assert(result != EOF); + result = fscanf(fp, "%f", &(vert[0][1])); + assert(result != EOF); + result = fscanf(fp, "%f", &(vert[1][0])); + assert(result != EOF); + result = fscanf(fp, "%f", &(vert[1][1])); + assert(result != EOF); VV[1][0] = vert[0][0]; VV[1][1] = vert[0][1]; sampledLine *sLine = new sampledLine(2, vert); @@ -818,8 +828,10 @@ thisPoly->rootLinkSet(NULL); { vert[0][0]=vert[1][0]; vert[0][1]=vert[1][1]; - fscanf(fp, "%f", &(vert[1][0])); - fscanf(fp, "%f", &(vert[1][1])); + result = fscanf(fp, "%f", &(vert[1][0])); + assert(result != EOF); + result = fscanf(fp, "%f", &(vert[1][1])); + assert(result != EOF); sLine = new sampledLine(2,vert); dLine = new directedLine(INCREASING, sLine); dLine->rootLinkSet(thisPoly); diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.cc index 814bf32fa..cb28129ad 100644 --- a/mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.cc +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.cc @@ -127,6 +127,7 @@ monoChain::monoChain(directedLine* cHead, directedLine* cTail) current = chainTail; isKey = 0; + keyY = 0; } //insert a new line between prev and this @@ -263,6 +264,7 @@ monoChain* directedLineLoopToMonoChainLoop(directedLine* loop) prevCusp = temp; } } + assert(ret); ret->insert(new monoChain(prevCusp, firstCusp)); return ret; diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.cc index 297c62997..e097461ac 100644 --- a/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.cc +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.cc @@ -111,8 +111,8 @@ Int isCusp(directedLine *v) else if(A[1] > B[1] && C[1] > B[1]) return 1; - if(isAbove(v, v) && isAbove(v, v->getPrev()) || - isBelow(v, v) && isBelow(v, v->getPrev())) + if((isAbove(v, v) && isAbove(v, v->getPrev())) || + (isBelow(v, v) && isBelow(v, v->getPrev()))) return 1; else return 0; diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.h index 8dda409de..5570c183d 100644 --- a/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.h +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.h @@ -39,7 +39,7 @@ *or both at or below v. In addition, at least one of the ajacent verteces is *strictly below or above v. * A vertex is a relex vertex if the internals angle is strictly greater than - *180. In other words, if the the signed area is negative: + *180. In other words, if the signed area is negative: *(x1, y1), (x2, y2), (x3, y3) are the three vertices along a polygon, the *order is such that left hand side is inside the polygon. Then (x2,y2) is *reflex if: diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc index 26d05342f..dfdbd4e84 100644 --- a/mesalib/src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc @@ -156,6 +156,8 @@ primStream::primStream(Int sizeLengths, Int sizeVertices) index_vertices = 0; size_lengths = sizeLengths; size_vertices = sizeVertices; + + counter = 0; } primStream::~primStream() diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc index e12f88bab..2e70f8393 100644 --- a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc @@ -207,7 +207,7 @@ void sampleBotRightWithGridLine(Real* botVertex, return; } - Int segIndexMono, segIndexPass; + Int segIndexMono = 0, segIndexPass; findBotRightSegment(rightChain, rightEnd, rightCorner, @@ -293,7 +293,7 @@ void sampleBotLeftWithGridLine(Real* botVertex, return; } - Int segIndexPass, segIndexMono; + Int segIndexPass, segIndexMono = 0; findBotLeftSegment(leftChain, leftEnd, leftCorner, grid->get_u_value(leftU), segIndexMono, segIndexPass); sampleBotLeftWithGridLinePost(botVertex, diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc index b7b929623..951e937c4 100644 --- a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc @@ -172,7 +172,7 @@ void sampleTopRightWithGridLine(Real* topVertex, return; } - Int segIndexSmall, segIndexLarge; + Int segIndexSmall = 0, segIndexLarge; findTopRightSegment(rightChain, rightStart, rightEnd, @@ -294,7 +294,7 @@ void sampleTopLeftWithGridLine(Real* topVertex, primStream* pStream ) { - Int segIndexSmall, segIndexLarge; + Int segIndexSmall = 0, segIndexLarge; //if left chain is empty, then there is only one top vertex with one grid // line if(leftEnd < leftStart) { diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc index 6253a7c09..89f6c6e23 100644 --- a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc @@ -107,6 +107,9 @@ sampledLine::sampledLine(Real pt1[2], Real pt2[2]) //needs tp call init to setup sampledLine::sampledLine() { + npoints = 0; + points = NULL; + next = NULL; } //warning: ONLY pointer is copies!!! |