(clang-tidy) : modernize-use-nullptr

This commit is contained in:
Magne Sjaastad
2018-02-18 18:56:43 +01:00
parent 69875eec8f
commit 1ae30ef11a
195 changed files with 552 additions and 552 deletions

View File

@@ -207,14 +207,14 @@ public:
if (actCellInfo->isActive(cIdx))
{
RigGridBase* grid = reservoirCells[cIdx].hostGrid();
CVF_ASSERT(grid != NULL);
CVF_ASSERT(grid != nullptr);
size_t cellIndex = reservoirCells[cIdx].gridLocalCellIndex();
size_t i, j, k;
grid->ijkFromCellIndex(cellIndex, &i, &j, &k);
size_t pi, pj, pk;
RigGridBase* parentGrid = NULL;
RigGridBase* parentGrid = nullptr;
if (grid->isMainGrid())
{
@@ -227,7 +227,7 @@ public:
{
size_t parentCellIdx = reservoirCells[cIdx].parentCellIndex();
parentGrid = (static_cast<RigLocalGrid*>(grid))->parentGrid();
CVF_ASSERT(parentGrid != NULL);
CVF_ASSERT(parentGrid != nullptr);
parentGrid->ijkFromCellIndex(parentCellIdx, &pi, &pj, &pk);
}

View File

@@ -298,7 +298,7 @@ class RiaSetNNCProperty: public RiaSocketCommand
{
public:
RiaSetNNCProperty() :
m_currentReservoir(NULL),
m_currentReservoir(nullptr),
m_currentScalarIndex(cvf::UNDEFINED_SIZE_T),
m_timeStepCountToRead(0),
m_bytesPerTimeStepToRead(0),

View File

@@ -171,7 +171,7 @@ public:
virtual bool interpretCommand(RiaSocketServer* server, const QList<QByteArray>& args, QDataStream& socketStream)
{
RimProject* proj = RiaApplication::instance()->project();
RimEclipseCaseCollection* analysisModels = (proj && proj->activeOilField()) ? proj->activeOilField()->analysisModels() : NULL;
RimEclipseCaseCollection* analysisModels = (proj && proj->activeOilField()) ? proj->activeOilField()->analysisModels() : nullptr;
if (analysisModels)
{
std::vector<QString> groupNames;
@@ -236,7 +236,7 @@ public:
}
RimProject* proj = RiaApplication::instance()->project();
RimEclipseCaseCollection* analysisModels = (proj && proj->activeOilField()) ? proj->activeOilField()->analysisModels() : NULL;
RimEclipseCaseCollection* analysisModels = (proj && proj->activeOilField()) ? proj->activeOilField()->analysisModels() : nullptr;
if (analysisModels)
{
@@ -247,7 +247,7 @@ public:
}
else
{
RimIdenticalGridCaseGroup* caseGroup = NULL;
RimIdenticalGridCaseGroup* caseGroup = nullptr;
for (size_t i = 0; i < analysisModels->caseGroups().size(); i++)
{
RimIdenticalGridCaseGroup* cg = analysisModels->caseGroups()[i];

View File

@@ -74,7 +74,7 @@ public:
// Find the requested data
size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T;
std::vector< std::vector<double> >* scalarResultFrames = NULL;
std::vector< std::vector<double> >* scalarResultFrames = nullptr;
if (rimCase && rimCase->results(porosityModelEnum))
{
@@ -87,7 +87,7 @@ public:
}
if (scalarResultFrames == NULL)
if (scalarResultFrames == nullptr)
{
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n")
+ RiaSocketServer::tr("Could not find the %1 model property named: \"%2\"").arg(porosityModelName).arg(propertyName));
@@ -95,7 +95,7 @@ public:
// Write data back : timeStepCount, bytesPrTimestep, dataForTimestep0 ... dataForTimestepN
if ( scalarResultFrames == NULL)
if ( scalarResultFrames == nullptr)
{
// No data available
socketStream << (quint64)0 << (quint64)0 ;
@@ -230,7 +230,7 @@ public:
QString porosityModelName = args[4];
RimEclipseCase*rimCase = server->findReservoir(caseId);
if (rimCase == NULL)
if (rimCase == nullptr)
{
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the case with ID: \"%1\"").arg(caseId));
@@ -382,8 +382,8 @@ class RiaSetActiveCellProperty: public RiaSocketCommand
{
public:
RiaSetActiveCellProperty() :
m_currentReservoir(NULL),
m_scalarResultsToAdd(NULL),
m_currentReservoir(nullptr),
m_scalarResultsToAdd(nullptr),
m_currentScalarIndex(cvf::UNDEFINED_SIZE_T),
m_timeStepCountToRead(0),
m_bytesPerTimeStepToRead(0),
@@ -409,7 +409,7 @@ public:
// Find the requested data, Or create a set if we are setting data and it is not found
size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T;
std::vector< std::vector<double> >* scalarResultFrames = NULL;
std::vector< std::vector<double> >* scalarResultFrames = nullptr;
if (rimCase && rimCase->results(m_porosityModelEnum))
{
@@ -436,7 +436,7 @@ public:
}
}
if (scalarResultFrames == NULL)
if (scalarResultFrames == nullptr)
{
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the %1 model property named: \"%2\"").arg(porosityModelName).arg(propertyName));
return true;
@@ -581,7 +581,7 @@ public:
}
std::vector<double> readBuffer;
double * internalMatrixData = NULL;
double * internalMatrixData = nullptr;
if (isCoarseningActive)
{
@@ -635,7 +635,7 @@ public:
if (m_currentTimeStepNumberToRead == m_timeStepCountToRead)
{
if (m_currentReservoir != NULL)
if (m_currentReservoir != nullptr)
{
// Create a new input property if we have an input reservoir
RimEclipseInputCase* inputRes = dynamic_cast<RimEclipseInputCase*>(m_currentReservoir);
@@ -661,7 +661,7 @@ public:
// Adjust the result data if only one time step is requested so the result behaves like a static result
if (m_requestedTimesteps.size() == 1 && m_currentScalarIndex != cvf::UNDEFINED_SIZE_T)
{
std::vector< std::vector<double> >* scalarResultFrames = NULL;
std::vector< std::vector<double> >* scalarResultFrames = nullptr;
scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->cellScalarResults(m_currentScalarIndex));
size_t lastIndexWithDataPresent = cvf::UNDEFINED_SIZE_T;
for (size_t i = 0; i < scalarResultFrames->size(); i++)
@@ -728,8 +728,8 @@ class RiaSetGridProperty : public RiaSocketCommand
{
public:
RiaSetGridProperty() :
m_currentReservoir(NULL),
m_scalarResultsToAdd(NULL),
m_currentReservoir(nullptr),
m_scalarResultsToAdd(nullptr),
m_currentGridIndex(cvf::UNDEFINED_SIZE_T),
m_currentScalarIndex(cvf::UNDEFINED_SIZE_T),
m_timeStepCountToRead(0),
@@ -803,7 +803,7 @@ public:
size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T;
std::vector< std::vector<double> >* scalarResultFrames = NULL;
std::vector< std::vector<double> >* scalarResultFrames = nullptr;
if (rimCase && rimCase->results(m_porosityModelEnum))
{
@@ -825,7 +825,7 @@ public:
}
}
if (scalarResultFrames == NULL)
if (scalarResultFrames == nullptr)
{
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the %1 model property named: \"%2\"").arg(porosityModelName).arg(propertyName));
return true;
@@ -999,7 +999,7 @@ public:
if (m_currentTimeStepNumberToRead == m_timeStepCountToRead)
{
if (m_currentReservoir != NULL)
if (m_currentReservoir != nullptr)
{
// Create a new input property if we have an input reservoir
RimEclipseInputCase* inputRes = dynamic_cast<RimEclipseInputCase*>(m_currentReservoir);
@@ -1025,7 +1025,7 @@ public:
// Adjust the result data if only one time step is requested so the result behaves like a static result
if (m_requestedTimesteps.size() == 1 && m_currentScalarIndex != cvf::UNDEFINED_SIZE_T)
{
std::vector< std::vector<double> >* scalarResultFrames = NULL;
std::vector< std::vector<double> >* scalarResultFrames = nullptr;
scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->cellScalarResults(m_currentScalarIndex));
size_t lastIndexWithDataPresent = cvf::UNDEFINED_SIZE_T;
for (size_t i = 0; i < scalarResultFrames->size(); i++)

View File

@@ -44,10 +44,10 @@
//--------------------------------------------------------------------------------------------------
RiaSocketServer::RiaSocketServer(QObject* parent)
: QObject(parent),
m_tcpServer(NULL),
m_currentClient(NULL),
m_tcpServer(nullptr),
m_currentClient(nullptr),
m_currentCommandSize(0),
m_currentCommand(NULL),
m_currentCommand(nullptr),
m_currentCaseId(-1)
{
m_errorMessageDialog = new QErrorMessage(RiuMainWindow::instance());
@@ -161,7 +161,7 @@ RimEclipseCase* RiaSocketServer::findReservoir(int caseId)
else
{
RimProject* project = RiaApplication::instance()->project();
if (!project) return NULL;
if (!project) return nullptr;
std::vector<RimCase*> cases;
project->allCases(cases);
@@ -175,7 +175,7 @@ RimEclipseCase* RiaSocketServer::findReservoir(int caseId)
}
}
return NULL;
return nullptr;
}
//--------------------------------------------------------------------------------------------------
@@ -302,7 +302,7 @@ void RiaSocketServer::terminateCurrentConnection()
m_currentClient->disconnect(SIGNAL(disconnected()));
m_currentClient->disconnect(SIGNAL(readyRead()));
m_currentClient->deleteLater();
m_currentClient = NULL;
m_currentClient = nullptr;
}
// Clean up more state:
@@ -310,7 +310,7 @@ void RiaSocketServer::terminateCurrentConnection()
if (m_currentCommand)
{
delete m_currentCommand;
m_currentCommand = NULL;
m_currentCommand = nullptr;
}
m_currentCommandSize = 0;
@@ -341,8 +341,8 @@ void RiaSocketServer::handleNextPendingConnection()
QTcpSocket* clientToHandle = m_tcpServer->nextPendingConnection();
if (clientToHandle)
{
CVF_ASSERT(m_currentClient == NULL);
CVF_ASSERT(m_currentCommand == NULL);
CVF_ASSERT(m_currentClient == nullptr);
CVF_ASSERT(m_currentCommand == nullptr);
m_currentClient = clientToHandle;
m_currentCommandSize = 0;

View File

@@ -47,7 +47,7 @@ public:
enum ReadState {ReadingCommand, ReadingPropertyData};
public:
explicit RiaSocketServer(QObject *parent = 0);
explicit RiaSocketServer(QObject *parent = nullptr);
~RiaSocketServer();
unsigned short serverPort();

View File

@@ -49,7 +49,7 @@
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RiaSocketTools::findCaseFromArgs(RiaSocketServer* server, const QList<QByteArray>& args)
{
RimEclipseCase* rimCase = NULL;
RimEclipseCase* rimCase = nullptr;
int caseId = -1;
if (args.size() > 1)
@@ -58,7 +58,7 @@ RimEclipseCase* RiaSocketTools::findCaseFromArgs(RiaSocketServer* server, const
}
rimCase = server->findReservoir(caseId);
if (rimCase == NULL)
if (rimCase == nullptr)
{
// TODO: Display error message a different place to avoid socket comm to be halted.
//server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the Case with CaseId : \"%1\"").arg(caseId));
@@ -79,7 +79,7 @@ void RiaSocketTools::getCaseInfoFromCase(RimCase* rimCase, qint64& caseId, QStri
caseName = rimCase->caseUserDescription;
RimEclipseCase* eclCase = dynamic_cast<RimEclipseCase*> (rimCase);
RimCaseCollection* caseCollection = NULL;
RimCaseCollection* caseCollection = nullptr;
if (eclCase)
{
caseCollection = eclCase->parentCaseCollection();