Commit b85b5f6a authored by Sean McBride's avatar Sean McBride

Replace size() with empty()

Fixes cppcheck warning, should be a little faster

Change-Id: I24ebe2085e2f1c771d2a83fba6ebfb8761cfb9ab
parent c0f818bb
......@@ -882,7 +882,7 @@ void vtkPlotPoints::FindBadPoints()
}
// If there are bad points copy them, if not ensure the pointer is null.
if (bad.size() > 0)
if (!bad.empty())
{
if (!this->BadPoints)
{
......
......@@ -1060,7 +1060,7 @@ vtkReebGraph::Implementation::vtkReebPath vtkReebGraph::Implementation::FindPath
if (M==N1)
{
//clear all the items in the priority queue
while (pq.size())
while (!pq.empty())
{
vtkReebPath aux=pq.top();pq.pop();
delete aux.ArcTable;
......
......@@ -346,7 +346,7 @@ int vtkSelectionSource::RequestData(
vtkSelectionSourceInternals::StringIDSetType& selSet =
this->Internal->StringIDs[idx];
if (selSet.size() > 0)
if (!selSet.empty())
{
// Create the selection list
selectionList->SetNumberOfTuples(selSet.size());
......@@ -408,7 +408,7 @@ int vtkSelectionSource::RequestData(
vtkSelectionSourceInternals::IDSetType& selSet =
this->Internal->IDs[idx];
if (selSet.size() > 0)
if (!selSet.empty())
{
// Create the selection list
selectionList->SetNumberOfTuples(selSet.size());
......
......@@ -977,7 +977,7 @@ void vtkLSDynaPartCollection::FillPointProperty(const vtkIdType& numTuples,
++partIt;
}
}
if(leftOver>0 && sortedParts.size() > 0)
if(leftOver>0 && !sortedParts.empty())
{
p->Fam.BufferChunk(LSDynaFamily::Float, leftOver*numComps);
buf = p->Fam.GetBufferAs<T>();
......
......@@ -84,7 +84,7 @@ void vtkTDxMacDevice::Initialize()
assert("pre: not_yet_initialized" && !this->GetInitialized());
assert("pre: valid_name" && this->GetClientApplicationName()!=0);
if(vtkClientIDToDeviceObject.size()==0)
if(vtkClientIDToDeviceObject.empty())
{
OSErr result=InstallConnexionHandlers(vtkTDxMacDeviceMessageHandler,0L,0L);
this->Initialized=result==noErr; // 0
......@@ -141,7 +141,7 @@ void vtkTDxMacDevice::Close()
}
// only if the map is empty.
if(vtkClientIDToDeviceObject.size()==0)
if(vtkClientIDToDeviceObject.empty())
{
CleanupConnexionHandlers();
}
......
......@@ -205,7 +205,7 @@ void vtkTDxWinDevice::Initialize()
HRESULT hr=0;
CComPtr<IUnknown> device;
bool alreadyConnected=vtkWindowHandleToDeviceObjectConnection.size()!=0;
bool alreadyConnected=!vtkWindowHandleToDeviceObjectConnection.empty();
if(alreadyConnected)
{
......@@ -354,7 +354,7 @@ void vtkTDxWinDevice::Close()
vtkWindowHandleToDeviceObjectConnection.erase(it);
}
if(vtkWindowHandleToDeviceObjectConnection.size()==0)
if(vtkWindowHandleToDeviceObjectConnection.empty())
{
// Release the sensor and keyboard interfaces
vtkTDxWinDevicePrivate *o=this->Private;
......
......@@ -1188,7 +1188,7 @@ void DICOMAppHelper::GetSliceNumberFilenamePairs(const dicom_stl::string &series
void DICOMAppHelper::GetSliceNumberFilenamePairs(dicom_stl::vector<dicom_stl::pair<int, dicom_stl::string> >& v, bool ascending)
{
// Default to using the first series
if (this->Implementation->SeriesUIDMap.size() > 0)
if (!this->Implementation->SeriesUIDMap.empty())
{
this->GetSliceNumberFilenamePairs( (*this->Implementation->SeriesUIDMap.begin()).first, v, ascending );
}
......@@ -1242,7 +1242,7 @@ void DICOMAppHelper::GetSliceLocationFilenamePairs(const dicom_stl::string &seri
void DICOMAppHelper::GetSliceLocationFilenamePairs(dicom_stl::vector<dicom_stl::pair<float, dicom_stl::string> >& v, bool ascending)
{
// Default to using the first series
if (this->Implementation->SeriesUIDMap.size() > 0)
if (!this->Implementation->SeriesUIDMap.empty())
{
this->GetSliceLocationFilenamePairs( (*this->Implementation->SeriesUIDMap.begin()).first,
v , ascending);
......@@ -1319,7 +1319,7 @@ void DICOMAppHelper::GetImagePositionPatientFilenamePairs(const dicom_stl::strin
void DICOMAppHelper::GetImagePositionPatientFilenamePairs(dicom_stl::vector<dicom_stl::pair<float, dicom_stl::string> >& v, bool ascending)
{
// Default to using the first series
if (this->Implementation->SeriesUIDMap.size() > 0)
if (!this->Implementation->SeriesUIDMap.empty())
{
this->GetImagePositionPatientFilenamePairs(
(*this->Implementation->SeriesUIDMap.begin()).first, v, ascending);
......
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