Fix coverity ignored return value warnings

This commit is contained in:
Nyall Dawson 2017-12-05 10:34:33 +10:00
parent b0a36e9bb1
commit 75c99800d0
4 changed files with 18 additions and 9 deletions

View File

@ -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

View File

@ -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
{

View File

@ -187,7 +187,7 @@ QgsGdalProvider::QgsGdalProvider( const QString &uri, bool update, GDALDatasetH
}
else
{
initIfNeeded();
( void )initIfNeeded();
}
}

View File

@ -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