Skip to content

Commit

Permalink
Fix warnings and QT < 5.10 chopped
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jan 10, 2020
1 parent feaf00f commit e4c687d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/providers/postgres/raster/qgspostgresrasterprovider.cpp
Expand Up @@ -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() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/raster/qgspostgresrasterutils.cpp
Expand Up @@ -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 );
Expand Down

0 comments on commit e4c687d

Please sign in to comment.