Skip to content

Commit 737c92d

Browse files
committedFeb 6, 2017
Fix logically dead code identified by Coverity
1 parent a80cca0 commit 737c92d

File tree

2 files changed

+46
-57
lines changed

2 files changed

+46
-57
lines changed
 

‎src/app/dwg/qgsdwgimporter.cpp

Lines changed: 46 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -635,56 +635,54 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa
635635
return false;
636636
}
637637

638-
if ( result != DRW::BAD_NONE )
638+
switch ( result )
639639
{
640-
switch ( result )
641-
{
642-
case DRW::BAD_NONE:
643-
error = QObject::tr( "No error." );
644-
break;
645-
case DRW::BAD_UNKNOWN:
646-
error = QObject::tr( "Unknown error." );
647-
break;
648-
case DRW::BAD_OPEN:
649-
error = QObject::tr( "error opening file." );
650-
break;
651-
case DRW::BAD_VERSION:
652-
error = QObject::tr( "unsupported version." );
653-
break;
654-
case DRW::BAD_READ_METADATA:
655-
error = QObject::tr( "error reading metadata." );
656-
break;
657-
case DRW::BAD_READ_FILE_HEADER:
658-
error = QObject::tr( "error in file header read process." );
659-
break;
660-
case DRW::BAD_READ_HEADER:
661-
error = QObject::tr( "error in header vars read process." );
662-
break;
663-
case DRW::BAD_READ_HANDLES:
664-
error = QObject::tr( "error in object map read process." );
665-
break;
666-
case DRW::BAD_READ_CLASSES:
667-
error = QObject::tr( "error in classes read process." );
668-
break;
669-
case DRW::BAD_READ_TABLES:
670-
error = QObject::tr( "error in tables read process." );
671-
result = DRW::BAD_NONE;
672-
break;
673-
case DRW::BAD_READ_BLOCKS:
674-
error = QObject::tr( "error in block read process." );
675-
break;
676-
case DRW::BAD_READ_ENTITIES:
677-
error = QObject::tr( "error in entities read process." );
678-
break;
679-
case DRW::BAD_READ_OBJECTS:
680-
error = QObject::tr( "error in objects read process." );
681-
break;
682-
}
640+
case DRW::BAD_NONE:
641+
error = QObject::tr( "No error." );
642+
break;
643+
case DRW::BAD_UNKNOWN:
644+
error = QObject::tr( "Unknown error." );
645+
break;
646+
case DRW::BAD_OPEN:
647+
error = QObject::tr( "error opening file." );
648+
break;
649+
case DRW::BAD_VERSION:
650+
error = QObject::tr( "unsupported version." );
651+
break;
652+
case DRW::BAD_READ_METADATA:
653+
error = QObject::tr( "error reading metadata." );
654+
break;
655+
case DRW::BAD_READ_FILE_HEADER:
656+
error = QObject::tr( "error in file header read process." );
657+
break;
658+
case DRW::BAD_READ_HEADER:
659+
error = QObject::tr( "error in header vars read process." );
660+
break;
661+
case DRW::BAD_READ_HANDLES:
662+
error = QObject::tr( "error in object map read process." );
663+
break;
664+
case DRW::BAD_READ_CLASSES:
665+
error = QObject::tr( "error in classes read process." );
666+
break;
667+
case DRW::BAD_READ_TABLES:
668+
error = QObject::tr( "error in tables read process." );
669+
result = DRW::BAD_NONE;
670+
break;
671+
case DRW::BAD_READ_BLOCKS:
672+
error = QObject::tr( "error in block read process." );
673+
break;
674+
case DRW::BAD_READ_ENTITIES:
675+
error = QObject::tr( "error in entities read process." );
676+
break;
677+
case DRW::BAD_READ_OBJECTS:
678+
error = QObject::tr( "error in objects read process." );
679+
break;
680+
}
683681

682+
if ( result != DRW::BAD_NONE )
683+
{
684684
QgsDebugMsg( QString( "error:%1" ).arg( error ) );
685-
686-
if ( result != DRW::BAD_NONE )
687-
return false;
685+
return false;
688686
}
689687

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

25542552
OGRFeatureH insert = nullptr;
25552553
int i = 0, errors = 0;
2556-
for ( int i = 0, errors = 0; true; ++i )
2554+
for ( int i = 0; true; ++i )
25572555
{
25582556
if ( i % 1000 == 0 )
25592557
{
@@ -2731,18 +2729,12 @@ bool QgsDwgImporter::expandInserts( QString &error )
27312729
++j;
27322730
}
27332731

2734-
if ( f )
2735-
OGR_F_Destroy( f );
2736-
27372732
OGR_DS_ReleaseResultSet( mDs, src );
27382733

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

2743-
if ( insert )
2744-
OGR_F_Destroy( insert );
2745-
27462738
if ( errors > 0 )
27472739
{
27482740
error = QObject::tr( "%1 write errors during block expansion" ).arg( errors );

‎src/server/services/wfs/qgswfstransaction.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,6 @@ namespace QgsWfs
485485
respElem.appendChild( trElem );
486486

487487
return resp;
488-
489-
490-
return doc;
491488
}
492489

493490
namespace

0 commit comments

Comments
 (0)
Please sign in to comment.