Skip to content

Commit

Permalink
Fix coverity ignored return value warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 5, 2017
1 parent b0a36e9 commit 75c9980
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
15 changes: 11 additions & 4 deletions src/core/qgsfiledownloader.cpp
Expand Up @@ -174,10 +174,17 @@ void QgsFileDownloader::onFinished()
QUrl newUrl = mUrl.resolved( redirectionTarget.toUrl() );
mUrl = newUrl;
mReply->deleteLater();
mFile.open( QIODevice::WriteOnly );
mFile.resize( 0 );
mFile.close();
startDownload();
if ( !mFile.open( QIODevice::WriteOnly ) )
{
mFile.remove();
error( tr( "Cannot open output file: %1" ).arg( mFile.fileName() ) );
}
else
{
mFile.resize( 0 );
mFile.close();
startDownload();
}
return;
}
else
Expand Down
8 changes: 5 additions & 3 deletions src/gui/attributetable/qgsattributetablemodel.cpp
Expand Up @@ -289,9 +289,11 @@ void QgsAttributeTableModel::attributeValueChanged( QgsFeatureId fid, int idx, c
{
if ( mSortFieldIndex == -1 )
{
loadFeatureAtId( fid );
mExpressionContext.setFeature( mFeat );
mSortCache[fid] = mSortCacheExpression.evaluate( &mExpressionContext );
if ( loadFeatureAtId( fid ) )
{
mExpressionContext.setFeature( mFeat );
mSortCache[fid] = mSortCacheExpression.evaluate( &mExpressionContext );
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/providers/gdal/qgsgdalprovider.cpp
Expand Up @@ -187,7 +187,7 @@ QgsGdalProvider::QgsGdalProvider( const QString &uri, bool update, GDALDatasetH
}
else
{
initIfNeeded();
( void )initIfNeeded();
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/testqgsdxfexport.cpp
Expand Up @@ -301,7 +301,7 @@ bool TestQgsDxfExport::fileContainsText( const QString &path, const QString &tex
{
QStringList searchLines = text.split( '\n' );
QFile file( path );
file.open( QIODevice::ReadOnly );
QVERIFY( file.open( QIODevice::ReadOnly ) );
QTextStream in( &file );
QString line;
do
Expand Down

0 comments on commit 75c9980

Please sign in to comment.