Skip to content
Permalink
Browse files

[qt6] Changed size of size(), length()

long long vs int
  • Loading branch information
m-kuhn authored and nyalldawson committed Mar 27, 2021
1 parent 4a41f63 commit abc51f935e7223b35756738e7ba2ef01cc1e1167
@@ -272,7 +272,7 @@ bool QgsGeometryCollection::insertGeometry( QgsAbstractGeometry *g, int index )
return false;
}

index = std::min( mGeometries.count(), index );
index = std::min( static_cast<int>( mGeometries.count() ), index );

mGeometries.insert( index, g );
clearCache(); //set bounding box invalid
@@ -1586,7 +1586,7 @@ void QgsPalLayerSettings::calculateLabelSize( const QFontMetricsF *fm, const QSt
int maxLineLength = 0;
for ( const auto &line : multiLineSplit )
{
maxLineLength = std::max( maxLineLength, line.length() );
maxLineLength = std::max( maxLineLength, static_cast<int>( line.length() ) );
}
h = fm->ascent() * maxLineLength + ( maxLineLength - 1 ) * letterSpacing;
break;
@@ -1612,7 +1612,7 @@ void QgsPalLayerSettings::calculateLabelSize( const QFontMetricsF *fm, const QSt
int maxLineLength = 0;
for ( const auto &line : multiLineSplit )
{
maxLineLength = std::max( maxLineLength, line.length() );
maxLineLength = std::max( maxLineLength, static_cast<int>( line.length() ) );
}
heightVertical = fm->ascent() * maxLineLength + ( maxLineLength - 1 ) * letterSpacing;

@@ -417,7 +417,7 @@ void QgsAbstractReportSection::insertChild( int index, QgsAbstractReportSection
{
section->setParentSection( this );
index = std::max( 0, index );
index = std::min( index, mChildren.count() );
index = std::min( index, static_cast<int>( mChildren.count() ) );
mChildren.insert( index, section );
}

@@ -360,9 +360,9 @@ QPair<int, int> QgsLayoutTable::rowRange( QgsRenderContext &context, const int f
}

//using zero based indexes
int firstVisible = std::min( rowsAlreadyShown, mTableContents.length() );
int firstVisible = std::min( rowsAlreadyShown, static_cast<int>( mTableContents.length() ) );
int possibleRowsVisible = rowsVisible( context, frameIndex, rowsAlreadyShown, false );
int lastVisible = std::min( firstVisible + possibleRowsVisible, mTableContents.length() );
int lastVisible = std::min( firstVisible + possibleRowsVisible, static_cast<int>( mTableContents.length() ) );

return qMakePair( firstVisible, lastVisible );
}
@@ -144,8 +144,8 @@ void QgsStringStatisticalSummary::testString( const QString &string )
}
if ( mStatistics & MeanLength )
mSumLengths += string.length();
mMinLength = std::min( mMinLength, string.length() );
mMaxLength = std::max( mMaxLength, string.length() );
mMinLength = std::min( mMinLength, static_cast<int>( string.length() ) );
mMaxLength = std::max( mMaxLength, static_cast<int>( string.length() ) );
}

QVariant QgsStringStatisticalSummary::statistic( QgsStringStatisticalSummary::Statistic stat ) const
@@ -475,7 +475,7 @@ void QgsRasterBlock::setData( const QByteArray &data, int offset )

if ( mData )
{
int len = std::min( data.size(), typeSize( mDataType ) * mWidth * mHeight - offset );
int len = std::min( static_cast<int>( data.size() ), typeSize( mDataType ) * mWidth * mHeight - offset );
::memcpy( static_cast<char *>( mData ) + offset, data.constData(), len );
}
else if ( mImage && mImage->constBits() )
@@ -355,7 +355,7 @@ class QgsThreadStackOverflowGuard
QStringList dumpStack;
const QStack<QString> &stack = mStorage.localData();

int dumpSize = std::min( stack.size(), 10 );
int dumpSize = std::min( static_cast<int>( stack.size() ), 10 );
for ( int i = 0; i < dumpSize; ++i )
{
dumpStack += stack.at( i );
@@ -306,7 +306,7 @@ QVariant QgsVectorLayerUtils::createUniqueValueFromCache( const QgsVectorLayer *

if ( field.isNumeric() )
{
QVariant maxVal = existingValues.isEmpty() ? 0 : *std::max_element( existingValues.begin(), existingValues.end() );
QVariant maxVal = existingValues.isEmpty() ? 0 : *std::max_element( existingValues.begin(), existingValues.end(), []( const QVariant & a, const QVariant & b ) { return a.toLongLong() < b.toLongLong(); } );
QVariant newVar( maxVal.toLongLong() + 1 );
if ( field.convertCompatible( newVar ) )
return newVar;

0 comments on commit abc51f9

Please sign in to comment.