Standard_Boolean aResult (isFullIn);
 
   if ((myType & Type_Triangulation) && myIsDrawPolygons == Standard_False) {
-    unsigned int iNode = 0;
-    for (; iNode < myNNodes * myNodeCoord; iNode += myNodeCoord)
+    unsigned int nbSteps = (unsigned)myNNodes * myNodeCoord;
+    for (unsigned int iNode = 0; iNode < nbSteps; iNode += myNodeCoord)
     {
-      gp_XYZ aPnt (static_cast<Standard_Real>(mypNodes[iNode+0]),
-                   static_cast<Standard_Real>(mypNodes[iNode+1]), 0.);
+      gp_XYZ aPnt (mypNodes[iNode+0], mypNodes[iNode+1], 0.);
       if (myNodeCoord > 2)
-        aPnt.SetZ (static_cast<Standard_Real>(mypNodes[iNode+2]));
+        aPnt.SetZ (mypNodes[iNode+2]);
       theTrf.Transforms (aPnt);
       if (theBox.IsOut (aPnt)) {
         if (isFullIn) {
   Standard_Boolean aResult (isFullIn);
 
   if ((myType & Type_Triangulation) && myIsDrawPolygons == Standard_False) {
-    unsigned int iNode = 0;
-    for (; iNode < myNNodes * myNodeCoord; iNode += myNodeCoord)
+    unsigned int nbSteps = (unsigned)myNNodes * myNodeCoord;
+    for (unsigned int iNode = 0; iNode < nbSteps; iNode += myNodeCoord)
     {
-      gp_XYZ aPnt (static_cast<Standard_Real>(mypNodes[iNode+0]),
-                   static_cast<Standard_Real>(mypNodes[iNode+1]), 0.);
+      gp_XYZ aPnt (mypNodes[iNode+0], mypNodes[iNode+1], 0.);
       if (myNodeCoord > 2)
-        aPnt.SetZ (static_cast<Standard_Real>(mypNodes[iNode+2]));
+        aPnt.SetZ (mypNodes[iNode+2]);
       theTrf.Transforms (aPnt);
 
       gp_XY aP2d(aPnt.X(), aPnt.Y());
 
 //10-05-96 : CAL ; Ajout d'un nouveau delta dans les copies de pixels (voir CALL_DEF_DELTA)
 #define CALL_DEF_DELTA 10
 
-// ---------------------------------------------------------------
-// Function: getNearestPowOfTwo
-// Purpose:  get the nearest power of two for theNumber
-// ---------------------------------------------------------------
-static GLsizei getNearestPowOfTwo (const GLsizei theNumber)
-{
-  GLsizei aLast = 1;
-  for (GLsizei p2 = 1; p2 <= theNumber; aLast = p2, p2 <<= 1);
-  return aLast;
-}
-
-// ---------------------------------------------------------------
-// Function: fitDimensionsRatio
-// Purpose:  calculate correct width/height ratio for theWidth and
-//           theHeight parameters
-// ---------------------------------------------------------------
-static void fitDimensionsRatio (Standard_Integer& theWidth,
-                                Standard_Integer& theHeight,
-                                const Standard_Real theViewRatio)
-{
-  // set dimensions in accordance with the viewratio
-  if (theHeight <  theWidth/theViewRatio)
-      theWidth  = (Standard_Integer)(theHeight*theViewRatio);
+#ifdef _WIN32
 
-  if (theWidth  <  theHeight*theViewRatio)
-      theHeight = (Standard_Integer)(theWidth/theViewRatio);
-}
+#ifndef HAVE_FREEIMAGE
 
 // ---------------------------------------------------------------
 // Function: initBitmapBuffer
 // Purpose:  init device independent bitmap to hold printing data
 // ---------------------------------------------------------------
-#ifdef _WIN32
-#ifndef HAVE_FREEIMAGE
 static void initBitmapBuffer (const HDC theMemoryDC,
                               HBITMAP &theMemoryBmp,
                               const   Standard_Integer theBmpWidth,
   theMemoryBmp = CreateDIBSection (theMemoryDC, &aBitmapData, DIB_RGB_COLORS,
                                    &theBufferPtr, NULL, 0);
 }
-#else
+
+#else /* HAVE_FREEIMAGE */
+
 // ---------------------------------------------------------------
 // Function: imagePasteDC
 // Purpose:  copy the data from image buffer to the device context
 
   return true;
 }
-#endif
+
+#endif /* HAVE_FREEIMAGE */
+
+// ---------------------------------------------------------------
+// Function: getNearestPowOfTwo
+// Purpose:  get the nearest power of two for theNumber
+// ---------------------------------------------------------------
+static GLsizei getNearestPowOfTwo (const GLsizei theNumber)
+{
+  GLsizei aLast = 1;
+  for (GLsizei p2 = 1; p2 <= theNumber; aLast = p2, p2 <<= 1);
+  return aLast;
+}
 
 // ---------------------------------------------------------------
 // Function: getMaxFrameSize
   theHeight = (Standard_Integer)aMaxY;
 }
 
+// ---------------------------------------------------------------
+// Function: fitDimensionsRatio
+// Purpose:  calculate correct width/height ratio for theWidth and
+//           theHeight parameters
+// ---------------------------------------------------------------
+static void fitDimensionsRatio (Standard_Integer& theWidth,
+                                Standard_Integer& theHeight,
+                                const Standard_Real theViewRatio)
+{
+  // set dimensions in accordance with the viewratio
+  if (theHeight <  theWidth/theViewRatio)
+      theWidth  = (Standard_Integer)(theHeight*theViewRatio);
+
+  if (theWidth  <  theHeight*theViewRatio)
+      theHeight = (Standard_Integer)(theWidth/theViewRatio);
+}
+
 // ---------------------------------------------------------------
 // Function: initBufferStretch
 // Purpose:  calculate initialization sizes for frame buffer
   if (theFrameHeight > theViewHeight)
       theFrameHeight = theViewHeight;
 }
-#endif
+
+#endif /* _WIN32 */
 
 // ---------------------------------------------------------------
 // ---------------------------------------------------------------
 
 #include <stdio.h>
 #include <gp_Vec.hxx>
 
-
 // constants
-static const int HEADER_SIZE           =  84;
-static const int SIZEOF_STL_FACET      =  50;
-static const int STL_MIN_FILE_SIZE     = 284;
-static const int ASCII_LINES_PER_FACET =   7;
-static const int IND_THRESHOLD         = 1000; // increment the indicator every 1k triangles
+static const size_t HEADER_SIZE           =  84;
+static const size_t SIZEOF_STL_FACET      =  50;
+static const size_t STL_MIN_FILE_SIZE     = 284;
+static const size_t ASCII_LINES_PER_FACET =   7;
+
+static const int IND_THRESHOLD = 1000; // increment the indicator every 1k triangles
 
 //=======================================================================
 //function : WriteInteger