Skip to content

Commit

Permalink
Fix logically dead code identified by Coverity
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 6, 2017
1 parent a80cca0 commit 737c92d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 57 deletions.
100 changes: 46 additions & 54 deletions src/app/dwg/qgsdwgimporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,56 +635,54 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa
return false;
}

if ( result != DRW::BAD_NONE )
switch ( result )
{
switch ( result )
{
case DRW::BAD_NONE:
error = QObject::tr( "No error." );
break;
case DRW::BAD_UNKNOWN:
error = QObject::tr( "Unknown error." );
break;
case DRW::BAD_OPEN:
error = QObject::tr( "error opening file." );
break;
case DRW::BAD_VERSION:
error = QObject::tr( "unsupported version." );
break;
case DRW::BAD_READ_METADATA:
error = QObject::tr( "error reading metadata." );
break;
case DRW::BAD_READ_FILE_HEADER:
error = QObject::tr( "error in file header read process." );
break;
case DRW::BAD_READ_HEADER:
error = QObject::tr( "error in header vars read process." );
break;
case DRW::BAD_READ_HANDLES:
error = QObject::tr( "error in object map read process." );
break;
case DRW::BAD_READ_CLASSES:
error = QObject::tr( "error in classes read process." );
break;
case DRW::BAD_READ_TABLES:
error = QObject::tr( "error in tables read process." );
result = DRW::BAD_NONE;
break;
case DRW::BAD_READ_BLOCKS:
error = QObject::tr( "error in block read process." );
break;
case DRW::BAD_READ_ENTITIES:
error = QObject::tr( "error in entities read process." );
break;
case DRW::BAD_READ_OBJECTS:
error = QObject::tr( "error in objects read process." );
break;
}
case DRW::BAD_NONE:
error = QObject::tr( "No error." );
break;
case DRW::BAD_UNKNOWN:
error = QObject::tr( "Unknown error." );
break;
case DRW::BAD_OPEN:
error = QObject::tr( "error opening file." );
break;
case DRW::BAD_VERSION:
error = QObject::tr( "unsupported version." );
break;
case DRW::BAD_READ_METADATA:
error = QObject::tr( "error reading metadata." );
break;
case DRW::BAD_READ_FILE_HEADER:
error = QObject::tr( "error in file header read process." );
break;
case DRW::BAD_READ_HEADER:
error = QObject::tr( "error in header vars read process." );
break;
case DRW::BAD_READ_HANDLES:
error = QObject::tr( "error in object map read process." );
break;
case DRW::BAD_READ_CLASSES:
error = QObject::tr( "error in classes read process." );
break;
case DRW::BAD_READ_TABLES:
error = QObject::tr( "error in tables read process." );
result = DRW::BAD_NONE;
break;
case DRW::BAD_READ_BLOCKS:
error = QObject::tr( "error in block read process." );
break;
case DRW::BAD_READ_ENTITIES:
error = QObject::tr( "error in entities read process." );
break;
case DRW::BAD_READ_OBJECTS:
error = QObject::tr( "error in objects read process." );
break;
}

if ( result != DRW::BAD_NONE )
{
QgsDebugMsg( QString( "error:%1" ).arg( error ) );

if ( result != DRW::BAD_NONE )
return false;
return false;
}

return !doExpandInserts || expandInserts( error );
Expand Down Expand Up @@ -2553,7 +2551,7 @@ bool QgsDwgImporter::expandInserts( QString &error )

OGRFeatureH insert = nullptr;
int i = 0, errors = 0;
for ( int i = 0, errors = 0; true; ++i )
for ( int i = 0; true; ++i )
{
if ( i % 1000 == 0 )
{
Expand Down Expand Up @@ -2731,18 +2729,12 @@ bool QgsDwgImporter::expandInserts( QString &error )
++j;
}

if ( f )
OGR_F_Destroy( f );

OGR_DS_ReleaseResultSet( mDs, src );

QgsDebugMsgLevel( QString( "%1: %2 features copied" ).arg( name ).arg( j ), 5 );
}
}

if ( insert )
OGR_F_Destroy( insert );

if ( errors > 0 )
{
error = QObject::tr( "%1 write errors during block expansion" ).arg( errors );
Expand Down
3 changes: 0 additions & 3 deletions src/server/services/wfs/qgswfstransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,6 @@ namespace QgsWfs
respElem.appendChild( trElem );

return resp;


return doc;
}

namespace
Expand Down

0 comments on commit 737c92d

Please sign in to comment.