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>
This commit is contained in:
Anton Kudryavtsev 2015-12-09 16:20:27 +03:00 committed by Marc Mutz
parent 03dcc5c036
commit b4c11c7cc5
2 changed files with 2 additions and 2 deletions

View File

@ -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) {

View File

@ -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;
};