@@ -884,12 +884,12 @@ void QgsGdalProvider::computeMinMax( int theBandNo )
884
884
return ;
885
885
}
886
886
GDALRasterBandH myGdalBand = GDALGetRasterBand ( mGdalDataset , theBandNo );
887
- int bApproxOK= false ;
887
+ int bApproxOK = false ;
888
888
int bGotMin, bGotMax;
889
889
double adfMinMax[2 ];
890
890
adfMinMax[0 ] = GDALGetRasterMinimum ( myGdalBand, &bGotMin );
891
891
adfMinMax[1 ] = GDALGetRasterMaximum ( myGdalBand, &bGotMax );
892
- if ( ! ( bGotMin && bGotMax ) )
892
+ if ( !( bGotMin && bGotMax ) )
893
893
{
894
894
GDALComputeRasterMinMax ( myGdalBand, TRUE , adfMinMax );
895
895
}
@@ -1838,7 +1838,7 @@ QgsRasterBandStats QgsGdalProvider::bandStatistics( int theBandNo )
1838
1838
{
1839
1839
GDALRasterBandH myGdalBand = GDALGetRasterBand ( mGdalDataset , theBandNo );
1840
1840
QgsRasterBandStats myRasterBandStats;
1841
- int bApproxOK= false ;
1841
+ int bApproxOK = false ;
1842
1842
double pdfMin;
1843
1843
double pdfMax;
1844
1844
double pdfMean;
@@ -1847,26 +1847,26 @@ QgsRasterBandStats QgsGdalProvider::bandStatistics( int theBandNo )
1847
1847
myProg.type = ProgressHistogram;
1848
1848
myProg.provider = this ;
1849
1849
1850
- // double myerval =
1851
- // GDALComputeRasterStatistics (
1852
- // myGdalBand, bApproxOK, &pdfMin, &pdfMax, &pdfMean, &pdfStdDev,
1853
- // progressCallback, &myProg ) ;
1854
- // double myerval =
1850
+ // double myerval =
1851
+ // GDALComputeRasterStatistics (
1852
+ // myGdalBand, bApproxOK, &pdfMin, &pdfMax, &pdfMean, &pdfStdDev,
1853
+ // progressCallback, &myProg ) ;
1854
+ // double myerval =
1855
1855
// GDALGetRasterStatistics ( myGdalBand, bApproxOK, TRUE, &pdfMin, &pdfMax, &pdfMean, &pdfStdDev);
1856
- // double myerval =
1856
+ // double myerval =
1857
1857
// GDALGetRasterStatisticsProgress ( myGdalBand, bApproxOK, TRUE, &pdfMin, &pdfMax, &pdfMean, &pdfStdDev,
1858
- // progressCallback, &myProg );
1858
+ // progressCallback, &myProg );
1859
1859
1860
1860
// try to fetch the cached stats (bForce=FALSE)
1861
- CPLErr myerval =
1862
- GDALGetRasterStatistics ( myGdalBand, bApproxOK, FALSE , &pdfMin, &pdfMax, &pdfMean, &pdfStdDev);
1861
+ CPLErr myerval =
1862
+ GDALGetRasterStatistics ( myGdalBand, bApproxOK, FALSE , &pdfMin, &pdfMax, &pdfMean, &pdfStdDev );
1863
1863
1864
1864
// if cached stats are not found, compute them
1865
1865
if ( CE_Warning == myerval )
1866
1866
{
1867
- myerval = GDALComputeRasterStatistics ( myGdalBand, bApproxOK,
1868
- &pdfMin, &pdfMax, &pdfMean, &pdfStdDev,
1869
- progressCallback, &myProg ) ;
1867
+ myerval = GDALComputeRasterStatistics ( myGdalBand, bApproxOK,
1868
+ &pdfMin, &pdfMax, &pdfMean, &pdfStdDev,
1869
+ progressCallback, &myProg ) ;
1870
1870
}
1871
1871
1872
1872
// if stats are found populate the QgsRasterBandStats object
@@ -2010,6 +2010,8 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
2010
2010
if ( !hDS )
2011
2011
return 0 ;
2012
2012
2013
+ GDALClose ( hDS );
2014
+
2013
2015
QgsDebugMsg ( " GdalDataset opened " + thePath );
2014
2016
2015
2017
QString name = info.fileName ();
0 commit comments