From 53bd065ec842fb13bf9d92dc1611c3afdcdc3ca4 Mon Sep 17 00:00:00 2001 From: litiangang4 Date: Wed, 2 Aug 2023 16:20:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: litiangang4 --- common/include/input_hub.cpp | 2 +- utils/include/dinput_utils_tool.h | 4 ++-- utils/src/dinput_utils_tool.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) 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; -- Gitee