From df060782b0fdcf2560f25e8ff67b2de8d6d1e967 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Fri, 20 May 2022 11:12:09 +0800 Subject: [PATCH] =?UTF-8?q?codecheck=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyb0625 --- utils/include/dm_error_message.h | 3 ++- utils/src/dm_error_message.cpp | 13 +++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/utils/include/dm_error_message.h b/utils/include/dm_error_message.h index 52e22059..ba5dfe8e 100644 --- a/utils/include/dm_error_message.h +++ b/utils/include/dm_error_message.h @@ -16,10 +16,11 @@ #ifndef OHOS_DM_ERROMSG_H #define OHOS_DM_ERROMSG_H -#include #include "dm_log.h" #include "dm_constants.h" +#include + namespace OHOS { namespace DistributedHardware { std::string GetErrorString(int failedReason); diff --git a/utils/src/dm_error_message.cpp b/utils/src/dm_error_message.cpp index d9e24471..3f82bf28 100644 --- a/utils/src/dm_error_message.cpp +++ b/utils/src/dm_error_message.cpp @@ -17,14 +17,12 @@ namespace OHOS { namespace DistributedHardware { -typedef struct ERROR_INFO -{ +typedef struct ERROR_INFO { int errCode; std::string errMsg; -}ERROR_INFO; +} ERROR_INFO; -static ERROR_INFO g_errorMessages[] = -{ +static ERROR_INFO g_errorMessages[] = { {ERR_DM_FAILED, DM_FAILED_INFO}, {ERR_DM_TIME_OUT, DM_TIME_OUT_INFO}, {ERR_DM_NOT_INIT, DM_NOT_INIT_INFO}, @@ -59,9 +57,8 @@ static ERROR_INFO g_errorMessages[] = std::string GetErrorString(int failedReason) { std::string g_errorMessage = "dm process execution failed."; - for (int i =0; i