QStringConverter: Do not use std::optional::value()

value() can potentially throw an exception. We know that it doesn't in
this case, but the compiler doesn't know. And our code checker doesn't
know either and generates lots of false positives. Also, without the
exception propagation code the resulting binary is probably smaller.

Coverity-Id: 386110
Coverity-Id: 384314
Coverity-Id: 383835
Coverity-Id: 383784
Pick-to: 6.4
Change-Id: Icdacf8e003fd3a6ac8fd260ed335239a59de3295
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ulf Hermann 2022-07-04 10:56:46 +02:00
parent 551127209e
commit af6b6c8e7c

View File

@ -1924,7 +1924,7 @@ QStringConverter::QStringConverter(const char *name, Flags f)
{
auto e = encodingForName(name);
if (e)
iface = encodingInterfaces + int(e.value());
iface = encodingInterfaces + int(*e);
#if QT_CONFIG(icu)
else
iface = QStringConverterICU::make_icu_converter(&state, name);