Skip to content

Commit

Permalink
Static cast added for Wconversion errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs authored and pull[bot] committed Sep 18, 2023
1 parent ced0f7e commit 1ef4629
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/app/clusters/scenes/ExtensionFieldsSetsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t>(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
Expand Down
12 changes: 6 additions & 6 deletions src/app/clusters/scenes/SceneTableImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t>(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
Expand Down

0 comments on commit 1ef4629

Please sign in to comment.