fix warnings

This commit is contained in:
Juergen E. Fischer 2018-06-21 17:02:37 +02:00
parent 7604d9b8e3
commit 314eca9934
2 changed files with 18 additions and 17 deletions

View File

@ -1931,7 +1931,7 @@ int QgsCoordinateReferenceSystem::syncDatabase()
QString srsProj4;
QString srsDesc;
bool srsDeprecated;
bool srsDeprecated = deprecated;
if ( statement.step() == SQLITE_ROW )
{
srsProj4 = statement.columnAsText( 0 );
@ -2133,6 +2133,7 @@ int QgsCoordinateReferenceSystem::syncDatabase()
return -1;
}
Q_UNUSED( deleted );
QgsDebugMsgLevel( QStringLiteral( "CRS update (inserted:%1 updated:%2 deleted:%3 errors:%4)" ).arg( QString::number( inserted ), QString::number( updated ), QString::number( deleted ), QString::number( errors ) ), 4 );
if ( errors > 0 )

View File

@ -251,25 +251,25 @@ class CORE_EXPORT QgsSettings : public QObject
QByteArray ba = value( key, metaEnum.valueToKey( defaultValue ) ).toString().toUtf8();
const char *vs = ba.data();
v = static_cast<T>( metaEnum.keyToValue( vs, &ok ) );
if ( ok )
return v;
}
if ( !ok )
// if failed, try to read as int (old behavior)
// this code shall be removed later (probably after QGIS 3.4 LTR for 3.6)
// then the method could be marked as const
v = static_cast<T>( value( key, static_cast<int>( defaultValue ), section ).toInt( &ok ) );
if ( metaEnum.isValid() )
{
// if failed, try to read as int (old behavior)
// this code shall be removed later (probably after QGIS 3.4 LTR for 3.6)
// then the method could be marked as const
v = static_cast<T>( value( key, static_cast<int>( defaultValue ), section ).toInt( &ok ) );
if ( metaEnum.isValid() )
if ( !ok || !metaEnum.valueToKey( static_cast<int>( v ) ) )
{
if ( !ok || !metaEnum.valueToKey( static_cast<int>( v ) ) )
{
v = defaultValue;
}
else
{
// found setting as an integer
// convert the setting to the new form (string)
setEnumValue( key, v, section );
}
v = defaultValue;
}
else
{
// found setting as an integer
// convert the setting to the new form (string)
setEnumValue( key, v, section );
}
}