diff --git a/services/distributedhardwarefwkservice/src/task/offline_task.cpp b/services/distributedhardwarefwkservice/src/task/offline_task.cpp index d73ae1f4fa7bbca9571c1e0618968b743b7261a1..de8508e6405cf0452f8b669f4838bf8c5b1321e8 100644 --- a/services/distributedhardwarefwkservice/src/task/offline_task.cpp +++ b/services/distributedhardwarefwkservice/src/task/offline_task.cpp @@ -54,7 +54,7 @@ void OffLineTask::DoTaskInner() { DHLOGD("start offline task, id = %s, uuid = %s", GetId().c_str(), GetAnonyString(GetUUID()).c_str()); this->SetTaskState(TaskState::RUNNING); - for (auto& step : this->GetTaskSteps()) { + for (const auto& step : this->GetTaskSteps()) { switch (step) { case TaskStep::UNREGISTER_OFFLINE_DISTRIBUTED_HARDWARE: { CreateDisableTask(); diff --git a/services/distributedhardwarefwkservice/src/task/online_task.cpp b/services/distributedhardwarefwkservice/src/task/online_task.cpp index 8f65bb3699528d823f684a60c7147e0c994ac710..b5475d40ae5d1f3c77c9846d3e22cfc6d92c40bf 100644 --- a/services/distributedhardwarefwkservice/src/task/online_task.cpp +++ b/services/distributedhardwarefwkservice/src/task/online_task.cpp @@ -47,7 +47,7 @@ void OnLineTask::DoTask() { DHLOGD("start online task, id = %s, uuid = %s", GetId().c_str(), GetAnonyString(GetUUID()).c_str()); this->SetTaskState(TaskState::RUNNING); - for (auto& step : this->GetTaskSteps()) { + for (const auto& step : this->GetTaskSteps()) { switch (step) { case TaskStep::SYNC_ONLINE_INFO: { DoSyncInfo(); diff --git a/services/distributedhardwarefwkservice/test/unittest/common/task/src/mock_offline_task.cpp b/services/distributedhardwarefwkservice/test/unittest/common/task/src/mock_offline_task.cpp index ad52c38f6d30f89ccad9ce57ab23a108c9193c94..b30914ec919ade2f9c0a84ed6a00f73a62e6613a 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/task/src/mock_offline_task.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/task/src/mock_offline_task.cpp @@ -30,7 +30,7 @@ MockOffLineTask::MockOffLineTask(const std::string &networkId, const std::string void MockOffLineTask::CreateDisableTask() { - for (auto &devInfo : offLineDevInfos) { + for (const auto &devInfo : offLineDevInfos) { TaskParam taskParam = { .networkId = devInfo.networkId, .uuid = devInfo.uuid,