diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2025-07-18 22:07:11 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2025-07-21 23:32:53 +0000 |
| commit | aea88d4106f8ca9f8f2234094491df2eff0f2015 (patch) | |
| tree | 2b72f2d4f6504465d6dca6d48d06c1bad7f8f8b1 /src/corelib/kernel/qtimer.cpp | |
| parent | f1c1f8575a97a7d7758d1a1112f7aa912f85e11b (diff) | |
QLocale: fix off-by-one error in codeToScript()
QLocale::LastScript, as the name suggests, is still a valid script,
but the old code let the loop run only while i < LastScript, so it
never checks the last entry, which therefore can't be found by string
lookup (both in codeToString() and in qt_splitLocaleName()
(ie. QLocale(QString/View))).
Fix by letting the loop run while i < NumScripts, which is a new local
constant for LastScript + 1. Also add a static_assert that the size of
script_code_list matches the cardinality of QLocale::Script, which is
actually how this bug was found...
Amends the start of the public history(!).
[ChangeLog][QtCore][QLocale] Fixed a bug where QLocale could not find
the QLocale::Script with the highest value when looked up by string
(codeToString() or QLocale(string) constructor).
Fixes: QTBUG-138566
Task-number: QTBUG-17105
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ie938588e2f6ff711a0c097803f05360104162d85
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qtimer.cpp')
0 files changed, 0 insertions, 0 deletions
