Skip to content
Permalink
Browse files

Fix logically dead code identified by Coverity

  • Loading branch information
nyalldawson committed Feb 6, 2017
1 parent a80cca0 commit 737c92ddbb9cb8ac4d18325b00a0cab17a8bc3b7
Showing with 46 additions and 57 deletions.
  1. +46 −54 src/app/dwg/qgsdwgimporter.cpp
  2. +0 −3 src/server/services/wfs/qgswfstransaction.cpp
@@ -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 );
@@ -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 )
{
@@ -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 );
@@ -485,9 +485,6 @@ namespace QgsWfs
respElem.appendChild( trElem );

return resp;


return doc;
}

namespace

0 comments on commit 737c92d

Please sign in to comment.
You can’t perform that action at this time.