diff options
author | Marc Mutz <[email protected]> | 2025-10-16 13:11:00 +0200 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2025-10-19 16:25:22 +0000 |
commit | 168a2e3efc348e3cba91a638fc25c1d15a725d78 (patch) | |
tree | 2637c29d755e44add52f84a98c79422a912e5dad /src/plugins/platforms/wasm/qwasmfontdatabase.cpp | |
parent | e3ab3825cdffde880436157bb5646208f152f915 (diff) |
QChar: scope variables tigher in canonicalOrderHelper()
The old code defined four variables outside a complex loop (with a
nested goto). These can all be defined at their point of
initialization, though, improving readability of the function (a tiny
bit...), because the tighter scope makes it obvious that the loop
isn't carrying state in these variables from one iteration to the
next.
The construction is safe, because, in C++, a backwards goto will
destroy all variables declared after the label¹, iow: u2 and c2 are
re-created by each jump though `advance`.
Found while trying to fix char32_t → char16_t narrowing highlighted by
Clang 21's -Wcharacter-conversion.
Fix function has many other problems (most prominently, said goto),
but they're out of scope of this immediate patch series, though they
should eventually be fixed. This is security-critical code; we ought
not have to deal with assembler-esque C++ code in such components.
Amends f4d02ecdbf54987a0bada20fe8f8537e90c051d8.
As a drive-by, change the c variables from char16_t back to ushort,
because they don't represent characters, but character combining
classes, partially reverting 7b04e0012b40203970f27869db2ab3e838ffe359.
¹ https://en.cppreference.com/w/cpp/language/goto.html#Explanation
Pick-to: 6.10 6.8 6.5
Change-Id: If06356483bc77a16812d2790bd98f793bc74faa2
Reviewed-by: Thiago Macieira <[email protected]>
Reviewed-by: Ahmad Samir <[email protected]>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmfontdatabase.cpp')
0 files changed, 0 insertions, 0 deletions