diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-03-03 16:50:45 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-03-03 19:16:55 +0100 |
commit | 7b3883614d23235f47df632d82b29b52fb521fa1 (patch) | |
tree | 0d64047bbb28c0e20728f8b4bdfb45376eb2797f /src/corelib/kernel/qmetatype.cpp | |
parent | 3bf0a40a3b5f20cbeb0346edbff2aae05ec4585f (diff) |
Initialize out-variable
QMetaType::convert does have code paths where nothing is written to the
'to' out-variable. Those code paths shouldn't run in this particular
case, but it's good practice to initialize out-variables anyway.
Fixes static analyzer warning 1453920f5abe1e30471eca6aa01d22d1.
Change-Id: I6f6d1044759866c405e61cb51147ca0490c4f3a4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qmetatype.cpp')
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index ac792a2f27..3fc35189f8 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1835,7 +1835,7 @@ static bool convertFromEnum(QMetaType fromType, const void *from, QMetaType toTy static bool convertToEnum(QMetaType fromType, const void *from, QMetaType toType, void *to) { int fromTypeId = fromType.id(); - qlonglong value; + qlonglong value = -1; bool ok = false; #ifndef QT_NO_QOBJECT if (fromTypeId == QMetaType::QString || fromTypeId == QMetaType::QByteArray) { |