#1292 Fixed CppCheck Issues in ProjectDataModel

This commit is contained in:
Jacob Støren
2017-03-06 11:18:57 +01:00
parent b5e782dfc3
commit 6c0a866008
10 changed files with 10 additions and 21 deletions

View File

@@ -70,7 +70,7 @@ RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
RimEclipseResultCase* eclCase; RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase); this->firstAncestorOrThisOfType(eclCase);
CVF_ASSERT(eclCase && eclCase->reservoirData() && eclCase->reservoirData() ); CVF_ASSERT(eclCase && eclCase->reservoirData() );
timeStepCount = eclCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount(); timeStepCount = eclCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount();

View File

@@ -180,8 +180,7 @@ void RimWellAllocationPlot::updateFromWell()
if (!m_case) return; if (!m_case) return;
const RigSingleWellResultsData* wellResults = nullptr; const RigSingleWellResultsData* wellResults = m_case->reservoirData()->findWellResult(m_wellName);
wellResults = m_case->reservoirData()->findWellResult(m_wellName);
if (!wellResults) return; if (!wellResults) return;
@@ -450,8 +449,7 @@ QString RimWellAllocationPlot::wellStatusTextForTimeStep(const QString& wellName
if (eclipseResultCase) if (eclipseResultCase)
{ {
const RigSingleWellResultsData* wellResults = nullptr; const RigSingleWellResultsData* wellResults = eclipseResultCase->reservoirData()->findWellResult(wellName);
wellResults = eclipseResultCase->reservoirData()->findWellResult(wellName);
if (wellResults) if (wellResults)
{ {

View File

@@ -224,9 +224,7 @@ const cvf::StructGridInterface* RimCellRangeFilterCollection::gridByIndex(int gr
if (mnGrid) if (mnGrid)
{ {
RigGridBase* grid = NULL; RigGridBase* grid = mnGrid->gridByIndex(gridIndex);
grid = mnGrid->gridByIndex(gridIndex);
CVF_ASSERT(grid); CVF_ASSERT(grid);

View File

@@ -118,8 +118,6 @@ void RimEclipseCellColors::changeLegendConfig(QString resultVarNameOfNewLegend)
{ {
if (resultVarNameOfNewLegend != RimDefines::ternarySaturationResultName()) if (resultVarNameOfNewLegend != RimDefines::ternarySaturationResultName())
{ {
bool found = false;
QString legendResultVariable; QString legendResultVariable;
if (this->m_legendConfigPtrField()) if (this->m_legendConfigPtrField())
@@ -129,6 +127,7 @@ void RimEclipseCellColors::changeLegendConfig(QString resultVarNameOfNewLegend)
if (!this->m_legendConfigPtrField() || legendResultVariable != resultVarNameOfNewLegend) if (!this->m_legendConfigPtrField() || legendResultVariable != resultVarNameOfNewLegend)
{ {
bool found = false;
for (size_t i = 0; i < m_legendConfigData.size(); i++) for (size_t i = 0; i < m_legendConfigData.size(); i++)
{ {
if (m_legendConfigData[i]->resultVariableName() == resultVarNameOfNewLegend) if (m_legendConfigData[i]->resultVariableName() == resultVarNameOfNewLegend)

View File

@@ -248,11 +248,10 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
size_t inputPropCount = this->m_inputPropertyCollection()->inputProperties.size(); size_t inputPropCount = this->m_inputPropertyCollection()->inputProperties.size();
caf::ProgressInfo progInfo(static_cast<int>(filenames.size() * inputPropCount), "Reading Input properties" ); caf::ProgressInfo progInfo(static_cast<int>(filenames.size() * inputPropCount), "Reading Input properties" );
int progress = 0;
for_all(filenames, i) for_all(filenames, i)
{ {
progress = static_cast<int>(i*inputPropCount); int progress = static_cast<int>(i*inputPropCount);
// Find all the keywords present on the file // Find all the keywords present on the file
progInfo.setProgressDescription(filenames[i]); progInfo.setProgressDescription(filenames[i]);

View File

@@ -632,7 +632,7 @@ cvf::BoundingBox RimIntersectionBox::currentCellBoundingBox()
this->firstAncestorOrThisOfType(rimCase); this->firstAncestorOrThisOfType(rimCase);
CVF_ASSERT(rimCase); CVF_ASSERT(rimCase);
/*
RimEclipseView* eclView = nullptr; RimEclipseView* eclView = nullptr;
this->firstAncestorOrThisOfType(eclView); this->firstAncestorOrThisOfType(eclView);
@@ -644,7 +644,7 @@ cvf::BoundingBox RimIntersectionBox::currentCellBoundingBox()
if(false)//useAllCells) // For now, only use the active CellsBBox. if(false)//useAllCells) // For now, only use the active CellsBBox.
return rimCase->allCellsBoundingBox(); return rimCase->allCellsBoundingBox();
else else */
return rimCase->activeCellsBoundingBox(); return rimCase->activeCellsBoundingBox();
} }

View File

@@ -88,8 +88,6 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
{ {
QList<caf::PdmOptionItemInfo> options; QList<caf::PdmOptionItemInfo> options;
RimProject* proj = RiaApplication::instance()->project();
if (fieldNeedingOptions == &view) if (fieldNeedingOptions == &view)
{ {
options.push_back(caf::PdmOptionItemInfo("None", nullptr)); options.push_back(caf::PdmOptionItemInfo("None", nullptr));

View File

@@ -343,7 +343,7 @@ int RimSummaryCurveAppearanceCalculator::cycledLineThickness(int index)
static const int thicknesses[] ={ 1, 3, 5 }; static const int thicknesses[] ={ 1, 3, 5 };
if (index < 0) return 1; if (index < 0) return 1;
return (thicknesses[(index) % 3]); return (thicknesses[(index) % thicknessCount]);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -31,7 +31,7 @@ class RifEclipseSummaryAddress;
class RimSummaryCurveAppearanceCalculator class RimSummaryCurveAppearanceCalculator
{ {
public: public:
RimSummaryCurveAppearanceCalculator(const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& curveDefinitions); explicit RimSummaryCurveAppearanceCalculator(const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& curveDefinitions);
enum CurveAppearanceType enum CurveAppearanceType
{ {
NONE, NONE,

View File

@@ -513,9 +513,6 @@ void RimSummaryCurveFilter::createSetOfCasesAndResultAdresses(
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimSummaryCurveFilter::createCurvesFromCurveDefinitions(const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& curveDefinitions) void RimSummaryCurveFilter::createCurvesFromCurveDefinitions(const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& curveDefinitions)
{ {
int colorIndex = 2;
int lineStyleIdx = -1;
RimSummaryCase* prevCase = nullptr; RimSummaryCase* prevCase = nullptr;
RimPlotCurve::LineStyleEnum lineStyle = RimPlotCurve::STYLE_SOLID; RimPlotCurve::LineStyleEnum lineStyle = RimPlotCurve::STYLE_SOLID;
RimSummaryCurveAppearanceCalculator curveLookCalc(curveDefinitions); RimSummaryCurveAppearanceCalculator curveLookCalc(curveDefinitions);