diff --git a/common/include/input_hub.cpp b/common/include/input_hub.cpp index afa54a5..1001041 100644 --- a/common/include/input_hub.cpp +++ b/common/include/input_hub.cpp @@ -424,7 +424,7 @@ void InputHub::ScanInputDevices(const std::string& dirName) DHLOGI("ScanInputDevices enter, dirName %s.", dirName.c_str()); std::vector vecInputDevPath; ScanInputDevicesPath(dirName, vecInputDevPath); - for (auto &tempPath: vecInputDevPath) { + for (const auto &tempPath: vecInputDevPath) { OpenInputDeviceLocked(tempPath); } } diff --git a/utils/include/dinput_utils_tool.h b/utils/include/dinput_utils_tool.h index 8092ce2..bb79969 100644 --- a/utils/include/dinput_utils_tool.h +++ b/utils/include/dinput_utils_tool.h @@ -53,9 +53,9 @@ std::string Sha256(const std::string& string); void CloseFd(int& fd); int BitIsSet(const unsigned long *array, int bit); void StringSplitToVector(const std::string& str, const char split, std::vector& vecStr); -int OpenInputDeviceFdByPath(std::string devicePath); +int OpenInputDeviceFdByPath(const std::string &devicePath); std::string ConvertErrNo(); -void ScanInputDevicesPath(std::string dirName, std::vector& vecInputDevPath); +void ScanInputDevicesPath(const std::string &dirName, std::vector& vecInputDevPath); } // namespace DistributedInput } // namespace DistributedHardware } // namespace OHOS diff --git a/utils/src/dinput_utils_tool.cpp b/utils/src/dinput_utils_tool.cpp index 659e93d..51a1b40 100644 --- a/utils/src/dinput_utils_tool.cpp +++ b/utils/src/dinput_utils_tool.cpp @@ -324,7 +324,7 @@ void StringSplitToVector(const std::string& str, const char split, std::vector& vecInputDevPath) +void ScanInputDevicesPath(const std::string &dirName, std::vector& vecInputDevPath) { DIR *dir; struct dirent *de;