Fix compilation with QT 5.9.0

This commit is contained in:
Even Rouault 2019-10-26 19:40:33 +02:00
parent 0edd2777e7
commit 6665fe0621
No known key found for this signature in database
GPG Key ID: 33EBBFC47B3DD87D
2 changed files with 4 additions and 1 deletions

View File

@ -5047,6 +5047,7 @@ static QVariant fcnGenericHash( const QVariantList &values, const QgsExpressionC
{
hash = fcnHash( str, QCryptographicHash::Sha3_512 );
}
#if QT_VERSION >= QT_VERSION_CHECK( 5, 9, 2 )
else if ( method == QLatin1String( "keccak_224" ) )
{
hash = fcnHash( str, QCryptographicHash::Keccak_224 );
@ -5063,6 +5064,7 @@ static QVariant fcnGenericHash( const QVariantList &values, const QgsExpressionC
{
hash = fcnHash( str, QCryptographicHash::Keccak_512 );
}
#endif
return hash;
}

View File

@ -1488,11 +1488,12 @@ class TestQgsExpression: public QObject
QTest::newRow( "hash('QGIS', 'sha3_256')" ) << QStringLiteral( "hash('QGIS', 'sha3_256')" ) << false << QVariant( "540f7354b6b8a6e735f2845250f15f4f3ba4f666c55574d9e9354575de0e980f" );
QTest::newRow( "hash('QGIS', 'sha3_384')" ) << QStringLiteral( "hash('QGIS', 'sha3_384')" ) << false << QVariant( "96052da1e77679e9a65f60d7ead961b287977823144786386eb43647b0901fd8516fa6f1b9d243fb3f28775e6dde6107" );
QTest::newRow( "hash('QGIS', 'sha3_512')" ) << QStringLiteral( "hash('QGIS', 'sha3_512')" ) << false << QVariant( "900d079dc69761da113980253aa8ac0414a8bd6d09879a916228f8743707c4758051c98445d6b8945ec854ff90655005e02aceb0a2ffc6a0ebf818745d665349" );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 9, 2 )
QTest::newRow( "hash('QGIS', 'keccak_224')" ) << QStringLiteral( "hash('QGIS', 'keccak_224')" ) << false << QVariant( "5b0ce6acef8b0a121d4ac4f3eaa8503c799ad4e26a3392d1fb201478" );
QTest::newRow( "hash('QGIS', 'keccak_256')" ) << QStringLiteral( "hash('QGIS', 'keccak_256')" ) << false << QVariant( "991c520aa6815392de24087f61b2ae0fd56abbfeee4a8ca019c1011d327c577e" );
QTest::newRow( "hash('QGIS', 'keccak_384')" ) << QStringLiteral( "hash('QGIS', 'keccak_384')" ) << false << QVariant( "c57a3aed9d856fa04e5eeee9b62b6e027cca81ba574116d3cc1f0d48a1ef9e5886ff463ea8d0fac772ee473bf92f810d" );
QTest::newRow( "hash('QGIS', 'keccak_512')" ) << QStringLiteral( "hash('QGIS', 'keccak_512')" ) << false << QVariant( "6f0f751776b505e317de222508fa5d3ed7099d8f07c74fed54ccee6e7cdc6b89b4a085e309f2ee5210c942bbeb142bdfe48f84f912e0f3f41bdbf47110c2d344" );
#endif
}