Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 abc51f9
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/core/geometry/qgsgeometrycollection.cpp
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/core/labeling/qgspallabeling.cpp
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/core/layout/qgsabstractreportsection.cpp
Expand Up @@ -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 );
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/layout/qgslayouttable.cpp
Expand Up @@ -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 );
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsstringstatisticalsummary.cpp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgsrasterblock.cpp
Expand Up @@ -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() )
Expand Down
2 changes: 1 addition & 1 deletion src/core/vector/qgsvectorlayerfeatureiterator.cpp
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/core/vector/qgsvectorlayerutils.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit abc51f9

Please sign in to comment.