Skip to content

Commit 1b8a100

Browse files
Arunmozhimhugent
Arunmozhi
authored andcommitted
refactored code to reduce loop in favour of a func
1 parent c9d9c17 commit 1b8a100

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.cpp

+2-22
Original file line numberDiff line numberDiff line change
@@ -70,28 +70,8 @@ QgsRasterTerrainAnalysisDialog::QgsRasterTerrainAnalysisDialog( DisplayMode mode
7070

7171
//store the driver shortnames and the corresponding extensions
7272
//(just in case the user does not give an extension for the output file name)
73-
int index = 0;
74-
while (( driverMetadata ) && driverMetadata[index] != 0 )
75-
{
76-
QStringList metadataTokens = QString( driverMetadata[index] ).split( "=", QString::SkipEmptyParts );
77-
if ( metadataTokens.size() < 1 )
78-
{
79-
break;
80-
}
81-
82-
if ( metadataTokens[0] == "DMD_EXTENSION" )
83-
{
84-
if ( metadataTokens.size() < 2 )
85-
{
86-
++index;
87-
continue;
88-
}
89-
mDriverExtensionMap.insert( QString( GDALGetDriverShortName( driver ) ), metadataTokens[1] );
90-
break;
91-
}
92-
++index;
93-
}
94-
73+
QString driverExtension = GDALGetMetadataItem( driver, GDAL_DMD_EXTENSION, NULL );
74+
mDriverExtensionMap.insert( QString( GDALGetDriverShortName( driver ) ), driverExtension );
9575
}
9676
}
9777
}

0 commit comments

Comments
 (0)