From 231920403431965b9f9affa6d9e1d895265988d8 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Thu, 2 Mar 2023 16:34:08 -0500 Subject: [PATCH] Static cast added for Wconversion errors --- src/app/clusters/scenes/ExtensionFieldsSetsImpl.cpp | 6 +++--- src/app/clusters/scenes/SceneTableImpl.cpp | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/app/clusters/scenes/ExtensionFieldsSetsImpl.cpp b/src/app/clusters/scenes/ExtensionFieldsSetsImpl.cpp index 27038353dcec80..7c85bc7fa8d0ec 100644 --- a/src/app/clusters/scenes/ExtensionFieldsSetsImpl.cpp +++ b/src/app/clusters/scenes/ExtensionFieldsSetsImpl.cpp @@ -129,12 +129,12 @@ CHIP_ERROR ExtensionFieldsSetsImpl::RemoveFieldAtPosition(uint8_t position) VerifyOrReturnError(position < kMaxClusterPerScenes, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnValue(!this->IsEmpty() && !this->mEFS[position].IsEmpty(), CHIP_NO_ERROR); - uint8_t next = position + 1; - uint8_t moveNum = kMaxClusterPerScenes - next; + uint8_t nextPos = position++; + uint8_t moveNum = static_cast(kMaxClusterPerScenes - nextPos); // TODO: Implement general array management methods // Compress array after removal - memmove(&this->mEFS[position], &this->mEFS[next], sizeof(ExtensionFieldsSet) * moveNum); + memmove(&this->mEFS[position], &this->mEFS[nextPos], sizeof(ExtensionFieldsSet) * moveNum); this->mFieldNum--; // Clear last occupied position diff --git a/src/app/clusters/scenes/SceneTableImpl.cpp b/src/app/clusters/scenes/SceneTableImpl.cpp index 02c2ebf11918df..0c4ac6b1da2c7d 100644 --- a/src/app/clusters/scenes/SceneTableImpl.cpp +++ b/src/app/clusters/scenes/SceneTableImpl.cpp @@ -438,17 +438,17 @@ CHIP_ERROR DefaultSceneTableImpl::RegisterHandler(SceneHandler * handler) return err; } -CHIP_ERROR DefaultSceneTableImpl::UnregisterHandler(uint8_t pos) +CHIP_ERROR DefaultSceneTableImpl::UnregisterHandler(uint8_t position) { - VerifyOrReturnError(pos < kMaxSceneHandlers, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnValue(!this->HandlerListEmpty() && !(this->mHandlers[pos] == nullptr), CHIP_NO_ERROR); + VerifyOrReturnError(position < kMaxSceneHandlers, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnValue(!this->HandlerListEmpty() && !(this->mHandlers[position] == nullptr), CHIP_NO_ERROR); - uint8_t nextPos = pos++; - uint8_t moveNum = kMaxSceneHandlers - nextPos; + uint8_t nextPos = position++; + uint8_t moveNum = static_cast(kMaxSceneHandlers - nextPos); // TODO: Implement general array management methods // Compress array after removal - memmove(&this->mHandlers[pos], &this->mHandlers[nextPos], sizeof(SceneHandler *) * moveNum); + memmove(&this->mHandlers[position], &this->mHandlers[nextPos], sizeof(SceneHandler *) * moveNum); this->handlerNum--; // Clear last occupied position