Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
(q)floor -> std::floor
  • Loading branch information
nyalldawson committed Aug 24, 2017
1 parent 2e5d1ab commit 8c64d80
Show file tree
Hide file tree
Showing 31 changed files with 87 additions and 87 deletions.
2 changes: 1 addition & 1 deletion src/analysis/raster/qgsalignraster.cpp
Expand Up @@ -41,7 +41,7 @@ static double floor_with_tolerance( double value )
if ( std::fabs( value - std::round( value ) ) < 1e-6 )
return std::round( value );
else
return qFloor( value );
return floor( value );
}

static double fmod_with_tolerance( double num, double denom )
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/raster/qgsrastermatrix.cpp
Expand Up @@ -415,7 +415,7 @@ bool QgsRasterMatrix::twoArgumentOperation( TwoArgOperator op, const QgsRasterMa

bool QgsRasterMatrix::testPowerValidity( double base, double power ) const
{
if ( ( base == 0 && power < 0 ) || ( base < 0 && ( power - floor( power ) ) > 0 ) )
if ( ( base == 0 && power < 0 ) || ( base < 0 && ( power - std::floor( power ) ) > 0 ) )
{
return false;
}
Expand Down
32 changes: 16 additions & 16 deletions src/analysis/vector/qgsgeometrysnapper.cpp
Expand Up @@ -112,8 +112,8 @@ class Raytracer
Raytracer( float x0, float y0, float x1, float y1 )
: m_dx( std::fabs( x1 - x0 ) )
, m_dy( std::fabs( y1 - y0 ) )
, m_x( qFloor( x0 ) )
, m_y( qFloor( y0 ) )
, m_x( std::floor( x0 ) )
, m_y( std::floor( y0 ) )
, m_n( 1 )
{
if ( m_dx == 0. )
Expand All @@ -124,14 +124,14 @@ class Raytracer
else if ( x1 > x0 )
{
m_xInc = 1;
m_n += int( qFloor( x1 ) ) - m_x;
m_error = ( qFloor( x0 ) + 1 - x0 ) * m_dy;
m_n += int( std::floor( x1 ) ) - m_x;
m_error = ( std::floor( x0 ) + 1 - x0 ) * m_dy;
}
else
{
m_xInc = -1;
m_n += m_x - int( qFloor( x1 ) );
m_error = ( x0 - qFloor( x0 ) ) * m_dy;
m_n += m_x - int( std::floor( x1 ) );
m_error = ( x0 - std::floor( x0 ) ) * m_dy;
}
if ( m_dy == 0. )
{
Expand All @@ -141,14 +141,14 @@ class Raytracer
else if ( y1 > y0 )
{
m_yInc = 1;
m_n += int( qFloor( y1 ) ) - m_y;
m_error -= ( qFloor( y0 ) + 1 - y0 ) * m_dx;
m_n += int( std::floor( y1 ) ) - m_y;
m_error -= ( std::floor( y0 ) + 1 - y0 ) * m_dx;
}
else
{
m_yInc = -1;
m_n += m_y - int( qFloor( y1 ) );
m_error -= ( y0 - qFloor( y0 ) ) * m_dx;
m_n += m_y - int( std::floor( y1 ) );
m_error -= ( y0 - std::floor( y0 ) ) * m_dx;
}
}
int curCol() const { return m_x; }
Expand Down Expand Up @@ -302,8 +302,8 @@ QgsSnapIndex::Cell &QgsSnapIndex::getCreateCell( int col, int row )
void QgsSnapIndex::addPoint( const CoordIdx *idx, bool isEndPoint )
{
QgsPoint p = idx->point();
int col = qFloor( ( p.x() - mOrigin.x() ) / mCellSize );
int row = qFloor( ( p.y() - mOrigin.y() ) / mCellSize );
int col = std::floor( ( p.x() - mOrigin.x() ) / mCellSize );
int row = std::floor( ( p.y() - mOrigin.y() ) / mCellSize );
getCreateCell( col, row ).append( new PointSnapItem( idx, isEndPoint ) );
}

Expand Down Expand Up @@ -400,10 +400,10 @@ QgsPoint QgsSnapIndex::getClosestSnapToPoint( const QgsPoint &p, const QgsPoint

QgsSnapIndex::SnapItem *QgsSnapIndex::getSnapItem( const QgsPoint &pos, double tol, QgsSnapIndex::PointSnapItem **pSnapPoint, QgsSnapIndex::SegmentSnapItem **pSnapSegment, bool endPointOnly ) const
{
int colStart = qFloor( ( pos.x() - tol - mOrigin.x() ) / mCellSize );
int rowStart = qFloor( ( pos.y() - tol - mOrigin.y() ) / mCellSize );
int colEnd = qFloor( ( pos.x() + tol - mOrigin.x() ) / mCellSize );
int rowEnd = qFloor( ( pos.y() + tol - mOrigin.y() ) / mCellSize );
int colStart = std::floor( ( pos.x() - tol - mOrigin.x() ) / mCellSize );
int rowStart = std::floor( ( pos.y() - tol - mOrigin.y() ) / mCellSize );
int colEnd = std::floor( ( pos.x() + tol - mOrigin.x() ) / mCellSize );
int rowEnd = std::floor( ( pos.y() + tol - mOrigin.y() ) / mCellSize );

rowStart = qMax( rowStart, mRowsStartIdx );
rowEnd = qMin( rowEnd, mRowsStartIdx + mGridRows.size() - 1 );
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsdecorationgrid.cpp
Expand Up @@ -787,7 +787,7 @@ bool QgsDecorationGrid::getIntervalFromExtent( double *values, bool useXAxis )
if ( !qgsDoubleNear( interval, 0.0 ) )
{
double interval2 = 0;
int factor = std::pow( 10, floor( log10( interval ) ) );
int factor = std::pow( 10, std::floor( log10( interval ) ) );
if ( factor != 0 )
{
interval2 = std::round( interval / factor ) * factor;
Expand Down Expand Up @@ -842,9 +842,9 @@ bool QgsDecorationGrid::getIntervalFromCurrentLayer( double *values )
// calculate offset - when using very high resolution rasters in geographic CRS
// there seems to be a small shift, but this may be due to rendering issues and depends on zoom
double ratio = extent.xMinimum() / values[0];
values[2] = ( ratio - floor( ratio ) ) * values[0];
values[2] = ( ratio - std::floor( ratio ) ) * values[0];
ratio = extent.yMinimum() / values[1];
values[3] = ( ratio - floor( ratio ) ) * values[1];
values[3] = ( ratio - std::floor( ratio ) ) * values[1];

QgsDebugMsg( QString( "xmax: %1 xmin: %2 width: %3 xInterval: %4 xOffset: %5" ).arg(
extent.xMaximum() ).arg( extent.xMinimum() ).arg( rlayer->width() ).arg( values[0] ).arg( values[2] ) );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdecorationscalebar.cpp
Expand Up @@ -158,7 +158,7 @@ void QgsDecorationScaleBar::render( const QgsMapSettings &mapSettings, QgsRender

// Work out the exponent for the number - e.g, 1234 will give 3,
// and .001234 will give -3
double myPowerOf10 = floor( log10( myActualSize ) );
double myPowerOf10 = std::floor( log10( myActualSize ) );

// snap to integer < 10 times power of 10
if ( mSnapping )
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgspluginregistry.h
Expand Up @@ -104,7 +104,7 @@ class APP_EXPORT QgsPluginRegistry
bool checkPythonPlugin( const QString &packageName );

//! Check current QGIS version against requested minimal and optionally maximal QGIS version
//! if maxVersion not specified, the default value is assumed: floor(minVersion) + 0.99.99
//! if maxVersion not specified, the default value is assumed: std::floor(minVersion) + 0.99.99
bool checkQgisVersion( const QString &minVersion, const QString &maxVersion = "" ) const;

private:
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposermultiframe.cpp
Expand Up @@ -124,7 +124,7 @@ void QgsComposerMultiFrame::recalculateFrameSizes()
while ( ( mResizeMode == RepeatOnEveryPage ) || currentY < totalHeight )
{
//find out on which page the lower left point of the last frame is
int page = qFloor( ( currentItem->pos().y() + currentItem->rect().height() ) / ( mComposition->paperHeight() + mComposition->spaceBetweenPages() ) ) + 1;
int page = std::floor( ( currentItem->pos().y() + currentItem->rect().height() ) / ( mComposition->paperHeight() + mComposition->spaceBetweenPages() ) ) + 1;

if ( mResizeMode == RepeatOnEveryPage )
{
Expand Down
8 changes: 4 additions & 4 deletions src/core/composer/qgscomposerscalebar.cpp
Expand Up @@ -262,14 +262,14 @@ void QgsComposerScaleBar::refreshDataDefinedProperty( const QgsComposerObject::D
// nextNiceNumber(4573.23, d) = 5000 (d=1) -> 4600 (d=10) -> 4580 (d=100) -> 4574 (d=1000) -> etc
inline double nextNiceNumber( double a, double d = 1 )
{
double s = std::pow( 10.0, floor( log10( a ) ) ) / d;
double s = std::pow( 10.0, std::floor( log10( a ) ) ) / d;
return ceil( a / s ) * s;
}

// prevNiceNumber(4573.23, d) = 4000 (d=1) -> 4500 (d=10) -> 4570 (d=100) -> 4573 (d=1000) -> etc
inline double prevNiceNumber( double a, double d = 1 )
{
double s = std::pow( 10.0, floor( log10( a ) ) ) / d;
double s = std::pow( 10.0, std::floor( log10( a ) ) ) / d;
return floor( a / s ) * s;
}

Expand Down Expand Up @@ -473,9 +473,9 @@ void QgsComposerScaleBar::applyDefaultSize( QgsUnitTypes::DistanceUnit u )
}

double segmentWidth = initialUnitsPerSegment / upperMagnitudeMultiplier;
int segmentMagnitude = floor( log10( segmentWidth ) );
int segmentMagnitude = std::floor( log10( segmentWidth ) );
double unitsPerSegment = upperMagnitudeMultiplier * ( std::pow( 10.0, segmentMagnitude ) );
double multiplier = floor( ( widthInSelectedUnits / ( unitsPerSegment * 10.0 ) ) / 2.5 ) * 2.5;
double multiplier = std::floor( ( widthInSelectedUnits / ( unitsPerSegment * 10.0 ) ) / 2.5 ) * 2.5;

if ( multiplier > 0 )
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposertablev2.cpp
Expand Up @@ -278,7 +278,7 @@ int QgsComposerTableV2::rowsVisible( double frameHeight, int firstRow, bool incl
if ( includeEmptyRows && contentHeight > 0 )
{
double rowHeight = ( mShowGrid && mHorizontalGrid ? mGridStrokeWidth : 0 ) + 2 * mCellMargin + QgsComposerUtils::fontAscentMM( mContentFont );
currentRow += qMax( floor( contentHeight / rowHeight ), 0.0 );
currentRow += qMax( std::floor( contentHeight / rowHeight ), 0.0 );
}

return currentRow - firstRow - 1;
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposition.cpp
Expand Up @@ -572,7 +572,7 @@ QPointF QgsComposition::positionOnPage( QPointF position ) const

int QgsComposition::pageNumberForPoint( QPointF position ) const
{
int pageNumber = qFloor( position.y() / ( paperHeight() + spaceBetweenPages() ) ) + 1;
int pageNumber = std::floor( position.y() / ( paperHeight() + spaceBetweenPages() ) ) + 1;
pageNumber = pageNumber < 1 ? 1 : pageNumber;
pageNumber = pageNumber > mPages.size() ? mPages.size() : pageNumber;
return pageNumber;
Expand Down
2 changes: 1 addition & 1 deletion src/core/expression/qgsexpressionfunction.cpp
Expand Up @@ -859,7 +859,7 @@ static QVariant fcnClamp( const QVariantList &values, const QgsExpressionContext
static QVariant fcnFloor( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent )
{
double x = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent );
return QVariant( floor( x ) );
return QVariant( std::floor( x ) );
}

static QVariant fcnCeil( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent )
Expand Down
2 changes: 1 addition & 1 deletion src/core/expression/qgsexpressionnodeimpl.cpp
Expand Up @@ -268,7 +268,7 @@ QVariant QgsExpressionNodeBinaryOperator::evalNode( QgsExpression *parent, const
ENSURE_NO_EVAL_ERROR;
if ( fR == 0. )
return QVariant(); // silently handle division by zero and return NULL
return QVariant( qFloor( fL / fR ) );
return QVariant( qlonglong( std::floor( fL / fR ) ) );
}
case boPow:
if ( QgsExpressionUtils::isNull( vL ) || QgsExpressionUtils::isNull( vR ) )
Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgsinternalgeometryengine.cpp
Expand Up @@ -575,7 +575,7 @@ QgsLineString *doDensify( QgsLineString *ring, int extraNodesPerSegment = -1, do
if ( extraNodesPerSegment < 0 )
{
// distance mode
extraNodesThisSegment = floor( sqrt( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) ) / distance );
extraNodesThisSegment = std::floor( sqrt( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) ) / distance );
if ( extraNodesThisSegment >= 1 )
multiplier = 1.0 / ( extraNodesThisSegment + 1 );
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsfield.cpp
Expand Up @@ -270,7 +270,7 @@ bool QgsField::convertCompatible( QVariant &v ) const
{
double s = std::pow( 10, d->precision );
double d = v.toDouble() * s;
v = QVariant( ( d < 0 ? std::ceil( d - 0.5 ) : floor( d + 0.5 ) ) / s );
v = QVariant( ( d < 0 ? std::ceil( d - 0.5 ) : std::floor( d + 0.5 ) ) / s );
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/raster/qgscubicrasterresampler.cpp
Expand Up @@ -105,15 +105,15 @@ void QgsCubicRasterResampler::resample( const QImage &srcImage, QImage &dstImage

for ( int y = 0; y < dstImage.height(); ++y )
{
currentSrcRowInt = floor( currentSrcRow );
currentSrcRowInt = std::floor( currentSrcRow );
v = currentSrcRow - currentSrcRowInt;

currentSrcCol = nSrcPerDstX / 2.0 - 0.5;

QRgb *scanLine = ( QRgb * )dstImage.scanLine( y );
for ( int x = 0; x < dstImage.width(); ++x )
{
currentSrcColInt = floor( currentSrcCol );
currentSrcColInt = std::floor( currentSrcCol );
u = currentSrcCol - currentSrcColInt;

//handle eight edge-cases
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgsrasterblock.cpp
Expand Up @@ -279,7 +279,7 @@ double QgsRasterBlock::value( int row, int column ) const

QRgb QgsRasterBlock::color( qgssize index ) const
{
int row = floor( static_cast< double >( index ) / mWidth );
int row = std::floor( static_cast< double >( index ) / mWidth );
int column = index % mWidth;
return color( row, column );
}
Expand Down
12 changes: 6 additions & 6 deletions src/core/raster/qgsrasterdataprovider.cpp
Expand Up @@ -121,14 +121,14 @@ QgsRasterBlock *QgsRasterDataProvider::block( int bandNo, QgsRectangle const &b
// resolution to avoid possible shift due to resampling
if ( tmpXRes > xRes )
{
int col = floor( ( tmpExtent.xMinimum() - extent().xMinimum() ) / providerXRes );
int col = std::floor( ( tmpExtent.xMinimum() - extent().xMinimum() ) / providerXRes );
tmpExtent.setXMinimum( extent().xMinimum() + col * providerXRes );
col = std::ceil( ( tmpExtent.xMaximum() - extent().xMinimum() ) / providerXRes );
tmpExtent.setXMaximum( extent().xMinimum() + col * providerXRes );
}
if ( tmpYRes > yRes )
{
int row = floor( ( extent().yMaximum() - tmpExtent.yMaximum() ) / providerYRes );
int row = std::floor( ( extent().yMaximum() - tmpExtent.yMaximum() ) / providerYRes );
tmpExtent.setYMaximum( extent().yMaximum() - row * providerYRes );
row = std::ceil( ( extent().yMaximum() - tmpExtent.yMinimum() ) / providerYRes );
tmpExtent.setYMinimum( extent().yMaximum() - row * providerYRes );
Expand Down Expand Up @@ -159,12 +159,12 @@ QgsRasterBlock *QgsRasterDataProvider::block( int bandNo, QgsRectangle const &b
for ( int row = fromRow; row <= toRow; row++ )
{
double y = yMax - ( row + 0.5 ) * yRes;
int tmpRow = floor( ( tmpYMax - y ) / tmpYRes );
int tmpRow = std::floor( ( tmpYMax - y ) / tmpYRes );

for ( int col = fromCol; col <= toCol; col++ )
{
double x = xMin + ( col + 0.5 ) * xRes;
int tmpCol = floor( ( x - tmpXMin ) / tmpXRes );
int tmpCol = std::floor( ( x - tmpXMin ) / tmpXRes );

if ( tmpRow < 0 || tmpRow >= tmpHeight || tmpCol < 0 || tmpCol >= tmpWidth )
{
Expand Down Expand Up @@ -307,8 +307,8 @@ QgsRasterIdentifyResult QgsRasterDataProvider::identify( const QgsPointXY &point
double xres = ( finalExtent.width() ) / width;
double yres = ( finalExtent.height() ) / height;

int col = static_cast< int >( floor( ( point.x() - finalExtent.xMinimum() ) / xres ) );
int row = static_cast< int >( floor( ( finalExtent.yMaximum() - point.y() ) / yres ) );
int col = static_cast< int >( std::floor( ( point.x() - finalExtent.xMinimum() ) / xres ) );
int row = static_cast< int >( std::floor( ( finalExtent.yMaximum() - point.y() ) / yres ) );

double xMin = finalExtent.xMinimum() + col * xres;
double xMax = xMin + xres;
Expand Down
4 changes: 2 additions & 2 deletions src/core/raster/qgsrasterinterface.cpp
Expand Up @@ -479,7 +479,7 @@ QgsRasterHistogram QgsRasterInterface::histogram( int bandNo,
}
double myValue = blk->value( i );

int myBinIndex = static_cast <int>( qFloor( ( myValue - myMinimum ) / myBinSize ) );
int myBinIndex = static_cast <int>( std::floor( ( myValue - myMinimum ) / myBinSize ) );

if ( ( myBinIndex < 0 || myBinIndex > ( myBinCount - 1 ) ) && !includeOutOfRange )
{
Expand Down Expand Up @@ -566,7 +566,7 @@ void QgsRasterInterface::cumulativeCut( int bandNo,
mySrcDataType == Qgis::UInt16 || mySrcDataType == Qgis::UInt32 )
{
if ( lowerValue != std::numeric_limits<double>::quiet_NaN() )
lowerValue = floor( lowerValue );
lowerValue = std::floor( lowerValue );
if ( upperValue != std::numeric_limits<double>::quiet_NaN() )
upperValue = std::ceil( upperValue );
}
Expand Down
6 changes: 3 additions & 3 deletions src/core/raster/qgsrasterlayerrenderer.cpp
Expand Up @@ -126,14 +126,14 @@ QgsRasterLayerRenderer::QgsRasterLayerRenderer( QgsRasterLayer *layer, QgsRender
mRasterViewPort->mTopLeftPoint = mapToPixel.transform( myRasterExtent.xMinimum(), myRasterExtent.yMaximum() );
mRasterViewPort->mBottomRightPoint = mapToPixel.transform( myRasterExtent.xMaximum(), myRasterExtent.yMinimum() );

// align to output device grid, i.e. floor/ceil to integers
// align to output device grid, i.e. std::floor/ceil to integers
// TODO: this should only be done if paint device is raster - screen, image
// for other devices (pdf) it can have floating point origin
// we could use floating point for raster devices as well, but respecting the
// output device grid should make it more effective as the resampling is done in
// the provider anyway
mRasterViewPort->mTopLeftPoint.setX( floor( mRasterViewPort->mTopLeftPoint.x() ) );
mRasterViewPort->mTopLeftPoint.setY( floor( mRasterViewPort->mTopLeftPoint.y() ) );
mRasterViewPort->mTopLeftPoint.setX( std::floor( mRasterViewPort->mTopLeftPoint.x() ) );
mRasterViewPort->mTopLeftPoint.setY( std::floor( mRasterViewPort->mTopLeftPoint.y() ) );
mRasterViewPort->mBottomRightPoint.setX( std::ceil( mRasterViewPort->mBottomRightPoint.x() ) );
mRasterViewPort->mBottomRightPoint.setY( std::ceil( mRasterViewPort->mBottomRightPoint.y() ) );
// recalc myRasterExtent to aligned values
Expand Down
16 changes: 8 additions & 8 deletions src/core/raster/qgsrasterprojector.cpp
Expand Up @@ -255,7 +255,7 @@ void ProjectorData::calcSrcExtent()
if ( mMaxSrcXRes > 0 )
{
// with floor/ceil it should work correctly also for mSrcExtent.xMinimum() < mExtent.xMinimum()
double col = floor( ( mSrcExtent.xMinimum() - mExtent.xMinimum() ) / mMaxSrcXRes );
double col = std::floor( ( mSrcExtent.xMinimum() - mExtent.xMinimum() ) / mMaxSrcXRes );
double x = mExtent.xMinimum() + col * mMaxSrcXRes;
mSrcExtent.setXMinimum( x );

Expand All @@ -265,7 +265,7 @@ void ProjectorData::calcSrcExtent()
}
if ( mMaxSrcYRes > 0 )
{
double row = floor( ( mExtent.yMaximum() - mSrcExtent.yMaximum() ) / mMaxSrcYRes );
double row = std::floor( ( mExtent.yMaximum() - mSrcExtent.yMaximum() ) / mMaxSrcYRes );
double y = mExtent.yMaximum() - row * mMaxSrcYRes;
mSrcExtent.setYMaximum( y );

Expand Down Expand Up @@ -384,11 +384,11 @@ inline void ProjectorData::destPointOnCPMatrix( int row, int col, double *theX,

inline int ProjectorData::matrixRow( int destRow )
{
return static_cast< int >( floor( ( destRow + 0.5 ) / mDestRowsPerMatrixRow ) );
return static_cast< int >( std::floor( ( destRow + 0.5 ) / mDestRowsPerMatrixRow ) );
}
inline int ProjectorData::matrixCol( int destCol )
{
return static_cast< int >( floor( ( destCol + 0.5 ) / mDestColsPerMatrixCol ) );
return static_cast< int >( std::floor( ( destCol + 0.5 ) / mDestColsPerMatrixCol ) );
}

void ProjectorData::calcHelper( int matrixRow, QgsPointXY *points )
Expand Down Expand Up @@ -470,8 +470,8 @@ bool ProjectorData::preciseSrcRowCol( int destRow, int destCol, int *srcRow, int
return false;
}
// Get source row col
*srcRow = static_cast< int >( floor( ( mSrcExtent.yMaximum() - y ) / mSrcYRes ) );
*srcCol = static_cast< int >( floor( ( x - mSrcExtent.xMinimum() ) / mSrcXRes ) );
*srcRow = static_cast< int >( std::floor( ( mSrcExtent.yMaximum() - y ) / mSrcYRes ) );
*srcCol = static_cast< int >( std::floor( ( x - mSrcExtent.xMinimum() ) / mSrcXRes ) );
#ifdef QGISDEBUG
QgsDebugMsgLevel( QString( "mSrcExtent.yMinimum() = %1 mSrcExtent.yMaximum() = %2 mSrcYRes = %3" ).arg( mSrcExtent.yMinimum() ).arg( mSrcExtent.yMaximum() ).arg( mSrcYRes ), 5 );
QgsDebugMsgLevel( QString( "theSrcRow = %1 srcCol = %2" ).arg( *srcRow ).arg( *srcCol ), 5 );
Expand Down Expand Up @@ -532,8 +532,8 @@ bool ProjectorData::approximateSrcRowCol( int destRow, int destCol, int *srcRow,

// TODO: check again cell selection (coor is in the middle)

*srcRow = static_cast< int >( floor( ( mSrcExtent.yMaximum() - mySrcY ) / mSrcYRes ) );
*srcCol = static_cast< int >( floor( ( mySrcX - mSrcExtent.xMinimum() ) / mSrcXRes ) );
*srcRow = static_cast< int >( std::floor( ( mSrcExtent.yMaximum() - mySrcY ) / mSrcYRes ) );
*srcCol = static_cast< int >( std::floor( ( mySrcX - mSrcExtent.xMinimum() ) / mSrcXRes ) );

// For now silently correct limits to avoid crashes
// TODO: review
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology/qgsgraduatedsymbolrenderer.cpp
Expand Up @@ -699,7 +699,7 @@ static QList<double> _calcJenksBreaks( QList<double> values, int classes,
{
// pick a random integer from 0 to n
double r = qrand();
int j = floor( r / RAND_MAX * ( values.size() - 1 ) );
int j = std::floor( r / RAND_MAX * ( values.size() - 1 ) );
sample[ i ] = values[ j ];
}
}
Expand Down

0 comments on commit 8c64d80

Please sign in to comment.