summaryrefslogtreecommitdiff
path: root/src/glu/sgi/libnurbs/nurbtess
diff options
context:
space:
mode:
Diffstat (limited to 'src/glu/sgi/libnurbs/nurbtess')
-rw-r--r--src/glu/sgi/libnurbs/nurbtess/directedLine.cc32
-rw-r--r--src/glu/sgi/libnurbs/nurbtess/monoChain.cc1
-rw-r--r--src/glu/sgi/libnurbs/nurbtess/partitionY.cc4
-rw-r--r--src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc4
-rw-r--r--src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc4
-rw-r--r--src/glu/sgi/libnurbs/nurbtess/sampledLine.cc3
6 files changed, 32 insertions, 16 deletions
diff --git a/src/glu/sgi/libnurbs/nurbtess/directedLine.cc b/src/glu/sgi/libnurbs/nurbtess/directedLine.cc
index 74450352d8..d942db7287 100644
--- a/src/glu/sgi/libnurbs/nurbtess/directedLine.cc
+++ b/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/src/glu/sgi/libnurbs/nurbtess/monoChain.cc b/src/glu/sgi/libnurbs/nurbtess/monoChain.cc
index 814bf32fae..b17b9405c1 100644
--- a/src/glu/sgi/libnurbs/nurbtess/monoChain.cc
+++ b/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
diff --git a/src/glu/sgi/libnurbs/nurbtess/partitionY.cc b/src/glu/sgi/libnurbs/nurbtess/partitionY.cc
index 297c629976..e097461ac5 100644
--- a/src/glu/sgi/libnurbs/nurbtess/partitionY.cc
+++ b/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/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc b/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc
index e12f88bab1..2e70f83936 100644
--- a/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc
+++ b/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/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc b/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc
index b7b929623a..951e937c45 100644
--- a/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc
+++ b/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/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc b/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc
index 6253a7c09d..89f6c6e23f 100644
--- a/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc
+++ b/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!!!