(patch) tiny C++ non-conformance fix

Mumit Khan khan at xraylith.wisc.edu
Sat Jul 17 16:57:07 EDT 1999


The ISO C++ standard prohibits implicit conversion of integral to 
enumeration type (cf: Sec. 7.2 [dcl.enum]/8), while enum to integral
is permitted, and newer compilers that conform more closely to the 
standard will enforce this. Upcoming gcc-2.95 is one such compiler 
(-fpermissive will allow this usage however). 

I've used static_cast below, which I assume by now all the "popular"
compilers support. If not, it's trivial to let configure figure it
out and either use static_cast or the old sledgehammer explicit
cast as appropriate.

Diff against one of the recent nightly builds.

Sat Jul 17 15:40:34 1999  Mumit Khan  <khan at xraylith.wisc.edu>

	* graphics/vtkOpenGLPolyDataMapper.cxx 
	(vtkOpenGLPolyDataMapper::Render): Fix int->enum conversion.

Index: graphics/vtkOpenGLPolyDataMapper.cxx
===================================================================
RCS file: /cvs/CVSROOT/vtk/graphics/vtkOpenGLPolyDataMapper.cxx,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 vtkOpenGLPolyDataMapper.cxx
--- graphics/vtkOpenGLPolyDataMapper.cxx	1999/07/17 04:26:40	1.1.1.1
+++ graphics/vtkOpenGLPolyDataMapper.cxx	1999/07/17 04:30:01
@@ -209,7 +209,7 @@ void vtkOpenGLPolyDataMapper::Render(vtk
 
   for (i = 0; i < numClipPlanes; i++)
     {
-     glEnable(GL_CLIP_PLANE0+i);
+     glEnable(static_cast<GLenum>(GL_CLIP_PLANE0+i));
     }
 
   for (i = 0; i < numClipPlanes; i++)
@@ -222,7 +222,7 @@ void vtkOpenGLPolyDataMapper::Render(vtk
     planeEquation[3] = -(planeEquation[0]*plane->GetOrigin()[0]+
 			 planeEquation[1]*plane->GetOrigin()[1]+
 			 planeEquation[2]*plane->GetOrigin()[2]);
-    glClipPlane(GL_CLIP_PLANE0+i,planeEquation);
+    glClipPlane(static_cast<GLenum>(GL_CLIP_PLANE0+i),planeEquation);
     }
   //
   // if something has changed regenrate colors and display lists
@@ -290,7 +290,7 @@ void vtkOpenGLPolyDataMapper::Render(vtk
 
   for (i = 0; i < numClipPlanes; i++)
     {
-    glDisable(GL_CLIP_PLANE0+i);
+    glDisable(static_cast<GLenum>(GL_CLIP_PLANE0+i));
     }
 
   timer->Delete();

Regards,
Mumit




-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list