@@ -884,12 +884,12 @@ void QgsGdalProvider::computeMinMax( int theBandNo )
884884 return ;
885885 }
886886 GDALRasterBandH myGdalBand = GDALGetRasterBand ( mGdalDataset , theBandNo );
887- int bApproxOK= false ;
887+ int bApproxOK = false ;
888888 int bGotMin, bGotMax;
889889 double adfMinMax[2 ];
890890 adfMinMax[0 ] = GDALGetRasterMinimum ( myGdalBand, &bGotMin );
891891 adfMinMax[1 ] = GDALGetRasterMaximum ( myGdalBand, &bGotMax );
892- if ( ! ( bGotMin && bGotMax ) )
892+ if ( !( bGotMin && bGotMax ) )
893893 {
894894 GDALComputeRasterMinMax ( myGdalBand, TRUE , adfMinMax );
895895 }
@@ -1838,7 +1838,7 @@ QgsRasterBandStats QgsGdalProvider::bandStatistics( int theBandNo )
18381838{
18391839 GDALRasterBandH myGdalBand = GDALGetRasterBand ( mGdalDataset , theBandNo );
18401840 QgsRasterBandStats myRasterBandStats;
1841- int bApproxOK= false ;
1841+ int bApproxOK = false ;
18421842 double pdfMin;
18431843 double pdfMax;
18441844 double pdfMean;
@@ -1847,26 +1847,26 @@ QgsRasterBandStats QgsGdalProvider::bandStatistics( int theBandNo )
18471847 myProg.type = ProgressHistogram;
18481848 myProg.provider = this ;
18491849
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 =
18551855 // GDALGetRasterStatistics ( myGdalBand, bApproxOK, TRUE, &pdfMin, &pdfMax, &pdfMean, &pdfStdDev);
1856- // double myerval =
1856+ // double myerval =
18571857 // GDALGetRasterStatisticsProgress ( myGdalBand, bApproxOK, TRUE, &pdfMin, &pdfMax, &pdfMean, &pdfStdDev,
1858- // progressCallback, &myProg );
1858+ // progressCallback, &myProg );
18591859
18601860 // 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 );
18631863
18641864 // if cached stats are not found, compute them
18651865 if ( CE_Warning == myerval )
18661866 {
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 ) ;
18701870 }
18711871
18721872 // if stats are found populate the QgsRasterBandStats object
@@ -2010,6 +2010,8 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
20102010 if ( !hDS )
20112011 return 0 ;
20122012
2013+ GDALClose ( hDS );
2014+
20132015 QgsDebugMsg ( " GdalDataset opened " + thePath );
20142016
20152017 QString name = info.fileName ();
0 commit comments