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