Skip to content

Commit

Permalink
followup : keep using 64 bit int
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierdalang committed Dec 3, 2019
1 parent 65fed42 commit cfe729e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/expression/qgsexpressionfunction.cpp
Expand Up @@ -400,8 +400,8 @@ static QVariant fcnRndF( const QVariantList &values, const QgsExpressionContext
}
static QVariant fcnRnd( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
{
quint32 min = QgsExpressionUtils::getIntValue( values.at( 0 ), parent );
quint32 max = QgsExpressionUtils::getIntValue( values.at( 1 ), parent );
qlonglong min = QgsExpressionUtils::getIntValue( values.at( 0 ), parent );
qlonglong max = QgsExpressionUtils::getIntValue( values.at( 1 ), parent );
if ( max < min )
return QVariant();

Expand Down Expand Up @@ -429,7 +429,7 @@ static QVariant fcnRnd( const QVariantList &values, const QgsExpressionContext *
}

// Return a random integer in the range [min, max] (inclusive)
return QVariant( generator->bounded( min, max + 1 ) );
return QVariant( min + static_cast< qlonglong >(generator->bounded( static_cast< quint32 >(max - min + 1) ) ) );
}

static QVariant fcnLinearScale( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
Expand Down

0 comments on commit cfe729e

Please sign in to comment.