From 7b3883614d23235f47df632d82b29b52fb521fa1 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 3 Mar 2021 16:50:45 +0100 Subject: 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 --- src/corelib/kernel/qmetatype.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/kernel/qmetatype.cpp') 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) { -- cgit v1.2.3