(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

@@ -216,7 +216,7 @@ RiaApplication::RiaApplication(int& argc, char** argv)
setWindowIcon(QIcon(":/AppLogo48x48.png"));
m_socketServer = new RiaSocketServer( this);
m_workerProcess = NULL;
m_workerProcess = nullptr;
#ifdef WIN32
m_startupDefaultDirectory = QDir::homePath();
@@ -393,10 +393,10 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
closeProject();
QString tmp = QString("Unknown project file version detected in file \n%1\n\nCould not open project.").arg(projectFileName);
QMessageBox::warning(NULL, "Error when opening project file", tmp);
QMessageBox::warning(nullptr, "Error when opening project file", tmp);
RiuMainWindow* mainWnd = RiuMainWindow::instance();
mainWnd->setPdmRoot(NULL);
mainWnd->setPdmRoot(nullptr);
// Delete all object possibly generated by readFile()
delete m_project;
@@ -445,8 +445,8 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
for (size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++)
{
RimOilField* oilField = m_project->oilFields[oilFieldIdx];
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : NULL;
if (analysisModels == NULL) continue;
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : nullptr;
if (analysisModels == nullptr) continue;
for (size_t cgIdx = 0; cgIdx < analysisModels->caseGroups.size(); ++cgIdx)
{
@@ -460,8 +460,8 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
for(RimOilField* oilField: m_project->oilFields)
{
if (oilField == NULL) continue;
if(oilField->formationNamesCollection() != NULL)
if (oilField == nullptr) continue;
if(oilField->formationNamesCollection() != nullptr)
{
oilField->formationNamesCollection()->readAllFormationNames();
}
@@ -472,8 +472,8 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
for (size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++)
{
RimOilField* oilField = m_project->oilFields[oilFieldIdx];
if (oilField == NULL) continue;
if (oilField->wellPathCollection == NULL)
if (oilField == nullptr) continue;
if (oilField->wellPathCollection == nullptr)
{
//printf("Create well path collection for oil field %i in loadProject.\n", oilFieldIdx);
oilField->wellPathCollection = new RimWellPathCollection();
@@ -488,7 +488,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
for (RimOilField* oilField: m_project->oilFields)
{
if (oilField == NULL) continue;
if (oilField == nullptr) continue;
// Temporary
if(!oilField->summaryCaseMainCollection())
{
@@ -537,7 +537,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
for (size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++)
{
RimOilField* oilField = m_project->oilFields[oilFieldIdx];
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : NULL;
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : nullptr;
if (analysisModels)
{
analysisModels->recomputeStatisticsForAllCaseGroups();
@@ -641,7 +641,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
//--------------------------------------------------------------------------------------------------
bool RiaApplication::loadProject(const QString& projectFileName)
{
return loadProject(projectFileName, PLA_NONE, NULL);
return loadProject(projectFileName, PLA_NONE, nullptr);
}
//--------------------------------------------------------------------------------------------------
@@ -789,12 +789,12 @@ void RiaApplication::storeTreeViewState()
//--------------------------------------------------------------------------------------------------
void RiaApplication::addWellPathsToModel(QList<QString> wellPathFilePaths)
{
if (m_project == NULL || m_project->oilFields.size() < 1) return;
if (m_project == nullptr || m_project->oilFields.size() < 1) return;
RimOilField* oilField = m_project->activeOilField();
if (oilField == NULL) return;
if (oilField == nullptr) return;
if (oilField->wellPathCollection == NULL)
if (oilField->wellPathCollection == nullptr)
{
//printf("Create well path collection.\n");
oilField->wellPathCollection = new RimWellPathCollection();
@@ -895,7 +895,7 @@ bool RiaApplication::saveProjectPromptForFileName()
startPath += "/ResInsightProject.rsp";
}
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save File"), startPath, tr("Project Files (*.rsp);;All files(*.*)"));
QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Save File"), startPath, tr("Project Files (*.rsp);;All files(*.*)"));
if (fileName.isEmpty())
{
return false;
@@ -972,7 +972,7 @@ bool RiaApplication::saveProjectAs(const QString& fileName)
if (!m_project->writeFile())
{
QMessageBox::warning(NULL, "Error when saving project file", QString("Not possible to save project file. Make sure you have sufficient access rights.\n\nProject file location : %1").arg(fileName));
QMessageBox::warning(nullptr, "Error when saving project file", QString("Not possible to save project file. Make sure you have sufficient access rights.\n\nProject file location : %1").arg(fileName));
return false;
}
@@ -1098,10 +1098,10 @@ bool RiaApplication::openOdbCaseFromFile(const QString& fileName)
geoMechCase->setFileName(fileName);
geoMechCase->caseUserDescription = caseName;
RimGeoMechModels* geoMechModelCollection = m_project->activeOilField() ? m_project->activeOilField()->geoMechModels() : NULL;
RimGeoMechModels* geoMechModelCollection = m_project->activeOilField() ? m_project->activeOilField()->geoMechModels() : nullptr;
// Create the geoMech model container if it is not there already
if (geoMechModelCollection == NULL)
if (geoMechModelCollection == nullptr)
{
geoMechModelCollection = new RimGeoMechModels();
m_project->activeOilField()->geoMechModels = geoMechModelCollection;
@@ -1343,7 +1343,7 @@ int RiaApplication::launchUnitTestsWithConsole()
//--------------------------------------------------------------------------------------------------
void RiaApplication::createMainPlotWindow()
{
CVF_ASSERT(m_mainPlotWindow == NULL);
CVF_ASSERT(m_mainPlotWindow == nullptr);
m_mainPlotWindow = new RiuMainPlotWindow;
@@ -1361,7 +1361,7 @@ void RiaApplication::deleteMainPlotWindow()
if (m_mainPlotWindow)
{
m_mainPlotWindow->deleteLater();
m_mainPlotWindow = NULL;
m_mainPlotWindow = nullptr;
}
}
@@ -1415,7 +1415,7 @@ RiuMainWindowBase* RiaApplication::mainWindowByID(int mainWindowID)
//--------------------------------------------------------------------------------------------------
RimViewWindow* RiaApplication::activeViewWindow()
{
RimViewWindow* viewWindow = NULL;
RimViewWindow* viewWindow = nullptr;
QWidget* mainWindowWidget = RiaApplication::activeWindow();
@@ -1609,7 +1609,7 @@ void RiaApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatu
{
m_workerProcess->close();
}
m_workerProcess = NULL;
m_workerProcess = nullptr;
// Either the work process crashed or was aborted by the user
if (exitStatus == QProcess::CrashExit)
@@ -1649,7 +1649,7 @@ void RiaApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatu
//--------------------------------------------------------------------------------------------------
bool RiaApplication::launchProcess(const QString& program, const QStringList& arguments)
{
if (m_workerProcess == NULL)
if (m_workerProcess == nullptr)
{
// If multiple cases are present, pop the first case ID from the list and set as current case
if (!m_currentCaseIds.empty())
@@ -1701,7 +1701,7 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
if (!m_workerProcess->waitForStarted(1000))
{
m_workerProcess->close();
m_workerProcess = NULL;
m_workerProcess = nullptr;
m_runningWorkerProcess = false;
RiuMainWindow::instance()->processMonitor()->stopMonitorWorkProcess();
@@ -1715,7 +1715,7 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
}
else
{
QMessageBox::warning(NULL, "Script execution", "An Octave process is still running. Please stop this process before executing a new script.");
QMessageBox::warning(nullptr, "Script execution", "An Octave process is still running. Please stop this process before executing a new script.");
return false;
}
}
@@ -1825,7 +1825,7 @@ void RiaApplication::terminateProcess()
}
m_runningWorkerProcess = false;
m_workerProcess = NULL;
m_workerProcess = nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -92,8 +92,8 @@ bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QStr
RiaApplication* app = RiaApplication::instance();
RimProject* project = app->project();
RimEclipseCaseCollection* analysisModels = project->activeOilField() ? project->activeOilField()->analysisModels() : NULL;
if (analysisModels == NULL) return false;
RimEclipseCaseCollection* analysisModels = project->activeOilField() ? project->activeOilField()->analysisModels() : nullptr;
if (analysisModels == nullptr) return false;
RiuMainWindow::instance()->show();
@@ -114,7 +114,7 @@ bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QStr
// Add a corresponding summary case if it exists
{
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : NULL;
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : nullptr;
if (sumCaseColl)
{
{
@@ -193,9 +193,9 @@ bool RiaImportEclipseCaseTools::addEclipseCases(const QStringList& fileNames)
// First file is read completely including grid.
// The main grid from the first case is reused directly in for the other cases.
// When reading active cell info, only the total cell count is tested for consistency
RimEclipseResultCase* mainResultCase = NULL;
RimEclipseResultCase* mainResultCase = nullptr;
std::vector< std::vector<int> > mainCaseGridDimensions;
RimIdenticalGridCaseGroup* gridCaseGroup = NULL;
RimIdenticalGridCaseGroup* gridCaseGroup = nullptr;
RiaApplication* app = RiaApplication::instance();
RimProject* project = app->project();

View File

@@ -157,7 +157,7 @@ void RiaDefaultConsoleLogger::writeToConsole(const std::string& str)
DWORD stringLength = static_cast<DWORD>(str.length());
unsigned long iDum = 0;
WriteConsoleA(hStdOutputHandle, str.c_str(), stringLength, &iDum, NULL);
WriteConsoleA(hStdOutputHandle, str.c_str(), stringLength, &iDum, nullptr);
}
#else
fputs(str.c_str(), stderr);
@@ -203,7 +203,7 @@ void RiaLogging::setLoggerInstance(RiaLogger* loggerInstance)
void RiaLogging::deleteLoggerInstance()
{
delete sm_logger;
sm_logger = NULL;
sm_logger = nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -125,7 +125,7 @@ void RiaProjectModifier::replaceSourceCases(RimProject* project)
{
for (RimOilField* oilField : project->oilFields())
{
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : NULL;
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : nullptr;
if (analysisModels)
{
for (RimIdenticalGridCaseGroup* caseGroup : analysisModels->caseGroups)
@@ -280,7 +280,7 @@ int RiaProjectModifier::firstGroupId(RimProject* project)
for (size_t oilFieldIdx = 0; oilFieldIdx < project->oilFields().size(); oilFieldIdx++)
{
RimOilField* oilField = project->oilFields[oilFieldIdx];
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : NULL;
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : nullptr;
if (analysisModels)
{
if (analysisModels->caseGroups.size() > 0)