From 472722382d6aa7560eae716aca76763383ae7984 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 30 Jan 2022 21:04:53 +0100 Subject: [PATCH] QCoffPeParser: simplify std::optional check Even in C++98 one could declare variables in if statements and contextually convert them to bool: if (D* d = dynamic_cast(base)) ~~~ else if (D2* d = dynamic_cast(base)) ~~~ std::optional is contextually convertible to bool, so we don't need C++17 if initializers. Just use if (auto optional = ~~~~) Pick-to: 6.3 Change-Id: Ie64c2c1ceb7b608eda0534d837f46d3c4be49bf8 Reviewed-by: Thiago Macieira --- src/corelib/plugin/qcoffpeparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/plugin/qcoffpeparser.cpp b/src/corelib/plugin/qcoffpeparser.cpp index 4813a07b27..15d1f64426 100644 --- a/src/corelib/plugin/qcoffpeparser.cpp +++ b/src/corelib/plugin/qcoffpeparser.cpp @@ -364,7 +364,7 @@ QLibraryScanResult QCoffPeParser::parse(QByteArrayView data, QString *errMsg) return {}; QByteArrayView stringTable; - if (auto optional = findStringTable(data, ntHeaders, error); optional) + if (auto optional = findStringTable(data, ntHeaders, error)) stringTable = *optional; else return {};