Skip to content

Commit 75c9980

Browse files
committedDec 5, 2017
Fix coverity ignored return value warnings
1 parent b0a36e9 commit 75c9980

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed
 

‎src/core/qgsfiledownloader.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,17 @@ void QgsFileDownloader::onFinished()
174174
QUrl newUrl = mUrl.resolved( redirectionTarget.toUrl() );
175175
mUrl = newUrl;
176176
mReply->deleteLater();
177-
mFile.open( QIODevice::WriteOnly );
178-
mFile.resize( 0 );
179-
mFile.close();
180-
startDownload();
177+
if ( !mFile.open( QIODevice::WriteOnly ) )
178+
{
179+
mFile.remove();
180+
error( tr( "Cannot open output file: %1" ).arg( mFile.fileName() ) );
181+
}
182+
else
183+
{
184+
mFile.resize( 0 );
185+
mFile.close();
186+
startDownload();
187+
}
181188
return;
182189
}
183190
else

‎src/gui/attributetable/qgsattributetablemodel.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,11 @@ void QgsAttributeTableModel::attributeValueChanged( QgsFeatureId fid, int idx, c
289289
{
290290
if ( mSortFieldIndex == -1 )
291291
{
292-
loadFeatureAtId( fid );
293-
mExpressionContext.setFeature( mFeat );
294-
mSortCache[fid] = mSortCacheExpression.evaluate( &mExpressionContext );
292+
if ( loadFeatureAtId( fid ) )
293+
{
294+
mExpressionContext.setFeature( mFeat );
295+
mSortCache[fid] = mSortCacheExpression.evaluate( &mExpressionContext );
296+
}
295297
}
296298
else
297299
{

‎src/providers/gdal/qgsgdalprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ QgsGdalProvider::QgsGdalProvider( const QString &uri, bool update, GDALDatasetH
187187
}
188188
else
189189
{
190-
initIfNeeded();
190+
( void )initIfNeeded();
191191
}
192192
}
193193

‎tests/src/core/testqgsdxfexport.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ bool TestQgsDxfExport::fileContainsText( const QString &path, const QString &tex
301301
{
302302
QStringList searchLines = text.split( '\n' );
303303
QFile file( path );
304-
file.open( QIODevice::ReadOnly );
304+
QVERIFY( file.open( QIODevice::ReadOnly ) );
305305
QTextStream in( &file );
306306
QString line;
307307
do

0 commit comments

Comments
 (0)
Please sign in to comment.