From cc6677a6c72677fb39fa08e2c97aeb262fd9abc7 Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Sat, 26 Sep 2020 09:52:20 +0200 Subject: [PATCH] Fix -Wmaybe-uninitialized warnings Fixes few of these, for example: qurlrecode.cpp:308:19: warning: 'ucs4' may be used uninitialized in this function [-Wmaybe-uninitialized] *output++ = ucs4; Change-Id: Iaf09fa854102c76b51e6e18556c5ef20212e57cf Reviewed-by: Alexandru Croitor --- src/corelib/io/qurlrecode.cpp | 2 +- src/corelib/text/qstring.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qurlrecode.cpp b/src/corelib/io/qurlrecode.cpp index 2ac335cf5c..44e0a8239d 100644 --- a/src/corelib/io/qurlrecode.cpp +++ b/src/corelib/io/qurlrecode.cpp @@ -294,7 +294,7 @@ struct QUrlUtf8Traits : public QUtf8BaseTraitsNoAscii static bool encodedUtf8ToUtf16(QString &result, ushort *&output, const ushort *begin, const ushort *&input, const ushort *end, ushort decoded) { - uint ucs4, *dst = &ucs4; + uint ucs4 = 0, *dst = &ucs4; const ushort *src = input + 3;// skip the %XX that yielded \a decoded int charsNeeded = QUtf8Functions::fromUtf8(decoded, dst, src, end); if (charsNeeded < 0) diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 422e1f8419..b05a3cd707 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -886,7 +886,7 @@ static int ucstricmp8(const char *utf8, const char *utf8end, const QChar *utf16, QStringIterator src2(utf16, utf16end); while (src1 < end1 && src2.hasNext()) { - uint uc1; + uint uc1 = 0; uint *output = &uc1; uchar b = *src1++; int res = QUtf8Functions::fromUtf8(b, output, src1, end1);