diff options
author | 2023-04-17 08:45:31 -0700 | |
---|---|---|
committer | 2023-04-17 15:14:59 -0700 | |
commit | 5af2834b5ec418e7d1c8b5925b488df12c18aab4 (patch) | |
tree | d4bc8ef01d6f78fac1d01ed0ce1ad40ed362c736 | |
parent | 0fe0126d4a0cab98a8c5cc92496d7abe9f0fb781 (diff) |
Pass reference to finishKey
Since the parameter is assumed to be non-null, pass it by reference.
Bug: 274058082
Test: m libinput_tests && $ANDROID_HOST_OUT/nativetest64/libinput_tests/libinput_tests
Change-Id: Iedf8970a57e4463e6addc8ee1013feb3ee60c009
-rw-r--r-- | include/input/KeyCharacterMap.h | 2 | ||||
-rw-r--r-- | libs/input/KeyCharacterMap.cpp | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/include/input/KeyCharacterMap.h b/include/input/KeyCharacterMap.h index c67310eaec..9f1c0e28c6 100644 --- a/include/input/KeyCharacterMap.h +++ b/include/input/KeyCharacterMap.h @@ -227,7 +227,7 @@ private: status_t parseMapKey(); status_t parseKey(); status_t parseKeyProperty(); - status_t finishKey(Key* key); + status_t finishKey(Key& key); status_t parseModifier(const std::string& token, int32_t* outMetaState); status_t parseCharacterLiteral(char16_t* outCharacter); }; diff --git a/libs/input/KeyCharacterMap.cpp b/libs/input/KeyCharacterMap.cpp index 737bd15901..65398d717d 100644 --- a/libs/input/KeyCharacterMap.cpp +++ b/libs/input/KeyCharacterMap.cpp @@ -1048,7 +1048,7 @@ status_t KeyCharacterMap::Parser::parseKeyProperty() { String8 token = mTokenizer->nextToken(WHITESPACE_OR_PROPERTY_DELIMITER); if (token == "}") { mState = STATE_TOP; - return finishKey(key); + return finishKey(*key); } Vector<Property> properties; @@ -1230,12 +1230,12 @@ status_t KeyCharacterMap::Parser::parseKeyProperty() { return NO_ERROR; } -status_t KeyCharacterMap::Parser::finishKey(Key* key) { +status_t KeyCharacterMap::Parser::finishKey(Key& key) { // Fill in default number property. - if (!key->number) { + if (!key.number) { char16_t digit = 0; char16_t symbol = 0; - for (const Behavior& b : key->behaviors) { + for (const Behavior& b : key.behaviors) { char16_t ch = b.character; if (ch) { if (ch >= '0' && ch <= '9') { @@ -1247,7 +1247,7 @@ status_t KeyCharacterMap::Parser::finishKey(Key* key) { } } } - key->number = digit ? digit : symbol; + key.number = digit ? digit : symbol; } return NO_ERROR; } |