From 9c8cbe6950096c4ec2fd1963edbc6c993c86947f Mon Sep 17 00:00:00 2001 From: Karl Schultz Date: Thu, 29 Nov 2001 16:16:55 +0000 Subject: Fix compilation errors and warnings for NURBS support. (Robert Bergkvist) --- src/glu/sgi/libnurbs/interface/bezierEval.cc | 12 ++++++------ src/glu/sgi/libnurbs/internals/mapdesc.cc | 22 +++++++++++----------- src/glu/sgi/libnurbs/internals/mesher.cc | 6 +++--- src/glu/sgi/libnurbs/internals/sorter.cc | 6 +++--- src/glu/sgi/libnurbs/nurbtess/directedLine.cc | 6 +++--- src/glu/sgi/libnurbs/nurbtess/partitionY.cc | 8 ++++---- src/glu/sgi/libnurbs/nurbtess/polyDBG.cc | 6 +++--- src/glu/sgi/libnurbs/nurbtess/polyUtil.h | 12 ++++++++---- src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc | 8 ++++---- src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc | 22 +++++++++++----------- src/glu/sgi/libnurbs/nurbtess/sampledLine.cc | 5 ++--- 11 files changed, 58 insertions(+), 55 deletions(-) (limited to 'src/glu/sgi/libnurbs') diff --git a/src/glu/sgi/libnurbs/interface/bezierEval.cc b/src/glu/sgi/libnurbs/interface/bezierEval.cc index 3f086c0c32..a1bbbf52a7 100644 --- a/src/glu/sgi/libnurbs/interface/bezierEval.cc +++ b/src/glu/sgi/libnurbs/interface/bezierEval.cc @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $ +** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/bezierEval.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/bezierEval.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ */ #include @@ -72,8 +72,8 @@ void bezierCurveEval(float u0, float u1, int order, float *ctlpoints, int stride { float uprime = (u-u0)/(u1-u0); float *ctlptr = ctlpoints; - float oneMinusX = 1.0-uprime; - float XPower = 1.0; + float oneMinusX = 1.0f-uprime; + float XPower = 1.0f; int i,k; for(k=0; k @@ -372,13 +372,13 @@ Mapdesc::xformAndCullCheck( unsigned int bits = clipbits( cpts ); outbits |= bits; inbits &= bits; - if( ( outbits == mask ) && ( inbits != mask ) ) return CULL_ACCEPT; + if( ( outbits == (unsigned int)mask ) && ( inbits != (unsigned int)mask ) ) return CULL_ACCEPT; } } - if( outbits != mask ) { + if( outbits != (unsigned int)mask ) { return CULL_TRIVIAL_REJECT; - } else if( inbits == mask ) { + } else if( inbits == (unsigned int)mask ) { return CULL_TRIVIAL_ACCEPT; } else { return CULL_ACCEPT; @@ -404,13 +404,13 @@ Mapdesc::cullCheck( REAL *pts, int uorder, int ustride, int vorder, int vstride unsigned int bits = clipbits( q ); outbits |= bits; inbits &= bits; - if( ( outbits == mask ) && ( inbits != mask ) ) return CULL_ACCEPT; + if( ( outbits == (unsigned int)mask ) && ( inbits != (unsigned int)mask ) ) return CULL_ACCEPT; } } - if( outbits != mask ) { + if( outbits != (unsigned int)mask ) { return CULL_TRIVIAL_REJECT; - } else if( inbits == mask ) { + } else if( inbits == (unsigned int)mask ) { return CULL_TRIVIAL_ACCEPT; } else { return CULL_ACCEPT; @@ -434,12 +434,12 @@ Mapdesc::cullCheck( REAL *pts, int order, int stride ) unsigned int bits = clipbits( p ); outbits |= bits; inbits &= bits; - if( ( outbits == mask ) && ( inbits != mask ) ) return CULL_ACCEPT; + if( ( outbits == (unsigned int)mask ) && ( inbits != (unsigned int)mask ) ) return CULL_ACCEPT; } - if( outbits != mask ) { + if( outbits != (unsigned int)mask ) { return CULL_TRIVIAL_REJECT; - } else if( inbits == mask ) { + } else if( inbits == (unsigned int)mask ) { return CULL_TRIVIAL_ACCEPT; } else { return CULL_ACCEPT; diff --git a/src/glu/sgi/libnurbs/internals/mesher.cc b/src/glu/sgi/libnurbs/internals/mesher.cc index 17322a79b2..1178eeb516 100644 --- a/src/glu/sgi/libnurbs/internals/mesher.cc +++ b/src/glu/sgi/libnurbs/internals/mesher.cc @@ -35,8 +35,8 @@ /* * mesher.c++ * - * $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mesher.cc,v 1.2 2001/08/07 17:34:11 brianp Exp $ + * $Date: 2001/11/29 16:16:55 $ $Revision: 1.3 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mesher.cc,v 1.3 2001/11/29 16:16:55 kschultz Exp $ */ #include "glimports.h" @@ -82,7 +82,7 @@ Mesher::init( unsigned int npts ) inline void Mesher::push( GridTrimVertex *gt ) { - assert( itop+1 != stacksize ); + assert( itop+1 != (int)stacksize ); vdata[++itop] = gt; } diff --git a/src/glu/sgi/libnurbs/internals/sorter.cc b/src/glu/sgi/libnurbs/internals/sorter.cc index 308f8e8ccc..876b34bf7d 100644 --- a/src/glu/sgi/libnurbs/internals/sorter.cc +++ b/src/glu/sgi/libnurbs/internals/sorter.cc @@ -35,8 +35,8 @@ /* * sorter.c++ * - * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/sorter.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ + * $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/sorter.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ */ #include "glimports.h" @@ -84,7 +84,7 @@ Sorter::qs1( char *a, char *l ) unsigned int n; start: - if((n=l-a) <= es) + if((n=l-a) <= (unsigned int)es) return; n = es * (n / (2*es)); hp = lp = a+n; diff --git a/src/glu/sgi/libnurbs/nurbtess/directedLine.cc b/src/glu/sgi/libnurbs/nurbtess/directedLine.cc index af8d095d4b..81e0104915 100644 --- a/src/glu/sgi/libnurbs/nurbtess/directedLine.cc +++ b/src/glu/sgi/libnurbs/nurbtess/directedLine.cc @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ +** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/directedLine.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/directedLine.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ */ #include @@ -596,7 +596,7 @@ Real directedLine::polyArea() y2 = temp->next->head()[1]; ret += -( x2*y1-x1*y2); } - return 0.5*ret; + return Real(0.5)*ret; } /*******************split or combine polygons begin********************/ diff --git a/src/glu/sgi/libnurbs/nurbtess/partitionY.cc b/src/glu/sgi/libnurbs/nurbtess/partitionY.cc index d7e6bcb5d4..216ac07e06 100644 --- a/src/glu/sgi/libnurbs/nurbtess/partitionY.cc +++ b/src/glu/sgi/libnurbs/nurbtess/partitionY.cc @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ +** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/partitionY.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/partitionY.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ */ #include @@ -231,7 +231,7 @@ Int sweepRangeEqual(sweepRange* src1, sweepRange* src2) */ inline/*static*/ Real intersectHoriz(Real x1, Real y1, Real x2, Real y2, Real y) { - return ((y2==y1)? (x1+x2)*0.5 : x1 + ((y-y1)/(y2-y1)) * (x2-x1)); + return ((y2==y1)? (x1+x2)*Real(0.5) : x1 + ((y-y1)/(y2-y1)) * (x2-x1)); /* if(y2 == y1) return (x1+x2)*0.5; else return x1 + ((y-y1)/(y2-y1)) * (x2-x1); @@ -309,7 +309,7 @@ static Int compEdges(directedLine *e1, directedLine *e2) Real Ymax = min(e1_Ymax, e2_Ymax); Real Ymin = max(e1_Ymin, e2_Ymin); - Real y = 0.5*(Ymax + Ymin); + Real y = Real(0.5)*(Ymax + Ymin); /* Real x1 = intersectHoriz(e1->head()[0], e1->head()[1], e1->tail()[0], e1->tail()[1], y); Real x2 = intersectHoriz(e2->head()[0], e2->head()[1], e2->tail()[0], e2->tail()[1], y); diff --git a/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc b/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc index bdf16ef96e..e4a65c2eb3 100644 --- a/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc +++ b/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ +** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ */ #include @@ -395,7 +395,7 @@ poly->printList(); */ /*for debug purpose*/ assert( (DBG_rayIntersectPoly(v,1,0,poly) % 2 ) - == (DBG_rayIntersectPoly(v,1,0.1234, poly) % 2 ) + == (DBG_rayIntersectPoly(v,1,Real(0.1234), poly) % 2 ) ); if(DBG_rayIntersectPoly(v, 1, 0, poly) % 2 == 1) return 1; diff --git a/src/glu/sgi/libnurbs/nurbtess/polyUtil.h b/src/glu/sgi/libnurbs/nurbtess/polyUtil.h index a18a83799f..19c76d37d3 100644 --- a/src/glu/sgi/libnurbs/nurbtess/polyUtil.h +++ b/src/glu/sgi/libnurbs/nurbtess/polyUtil.h @@ -31,20 +31,24 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ +** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyUtil.h,v 1.1 2001/03/17 00:25:41 brianp Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyUtil.h,v 1.2 2001/11/29 16:16:55 kschultz Exp $ */ #ifndef _POLYUTIL_H #define _POLYUTIL_H #include "definitions.h" - +#ifdef __cplusplus +extern "C" { +#endif Real area(Real A[2], Real B[2], Real C[2]); Int pointLeftLine(Real A[2], Real B[2], Real P[2]); Int pointLeft2Lines(Real A[2], Real B[2], Real C[2], Real P[2]); - +#ifdef __cplusplus +} +#endif #endif diff --git a/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc b/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc index c3c6ee9def..b66647aa99 100644 --- a/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc +++ b/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ +** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ */ #include @@ -327,7 +327,7 @@ Int findBotSeparator(vertexArray* leftChain, { oldLeftI = leftCorner-1; oldRightI = rightCorner; - leftMax = leftChain->getVertex(leftCorner)[0] - 1.0 ; //initilize to be left of leftCorner + leftMax = leftChain->getVertex(leftCorner)[0] - Real(1.0) ; //initilize to be left of leftCorner rightMin = rightChain->getVertex(rightCorner)[0]; } else //rightlower @@ -335,7 +335,7 @@ Int findBotSeparator(vertexArray* leftChain, oldLeftI = leftCorner; oldRightI = rightCorner-1; leftMax = leftChain->getVertex(leftCorner)[0]; - rightMin = rightChain->getVertex(rightCorner)[0] + 1.0; + rightMin = rightChain->getVertex(rightCorner)[0] + Real(1.0); } //i: the current working leftChain Index diff --git a/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc b/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc index 76a36e06e2..0d012d47ce 100644 --- a/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc +++ b/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ +** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ */ #include @@ -343,7 +343,7 @@ Int findTopSeparator(vertexArray* leftChain, { oldLeftI = leftEndIndex+1; oldRightI = rightEndIndex; - leftMax = leftChain->getVertex(leftEndIndex)[0] - 1.0; //initilza to left of leftU + leftMax = leftChain->getVertex(leftEndIndex)[0] - Real(1.0); //initilza to left of leftU rightMin = rightChain->getVertex(rightEndIndex)[0]; } else @@ -351,7 +351,7 @@ Int findTopSeparator(vertexArray* leftChain, oldLeftI = leftEndIndex; oldRightI = rightEndIndex+1; leftMax = leftChain->getVertex(leftEndIndex)[0]; - rightMin = rightChain->getVertex(rightEndIndex)[0] + 1.0; + rightMin = rightChain->getVertex(rightEndIndex)[0] + Real(1.0); } //i: the current working leftChain index, @@ -826,19 +826,19 @@ static void sampleCompTopSimpleOpt(gridWrap* grid, //find l in [j, k-1] so that dec_chain[l][0] 0 is closest to // inc_chain[i] int l; - Real tempI = j; - Real tempMin = fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(j)[0]); + Real tempI = Real(j); + Real tempMin = (Real)fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(j)[0]); for(l=j+1; l<= k-1; l++) { if(fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(l)[0]) <= tempMin) { - tempMin = fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(l)[0]); - tempI = l; + tempMin = (Real)fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(l)[0]); + tempI = (Real)l; } } //inc_chain[i] and dec_chain[tempI] are connected. - monoTriangulationRecGenOpt(dec_chain->getVertex(tempI), + monoTriangulationRecGenOpt(dec_chain->getVertex((int)tempI), botVertex, inc_chain, i, inc_end, dec_chain, (int)(tempI+1), dec_end, @@ -866,12 +866,12 @@ static void sampleCompTopSimpleOpt(gridWrap* grid, //inc_chain[l][0] is the closet to dec_chain[j][0] int tempI = i; int l; - Real tempMin = fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(j)[0]); + Real tempMin = (Real)fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(j)[0]); for(l=i+1; l<=k-1; l++) { if(fabs(inc_chain->getVertex(l)[0] - dec_chain->getVertex(j)[0]) <= tempMin) { - tempMin = fabs(inc_chain->getVertex(l)[0] - dec_chain->getVertex(j)[0]); + tempMin = (Real)fabs(inc_chain->getVertex(l)[0] - dec_chain->getVertex(j)[0]); tempI = l; } } diff --git a/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc b/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc index 66e1a7f77c..15332eb41c 100644 --- a/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc +++ b/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ +** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ */ #include @@ -96,7 +96,6 @@ sampledLine::sampledLine(Int n_points, Real2 pts[]) sampledLine::sampledLine(Real pt1[2], Real pt2[2]) { - int i; npoints = 2; points = (Real2*) malloc(sizeof(Real2) * 2); assert(points); -- cgit v1.2.3