codecheck修改

Signed-off-by: wangyb0625 <wangyibo38@huawei.com>
This commit is contained in:
wangyb0625
2022-05-20 11:12:09 +08:00
parent 8c6aa6c781
commit df060782b0
2 changed files with 7 additions and 9 deletions
+2 -1
View File
@@ -16,10 +16,11 @@
#ifndef OHOS_DM_ERROMSG_H
#define OHOS_DM_ERROMSG_H
#include <string>
#include "dm_log.h"
#include "dm_constants.h"
#include <string>
namespace OHOS {
namespace DistributedHardware {
std::string GetErrorString(int failedReason);
+5 -8
View File
@@ -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<sizeof(g_errorMessages);i++)
{
if(failedReason == g_errorMessages[i].errCode) {
for (int32_t i = 0; i < sizeof(g_errorMessages); i++) {
if(failedReason == g_errorMessages[i].errCode){
g_errorMessage = g_errorMessages[i].errMsg;
}
}