Commit c32011ea authored by Ben Boeckel's avatar Ben Boeckel
Browse files

clang-tidy: fix `modernize-use-nullptr` lints

parent 0ae057f4
......@@ -31,8 +31,8 @@
namespace
{
vtkCTHSource gSource;
vtkCPProcessor* coProcessor = 0;
vtkCPDataDescription* coProcessorData = 0;
vtkCPProcessor* coProcessor = nullptr;
vtkCPDataDescription* coProcessorData = nullptr;
}
#if !defined(_WIN32)
......@@ -90,7 +90,7 @@ void pvspy_fil(char* filename, int len, char* /*runid*/, int* /*error*/)
char* tok = strtok(line, " ");
if (tok && strstr(tok, "*paraview"))
{
script = strtok(0, " ");
script = strtok(nullptr, " ");
len = static_cast<int>(strlen(script) + 1);
break;
}
......@@ -131,10 +131,10 @@ void pvspy_viz(int cycle, double ptime, double /*pdt*/, int, int)
void pvspy_fin()
{
coProcessor->Delete();
coProcessor = 0;
coProcessor = nullptr;
coProcessorData->Delete();
coProcessorData = 0;
coProcessorData = nullptr;
}
//------------------------------------------------------------------------------
......
......@@ -31,9 +31,9 @@ vtkCTHDataArray::vtkCTHDataArray()
this->ExtentsSet = false;
this->PointerTime = 0;
this->Data = 0;
this->CopiedData = 0;
this->Tuple = 0;
this->Data = nullptr;
this->CopiedData = nullptr;
this->Tuple = nullptr;
this->TupleSize = 0;
this->Fallback = vtkDoubleArray::New();
......@@ -56,7 +56,7 @@ void vtkCTHDataArray::Initialize()
if (this->Fallback)
{
this->Fallback->Delete();
this->Fallback = 0;
this->Fallback = nullptr;
}
if (this->Data)
......@@ -70,13 +70,13 @@ void vtkCTHDataArray::Initialize()
}
delete[] this->Data;
}
this->Data = 0;
this->Data = nullptr;
if (this->CopiedData)
{
delete[] this->CopiedData;
}
this->CopiedData = 0;
this->CopiedData = nullptr;
if (this->Tuple)
{
......@@ -90,7 +90,7 @@ void vtkCTHDataArray::SetDimensions(int x, int y, int z)
if (this->Fallback)
{
this->Fallback->Delete();
this->Fallback = 0;
this->Fallback = nullptr;
}
this->Dimensions[0] = x;
......@@ -185,7 +185,7 @@ double* vtkCTHDataArray::GetTuple(vtkIdType i)
if (this->Tuple)
{
delete[] this->Tuple;
this->Tuple = 0;
this->Tuple = nullptr;
}
// fall through to the next if(), i.e. the initial case
}
......
......@@ -41,7 +41,7 @@ vtkCTHSource::~vtkCTHSource()
if (NeighborArray)
{
NeighborArray->Delete();
NeighborArray = 0;
NeighborArray = nullptr;
}
for (size_t i = 0; i < this->Blocks.size(); i++)
{
......@@ -132,7 +132,7 @@ void vtkCTHSource::SetMaterialFieldName(int field_id, char* field_name, char* co
void vtkCTHSource::SetCellFieldPointer(int block_id, int field_id, int k, int j, double* istrip)
{
Block& b = this->Blocks[block_id];
if (b.CFieldData[field_id] != 0)
if (b.CFieldData[field_id] != nullptr)
{
/// TODO fix for multiple components
b.CFieldData[field_id]->SetDataPointer(0, k, j, istrip);
......@@ -144,7 +144,7 @@ void vtkCTHSource::SetMaterialFieldPointer(
int block_id, int field_id, int mat, int k, int j, double* istrip)
{
Block& b = this->Blocks[block_id];
if (b.MFieldData[mat][field_id] != 0)
if (b.MFieldData[mat][field_id] != nullptr)
{
/// TODO fix for multiple components
b.MFieldData[mat][field_id]->SetDataPointer(0, k, j, istrip);
......@@ -164,7 +164,7 @@ void vtkCTHSource::InitializeBlock(int block_id, int Nx, int Ny, int Nz, double*
b.allocated = allocated;
b.active = active;
b.level = level;
b.ug = 0;
b.ug = nullptr;
b.Nx = Nx;
b.Ny = Ny;
b.Nz = Nz;
......@@ -184,7 +184,7 @@ void vtkCTHSource::InitializeBlock(int block_id, int Nx, int Ny, int Nz, double*
}
else
{
b.CFieldData[c] = 0;
b.CFieldData[c] = nullptr;
}
}
b.actualMaterials = 0; // so far we've filled none
......@@ -204,7 +204,7 @@ void vtkCTHSource::InitializeBlock(int block_id, int Nx, int Ny, int Nz, double*
}
else
{
b.MFieldData[m][f] = 0;
b.MFieldData[m][f] = nullptr;
}
}
}
......@@ -282,7 +282,7 @@ void vtkCTHSource::UpdateRepresentation()
}
for (size_t c = 0; c < b.CFieldData.size(); c++)
{
if (b.CFieldData[c] == 0)
if (b.CFieldData[c] == nullptr)
continue;
b.CFieldData[c]->Modified();
/*
......@@ -302,7 +302,7 @@ void vtkCTHSource::UpdateRepresentation()
{
for (size_t f = 0; f < b.MFieldData[m].size(); f++)
{
if (b.MFieldData[m][f] == 0)
if (b.MFieldData[m][f] == nullptr)
continue;
if (strncmp(b.MFieldData[m][f]->GetName(), "Volume Fraction", 15) != 0)
{
......@@ -364,7 +364,7 @@ int vtkCTHSource::FillInputData(vtkCPInputDataDescription* input)
if (b.ug)
{
b.ug->Delete();
b.ug = 0;
b.ug = nullptr;
delete b.box;
}
if (b.allocated)
......@@ -590,7 +590,7 @@ void vtkCTHSource::AddFieldArrays(Block& b)
for (size_t c = 0; c < b.CFieldData.size(); c++)
{
if (b.CFieldData[c] == 0)
if (b.CFieldData[c] == nullptr)
continue;
b.CFieldData[c]->UnsetExtents();
cd->AddArray(b.CFieldData[c]);
......@@ -608,7 +608,7 @@ void vtkCTHSource::AddFieldArrays(Block& b)
// TODO In general for in situ, we should only pull the data we'd actually want.
for (size_t f = 0; f < b.MFieldData[m].size(); f++)
{
if (b.MFieldData[m][f] == 0)
if (b.MFieldData[m][f] == nullptr)
continue;
b.MFieldData[m][f]->UnsetExtents();
if (strncmp(b.MFieldData[m][f]->GetName(), "Volume Fraction", 15) != 0)
......@@ -643,7 +643,7 @@ void vtkCTHSource::AddFieldArrays(Block& b, int loCorner[3], int hiCorner[3])
for (size_t c = 0; c < b.CFieldData.size(); c++)
{
if (b.CFieldData[c] == 0)
if (b.CFieldData[c] == nullptr)
continue;
b.CFieldData[c]->SetExtents(loCorner, hiCorner);
cd->AddArray(b.CFieldData[c]);
......@@ -661,7 +661,7 @@ void vtkCTHSource::AddFieldArrays(Block& b, int loCorner[3], int hiCorner[3])
// TODO In general for in situ, we should only pull the data we'd actually want.
for (size_t f = 0; f < b.MFieldData[m].size(); f++)
{
if (b.MFieldData[m][f] == 0)
if (b.MFieldData[m][f] == nullptr)
continue;
b.MFieldData[m][f]->SetExtents(loCorner, hiCorner);
if (strncmp(b.MFieldData[m][f]->GetName(), "Volume Fraction", 15) != 0)
......
......@@ -233,7 +233,7 @@ Grid<gridType>::Grid()
, NLon(0)
, NLat(0)
, NLev(0)
, Lev(NULL)
, Lev(nullptr)
, Radius(0)
, Ne(0)
, Np(0)
......
......@@ -56,12 +56,12 @@ void fv_coprocessorfinalize()
if (g_coprocessor)
{
g_coprocessor->Delete();
g_coprocessor = NULL;
g_coprocessor = nullptr;
}
if (g_coprocessorData)
{
g_coprocessorData->Delete();
g_coprocessorData = NULL;
g_coprocessorData = nullptr;
}
}
} // anonymous namespace
......@@ -116,7 +116,7 @@ void fv_create_grid_(int* dim, double* lonCoord, double* latCoord, double* levCo
{
vtkGenericWarningMacro(<< "No input data description");
delete g_grid;
g_grid = NULL;
g_grid = nullptr;
}
g_sgrid = new CamAdaptor::Grid<CamAdaptor::SPHERE>();
......@@ -136,7 +136,7 @@ void fv_create_grid_(int* dim, double* lonCoord, double* latCoord, double* levCo
{
vtkGenericWarningMacro(<< "No input data description");
delete g_sgrid;
g_sgrid = NULL;
g_sgrid = nullptr;
}
}
......@@ -211,7 +211,7 @@ int fv_needtocreategrid_()
// assume that the grid is not changing so that we only build it
// the first time, otherwise we clear out the field data
vtkCPInputDataDescription* idd = g_coprocessorData->GetInputDescriptionByName("input");
return (idd == NULL || idd->GetGrid() == NULL);
return (idd == nullptr || idd->GetGrid() == nullptr);
}
//------------------------------------------------------------------------------
......
......@@ -55,12 +55,12 @@ void se_coprocessorfinalize()
if (g_coprocessor)
{
g_coprocessor->Delete();
g_coprocessor = NULL;
g_coprocessor = nullptr;
}
if (g_coprocessorData)
{
g_coprocessorData->Delete();
g_coprocessorData = NULL;
g_coprocessorData = nullptr;
}
}
} // anonymous namespace
......@@ -112,7 +112,7 @@ void se_create_grid_(int* ne, int* np, int* nlon, double* lonRad, int* nlat, dou
{
vtkGenericWarningMacro(<< "No input data description");
delete g_grid;
g_grid = NULL;
g_grid = nullptr;
}
}
......@@ -173,7 +173,7 @@ int se_needtocreategrid_()
// assume that the grid is not changing so that we only build it
// the first time, otherwise we clear out the field data
vtkCPInputDataDescription* idd = g_coprocessorData->GetInputDescriptionByName("input");
return (idd == NULL || idd->GetGrid() == NULL);
return (idd == nullptr || idd->GetGrid() == nullptr);
}
//------------------------------------------------------------------------------
......
......@@ -34,12 +34,12 @@ vtkCPCellFieldBuilder::vtkCPCellFieldBuilder()
void vtkCPCellFieldBuilder::BuildField(unsigned long timeStep, double time, vtkDataSet* grid)
{
vtkCPTensorFieldFunction* tensorFieldFunction = this->GetTensorFieldFunction();
if (tensorFieldFunction == 0)
if (tensorFieldFunction == nullptr)
{
vtkErrorMacro("Must set TensorFieldFunction.");
return;
}
if (this->GetArrayName() == 0)
if (this->GetArrayName() == nullptr)
{
vtkErrorMacro("Must set ArrayName.");
return;
......
......@@ -21,15 +21,15 @@ vtkCxxSetObjectMacro(vtkCPFieldBuilder, TensorFieldFunction, vtkCPTensorFieldFun
//----------------------------------------------------------------------------
vtkCPFieldBuilder::vtkCPFieldBuilder()
{
this->ArrayName = 0;
this->TensorFieldFunction = 0;
this->ArrayName = nullptr;
this->TensorFieldFunction = nullptr;
}
//----------------------------------------------------------------------------
vtkCPFieldBuilder::~vtkCPFieldBuilder()
{
this->SetArrayName(0);
this->SetTensorFieldFunction(0);
this->SetArrayName(nullptr);
this->SetTensorFieldFunction(nullptr);
}
//----------------------------------------------------------------------------
......
......@@ -27,17 +27,17 @@ vtkCxxSetObjectMacro(vtkCPFileGridBuilder, Grid, vtkDataObject);
//----------------------------------------------------------------------------
vtkCPFileGridBuilder::vtkCPFileGridBuilder()
{
this->FileName = 0;
this->FileName = nullptr;
this->KeepPointData = 1;
this->KeepCellData = 1;
this->Grid = 0;
this->Grid = nullptr;
}
//----------------------------------------------------------------------------
vtkCPFileGridBuilder::~vtkCPFileGridBuilder()
{
this->SetFileName(0);
this->SetGrid(0);
this->SetFileName(nullptr);
this->SetGrid(nullptr);
}
//----------------------------------------------------------------------------
......@@ -50,17 +50,17 @@ vtkDataObject* vtkCPFileGridBuilder::GetGrid()
vtkDataObject* vtkCPFileGridBuilder::GetGrid(unsigned long timeStep, double time, int& builtNewGrid)
{
builtNewGrid = 0;
if (this->FileName == 0)
if (this->FileName == nullptr)
{
vtkWarningMacro("FileName is not set.");
return 0;
return nullptr;
}
vtkCPBaseFieldBuilder* fieldBuilder = this->GetFieldBuilder();
if (fieldBuilder == 0 && this->KeepPointData == 0 && this->KeepCellData == 0)
if (fieldBuilder == nullptr && this->KeepPointData == 0 && this->KeepCellData == 0)
{
vtkWarningMacro("Need field data.");
return 0;
return nullptr;
}
if (!this->KeepPointData)
......
......@@ -21,13 +21,13 @@ vtkCxxSetObjectMacro(vtkCPGridBuilder, FieldBuilder, vtkCPBaseFieldBuilder);
//----------------------------------------------------------------------------
vtkCPGridBuilder::vtkCPGridBuilder()
{
this->FieldBuilder = 0;
this->FieldBuilder = nullptr;
}
//----------------------------------------------------------------------------
vtkCPGridBuilder::~vtkCPGridBuilder()
{
this->SetFieldBuilder(0);
this->SetFieldBuilder(nullptr);
}
//----------------------------------------------------------------------------
......
......@@ -35,16 +35,16 @@ struct vtkCPMultiBlockGridBuilderInternals
//----------------------------------------------------------------------------
vtkCPMultiBlockGridBuilder::vtkCPMultiBlockGridBuilder()
{
this->Grid = 0;
this->Grid = nullptr;
this->Internal = new vtkCPMultiBlockGridBuilderInternals;
}
//----------------------------------------------------------------------------
vtkCPMultiBlockGridBuilder::~vtkCPMultiBlockGridBuilder()
{
this->SetGrid(0);
this->SetGrid(nullptr);
delete this->Internal;
this->Internal = 0;
this->Internal = nullptr;
}
//----------------------------------------------------------------------------
......@@ -119,7 +119,7 @@ vtkCPGridBuilder* vtkCPMultiBlockGridBuilder::GetGridBuilder(unsigned int which)
if (which >= this->GetNumberOfGridBuilders())
{
vtkWarningMacro("Bad input.");
return 0;
return nullptr;
}
return this->Internal->GridBuilders[which];
}
......
......@@ -33,12 +33,12 @@ vtkCPNodalFieldBuilder::vtkCPNodalFieldBuilder()
void vtkCPNodalFieldBuilder::BuildField(unsigned long timeStep, double time, vtkDataSet* grid)
{
vtkCPTensorFieldFunction* tensorFieldFunction = this->GetTensorFieldFunction();
if (tensorFieldFunction == 0)
if (tensorFieldFunction == nullptr)
{
vtkErrorMacro("Must set TensorFieldFunction.");
return;
}
if (this->GetArrayName() == 0)
if (this->GetArrayName() == nullptr)
{
vtkErrorMacro("Must set ArrayName.");
return;
......
......@@ -29,7 +29,7 @@ vtkCPTestDriver::vtkCPTestDriver()
{
// put in reasonable values for the time stepping
this->NumberOfTimeSteps = 10;
this->GridBuilder = 0;
this->GridBuilder = nullptr;
this->StartTime = 0;
this->EndTime = 1;
}
......@@ -37,12 +37,12 @@ vtkCPTestDriver::vtkCPTestDriver()
//----------------------------------------------------------------------------
vtkCPTestDriver::~vtkCPTestDriver()
{
this->SetGridBuilder(0);
this->SetGridBuilder(nullptr);
}
//----------------------------------------------------------------------------
int vtkCPTestDriver::Run()
{
if (this->GridBuilder == 0)
if (this->GridBuilder == nullptr)
{
vtkErrorMacro("Need to set the grid builder.");
return 1;
......
......@@ -31,13 +31,13 @@ vtkCPUniformGridBuilder::vtkCPUniformGridBuilder()
this->Spacing[i] = 0;
this->Origin[i] = 0;
}
this->UniformGrid = 0;
this->UniformGrid = nullptr;
}
//----------------------------------------------------------------------------
vtkCPUniformGridBuilder::~vtkCPUniformGridBuilder()
{
this->SetUniformGrid(0);
this->SetUniformGrid(nullptr);
}
//----------------------------------------------------------------------------
......@@ -48,7 +48,7 @@ vtkDataObject* vtkCPUniformGridBuilder::GetGrid(
if (!fieldBuilder)
{
vtkErrorMacro("FieldBuilder is not defined.");
return 0;
return nullptr;
}
builtNewGrid = this->CreateUniformGrid();
......@@ -86,7 +86,7 @@ double* vtkCPUniformGridBuilder::GetOrigin()
bool vtkCPUniformGridBuilder::CreateUniformGrid()
{
bool builtNewGrid = 0;
if (this->UniformGrid == 0)
if (this->UniformGrid == nullptr)
{
builtNewGrid = 1;
}
......
......@@ -26,7 +26,7 @@ vtkCxxSetObjectMacro(vtkCPUnstructuredGridBuilder, UnstructuredGrid, vtkUnstruct
//----------------------------------------------------------------------------
vtkCPUnstructuredGridBuilder::vtkCPUnstructuredGridBuilder()
{
this->UnstructuredGrid = 0;
this->UnstructuredGrid = nullptr;
vtkUnstructuredGrid* UG = vtkUnstructuredGrid::New();
this->SetUnstructuredGrid(UG);
UG->Delete();
......@@ -36,7 +36,7 @@ vtkCPUnstructuredGridBuilder::vtkCPUnstructuredGridBuilder()
//----------------------------------------------------------------------------
vtkCPUnstructuredGridBuilder::~vtkCPUnstructuredGridBuilder()
{
this->SetUnstructuredGrid(0);
this->SetUnstructuredGrid(nullptr);
}
//----------------------------------------------------------------------------
......@@ -48,7 +48,7 @@ vtkDataObject* vtkCPUnstructuredGridBuilder::GetGrid(
if (!fieldBuilder)
{
vtkErrorMacro("FieldBuilder is not defined.");
return 0;
return nullptr;
}
fieldBuilder->BuildField(timeStep, time, this->UnstructuredGrid);
......
......@@ -29,10 +29,10 @@
namespace
{
vtkMPIController* controller = 0;
vtkParticlePipeline* pipeline = 0;
vtkCPProcessor* coProcessor = 0;
vtkCPDataDescription* coProcessorData = 0;
vtkMPIController* controller = nullptr;
vtkParticlePipeline* pipeline = nullptr;
vtkCPProcessor* coProcessor = nullptr;
vtkCPDataDescription* coProcessorData = nullptr;
}
void coprocessorinitialize(void* handle)
......@@ -40,11 +40,11 @@ void coprocessorinitialize(void* handle)
if (!controller)
{
controller = vtkMPIController::New();
controller->Initialize(0, 0, 1);
controller->Initialize(nullptr, nullptr, 1);
vtkMultiProcessController::SetGlobalController(controller);
}
if (handle != NULL)
if (handle != nullptr)
{
vtkMPICommunicatorOpaqueComm mpicomm((MPI_Comm*)handle);
vtkMPICommunicator* comm = vtkMPICommunicator::New();
......@@ -132,23 +132,23 @@ void coprocessorfinalize()
if (coProcessorData)
{
coProcessorData->Delete();
coProcessorData = 0;
coProcessorData = nullptr;
}
if (coProcessor)
{
coProcessor->Delete();
coProcessor = 0;
coProcessor = nullptr;
}
if (pipeline)
{
pipeline->Delete();
pipeline = 0;
pipeline = nullptr;
}
if (controller)
{
controller->Finalize(1);
controller->Delete();
controller = 0;
vtkMultiProcessController::SetGlobalController(0);
controller = nullptr;
vtkMultiProcessController::SetGlobalController(nullptr);
}
}
......@@ -58,7 +58,7 @@ vtkStandardNewMacro(vtkParticlePipeline);
vtkParticlePipeline::vtkParticlePipeline()
{
this->Filename = 0;
this->Filename = nullptr;
this->ParticleRadius = 1.0;
......@@ -190,7 +190,7 @@ void vtkParticlePipeline::SetupPipeline()
VTK_CREATE(vtkCameraPass, cameraP);
cameraP->SetDelegatePass(iceTPass);
vtkOpenGLRenderer* glRenderer = vtkOpenGLRenderer::SafeDownCast(this->renderer);
if (glRenderer != NULL)
if (glRenderer != nullptr)
{
glRenderer->SetPass(cameraP);
}
......
......@@ -101,8 +101,8 @@ public:
/**
* Returns the callback function to call to initialize the interpretor for
* the new vtk/server-manager classes added by this plugin. Returning NULL is
* perfectly valid.
* the new vtk/server-manager classes added by this plugin. Returning nullptr
* is perfectly valid.
*/
vtkClientServerInterpreterInitializer::InterpreterInitializationCallback
GetInitializeInterpreterCallback() override;
......
......@@ -52,5 +52,5 @@ vtkGraphLayoutStrategy* @_paraview_graph_layout_strategy_STRATEGY_TYPE@Implement
{
return vtk@_paraview_graph_layout_strategy_STRATEGY_TYPE@::New();
}
return NULL;
return nullptr;
}