@@ -635,56 +635,54 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa
635
635
return false ;
636
636
}
637
637
638
- if ( result != DRW::BAD_NONE )
638
+ switch ( result )
639
639
{
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
+ }
683
681
682
+ if ( result != DRW::BAD_NONE )
683
+ {
684
684
QgsDebugMsg ( QString ( " error:%1" ).arg ( error ) );
685
-
686
- if ( result != DRW::BAD_NONE )
687
- return false ;
685
+ return false ;
688
686
}
689
687
690
688
return !doExpandInserts || expandInserts ( error );
@@ -2553,7 +2551,7 @@ bool QgsDwgImporter::expandInserts( QString &error )
2553
2551
2554
2552
OGRFeatureH insert = nullptr ;
2555
2553
int i = 0 , errors = 0 ;
2556
- for ( int i = 0 , errors = 0 ; true ; ++i )
2554
+ for ( int i = 0 ; true ; ++i )
2557
2555
{
2558
2556
if ( i % 1000 == 0 )
2559
2557
{
@@ -2731,18 +2729,12 @@ bool QgsDwgImporter::expandInserts( QString &error )
2731
2729
++j;
2732
2730
}
2733
2731
2734
- if ( f )
2735
- OGR_F_Destroy ( f );
2736
-
2737
2732
OGR_DS_ReleaseResultSet ( mDs , src );
2738
2733
2739
2734
QgsDebugMsgLevel ( QString ( " %1: %2 features copied" ).arg ( name ).arg ( j ), 5 );
2740
2735
}
2741
2736
}
2742
2737
2743
- if ( insert )
2744
- OGR_F_Destroy ( insert );
2745
-
2746
2738
if ( errors > 0 )
2747
2739
{
2748
2740
error = QObject::tr ( " %1 write errors during block expansion" ).arg ( errors );
0 commit comments