System : Replace NULL with nullptr

This commit is contained in:
Magne Sjaastad
2018-10-10 10:17:27 +02:00
parent c0d8fe37e1
commit 9d9771295f
20 changed files with 27 additions and 27 deletions
@@ -211,7 +211,7 @@ private:
template<typename FieldType> template<typename FieldType>
void AddRicfCapabilityToField(FieldType* field) void AddRicfCapabilityToField(FieldType* field)
{ {
if(field->template capability< RicfFieldCapability<FieldType> >() == NULL) if(field->template capability< RicfFieldCapability<FieldType> >() == nullptr)
{ {
new RicfFieldCapability<FieldType>(field, true); new RicfFieldCapability<FieldType>(field, true);
} }
@@ -134,7 +134,7 @@ RimEclipseInputProperty* RicSaveEclipseInputPropertyFeature::selectedInputProper
std::vector<RimEclipseInputProperty*> selection; std::vector<RimEclipseInputProperty*> selection;
caf::SelectionManager::instance()->objectsByType(&selection); caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL; return selection.size() > 0 ? selection[0] : nullptr;
} }
@@ -133,7 +133,7 @@ void RicSnapshotViewToFileFeature::onActionTriggered(bool isChecked)
{ {
// Get active view window before displaying the file selection dialog // Get active view window before displaying the file selection dialog
// If this is done after the file save dialog is displayed (and closed) // If this is done after the file save dialog is displayed (and closed)
// app->activeViewWindow() returns NULL on Linux // app->activeViewWindow() returns nullptr on Linux
RimViewWindow* viewWindow = RiaApplication::activeViewWindow(); RimViewWindow* viewWindow = RiaApplication::activeViewWindow();
if (!viewWindow) if (!viewWindow)
@@ -49,7 +49,7 @@ bool RicDeleteScriptPathFeature::isCommandEnabled()
void RicDeleteScriptPathFeature::onActionTriggered(bool isChecked) void RicDeleteScriptPathFeature::onActionTriggered(bool isChecked)
{ {
std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections(); std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections();
RimScriptCollection* scriptCollection = calcScriptCollections.size() > 0 ? calcScriptCollections[0] : NULL; RimScriptCollection* scriptCollection = calcScriptCollections.size() > 0 ? calcScriptCollections[0] : nullptr;
if (scriptCollection) if (scriptCollection)
{ {
QString toBeRemoved = scriptCollection->directory; QString toBeRemoved = scriptCollection->directory;
@@ -56,8 +56,8 @@ void RicNewScriptFeature::onActionTriggered(bool isChecked)
std::vector<RimCalcScript*> calcScripts = RicScriptFeatureImpl::selectedScripts(); std::vector<RimCalcScript*> calcScripts = RicScriptFeatureImpl::selectedScripts();
std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections(); std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections();
RimCalcScript* calcScript = calcScripts.size() > 0 ? calcScripts[0] : NULL; RimCalcScript* calcScript = calcScripts.size() > 0 ? calcScripts[0] : nullptr;
RimScriptCollection* scriptColl = calcScriptCollections.size() > 0 ? calcScriptCollections[0] : NULL; RimScriptCollection* scriptColl = calcScriptCollections.size() > 0 ? calcScriptCollections[0] : nullptr;
QString fullPathNewScript; QString fullPathNewScript;
@@ -171,7 +171,7 @@ bool RicImportSummaryCasesFeature::createSummaryCasesFromFiles(const QStringList
{ {
QString errorMessage = fileSelector.createCombinedErrorMessage(); QString errorMessage = fileSelector.createCombinedErrorMessage();
RiaLogging::error(errorMessage); RiaLogging::error(errorMessage);
QMessageBox::warning(NULL, QString("Problem Importing Summary Case File(s)"), errorMessage); QMessageBox::warning(nullptr, QString("Problem Importing Summary Case File(s)"), errorMessage);
} }
return true; return true;
@@ -91,5 +91,5 @@ RimWellLogPlot* RicNewWellLogPlotTrackFeature::selectedWellLogPlot()
{ {
std::vector<RimWellLogPlot*> selection; std::vector<RimWellLogPlot*> selection;
caf::SelectionManager::instance()->objectsByType(&selection); caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL; return selection.size() > 0 ? selection[0] : nullptr;
} }
@@ -363,7 +363,7 @@ bool RifCsvUserDataParser::parseColumnBasedData(const AsciiDataParseOptions& par
throw 0; throw 0;
} }
// Add NULL value // Add nullptr value
value = HUGE_VAL; value = HUGE_VAL;
} }
col.values.push_back(value); col.values.push_back(value);
@@ -153,7 +153,7 @@ bool RifEclipseInputFileTools::openGridFile(const QString& fileName, RigEclipseC
allKwReadOk = allKwReadOk && nullptr != (coordKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ecl_type_create_from_type(ECL_FLOAT_TYPE))); allKwReadOk = allKwReadOk && nullptr != (coordKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ecl_type_create_from_type(ECL_FLOAT_TYPE)));
progress.setProgress(3); progress.setProgress(3);
// If ACTNUM is not defined, this pointer will be NULL, which is a valid condition // If ACTNUM is not defined, this pointer will be nullptr, which is a valid condition
if (actnumPos >= 0) if (actnumPos >= 0)
{ {
fseek(gridFilePointer, actnumPos, SEEK_SET); fseek(gridFilePointer, actnumPos, SEEK_SET);
@@ -161,7 +161,7 @@ bool RifEclipseInputFileTools::openGridFile(const QString& fileName, RigEclipseC
progress.setProgress(4); progress.setProgress(4);
} }
// If MAPAXES is not defined, this pointer will be NULL, which is a valid condition // If MAPAXES is not defined, this pointer will be nullptr, which is a valid condition
if (mapaxesPos >= 0) if (mapaxesPos >= 0)
{ {
fseek(gridFilePointer, mapaxesPos, SEEK_SET); fseek(gridFilePointer, mapaxesPos, SEEK_SET);
@@ -234,7 +234,7 @@ bool RifEclipseOutputFileTools::keywordData(ecl_file_type* ecl_file, const QStri
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Get first occurrence of file of given type in given list of filenames, as filename or NULL if not found /// Get first occurrence of file of given type in given list of filenames, as filename or nullptr if not found
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RifEclipseOutputFileTools::firstFileNameOfType(const QStringList& fileSet, ecl_file_enum fileType) QString RifEclipseOutputFileTools::firstFileNameOfType(const QStringList& fileSet, ecl_file_enum fileType)
{ {
@@ -50,7 +50,7 @@ RifEclipseRestartFilesetAccess::~RifEclipseRestartFilesetAccess()
ecl_file_close(m_ecl_files[i]); ecl_file_close(m_ecl_files[i]);
} }
m_ecl_files[i] = NULL; m_ecl_files[i] = nullptr;
} }
} }
@@ -91,7 +91,7 @@ void RifEclipseRestartFilesetAccess::setRestartFiles(const QStringList& fileSet)
for (int i = 0; i < m_fileNames.size(); i++) for (int i = 0; i < m_fileNames.size(); i++)
{ {
m_ecl_files.push_back(NULL); m_ecl_files.push_back(nullptr);
} }
CVF_ASSERT(m_fileNames.size() == static_cast<int>(m_ecl_files.size())); CVF_ASSERT(m_fileNames.size() == static_cast<int>(m_ecl_files.size()));
@@ -269,7 +269,7 @@ void RifEclipseRestartFilesetAccess::openTimeStep(size_t timeStep)
{ {
CVF_ASSERT(timeStep < m_ecl_files.size()); CVF_ASSERT(timeStep < m_ecl_files.size());
if (m_ecl_files[timeStep] == NULL) if (m_ecl_files[timeStep] == nullptr)
{ {
int index = static_cast<int>(timeStep); int index = static_cast<int>(timeStep);
ecl_file_type* ecl_file = ecl_file_open(RiaStringEncodingTools::toNativeEncoded(m_fileNames[index]).data(), ECL_FILE_CLOSE_STREAM); ecl_file_type* ecl_file = ecl_file_open(RiaStringEncodingTools::toNativeEncoded(m_fileNames[index]).data(), ECL_FILE_CLOSE_STREAM);
@@ -125,7 +125,7 @@ RifReaderEclipseSummary::~RifReaderEclipseSummary()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifReaderEclipseSummary::open(const QString& headerFileName, bool includeRestartFiles) bool RifReaderEclipseSummary::open(const QString& headerFileName, bool includeRestartFiles)
{ {
assert(m_ecl_sum == NULL); assert(m_ecl_sum == nullptr);
m_ecl_sum = openEclSum(headerFileName, includeRestartFiles); m_ecl_sum = openEclSum(headerFileName, includeRestartFiles);
@@ -375,7 +375,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode(const smspec_node_type * ertSu
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifReaderEclipseSummary::values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values) const bool RifReaderEclipseSummary::values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values) const
{ {
assert(m_ecl_sum != NULL); assert(m_ecl_sum != nullptr);
int variableIndex = indexFromAddress(resultAddress); int variableIndex = indexFromAddress(resultAddress);
@@ -428,7 +428,7 @@ int RifReaderEclipseSummary::timeStepCount() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::vector<time_t>& RifReaderEclipseSummary::timeSteps(const RifEclipseSummaryAddress& resultAddress) const const std::vector<time_t>& RifReaderEclipseSummary::timeSteps(const RifEclipseSummaryAddress& resultAddress) const
{ {
assert(m_ecl_sum != NULL); assert(m_ecl_sum != nullptr);
return m_timeSteps; return m_timeSteps;
} }
@@ -236,7 +236,7 @@ caf::EffectGenerator* RivTernaryScalarMapperEffectGenerator::copy() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Tests whether two texture images are equal. It might in some rare cases not detect the difference /// Tests whether two texture images are equal. It might in some rare cases not detect the difference
/// but to make the comparison fast only some sampling points are used. If both pointers are NULL, /// but to make the comparison fast only some sampling points are used. If both pointers are nullptr,
/// they are considered equal. /// they are considered equal.
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RivTernaryScalarMapperEffectGenerator::isImagesEqual(const cvf::TextureImage* texImg1, const cvf::TextureImage* texImg2) bool RivTernaryScalarMapperEffectGenerator::isImagesEqual(const cvf::TextureImage* texImg1, const cvf::TextureImage* texImg2)
@@ -170,7 +170,7 @@ void RimEclipseCellColors::initAfterRead()
// The current legend config is NOT stored in <ResultVarLegendDefinitionList> in ResInsight up to v 1.3.7-dev // The current legend config is NOT stored in <ResultVarLegendDefinitionList> in ResInsight up to v 1.3.7-dev
RimRegularLegendConfig* obsoleteLegend = obsoleteField_legendConfig(); RimRegularLegendConfig* obsoleteLegend = obsoleteField_legendConfig();
// set to NULL before pushing into container // set to nullptr before pushing into container
obsoleteField_legendConfig = nullptr; obsoleteField_legendConfig = nullptr;
m_legendConfigData.push_back(obsoleteLegend); m_legendConfigData.push_back(obsoleteLegend);
@@ -80,7 +80,7 @@ public:
size_t reservoirCellIndex = m_grid->reservoirCellIndex(gridLocalCellIndex); size_t reservoirCellIndex = m_grid->reservoirCellIndex(gridLocalCellIndex);
size_t resultValueIndex = m_activeCellInfo->cellResultIndex(reservoirCellIndex); size_t resultValueIndex = m_activeCellInfo->cellResultIndex(reservoirCellIndex);
CVF_TIGHT_ASSERT(m_reservoirResultValues != NULL && resultValueIndex < m_reservoirResultValues->size()); CVF_TIGHT_ASSERT(m_reservoirResultValues != nullptr && resultValueIndex < m_reservoirResultValues->size());
(*m_reservoirResultValues)[resultValueIndex] = scalarValue; (*m_reservoirResultValues)[resultValueIndex] = scalarValue;
} }
@@ -32,7 +32,7 @@ RigTernaryResultAccessor::RigTernaryResultAccessor()
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Requires at least two data objects present, asserts if more than one data accessor is NULL /// Requires at least two data objects present, asserts if more than one data accessor is nullptr
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigTernaryResultAccessor::setTernaryResultAccessors(RigResultAccessor* soil, RigResultAccessor* sgas, RigResultAccessor* swat) void RigTernaryResultAccessor::setTernaryResultAccessors(RigResultAccessor* soil, RigResultAccessor* sgas, RigResultAccessor* swat)
{ {
@@ -428,8 +428,8 @@ int GeometryTools::intersectLineSegmentTriangle( const cvf::Vec3d p0, const cvf:
const cvf::Vec3d t0, const cvf::Vec3d t1, const cvf::Vec3d t2, const cvf::Vec3d t0, const cvf::Vec3d t1, const cvf::Vec3d t2,
cvf::Vec3d* intersectionPoint , bool * isLineDirDotNormalNegative) cvf::Vec3d* intersectionPoint , bool * isLineDirDotNormalNegative)
{ {
CVF_TIGHT_ASSERT(intersectionPoint != NULL); CVF_TIGHT_ASSERT(intersectionPoint != nullptr);
CVF_TIGHT_ASSERT(isLineDirDotNormalNegative != NULL); CVF_TIGHT_ASSERT(isLineDirDotNormalNegative != nullptr);
cvf::Vec3d u, v, n; // triangle vectors cvf::Vec3d u, v, n; // triangle vectors
cvf::Vec3d dir, w0, w; // ray vectors cvf::Vec3d dir, w0, w; // ray vectors
@@ -82,7 +82,7 @@ RiaSocketServer::RiaSocketServer(QObject* parent)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiaSocketServer::~RiaSocketServer() RiaSocketServer::~RiaSocketServer()
{ {
assert (m_currentCommand == NULL); assert (m_currentCommand == nullptr);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -206,7 +206,7 @@ TEST(RigReservoirTest, DISABLED_FileOutputToolsTest)
} }
ecl_file_close(ertFile); ecl_file_close(ertFile);
ertFile = NULL; ertFile = nullptr;
timer.reportTime(); timer.reportTime();
//qDebug() << timer.lapt; //qDebug() << timer.lapt;
@@ -1043,7 +1043,7 @@ SummaryIdentifierAndField* RiuSummaryCurveDefSelection::lookupIdentifierAndField
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Returns the Controlling pdm field info for the specified pdm field info. /// Returns the Controlling pdm field info for the specified pdm field info.
/// Controlling means the field controlling the dependent field /// Controlling means the field controlling the dependent field
/// If the specified pdm field info is the topmost (i.e. index is 0), null pointer is returned /// If the specified pdm field info is the topmost (i.e. index is 0), nullptr is returned
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
SummaryIdentifierAndField* RiuSummaryCurveDefSelection::lookupControllingField(const SummaryIdentifierAndField *dependentField) const SummaryIdentifierAndField* RiuSummaryCurveDefSelection::lookupControllingField(const SummaryIdentifierAndField *dependentField) const
{ {