An update will be applied January 25th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit b20946a0 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot
Browse files

Merge topic 'Wconversion'

a16e53d0 Added explicit casts to fix Wconversion warnings
1a191c93 Fixed implicit float/double to bool conversion
418c62c6 Changed many int to vtkIdType
5700d2ee

 Fixed mismatch between ivars and get/set macros
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Utkarsh Ayachit's avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !50
parents 3c419e8d a16e53d0
......@@ -106,8 +106,8 @@ int vtkLookupTable::IsOpaque()
if (this->NanColor[3] < 1.0) { opaque = 0; }
if (this->UseBelowRangeColor && this->BelowRangeColor[3] < 1.0) { opaque = 0; }
if (this->UseAboveRangeColor && this->AboveRangeColor[3] < 1.0) { opaque = 0; }
int size=this->Table->GetNumberOfTuples();
int i=0;
vtkIdType size=this->Table->GetNumberOfTuples();
vtkIdType i=0;
unsigned char *ptr=this->Table->GetPointer(0);
while(opaque && i<size)
{
......@@ -199,12 +199,11 @@ int vtkLookupTable::Allocate(int sz, int ext)
// Force the lookup table to rebuild
void vtkLookupTable::ForceBuild()
{
int i;
double hue, sat, val, hinc, sinc, vinc, ainc;
double rgba[4], alpha;
unsigned char *c_rgba;
int maxIndex = this->NumberOfColors - 1;
vtkIdType maxIndex = this->NumberOfColors - 1;
if( maxIndex )
{
......@@ -218,7 +217,7 @@ void vtkLookupTable::ForceBuild()
hinc = sinc = vinc = ainc = 0.0;
}
for (i = 0; i <= maxIndex; i++)
for (vtkIdType i = 0; i <= maxIndex; i++)
{
hue = this->HueRange[0] + i*hinc;
sat = this->SaturationRange[0] + i*sinc;
......
......@@ -134,7 +134,7 @@ vtkIdType vtkPriorityQueue::Pop(vtkIdType location, double &priority)
}
// percolate down the tree from the specified location
int lastNodeToCheck = (this->MaxId-1)/2;
vtkIdType lastNodeToCheck = (this->MaxId-1)/2;
for ( vtkIdType j=0, i=location; i <= lastNodeToCheck; i=j )
{
idx = 2*i + 1;
......
......@@ -132,7 +132,7 @@ private:
inline double vtkPriorityQueue::DeleteId(vtkIdType id)
{
double priority=VTK_DOUBLE_MAX;
int loc;
vtkIdType loc;
if ( id <= this->ItemLocation->GetMaxId() &&
(loc=this->ItemLocation->GetValue(id)) != -1 )
......@@ -144,7 +144,7 @@ inline double vtkPriorityQueue::DeleteId(vtkIdType id)
inline double vtkPriorityQueue::GetPriority(vtkIdType id)
{
int loc;
vtkIdType loc;
if ( id <= this->ItemLocation->GetMaxId() &&
(loc=this->ItemLocation->GetValue(id)) != -1 )
......
......@@ -145,9 +145,9 @@ private:
//----------------------------------------------------------------------------
inline int vtkCellTypes::IsType(unsigned char type)
{
int numTypes=this->GetNumberOfTypes();
vtkIdType numTypes=this->GetNumberOfTypes();
for (int i=0; i<numTypes; i++)
for (vtkIdType i=0; i<numTypes; i++)
{
if ( type == this->GetCellType(i))
{
......
......@@ -101,8 +101,7 @@ vtkCell *vtkConvexPointSet::GetFace(int faceId)
int vtkConvexPointSet::Triangulate(int vtkNotUsed(index), vtkIdList *ptIds,
vtkPoints *pts)
{
int numPts=this->GetNumberOfPoints();
int i;
vtkIdType numPts=this->GetNumberOfPoints();
double x[3];
vtkIdType ptId;
......@@ -123,7 +122,7 @@ int vtkConvexPointSet::Triangulate(int vtkNotUsed(index), vtkIdList *ptIds,
// according to point id. We insert points with id == the index into the
// vtkConvexPointSet::PointIds and Points; but sort on the global point
// id.
for (i=0; i<numPts; i++)
for (vtkIdType i=0; i<numPts; i++)
{
ptId = this->PointIds->GetId(i);
this->Points->GetPoint(i, x);
......@@ -150,12 +149,11 @@ void vtkConvexPointSet::Contour(double value,
vtkCellData *outCd)
{
// For each tetra, contour it
int i, j;
vtkIdType ptId, localId;
int numTets = this->TetraIds->GetNumberOfIds() / 4;
for (i=0; i<numTets; i++)
vtkIdType numTets = this->TetraIds->GetNumberOfIds() / 4;
for (vtkIdType i=0; i<numTets; i++)
{
for (j=0; j<4; j++)
for (vtkIdType j=0; j<4; j++)
{
localId = this->TetraIds->GetId(4*i+j);
ptId = this->PointIds->GetId(localId);
......
......@@ -577,7 +577,7 @@ int vtkEdgeTable::InitPointInsertion(vtkPoints *newPts, vtkIdType estSize)
int vtkEdgeTable::InsertUniquePoint(vtkIdType p1, vtkIdType p2, double x[3],
vtkIdType &ptId)
{
int loc = this->IsEdge(p1,p2);
vtkIdType loc = this->IsEdge(p1,p2);
if ( loc != -1 )
{
......
......@@ -136,7 +136,7 @@ int vtkUniformGridPartitioner::RequestData(
int subdims[3];
vtkStructuredExtent::GetDimensions( ext, subdims );
int pntIdx = vtkStructuredData::ComputePointId( dims, ijk );
vtkIdType pntIdx = vtkStructuredData::ComputePointId( dims, ijk );
grd->GetPoint( pntIdx, origin );
......
......@@ -34,7 +34,7 @@ vtkContourValues::~vtkContourValues()
// Set the ith contour value.
void vtkContourValues::SetValue(int i, double value)
{
int numContours=this->Contours->GetMaxId()+1;
vtkIdType numContours=this->Contours->GetMaxId()+1;
i = (i < 0 ? 0 : i);
if ( i >= numContours || value != this->Contours->GetValue(i) )
......@@ -64,9 +64,9 @@ double *vtkContourValues::GetValues()
// allocated memory of size GetNumberOfContours().
void vtkContourValues::GetValues(double *contourValues)
{
int i, numContours=this->Contours->GetMaxId()+1;
vtkIdType numContours=this->Contours->GetMaxId()+1;
for ( i=0; i < numContours; i++ )
for ( vtkIdType i=0; i < numContours; i++ )
{
contourValues[i] = this->Contours->GetValue(i);
}
......@@ -77,9 +77,9 @@ void vtkContourValues::GetValues(double *contourValues)
// will automatically increase list size as needed.
void vtkContourValues::SetNumberOfContours(const int number)
{
int currentNumber = this->Contours->GetMaxId()+1;
int n = ( number < 0 ? 0 : number);
int i;
vtkIdType currentNumber = this->Contours->GetMaxId()+1;
vtkIdType n = ( number < 0 ? 0 : number);
vtkIdType i;
double *oldValues = NULL;
if ( n != currentNumber )
......@@ -101,7 +101,7 @@ void vtkContourValues::SetNumberOfContours(const int number)
// Copy them back in since the array may have been re-allocated
if ( currentNumber > 0 )
{
int limit = (currentNumber < n)?(currentNumber):(n);
vtkIdType limit = (currentNumber < n)?(currentNumber):(n);
for ( i = 0; i < limit; i++ )
{
this->Contours->SetValue( i, oldValues[i] );
......@@ -166,10 +166,10 @@ void vtkContourValues::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
int i, numContours=this->Contours->GetMaxId() + 1;
vtkIdType numContours=this->Contours->GetMaxId() + 1;
os << indent << "Contour Values: \n";
for ( i=0; i < numContours; i++)
for ( vtkIdType i=0; i < numContours; i++)
{
os << indent << " Value " << i << ": " << this->Contours->GetValue(i) << "\n";
}
......
......@@ -828,7 +828,7 @@ bool vtkFunctionParser::Evaluate()
int valTrue = stackPosition - 1;
int boolArg = stackPosition;
if (this->Stack[boolArg])
if (this->Stack[boolArg] != 0.0)
this->Stack[result] = this->Stack[valTrue];
else
this->Stack[result] = this->Stack[valFalse];
......@@ -848,7 +848,7 @@ bool vtkFunctionParser::Evaluate()
int zValTrue = stackPosition - 1;
int boolArg = stackPosition;
if (this->Stack[boolArg])
if (this->Stack[boolArg] != 0.0)
{
this->Stack[xResult] = this->Stack[xValTrue];
this->Stack[yResult] = this->Stack[yValTrue];
......
......@@ -159,10 +159,10 @@ void vtkIdentityTransform::TransformPointsNormalsVectors(vtkPoints *inPts,
void vtkIdentityTransform::TransformPoints(vtkPoints *inPts,
vtkPoints *outPts)
{
int n = inPts->GetNumberOfPoints();
vtkIdType n = inPts->GetNumberOfPoints();
double point[3];
for (int i = 0; i < n; i++)
for (vtkIdType i = 0; i < n; i++)
{
inPts->GetPoint(i,point);
outPts->InsertNextPoint(point);
......@@ -173,10 +173,10 @@ void vtkIdentityTransform::TransformPoints(vtkPoints *inPts,
void vtkIdentityTransform::TransformNormals(vtkDataArray *inNms,
vtkDataArray *outNms)
{
int n = inNms->GetNumberOfTuples();
vtkIdType n = inNms->GetNumberOfTuples();
double normal[3];
for (int i = 0; i < n; i++)
for (vtkIdType i = 0; i < n; i++)
{
inNms->GetTuple(i,normal);
outNms->InsertNextTuple(normal);
......@@ -187,10 +187,10 @@ void vtkIdentityTransform::TransformNormals(vtkDataArray *inNms,
void vtkIdentityTransform::TransformVectors(vtkDataArray *inNms,
vtkDataArray *outNms)
{
int n = inNms->GetNumberOfTuples();
vtkIdType n = inNms->GetNumberOfTuples();
double vect[3];
for (int i = 0; i < n; i++)
for (vtkIdType i = 0; i < n; i++)
{
inNms->GetTuple(i,vect);
outNms->InsertNextTuple(vect);
......
......@@ -741,7 +741,7 @@ static double vtkRBFDRr(double r, double &dUdr)
// the standard 2D thin plate spline basis function
static double vtkRBFr2logr(double r)
{
if (r)
if (r != 0.0)
{
return r*r*log(r);
}
......
......@@ -211,7 +211,7 @@ int vtkAppendFilter::RequestData(
vtkSmartPointer<vtkIdList> newPtIds = vtkSmartPointer<vtkIdList>::New();
newPtIds->Allocate(VTK_CELL_SIZE);
int twentieth = (totalNumPts + totalNumCells)/20 + 1;
vtkIdType twentieth = (totalNumPts + totalNumCells)/20 + 1;
// For optionally merging duplicate points
vtkIdType* globalIndices = new vtkIdType[totalNumPts];
......
......@@ -279,7 +279,7 @@ void vtkProbeFilter::ProbeEmptyPoints(vtkDataSet *input,
// Use tolerance as a function of size of source data
//
tol2 = source->GetLength();
tol2 = tol2 ? tol2*tol2 / 1000.0 : 0.001;
tol2 = (tol2 != 0.0) ? tol2*tol2 / 1000.0 : 0.001;
// the actual sampling rate needs to be considered for a
// more appropriate / accurate selection of the tolerance.
......
......@@ -129,8 +129,8 @@ int vtkExtractCells::RequestData(
this->InputIsUgrid =
((vtkUnstructuredGrid::SafeDownCast(input)) != NULL);
int numCellsInput = input->GetNumberOfCells();
int numCells = static_cast<int>(this->CellList->IdTypeSet.size());
vtkIdType numCellsInput = input->GetNumberOfCells();
vtkIdType numCells = this->CellList->IdTypeSet.size();
if (numCells == numCellsInput)
{
......@@ -219,15 +219,13 @@ int vtkExtractCells::RequestData(
//----------------------------------------------------------------------------
void vtkExtractCells::Copy(vtkDataSet *input, vtkUnstructuredGrid *output)
{
int i;
if (this->InputIsUgrid)
{
output->DeepCopy(vtkUnstructuredGrid::SafeDownCast(input));
return;
}
int numCells = input->GetNumberOfCells();
vtkIdType numCells = input->GetNumberOfCells();
vtkPointData *PD = input->GetPointData();
vtkCellData *CD = input->GetCellData();
......@@ -235,7 +233,7 @@ void vtkExtractCells::Copy(vtkDataSet *input, vtkUnstructuredGrid *output)
vtkPointData *newPD = output->GetPointData();
vtkCellData *newCD = output->GetCellData();
int numPoints = input->GetNumberOfPoints();
vtkIdType numPoints = input->GetNumberOfPoints();
output->Allocate(numCells);
......@@ -246,7 +244,7 @@ void vtkExtractCells::Copy(vtkDataSet *input, vtkUnstructuredGrid *output)
vtkPoints *pts = vtkPoints::New();
pts->SetNumberOfPoints(numPoints);
for (i=0; i<numPoints; i++)
for (vtkIdType i=0; i<numPoints; i++)
{
pts->SetPoint(i, input->GetPoint(i));
}
......@@ -280,13 +278,13 @@ vtkIdType vtkExtractCells::findInSortedList(vtkIdList *idList, vtkIdType id)
if (numids < 8) return idList->IsId(id);
int L, R, M;
vtkIdType L, R, M;
L=0;
R=numids-1;
vtkIdType *ids = idList->GetPointer(0);
int loc = -1;
vtkIdType loc = -1;
while (R > L)
{
......@@ -327,7 +325,7 @@ vtkIdType vtkExtractCells::findInSortedList(vtkIdList *idList, vtkIdType id)
//----------------------------------------------------------------------------
vtkIdList *vtkExtractCells::reMapPointIds(vtkDataSet *grid)
{
int totalPoints = grid->GetNumberOfPoints();
vtkIdType totalPoints = grid->GetNumberOfPoints();
char *temp = new char [totalPoints];
......@@ -386,7 +384,7 @@ vtkIdList *vtkExtractCells::reMapPointIds(vtkDataSet *grid)
{
if (*cellPtr > maxid) continue;
int loc = locs[*cellPtr];
vtkIdType loc = locs[*cellPtr];
vtkIdType nIds = cellArray[loc++];
......@@ -406,7 +404,7 @@ vtkIdList *vtkExtractCells::reMapPointIds(vtkDataSet *grid)
}
ptIds->SetNumberOfIds(numberOfIds);
int next=0;
vtkIdType next=0;
for (id=0; id<totalPoints; id++)
{
......@@ -460,7 +458,7 @@ void vtkExtractCells::CopyCellsDataSet(vtkIdList *ptMap, vtkDataSet *input,
cellPoints->SetId(i, newId);
}
int newId = output->InsertNextCell(input->GetCellType(cellId), cellPoints);
vtkIdType newId = output->InsertNextCell(input->GetCellType(cellId), cellPoints);
newCD->CopyData(oldCD, cellId, newId);
if(origMap)
......@@ -530,9 +528,9 @@ void vtkExtractCells::CopyCellsUnstructuredGrid(vtkIdList *ptMap,
{
if (*cellPtr > maxid) continue;
int oldCellId = *cellPtr;
vtkIdType oldCellId = *cellPtr;
int loc = locs[oldCellId];
vtkIdType loc = locs[oldCellId];
int size = static_cast<int>(cells[loc]);
vtkIdType *pts = cells + loc + 1;
unsigned char type = types->GetValue(oldCellId);
......
......@@ -118,7 +118,7 @@ int vtkExtractEdges::RequestData(
// Loop over all cells, extracting non-visited edges.
//
int tenth = numCells/10 + 1;
vtkIdType tenth = numCells/10 + 1;
for (cellNum=0; cellNum < numCells && !abort; cellNum++ )
{
if ( ! (cellNum % tenth) ) //manage progress reports / early abort
......
......@@ -92,7 +92,7 @@ int vtkExtractGeometry::RequestData(
vtkSmartPointer<vtkCellIterator>::Take(input->NewCellIterator());
vtkIdList *pointIdList;
int cellType;
int numCellPts;
vtkIdType numCellPts;
double x[3];
double multiplier;
vtkPoints *newPts;
......
......@@ -1067,10 +1067,10 @@ int vtkExtractSelectedFrustum::ABoxFrustumIsect(double *bounds, vtkCell *cell)
//handle degenerate cells by testing each point, if any in, then in
int vtkExtractSelectedFrustum::IsectDegenerateCell(vtkCell *cell)
{
int npts = cell->GetNumberOfPoints();
vtkIdType npts = cell->GetNumberOfPoints();
vtkPoints *pts = cell->GetPoints();
double x[3];
for (int i = 0; i < npts; i++)
for (vtkIdType i = 0; i < npts; i++)
{
pts->GetPoint(i, x);
if (this->Frustum->EvaluateFunction(x) < 0.0)
......
......@@ -228,7 +228,7 @@ int vtkExtractSelectedThresholds::ExtractCells(
vtkCell *cell = 0;
vtkPoints *newPoints = 0;
vtkIdType i, ptId, newId, numPts, numCells;
int numCellPts;
vtkIdType numCellPts;
double x[3];
vtkPointData *pd=input->GetPointData(), *outPD=output->GetPointData();
......
......@@ -139,7 +139,7 @@ int vtkExtractVectorComponents::RequestData(
vtkDataSet *output = vtkDataSet::SafeDownCast(
outInfo->Get(vtkDataObject::DATA_OBJECT()));
int numVectors = 0, numVectorsc = 0;
vtkIdType numVectors = 0, numVectorsc = 0;
vtkDataArray *vectors, *vectorsc;
vtkDataArray *vx, *vy, *vz;
vtkDataArray *vxc, *vyc, *vzc;
......
......@@ -446,8 +446,8 @@ int vtkBandedPolyDataContourFilter::RequestData(
// Polygons are assumed convex and chopped into filled, convex polygons.
// Triangle strips are treated similarly.
//
int numPolys = input->GetPolys()->GetNumberOfCells();
int numStrips = input->GetStrips()->GetNumberOfCells();
vtkIdType numPolys = input->GetPolys()->GetNumberOfCells();
vtkIdType numStrips = input->GetStrips()->GetNumberOfCells();
if ( numPolys > 0 || numStrips > 0 )
{
// Set up processing. We are going to store an ordered list of
......
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