Commit 8c6cf284 authored by Sean McBride's avatar Sean McBride

Auto applied clang-tidy readability-container-size-empty fixes

parent 2d148a8f
......@@ -239,7 +239,7 @@ int vtkDataArraySelection::GetArraySetting(int index)
void vtkDataArraySelection::RemoveAllArrays()
{
vtkDebugMacro("Removing all arrays.");
if (this->Internal->Arrays.size())
if (!this->Internal->Arrays.empty())
{
this->Internal->Arrays.clear();
this->Modified();
......
......@@ -1778,7 +1778,7 @@ int CreateContours(EdgeFaceSetMap& edgeFaceMap,
vtkNew<vtkIdList> poly;
EdgeSet visited;
while (availableContourEdges.size() > 0)
while (!availableContourEdges.empty())
{
Edge start = *availableContourEdges.begin();
Edge at(start);
......@@ -1889,7 +1889,7 @@ void vtkPolyhedron::Contour(double value,
offset += lines->GetNumberOfCells();
}
if (contourPointEdgeMultiMap.size() == 0)
if (contourPointEdgeMultiMap.empty())
{
return; // no contours made
}
......@@ -1952,7 +1952,7 @@ bool FindNext(vector<Edge>& unordered, const Edge& last, vector<Edge>::iterator&
bool OrderEdgePolygon(vector<Edge>& unordered, vector<vector<Edge>>& ordered)
{
if (unordered.size() == 0)
if (unordered.empty())
{
return true;
}
......@@ -1969,13 +1969,13 @@ bool OrderEdgePolygon(vector<Edge>& unordered, vector<vector<Edge>>& ordered)
edgePolygon.push_back(last);
unordered.erase(unordered.begin());
while (unordered.size() > 0)
while (!unordered.empty())
{
vector<Edge>::iterator next;
Edge nextEdge;
if (!FindNext(unordered, last, next, nextEdge))
{
if (unordered.size() > 0)
if (!unordered.empty())
{
last = *unordered.begin();
}
......@@ -2133,7 +2133,7 @@ void MergeTriFacePolygons(vtkPolyhedron* cell,
facePolygons.push_back(at->second);
}
if (facePolygons.size() > 0)
if (!facePolygons.empty())
{
vector<vector<vtkIdType>> mergedPolygons;
MergeTriFacePolygons(facePolygons, mergedPolygons, originalEdges, contourPointEdgeMultiMap);
......@@ -2215,7 +2215,7 @@ void vtkPolyhedron::Clip(double value,
return;
}
if (contourPointEdgeMultiMap.size() == 0)
if (contourPointEdgeMultiMap.empty())
{
return;
}
......@@ -2264,7 +2264,7 @@ void vtkPolyhedron::Clip(double value,
}
// if a polygon was identified (if all face points are all + or all -, there is no polygon)
if (polygon.size() > 0)
if (!polygon.empty())
{
triFacePolygonMap.insert(make_pair(i, polygon));
}
......@@ -2286,7 +2286,7 @@ void vtkPolyhedron::Clip(double value,
{
polygon.push_back(poly->GetId(i));
}
if (polygon.size() > 0)
if (!polygon.empty())
pPolygons->push_back(polygon);
};
......@@ -2295,7 +2295,7 @@ void vtkPolyhedron::Clip(double value,
// this next bit finds closed polyhedra by looking at disjoint sets of point ids
// that hold the polyhedra. Note that if two closed polyhedra share one point
// that they are identified as one closed polyhedron with two closed parts.
while (polygons.size() > 0)
while (!polygons.empty())
{
// the set of point ids that form a closed polyhedron
unordered_set<vtkIdType> polyhedralIdSet;
......
......@@ -1736,7 +1736,7 @@ int vtkPlaneCutter::RequestData(vtkInformation* vtkNotUsed(request),
vtkSphereTree* tree = nullptr;
if (this->BuildTree)
{
if (this->SphereTrees.size() < 1)
if (this->SphereTrees.empty())
{
this->SphereTrees.push_back(vtkSmartPointer<vtkSphereTree>::New());
}
......
......@@ -281,7 +281,7 @@ public:
stream << " block=" << key.CompositeID;
}
}
else if (stream.str().size() == 0)
else if (stream.str().empty())
{
assert(this->Self->GetReportStatisticsOnly());
stream << "stats";
......
......@@ -385,7 +385,7 @@ bool vtkEvenlySpacedStreamlines2D::IsLooping(
// do we have enough points to form a loop
vtkIdType p0 = points->GetNumberOfPoints() - 1;
vtkIdType minLoopPoints = std::max(vtkIdType(3), this->MinimumNumberOfLoopPoints);
if (this->CurrentPoints[cellId].size() > 0 &&
if (!this->CurrentPoints[cellId].empty() &&
p0 - this->MinPointIds[cellId] + 1 >= minLoopPoints)
{
vtkIdType p1 = p0 - 1;
......
......@@ -232,7 +232,7 @@ int vtkOBJReader::RequestData(
} // (end of first while loop)
// If no material texture coordinates are found, add default TCoords
if (tcoords_map.size() == 0)
if (tcoords_map.empty())
{
vtkFloatArray *tcoords = vtkFloatArray::New();
tcoords->SetNumberOfComponents(2);
......
......@@ -251,7 +251,7 @@ std::string vtkOBJPolyDataProcessor::GetTextureFilename( int idx )
{
vtkOBJImportedMaterial* mtl = this->GetMaterial(idx);
if (mtl && mtl->texture_filename.size())
if (mtl && !mtl->texture_filename.empty())
{
std::vector<std::string> path_and_filename(2);
path_and_filename[0] = this->TexturePath;
......
......@@ -776,7 +776,7 @@ int vtkMINCImageWriter::CreateMINCVariables(
{
if (strcmp(varname, *tryname) == 0)
{
if (rootChildren != MI_EMPTY_STRING)
if (!rootChildren.empty())
{
rootChildren.append(MI_CHILD_SEPARATOR);
}
......
......@@ -311,7 +311,7 @@ void vtkProperty::RemoveTexture(const char* name)
//----------------------------------------------------------------------------
void vtkProperty::RemoveAllTextures()
{
while (this->Textures.size())
while (!this->Textures.empty())
{
auto iter = this->Textures.begin();
iter->second->UnRegister(this);
......
......@@ -896,7 +896,7 @@ void vtkOpenGLPolyDataMapper::ReplaceShaderTCoord(
}
std::vector<texinfo> textures = this->GetTextures(actor);
if (textures.size() == 0)
if (textures.empty())
{
return;
}
......@@ -935,7 +935,7 @@ void vtkOpenGLPolyDataMapper::ReplaceShaderTCoord(
}
// if no texture coordinates then we are done
if (tcoordnames.size() == 0)
if (tcoordnames.empty())
{
shaders[vtkShader::Vertex]->SetSource(VSSource);
shaders[vtkShader::Geometry]->SetSource(GSSource);
......
......@@ -71,7 +71,7 @@ bool vtkOpenGLProperty::RenderTextures(vtkActor*, vtkRenderer* ren)
vtkOpenGLCheckErrorMacro("failed after Render");
return (textures.size() > 0);
return (!textures.empty());
}
//-----------------------------------------------------------------------------
......
......@@ -184,7 +184,7 @@ void vtkTransformFeedback::BindBuffer(bool allocateOneBuffer)
//------------------------------------------------------------------------------
void vtkTransformFeedback::ReadBuffer(int index)
{
if (this->Buffers.size() == 0)
if (this->Buffers.empty())
{
vtkErrorMacro("Buffers not set by BindBuffer().");
return;
......@@ -226,7 +226,7 @@ int vtkTransformFeedback::GetBufferHandle(int index)
//------------------------------------------------------------------------------
void vtkTransformFeedback::ReleaseGraphicsResources()
{
if (this->Buffers.size() > 0)
if (!this->Buffers.empty())
{
for (auto v : this->Buffers)
{
......
......@@ -400,7 +400,7 @@ const char* vtkWebApplication::GetWebGLBinaryData(
return nullptr;
}
if(this->Internals->WebGLExporterObjIdMap[webglExporter].size() > 0 &&
if(!this->Internals->WebGLExporterObjIdMap[webglExporter].empty() &&
this->Internals->WebGLExporterObjIdMap[webglExporter].find(id) !=
this->Internals->WebGLExporterObjIdMap[webglExporter].end())
{
......
......@@ -96,7 +96,7 @@ vtkWebGLExporter::vtkWebGLExporter()
vtkWebGLExporter::~vtkWebGLExporter()
{
while(this->Internal->Objects.size() != 0)
while(!this->Internal->Objects.empty())
{
vtkWebGLObject* obj = this->Internal->Objects.back();
obj->Delete();
......@@ -417,7 +417,7 @@ void vtkWebGLExporter::parseScene(vtkRendererCollection* renderers, const char*
}
else
{
while(this->Internal->Objects.size() != 0)
while(!this->Internal->Objects.empty())
{
this->Internal->tempObj.push_back(this->Internal->Objects.back());
this->Internal->Objects.pop_back();
......@@ -432,7 +432,7 @@ void vtkWebGLExporter::parseScene(vtkRendererCollection* renderers, const char*
vtkRenderer* renderer = vtkRenderer::SafeDownCast(renderers->GetItemAsObject(i));
if (renderer->GetDraw()) this->parseRenderer(renderer, viewId, onlyWidget, nullptr);
}
while(this->Internal->tempObj.size() != 0)
while(!this->Internal->tempObj.empty())
{
vtkWebGLObject* obj = this->Internal->tempObj.back();
this->Internal->tempObj.pop_back();
......
......@@ -61,7 +61,7 @@ vtkWebGLPolyData::vtkWebGLPolyData()
vtkWebGLPolyData::~vtkWebGLPolyData()
{
vtkWebGLDataSet* obj;
while(this->Internal->Parts.size() != 0)
while(!this->Internal->Parts.empty())
{
obj = this->Internal->Parts.back();
this->Internal->Parts.pop_back();
......@@ -75,7 +75,7 @@ void vtkWebGLPolyData::SetMesh(float* _vertices, int _numberOfVertices, int* _in
this->webGlType = wTRIANGLES;
vtkWebGLDataSet* obj;
while(this->Internal->Parts.size() != 0)
while(!this->Internal->Parts.empty())
{
obj = this->Internal->Parts.back();
this->Internal->Parts.pop_back();
......@@ -179,7 +179,7 @@ void vtkWebGLPolyData::SetLine(float *_points, int _numberOfPoints, int *_index,
this->webGlType = wLINES;
vtkWebGLDataSet* obj;
while(this->Internal->Parts.size() != 0)
while(!this->Internal->Parts.empty())
{
obj = this->Internal->Parts.back();
this->Internal->Parts.pop_back();
......@@ -274,7 +274,7 @@ void vtkWebGLPolyData::GenerateBinaryData()
obj->GenerateBinaryData();
ss << obj->GetMD5();
}
if(this->Internal->Parts.size() != 0)
if(!this->Internal->Parts.empty())
{
std::string localMD5;
vtkWebGLExporter::ComputeMD5((const unsigned char*)ss.str().c_str(), static_cast<int>(ss.str().size()), localMD5);
......@@ -434,7 +434,7 @@ void vtkWebGLPolyData::SetPoints(float *points, int numberOfPoints, unsigned cha
// Delete Old Objects
vtkWebGLDataSet* obj;
while(this->Internal->Parts.size() != 0)
while(!this->Internal->Parts.empty())
{
obj = this->Internal->Parts.back();
this->Internal->Parts.pop_back();
......
......@@ -39,7 +39,7 @@ vtkWebGLWidget::vtkWebGLWidget()
vtkWebGLWidget::~vtkWebGLWidget()
{
delete[] this->binaryData;
while(this->colors.size() !=0)
while(!this->colors.empty())
{
double* xrgb = this->colors.back();
this->colors.pop_back();
......
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