Fix warnings and QT < 5.10 chopped

This commit is contained in:
Alessandro Pasotti 2020-01-10 18:22:21 +01:00
parent feaf00fc4c
commit e4c687d8dc
2 changed files with 8 additions and 3 deletions

View File

@ -764,8 +764,13 @@ bool QgsPostgresRasterProvider::init()
throw QgsPostgresRasterProviderException( tr( "Cannot get band count from value: '%1'" ).arg( result.PQgetvalue( 0, 2 ) ) );
}
const QStringList pxTypes { result.PQgetvalue( 0, 3 ).chopped( 1 ).mid( 1 ).split( ',' ) };
const QStringList noDataValues { result.PQgetvalue( 0, 4 ).chopped( 1 ).mid( 1 ).split( ',' ) };
QString pxTypesArray { result.PQgetvalue( 0, 3 ) };
pxTypesArray.chop( 1 );
const QStringList pxTypes { pxTypesArray.mid( 1 ).split( ',' ) };
QString noDataValuesArray { result.PQgetvalue( 0, 4 ) };
noDataValuesArray.chop( 1 );
const QStringList noDataValues { noDataValuesArray.mid( 1 ).split( ',' ) };
if ( mBandCount != pxTypes.count( ) || mBandCount != noDataValues.count() )
{

View File

@ -130,7 +130,7 @@ QVariantMap QgsPostgresRasterUtils::parseWkb( const QByteArray &wkb, int bandNo
result[ QStringLiteral( "dataSize" ) ] = static_cast<unsigned int>( pxSize * result[ QStringLiteral( "width" ) ].toInt() * result[ QStringLiteral( "height" ) ].toInt() );
};
if ( bandNo > nBands )
if ( static_cast<unsigned int>( bandNo ) > nBands )
{
QgsMessageLog::logMessage( QStringLiteral( "Band number is not valid: %1 (nBands: %2" )
.arg( bandNo ).arg( nBands ), QStringLiteral( "PostGIS" ), Qgis::Critical );