diff options
author | Laszlo Papp <[email protected]> | 2022-05-14 17:56:13 +0100 |
---|---|---|
committer | Laszlo Papp <[email protected]> | 2022-05-15 19:02:22 +0100 |
commit | 5d8f815e101da3ae9cd6a666cc097853f52b21da (patch) | |
tree | 6ac528b8e80e7e0d73e8e6c8f15fdd31fca762f6 /src/gui/kernel/qkeysequence.cpp | |
parent | 7c7606460403e6495b860134f28e8d4d45c6c810 (diff) |
QKeySequence: Fix the one-off error in the mac glyph array size
It seems that the size of the corresponding array in the code has a one-off
error. This is now fixed.
The end of the array passed to lower_bound is wrong because the
hard-coded size is size + 1. However, the end is array + size. This is
what lower_bound expects from an array. Or any other algorithm for that
matter expecting the end of a container as an argument.
This can cause issues with something like lower_bound because a
potential "empty" fill is not sorted as lower_bound would expect the
data structure.
It could have been fixed by decreasing the size by one, however it is a more
future-proof solution to avoid hard-coding the size and just use
std::size(array) instead.
Pick-to: 5.15 6.2 6.3
Change-Id: I1d25a5b1a80a3b2634b229e0718108ad5e7808a0
Reviewed-by: Shawn Rutledge <[email protected]>
Diffstat (limited to 'src/gui/kernel/qkeysequence.cpp')
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index ec7420e178a..98ce31f3501 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -73,8 +73,7 @@ static const int kControlUnicode = 0x2303; static const int kOptionUnicode = 0x2325; static const int kCommandUnicode = 0x2318; -static const int NumEntries = 21; -static const MacSpecialKey entries[NumEntries] = { +static const MacSpecialKey entries[] = { { Qt::Key_Escape, 0x238B }, { Qt::Key_Tab, 0x21E5 }, { Qt::Key_Backtab, 0x21E4 }, @@ -96,6 +95,7 @@ static const MacSpecialKey entries[NumEntries] = { { Qt::Key_Alt, kOptionUnicode }, { Qt::Key_CapsLock, 0x21EA }, }; +static const int NumEntries = std::size(entries); static bool operator<(const MacSpecialKey &entry, int key) { |