Skip to content

Commit 314eca9

Browse files
committedJun 21, 2018
fix warnings
1 parent 7604d9b commit 314eca9

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed
 

‎src/core/qgscoordinatereferencesystem.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1931,7 +1931,7 @@ int QgsCoordinateReferenceSystem::syncDatabase()
19311931

19321932
QString srsProj4;
19331933
QString srsDesc;
1934-
bool srsDeprecated;
1934+
bool srsDeprecated = deprecated;
19351935
if ( statement.step() == SQLITE_ROW )
19361936
{
19371937
srsProj4 = statement.columnAsText( 0 );
@@ -2133,6 +2133,7 @@ int QgsCoordinateReferenceSystem::syncDatabase()
21332133
return -1;
21342134
}
21352135

2136+
Q_UNUSED( deleted );
21362137
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 );
21372138

21382139
if ( errors > 0 )

‎src/core/qgssettings.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -251,25 +251,25 @@ class CORE_EXPORT QgsSettings : public QObject
251251
QByteArray ba = value( key, metaEnum.valueToKey( defaultValue ) ).toString().toUtf8();
252252
const char *vs = ba.data();
253253
v = static_cast<T>( metaEnum.keyToValue( vs, &ok ) );
254+
if ( ok )
255+
return v;
254256
}
255-
if ( !ok )
257+
258+
// if failed, try to read as int (old behavior)
259+
// this code shall be removed later (probably after QGIS 3.4 LTR for 3.6)
260+
// then the method could be marked as const
261+
v = static_cast<T>( value( key, static_cast<int>( defaultValue ), section ).toInt( &ok ) );
262+
if ( metaEnum.isValid() )
256263
{
257-
// if failed, try to read as int (old behavior)
258-
// this code shall be removed later (probably after QGIS 3.4 LTR for 3.6)
259-
// then the method could be marked as const
260-
v = static_cast<T>( value( key, static_cast<int>( defaultValue ), section ).toInt( &ok ) );
261-
if ( metaEnum.isValid() )
264+
if ( !ok || !metaEnum.valueToKey( static_cast<int>( v ) ) )
262265
{
263-
if ( !ok || !metaEnum.valueToKey( static_cast<int>( v ) ) )
264-
{
265-
v = defaultValue;
266-
}
267-
else
268-
{
269-
// found setting as an integer
270-
// convert the setting to the new form (string)
271-
setEnumValue( key, v, section );
272-
}
266+
v = defaultValue;
267+
}
268+
else
269+
{
270+
// found setting as an integer
271+
// convert the setting to the new form (string)
272+
setEnumValue( key, v, section );
273273
}
274274
}
275275

0 commit comments

Comments
 (0)
Please sign in to comment.