Commit 9baec0e9 authored by Sean McBride's avatar Sean McBride

Fixed various -Wcast-qual warnings

Made some method signatures more const, changed some casts.
parent 1ac83f6e
......@@ -680,8 +680,6 @@ int vtkPointsProjectedHull::RectangleOutside(double hmin, double hmax,
int vtkPointsProjectedHull::RectangleOutside1DPolygon(double hmin, double hmax,
double vmin, double vmax, int dir)
{
int i;
double *p0 = this->CCWHull[dir];
double *p1 = this->CCWHull[dir] + 2;
......@@ -695,7 +693,7 @@ int vtkPointsProjectedHull::RectangleOutside1DPolygon(double hmin, double hmax,
double side;
double reference=0.0;
for (i=0; i<4; i++)
for (int i=0; i<4; i++)
{
side = VTK_ISLEFT(p0, p1,pts[i]);
......@@ -724,10 +722,8 @@ extern "C"
{
int vtkPointsProjectedHullIncrVertAxis(const void *p1, const void *p2)
{
double *a, *b;
a = (double *)p1;
b = (double *)p2;
const double *a = static_cast<const double*>(p1);
const double *b = static_cast<const double*>(p2);
if (a[1] < b[1])
{
......@@ -745,15 +741,12 @@ extern "C"
int vtkPointsProjectedHullCCW(const void *p1, const void *p2)
{
double *a, *b;
double val;
a = (double *)p1;
b = (double *)p2;
const double *a = static_cast<const double*>(p1);
const double *b = static_cast<const double*>(p2);
// sort in counter clockwise order from first point
val = VTK_ISLEFT(firstPt, a, b);
double val = VTK_ISLEFT(firstPt, a, b);
if (val < 0)
{
......
......@@ -106,8 +106,8 @@ public:
extern "C" int __compareMin(const void *pA, const void *B )
{
cell_extents *tA = (cell_extents *) pA;
cell_extents *tB = (cell_extents *) B;
const cell_extents *tA = static_cast<const cell_extents *>(pA);
const cell_extents *tB = static_cast<const cell_extents *>(B);
if ( tA->min == tB->min )
{
return 0;
......@@ -120,8 +120,8 @@ extern "C" int __compareMin(const void *pA, const void *B )
extern "C" int __compareMax(const void *pA, const void *B )
{
cell_extents *tA = (cell_extents *) pA;
cell_extents *tB = (cell_extents *) B;
const cell_extents *tA = static_cast<const cell_extents *>(pA);
const cell_extents *tB = static_cast<const cell_extents *>(B);
if ( tA->max == tB->max )
{
return 0;
......
......@@ -710,7 +710,7 @@ int vtkOBBTree::IntersectWithLine(const double p1[3], const double p2[3],
vtkOBBNode *node = OBBstack[--depth];
// check for intersection with node
if (this->LineIntersectsNode(node, (double *)p1, (double *)p2))
if (this->LineIntersectsNode(node, p1, p2))
{
if (node->Kids == nullptr)
{ // then this is a leaf node...get Cells
......@@ -1735,7 +1735,7 @@ int vtkOBBTree::TriangleIntersectsNode( vtkOBBNode *nodeA,
// pass all the way through the node, but at least some portion of the line
// must lie within the node.
int vtkOBBTree::LineIntersectsNode( vtkOBBNode *pA,
double b0[3], double b1[3] )
const double b0[3], const double b1[3] )
{
double rangeAmin, rangeAmax, rangeBmin, rangeBmax, dotB;
double eps;
......
......@@ -154,7 +154,7 @@ public:
/**
* Returns true if line intersects node.
*/
int LineIntersectsNode( vtkOBBNode *pA, double b0[3], double b1[3] );
int LineIntersectsNode( vtkOBBNode *pA, const double b0[3], const double b1[3] );
/**
* Returns true if triangle (optionally transformed) intersects node.
......
......@@ -152,17 +152,20 @@ int vtkBandedPolyDataContourFilter::ClipEdge(int v1, int v2,
extern "C" {
static int vtkCompareClipValues(const void *val1, const void *val2)
{
if ( *((double*)val1) < *((double*)val2) )
double v1 = *static_cast<const double*>(val1);
double v2 = *static_cast<const double*>(val2);
if ( v1 < v2 )
{
return (-1);
return -1;
}
else if ( *((double*)val1) > *((double*)val2) )
else if ( v1 > v2 )
{
return (1);
return 1;
}
else
{
return (0);
return 0;
}
}
}
......
......@@ -199,7 +199,7 @@ void vtkWebGLDataSet::GenerateBinaryData()
memcpy(&this->binary[0], &pos, sizeof(pos));
this->binarySize = total;
}
vtkWebGLExporter::ComputeMD5((unsigned char*)this->binary, this->binarySize, this->MD5);
vtkWebGLExporter::ComputeMD5((const unsigned char*)this->binary, this->binarySize, this->MD5);
this->hasChanged = true;
}
......
......@@ -277,7 +277,7 @@ void vtkWebGLPolyData::GenerateBinaryData()
if(this->Internal->Parts.size() != 0)
{
std::string localMD5;
vtkWebGLExporter::ComputeMD5((unsigned char*)ss.str().c_str(), static_cast<int>(ss.str().size()), localMD5);
vtkWebGLExporter::ComputeMD5((const unsigned char*)ss.str().c_str(), static_cast<int>(ss.str().size()), localMD5);
this->hasChanged = this->MD5.compare(localMD5) != 0;
this->MD5 = localMD5;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment