Skip to content

Commit 4a997c9

Browse files
committedJul 20, 2018
Fix some clazy warnings
(cherry-picked from 4fccc5e)
1 parent f05f2b6 commit 4a997c9

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed
 

‎src/core/raster/qgsrasterinterface.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void QgsRasterInterface::initStatistics( QgsRasterBandStats &statistics,
3939
const QgsRectangle &boundingBox,
4040
int sampleSize )
4141
{
42-
QgsDebugMsgLevel( QString( "theBandNo = %1 sampleSize = %2" ).arg( bandNo ).arg( sampleSize ), 4 );
42+
QgsDebugMsgLevel( QStringLiteral( "theBandNo = %1 sampleSize = %2" ).arg( bandNo ).arg( sampleSize ), 4 );
4343

4444
statistics.bandNumber = bandNo;
4545
statistics.statsGathered = stats;
@@ -87,15 +87,15 @@ void QgsRasterInterface::initStatistics( QgsRasterBandStats &statistics,
8787
statistics.height = 1000;
8888
}
8989
}
90-
QgsDebugMsgLevel( QString( "theStatistics.width = %1 statistics.height = %2" ).arg( statistics.width ).arg( statistics.height ), 4 );
90+
QgsDebugMsgLevel( QStringLiteral( "theStatistics.width = %1 statistics.height = %2" ).arg( statistics.width ).arg( statistics.height ), 4 );
9191
}
9292

9393
bool QgsRasterInterface::hasStatistics( int bandNo,
9494
int stats,
9595
const QgsRectangle &extent,
9696
int sampleSize )
9797
{
98-
QgsDebugMsgLevel( QString( "theBandNo = %1 stats = %2 sampleSize = %3" ).arg( bandNo ).arg( stats ).arg( sampleSize ), 4 );
98+
QgsDebugMsgLevel( QStringLiteral( "theBandNo = %1 stats = %2 sampleSize = %3" ).arg( bandNo ).arg( stats ).arg( sampleSize ), 4 );
9999
if ( mStatistics.isEmpty() ) return false;
100100

101101
QgsRasterBandStats myRasterBandStats;
@@ -105,7 +105,7 @@ bool QgsRasterInterface::hasStatistics( int bandNo,
105105
{
106106
if ( stats.contains( myRasterBandStats ) )
107107
{
108-
QgsDebugMsgLevel( "Has cached statistics.", 4 );
108+
QgsDebugMsgLevel( QStringLiteral( "Has cached statistics." ), 4 );
109109
return true;
110110
}
111111
}
@@ -117,7 +117,7 @@ QgsRasterBandStats QgsRasterInterface::bandStatistics( int bandNo,
117117
const QgsRectangle &extent,
118118
int sampleSize, QgsRasterBlockFeedback *feedback )
119119
{
120-
QgsDebugMsgLevel( QString( "theBandNo = %1 stats = %2 sampleSize = %3" ).arg( bandNo ).arg( stats ).arg( sampleSize ), 4 );
120+
QgsDebugMsgLevel( QStringLiteral( "theBandNo = %1 stats = %2 sampleSize = %3" ).arg( bandNo ).arg( stats ).arg( sampleSize ), 4 );
121121

122122
// TODO: null values set on raster layer!!!
123123

@@ -128,7 +128,7 @@ QgsRasterBandStats QgsRasterInterface::bandStatistics( int bandNo,
128128
{
129129
if ( stats.contains( myRasterBandStats ) )
130130
{
131-
QgsDebugMsgLevel( "Using cached statistics.", 4 );
131+
QgsDebugMsgLevel( QStringLiteral( "Using cached statistics." ), 4 );
132132
return stats;
133133
}
134134
}
@@ -169,7 +169,7 @@ QgsRasterBandStats QgsRasterInterface::bandStatistics( int bandNo,
169169
if ( feedback && feedback->isCanceled() )
170170
return myRasterBandStats;
171171

172-
QgsDebugMsgLevel( QString( "myYBlock = %1 myXBlock = %2" ).arg( myYBlock ).arg( myXBlock ), 4 );
172+
QgsDebugMsgLevel( QStringLiteral( "myYBlock = %1 myXBlock = %2" ).arg( myYBlock ).arg( myXBlock ), 4 );
173173
int myBlockWidth = std::min( myXBlockSize, myWidth - myXBlock * myXBlockSize );
174174
int myBlockHeight = std::min( myYBlockSize, myHeight - myYBlock * myYBlockSize );
175175

@@ -230,12 +230,12 @@ QgsRasterBandStats QgsRasterInterface::bandStatistics( int bandNo,
230230
// Divide result by sample size - 1 and get square root to get stdev
231231
myRasterBandStats.stdDev = std::sqrt( mySumOfSquares / ( myRasterBandStats.elementCount - 1 ) );
232232

233-
QgsDebugMsgLevel( "************ STATS **************", 4 );
234-
QgsDebugMsgLevel( QString( "MIN %1" ).arg( myRasterBandStats.minimumValue ), 4 );
235-
QgsDebugMsgLevel( QString( "MAX %1" ).arg( myRasterBandStats.maximumValue ), 4 );
236-
QgsDebugMsgLevel( QString( "RANGE %1" ).arg( myRasterBandStats.range ), 4 );
237-
QgsDebugMsgLevel( QString( "MEAN %1" ).arg( myRasterBandStats.mean ), 4 );
238-
QgsDebugMsgLevel( QString( "STDDEV %1" ).arg( myRasterBandStats.stdDev ), 4 );
233+
QgsDebugMsgLevel( QStringLiteral( "************ STATS **************" ), 4 );
234+
QgsDebugMsgLevel( QStringLiteral( "MIN %1" ).arg( myRasterBandStats.minimumValue ), 4 );
235+
QgsDebugMsgLevel( QStringLiteral( "MAX %1" ).arg( myRasterBandStats.maximumValue ), 4 );
236+
QgsDebugMsgLevel( QStringLiteral( "RANGE %1" ).arg( myRasterBandStats.range ), 4 );
237+
QgsDebugMsgLevel( QStringLiteral( "MEAN %1" ).arg( myRasterBandStats.mean ), 4 );
238+
QgsDebugMsgLevel( QStringLiteral( "STDDEV %1" ).arg( myRasterBandStats.stdDev ), 4 );
239239

240240
myRasterBandStats.statsGathered = QgsRasterBandStats::All;
241241
mStatistics.append( myRasterBandStats );
@@ -313,7 +313,7 @@ void QgsRasterInterface::initHistogram( QgsRasterHistogram &histogram,
313313
if ( xRes < srcXRes ) xRes = srcXRes;
314314
if ( yRes < srcYRes ) yRes = srcYRes;
315315
}
316-
QgsDebugMsgLevel( QString( "xRes = %1 yRes = %2" ).arg( xRes ).arg( yRes ), 4 );
316+
QgsDebugMsgLevel( QStringLiteral( "xRes = %1 yRes = %2" ).arg( xRes ).arg( yRes ), 4 );
317317

318318
histogram.width = static_cast <int>( finalExtent.width() / xRes );
319319
histogram.height = static_cast <int>( finalExtent.height() / yRes );
@@ -331,7 +331,7 @@ void QgsRasterInterface::initHistogram( QgsRasterHistogram &histogram,
331331
histogram.height = 1000;
332332
}
333333
}
334-
QgsDebugMsgLevel( QString( "theHistogram.width = %1 histogram.height = %2" ).arg( histogram.width ).arg( histogram.height ), 4 );
334+
QgsDebugMsgLevel( QStringLiteral( "theHistogram.width = %1 histogram.height = %2" ).arg( histogram.width ).arg( histogram.height ), 4 );
335335

336336
int myBinCount = binCount;
337337
if ( myBinCount == 0 )
@@ -360,7 +360,7 @@ void QgsRasterInterface::initHistogram( QgsRasterHistogram &histogram,
360360
}
361361
}
362362
histogram.binCount = myBinCount;
363-
QgsDebugMsgLevel( QString( "theHistogram.binCount = %1" ).arg( histogram.binCount ), 4 );
363+
QgsDebugMsgLevel( QStringLiteral( "theHistogram.binCount = %1" ).arg( histogram.binCount ), 4 );
364364
}
365365

366366

@@ -371,7 +371,7 @@ bool QgsRasterInterface::hasHistogram( int bandNo,
371371
int sampleSize,
372372
bool includeOutOfRange )
373373
{
374-
QgsDebugMsgLevel( QString( "theBandNo = %1 binCount = %2 minimum = %3 maximum = %4 sampleSize = %5" ).arg( bandNo ).arg( binCount ).arg( minimum ).arg( maximum ).arg( sampleSize ), 4 );
374+
QgsDebugMsgLevel( QStringLiteral( "theBandNo = %1 binCount = %2 minimum = %3 maximum = %4 sampleSize = %5" ).arg( bandNo ).arg( binCount ).arg( minimum ).arg( maximum ).arg( sampleSize ), 4 );
375375
// histogramDefaults() needs statistics if minimum or maximum is NaN ->
376376
// do other checks which don't need statistics before histogramDefaults()
377377
if ( mHistograms.isEmpty() ) return false;
@@ -383,7 +383,7 @@ bool QgsRasterInterface::hasHistogram( int bandNo,
383383
{
384384
if ( histogram == myHistogram )
385385
{
386-
QgsDebugMsgLevel( "Has cached histogram.", 4 );
386+
QgsDebugMsgLevel( QStringLiteral( "Has cached histogram." ), 4 );
387387
return true;
388388
}
389389
}
@@ -397,7 +397,7 @@ QgsRasterHistogram QgsRasterInterface::histogram( int bandNo,
397397
int sampleSize,
398398
bool includeOutOfRange, QgsRasterBlockFeedback *feedback )
399399
{
400-
QgsDebugMsgLevel( QString( "theBandNo = %1 binCount = %2 minimum = %3 maximum = %4 sampleSize = %5" ).arg( bandNo ).arg( binCount ).arg( minimum ).arg( maximum ).arg( sampleSize ), 4 );
400+
QgsDebugMsgLevel( QStringLiteral( "theBandNo = %1 binCount = %2 minimum = %3 maximum = %4 sampleSize = %5" ).arg( bandNo ).arg( binCount ).arg( minimum ).arg( maximum ).arg( sampleSize ), 4 );
401401

402402
QgsRasterHistogram myHistogram;
403403
initHistogram( myHistogram, bandNo, binCount, minimum, maximum, extent, sampleSize, includeOutOfRange );
@@ -407,7 +407,7 @@ QgsRasterHistogram QgsRasterInterface::histogram( int bandNo,
407407
{
408408
if ( histogram == myHistogram )
409409
{
410-
QgsDebugMsgLevel( "Using cached histogram.", 4 );
410+
QgsDebugMsgLevel( QStringLiteral( "Using cached histogram." ), 4 );
411411
return histogram;
412412
}
413413
}
@@ -444,7 +444,7 @@ QgsRasterHistogram QgsRasterInterface::histogram( int bandNo,
444444
myMinimum -= 0.1 * myerval;
445445
myMaximum += 0.1 * myerval;
446446

447-
QgsDebugMsgLevel( QString( "binCount = %1 myMinimum = %2 myMaximum = %3" ).arg( myHistogram.binCount ).arg( myMinimum ).arg( myMaximum ), 4 );
447+
QgsDebugMsgLevel( QStringLiteral( "binCount = %1 myMinimum = %2 myMaximum = %3" ).arg( myHistogram.binCount ).arg( myMinimum ).arg( myMaximum ), 4 );
448448

449449
double myBinSize = ( myMaximum - myMinimum ) / myBinCount;
450450

@@ -502,7 +502,7 @@ QgsRasterHistogram QgsRasterInterface::histogram( int bandNo,
502502
{
503503
hist += QString::number( myHistogram.histogramVector.value( i ) ) + ' ';
504504
}
505-
QgsDebugMsgLevel( "Histogram (max first 500 bins): " + hist, 4 );
505+
QgsDebugMsgLevel( QStringLiteral( "Histogram (max first 500 bins): " ) + hist, 4 );
506506
#endif
507507

508508
return myHistogram;
@@ -514,7 +514,7 @@ void QgsRasterInterface::cumulativeCut( int bandNo,
514514
const QgsRectangle &extent,
515515
int sampleSize )
516516
{
517-
QgsDebugMsgLevel( QString( "theBandNo = %1 lowerCount = %2 upperCount = %3 sampleSize = %4" ).arg( bandNo ).arg( lowerCount ).arg( upperCount ).arg( sampleSize ), 4 );
517+
QgsDebugMsgLevel( QStringLiteral( "theBandNo = %1 lowerCount = %2 upperCount = %3 sampleSize = %4" ).arg( bandNo ).arg( lowerCount ).arg( upperCount ).arg( sampleSize ), 4 );
518518

519519
int mySrcDataType = sourceDataType( bandNo );
520520

@@ -537,8 +537,8 @@ void QgsRasterInterface::cumulativeCut( int bandNo,
537537
int myMinCount = static_cast< int >( std::round( lowerCount * myHistogram.nonNullCount ) );
538538
int myMaxCount = static_cast< int >( std::round( upperCount * myHistogram.nonNullCount ) );
539539
bool myLowerFound = false;
540-
QgsDebugMsgLevel( QString( "binCount = %1 minimum = %2 maximum = %3 myBinXStep = %4" ).arg( myHistogram.binCount ).arg( myHistogram.minimum ).arg( myHistogram.maximum ).arg( myBinXStep ), 4 );
541-
QgsDebugMsgLevel( QString( "myMinCount = %1 myMaxCount = %2" ).arg( myMinCount ).arg( myMaxCount ), 4 );
540+
QgsDebugMsgLevel( QStringLiteral( "binCount = %1 minimum = %2 maximum = %3 myBinXStep = %4" ).arg( myHistogram.binCount ).arg( myHistogram.minimum ).arg( myHistogram.maximum ).arg( myBinXStep ), 4 );
541+
QgsDebugMsgLevel( QStringLiteral( "myMinCount = %1 myMaxCount = %2" ).arg( myMinCount ).arg( myMaxCount ), 4 );
542542

543543
for ( int myBin = 0; myBin < myHistogram.histogramVector.size(); myBin++ )
544544
{
@@ -548,12 +548,12 @@ void QgsRasterInterface::cumulativeCut( int bandNo,
548548
{
549549
lowerValue = myHistogram.minimum + myBin * myBinXStep;
550550
myLowerFound = true;
551-
QgsDebugMsgLevel( QString( "found lowerValue %1 at bin %2" ).arg( lowerValue ).arg( myBin ), 4 );
551+
QgsDebugMsgLevel( QStringLiteral( "found lowerValue %1 at bin %2" ).arg( lowerValue ).arg( myBin ), 4 );
552552
}
553553
if ( myCount >= myMaxCount )
554554
{
555555
upperValue = myHistogram.minimum + myBin * myBinXStep;
556-
QgsDebugMsgLevel( QString( "found upperValue %1 at bin %2" ).arg( upperValue ).arg( myBin ), 4 );
556+
QgsDebugMsgLevel( QStringLiteral( "found upperValue %1 at bin %2" ).arg( upperValue ).arg( myBin ), 4 );
557557
break;
558558
}
559559
}
@@ -563,9 +563,9 @@ void QgsRasterInterface::cumulativeCut( int bandNo,
563563
mySrcDataType == Qgis::Int16 || mySrcDataType == Qgis::Int32 ||
564564
mySrcDataType == Qgis::UInt16 || mySrcDataType == Qgis::UInt32 )
565565
{
566-
if ( lowerValue != std::numeric_limits<double>::quiet_NaN() )
566+
if ( !std::isnan( lowerValue ) )
567567
lowerValue = std::floor( lowerValue );
568-
if ( upperValue != std::numeric_limits<double>::quiet_NaN() )
568+
if ( !std::isnan( upperValue ) )
569569
upperValue = std::ceil( upperValue );
570570
}
571571
}
@@ -600,7 +600,7 @@ QString QgsRasterInterface::capabilitiesString() const
600600
abilitiesList += tr( "Build Pyramids" );
601601
}
602602

603-
QgsDebugMsgLevel( "Capability: " + abilitiesList.join( ", " ), 4 );
603+
QgsDebugMsgLevel( "Capability: " + abilitiesList.join( QStringLiteral( ", " ) ), 4 );
604604

605605
return abilitiesList.join( QStringLiteral( ", " ) );
606606
}

0 commit comments

Comments
 (0)
Please sign in to comment.