Fixes detected by cppcheck (#4974)

* Janitor : Remove obsolete pointer to dialog

* Janitor : Remove unused functions

* Janitor : Remove unused functions

* Janitor : Add explicit to constructors

* Janitor : Remove unused variables

* Janitor : Remove unused functions related to summary plot templates

* clang-tidy : Use nullptr instead of 0

* clang-tidy : Fix usage of virtual and override

* Upped to version 2019.08.2-dev.05

* Janitor : Remove unused variables

* Janitor : Clean up several cppcheck issues

* Janitor : Add cppcheck config files

* Janitor : Use const when possible
This commit is contained in:
Magne Sjaastad
2019-11-03 08:37:03 +01:00
committed by GitHub
parent 18eee02bb1
commit 67e7bb0cf3
64 changed files with 159 additions and 282 deletions

View File

@@ -217,47 +217,42 @@ void RifCaseRealizationParametersReader::closeDataStream()
RifCaseRealizationRunspecificationReader::RifCaseRealizationRunspecificationReader( const QString& fileName )
: RifCaseRealizationReader( fileName )
{
m_xmlStream = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifCaseRealizationRunspecificationReader::~RifCaseRealizationRunspecificationReader()
{
if ( m_xmlStream )
{
delete m_xmlStream;
}
}
RifCaseRealizationRunspecificationReader::~RifCaseRealizationRunspecificationReader() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifCaseRealizationRunspecificationReader::parse()
{
auto xml = openDataStream();
auto file = openFile();
QXmlStreamReader xml( file );
QString paramName;
while ( !xml->atEnd() )
while ( !xml.atEnd() )
{
xml->readNext();
xml.readNext();
if ( xml->isStartElement() )
if ( xml.isStartElement() )
{
if ( xml->name() == "modifier" )
if ( xml.name() == "modifier" )
{
paramName = "";
}
if ( xml->name() == "id" )
if ( xml.name() == "id" )
{
paramName = xml->readElementText();
paramName = xml.readElementText();
}
if ( xml->name() == "value" )
if ( xml.name() == "value" )
{
QString paramStrValue = xml->readElementText();
QString paramStrValue = xml.readElementText();
if ( paramName.isEmpty() ) continue;
@@ -272,7 +267,7 @@ void RifCaseRealizationRunspecificationReader::parse()
{
throw FileParseException(
QString( "RifEnsembleParametersReader: Invalid number format in line %1" )
.arg( xml->lineNumber() ) );
.arg( xml.lineNumber() ) );
}
bool parseOk = true;
@@ -281,44 +276,22 @@ void RifCaseRealizationRunspecificationReader::parse()
{
throw FileParseException(
QString( "RifEnsembleParametersReader: Invalid number format in line %1" )
.arg( xml->lineNumber() ) );
.arg( xml.lineNumber() ) );
}
m_parameters->addParameter( paramName, value );
}
}
}
else if ( xml->isEndElement() )
else if ( xml.isEndElement() )
{
if ( xml->name() == "modifier" )
if ( xml.name() == "modifier" )
{
paramName = "";
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QXmlStreamReader* RifCaseRealizationRunspecificationReader::openDataStream()
{
auto file = openFile();
m_xmlStream = new QXmlStreamReader( file );
return m_xmlStream;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifCaseRealizationRunspecificationReader::closeDataStream()
{
if ( m_xmlStream )
{
delete m_xmlStream;
m_xmlStream = nullptr;
}
closeFile();
}

View File

@@ -94,13 +94,6 @@ public:
~RifCaseRealizationRunspecificationReader() override;
void parse() override;
private:
QXmlStreamReader* openDataStream();
void closeDataStream();
private:
QXmlStreamReader* m_xmlStream;
};
//==================================================================================================

View File

@@ -231,7 +231,7 @@ void RifTextDataTableFormatter::outputBuffer()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifTextDataTableFormatter::outputComment( RifTextDataTableLine& comment )
void RifTextDataTableFormatter::outputComment( const RifTextDataTableLine& comment )
{
m_out << m_commentPrefix << comment.data[0] << "\n";
}

View File

@@ -157,7 +157,7 @@ protected:
QString formatColumn( const QString str, size_t columnIndex ) const;
void outputBuffer();
void outputComment( RifTextDataTableLine& comment );
void outputComment( const RifTextDataTableLine& comment );
void outputHorizontalLine( RifTextDataTableLine& comment );
bool isAllHeadersEmpty( const std::vector<RifTextDataTableColumn>& headers );