summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2015-12-09 16:20:27 +0300
committerMarc Mutz <marc.mutz@kdab.com>2016-01-09 15:20:20 +0000
commitb4c11c7cc56c18ebe14319b3389ff13c625e99d7 (patch)
tree47aed6bf1416e8015a8bd40f1198fd741519834d /src
parent03dcc5c036e887600a65907f1b192b06b2cc6c9b (diff)
QComposeInputContext: reduce composeBuffer to QT_KEYSEQUENCE_MAX_LEN
The extra length has been used for a sentinel null value. By checking the index before indexing into the array, that extra element can be dropped. Change-Id: I0b309420d8d89f75e2381a8065c8e68a1a33427c Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp2
-rw-r--r--src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
index d1bea9af23..58c91eca9f 100644
--- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
@@ -111,7 +111,7 @@ bool QComposeInputContext::filterEvent(const QEvent *event)
keysym = keyEvent->nativeVirtualKey();
int nCompose = 0;
- while (m_composeBuffer[nCompose] != 0 && nCompose < QT_KEYSEQUENCE_MAX_LEN)
+ while (nCompose < QT_KEYSEQUENCE_MAX_LEN && m_composeBuffer[nCompose] != 0)
nCompose++;
if (nCompose == QT_KEYSEQUENCE_MAX_LEN) {
diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h
index bdf5a91335..898eafd786 100644
--- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h
+++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h
@@ -68,7 +68,7 @@ protected:
private:
QObject *m_focusObject;
QVector<QComposeTableElement> m_composeTable;
- uint m_composeBuffer[QT_KEYSEQUENCE_MAX_LEN + 1];
+ uint m_composeBuffer[QT_KEYSEQUENCE_MAX_LEN];
TableGenerator::TableState m_tableState;
bool m_compositionTableInitialized;
};