summaryrefslogtreecommitdiff
path: root/src/glu/sgi
diff options
context:
space:
mode:
Diffstat (limited to 'src/glu/sgi')
-rw-r--r--src/glu/sgi/libnurbs/internals/arcsorter.h1
-rw-r--r--src/glu/sgi/libnurbs/internals/displaylist.h1
-rw-r--r--src/glu/sgi/libnurbs/internals/gridvertex.h2
-rw-r--r--src/glu/sgi/libnurbs/internals/knotvector.cc3
-rw-r--r--src/glu/sgi/libnurbs/internals/reader.h14
-rw-r--r--src/glu/sgi/libnurbs/internals/subdivider.cc6
-rw-r--r--src/glu/sgi/libnurbs/internals/varray.cc8
-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
-rw-r--r--src/glu/sgi/libtess/mesh.c7
-rw-r--r--src/glu/sgi/libutil/mipmap.c10
15 files changed, 72 insertions, 28 deletions
diff --git a/src/glu/sgi/libnurbs/internals/arcsorter.h b/src/glu/sgi/libnurbs/internals/arcsorter.h
index d72dd1e86c..a55df92677 100644
--- a/src/glu/sgi/libnurbs/internals/arcsorter.h
+++ b/src/glu/sgi/libnurbs/internals/arcsorter.h
@@ -37,7 +37,6 @@
#define __gluarcsorter_h_
#include "sorter.h"
-#include "arcsorter.h"
class Arc;
class Subdivider;
diff --git a/src/glu/sgi/libnurbs/internals/displaylist.h b/src/glu/sgi/libnurbs/internals/displaylist.h
index 22cbec3787..d009a42513 100644
--- a/src/glu/sgi/libnurbs/internals/displaylist.h
+++ b/src/glu/sgi/libnurbs/internals/displaylist.h
@@ -59,6 +59,7 @@ Dlnode::Dlnode( PFVS _work, void *_arg, PFVS _cleanup )
work = _work;
arg = _arg;
cleanup = _cleanup;
+ next = 0;
}
class DisplayList {
diff --git a/src/glu/sgi/libnurbs/internals/gridvertex.h b/src/glu/sgi/libnurbs/internals/gridvertex.h
index 36a65c7bdd..2e27436ef8 100644
--- a/src/glu/sgi/libnurbs/internals/gridvertex.h
+++ b/src/glu/sgi/libnurbs/internals/gridvertex.h
@@ -38,7 +38,7 @@
struct GridVertex {
long gparam[2];
- GridVertex( void ) {}
+ GridVertex( void ) { gparam[0] = 0, gparam[1] = 0; }
GridVertex( long u, long v ) { gparam[0] = u, gparam[1] = v; }
void set( long u, long v ) { gparam[0] = u, gparam[1] = v; }
long nextu() { return gparam[0]++; }
diff --git a/src/glu/sgi/libnurbs/internals/knotvector.cc b/src/glu/sgi/libnurbs/internals/knotvector.cc
index 9eb5cbace9..dcbf0067d8 100644
--- a/src/glu/sgi/libnurbs/internals/knotvector.cc
+++ b/src/glu/sgi/libnurbs/internals/knotvector.cc
@@ -61,6 +61,9 @@ void Knotvector::init( long _knotcount, long _stride, long _order, INREAL *_knot
Knotvector::Knotvector( void )
{
+ knotcount = 0;
+ stride = 0;
+ order = 0;
knotlist = 0;
}
diff --git a/src/glu/sgi/libnurbs/internals/reader.h b/src/glu/sgi/libnurbs/internals/reader.h
index 8a8dcebb50..cae6cada46 100644
--- a/src/glu/sgi/libnurbs/internals/reader.h
+++ b/src/glu/sgi/libnurbs/internals/reader.h
@@ -64,7 +64,7 @@ struct O_curve : public PooledObj {
int save; /* 1 if in display list */
long nuid;
O_curve() { next = 0; used = 0; owner = 0;
- curve.o_pwlcurve = 0; }
+ curve.o_pwlcurve = 0; curvetype = ct_none; save = 0; nuid = 0; }
};
struct O_nurbscurve : public PooledObj {
@@ -77,7 +77,7 @@ struct O_nurbscurve : public PooledObj {
int save; /* 1 if in display list */
O_curve * owner; /* owning curve */
O_nurbscurve( long _type )
- { type = _type; owner = 0; next = 0; used = 0; }
+ { bezier_curves = 0; type = _type; tesselation = 0; method = 0; next = 0; used = 0; save = 0; owner = 0; }
};
class O_pwlcurve : public PooledObj {
@@ -95,7 +95,7 @@ struct O_trim : public PooledObj {
O_curve *o_curve; /* closed trim loop */
O_trim * next; /* next loop along trim */
int save; /* 1 if in display list */
- O_trim() { next = 0; o_curve = 0; }
+ O_trim() { next = 0; o_curve = 0; save = 0; }
};
struct O_nurbssurface : public PooledObj {
@@ -106,7 +106,7 @@ struct O_nurbssurface : public PooledObj {
int save; /* 1 if in display list */
int used; /* 1 if prev called in block */
O_nurbssurface( long _type )
- { type = _type; owner = 0; next = 0; used = 0; }
+ { bezier_patches = 0; type = _type; owner = 0; next = 0; save = 0; used = 0; }
};
struct O_surface : public PooledObj {
@@ -114,7 +114,7 @@ struct O_surface : public PooledObj {
O_trim * o_trim; /* list of trim loops */
int save; /* 1 if in display list */
long nuid;
- O_surface() { o_trim = 0; o_nurbssurface = 0; }
+ O_surface() { o_trim = 0; o_nurbssurface = 0; save = 0; nuid = 0; }
};
struct Property : public PooledObj {
@@ -123,9 +123,9 @@ struct Property : public PooledObj {
REAL value;
int save; /* 1 if in display list */
Property( long _type, long _tag, INREAL _value )
- { type = _type; tag = _tag; value = (REAL) _value; }
+ { type = _type; tag = _tag; value = (REAL) _value; save = 0; }
Property( long _tag, INREAL _value )
- { type = 0; tag = _tag; value = (REAL) _value; }
+ { type = 0; tag = _tag; value = (REAL) _value; save = 0; }
};
class NurbsTessellator;
diff --git a/src/glu/sgi/libnurbs/internals/subdivider.cc b/src/glu/sgi/libnurbs/internals/subdivider.cc
index cc0b514706..ccddc270ff 100644
--- a/src/glu/sgi/libnurbs/internals/subdivider.cc
+++ b/src/glu/sgi/libnurbs/internals/subdivider.cc
@@ -531,16 +531,18 @@ Subdivider::nonSamplingSplit(
patchlist.pspec[param].range[1] ) * 0.5;
split( source, left, right, param, mid );
Patchlist subpatchlist( patchlist, param, mid );
- if( left.isnonempty() )
+ if( left.isnonempty() ) {
if( subpatchlist.cullCheck() == CULL_TRIVIAL_REJECT )
freejarcs( left );
else
nonSamplingSplit( left, subpatchlist, subdivisions-1, param );
- if( right.isnonempty() )
+ }
+ if( right.isnonempty() ) {
if( patchlist.cullCheck() == CULL_TRIVIAL_REJECT )
freejarcs( right );
else
nonSamplingSplit( right, patchlist, subdivisions-1, param );
+ }
} else {
// make bbox calls
diff --git a/src/glu/sgi/libnurbs/internals/varray.cc b/src/glu/sgi/libnurbs/internals/varray.cc
index 31cc73a9d0..1cb235443a 100644
--- a/src/glu/sgi/libnurbs/internals/varray.cc
+++ b/src/glu/sgi/libnurbs/internals/varray.cc
@@ -53,8 +53,16 @@ inline long sgn( REAL x )
Varray::Varray( void )
{
+ int i;
+
varray = 0;
size = 0;
+ numquads = 0;
+
+ for (i = 0; i < 1000; i++) {
+ vval[i] = 0;
+ voffset[i] = 0;
+ }
}
Varray::~Varray( void )
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!!!
diff --git a/src/glu/sgi/libtess/mesh.c b/src/glu/sgi/libtess/mesh.c
index ae861f8642..95f87cdc94 100644
--- a/src/glu/sgi/libtess/mesh.c
+++ b/src/glu/sgi/libtess/mesh.c
@@ -284,7 +284,12 @@ GLUhalfEdge *__gl_meshMakeEdge( GLUmesh *mesh )
}
e = MakeEdge( &mesh->eHead );
- if (e == NULL) return NULL;
+ if (e == NULL) {
+ memFree(newVertex1);
+ memFree(newVertex2);
+ memFree(newFace);
+ return NULL;
+ }
MakeVertex( newVertex1, e, &mesh->vHead );
MakeVertex( newVertex2, e->Sym, &mesh->vHead );
diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c
index af647af73c..d1fd5a7d72 100644
--- a/src/glu/sgi/libutil/mipmap.c
+++ b/src/glu/sgi/libutil/mipmap.c
@@ -3526,6 +3526,8 @@ gluScaleImage(GLenum format, GLsizei widthin, GLsizei heightin,
afterImage =
malloc(image_size(widthout, heightout, format, GL_UNSIGNED_SHORT));
if (beforeImage == NULL || afterImage == NULL) {
+ free(beforeImage);
+ free(afterImage);
return GLU_OUT_OF_MEMORY;
}
@@ -3606,6 +3608,7 @@ int gluBuild1DMipmapLevelsCore(GLenum target, GLint internalFormat,
glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels);
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes);
+ free(newImage);
return GLU_OUT_OF_MEMORY;
}
}
@@ -3760,6 +3763,7 @@ static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat,
glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels);
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes);
+ free(newImage);
return GLU_OUT_OF_MEMORY;
}
}
@@ -4104,6 +4108,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat,
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes);
+ free(srcImage);
return GLU_OUT_OF_MEMORY;
}
/* level userLevel+1 is in srcImage; level userLevel already saved */
@@ -4346,6 +4351,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat,
glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes);
+ free(srcImage);
return GLU_OUT_OF_MEMORY;
}
}
@@ -7382,6 +7388,8 @@ int gluScaleImage3D(GLenum format,
afterImage = malloc(imageSize3D(widthOut, heightOut, depthOut, format,
GL_UNSIGNED_SHORT));
if (beforeImage == NULL || afterImage == NULL) {
+ free(beforeImage);
+ free(afterImage);
return GLU_OUT_OF_MEMORY;
}
retrieveStoreModes3D(&psm);
@@ -8093,6 +8101,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat,
glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes);
glPixelStorei(GL_UNPACK_SKIP_IMAGES, psm.unpack_skip_images);
glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, psm.unpack_image_height);
+ free(srcImage);
return GLU_OUT_OF_MEMORY;
}
/* level userLevel+1 is in srcImage; level userLevel already saved */
@@ -8227,6 +8236,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat,
glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes);
glPixelStorei(GL_UNPACK_SKIP_IMAGES, psm.unpack_skip_images);
glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, psm.unpack_image_height);
+ free(srcImage);
return GLU_OUT_OF_MEMORY;
}
}