Skip to content

Commit abc51f9

Browse files
m-kuhnnyalldawson
authored andcommittedMar 27, 2021
[qt6] Changed size of size(), length()
long long vs int
1 parent 4a41f63 commit abc51f9

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed
 

‎src/core/geometry/qgsgeometrycollection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ bool QgsGeometryCollection::insertGeometry( QgsAbstractGeometry *g, int index )
272272
return false;
273273
}
274274

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

277277
mGeometries.insert( index, g );
278278
clearCache(); //set bounding box invalid

‎src/core/labeling/qgspallabeling.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,7 @@ void QgsPalLayerSettings::calculateLabelSize( const QFontMetricsF *fm, const QSt
15861586
int maxLineLength = 0;
15871587
for ( const auto &line : multiLineSplit )
15881588
{
1589-
maxLineLength = std::max( maxLineLength, line.length() );
1589+
maxLineLength = std::max( maxLineLength, static_cast<int>( line.length() ) );
15901590
}
15911591
h = fm->ascent() * maxLineLength + ( maxLineLength - 1 ) * letterSpacing;
15921592
break;
@@ -1612,7 +1612,7 @@ void QgsPalLayerSettings::calculateLabelSize( const QFontMetricsF *fm, const QSt
16121612
int maxLineLength = 0;
16131613
for ( const auto &line : multiLineSplit )
16141614
{
1615-
maxLineLength = std::max( maxLineLength, line.length() );
1615+
maxLineLength = std::max( maxLineLength, static_cast<int>( line.length() ) );
16161616
}
16171617
heightVertical = fm->ascent() * maxLineLength + ( maxLineLength - 1 ) * letterSpacing;
16181618

‎src/core/layout/qgsabstractreportsection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ void QgsAbstractReportSection::insertChild( int index, QgsAbstractReportSection
417417
{
418418
section->setParentSection( this );
419419
index = std::max( 0, index );
420-
index = std::min( index, mChildren.count() );
420+
index = std::min( index, static_cast<int>( mChildren.count() ) );
421421
mChildren.insert( index, section );
422422
}
423423

‎src/core/layout/qgslayouttable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,9 @@ QPair<int, int> QgsLayoutTable::rowRange( QgsRenderContext &context, const int f
360360
}
361361

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

367367
return qMakePair( firstVisible, lastVisible );
368368
}

‎src/core/qgsstringstatisticalsummary.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ void QgsStringStatisticalSummary::testString( const QString &string )
144144
}
145145
if ( mStatistics & MeanLength )
146146
mSumLengths += string.length();
147-
mMinLength = std::min( mMinLength, string.length() );
148-
mMaxLength = std::max( mMaxLength, string.length() );
147+
mMinLength = std::min( mMinLength, static_cast<int>( string.length() ) );
148+
mMaxLength = std::max( mMaxLength, static_cast<int>( string.length() ) );
149149
}
150150

151151
QVariant QgsStringStatisticalSummary::statistic( QgsStringStatisticalSummary::Statistic stat ) const

‎src/core/raster/qgsrasterblock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ void QgsRasterBlock::setData( const QByteArray &data, int offset )
475475

476476
if ( mData )
477477
{
478-
int len = std::min( data.size(), typeSize( mDataType ) * mWidth * mHeight - offset );
478+
int len = std::min( static_cast<int>( data.size() ), typeSize( mDataType ) * mWidth * mHeight - offset );
479479
::memcpy( static_cast<char *>( mData ) + offset, data.constData(), len );
480480
}
481481
else if ( mImage && mImage->constBits() )

‎src/core/vector/qgsvectorlayerfeatureiterator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ class QgsThreadStackOverflowGuard
355355
QStringList dumpStack;
356356
const QStack<QString> &stack = mStorage.localData();
357357

358-
int dumpSize = std::min( stack.size(), 10 );
358+
int dumpSize = std::min( static_cast<int>( stack.size() ), 10 );
359359
for ( int i = 0; i < dumpSize; ++i )
360360
{
361361
dumpStack += stack.at( i );

‎src/core/vector/qgsvectorlayerutils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ QVariant QgsVectorLayerUtils::createUniqueValueFromCache( const QgsVectorLayer *
306306

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

0 commit comments

Comments
 (0)
Please sign in to comment.