修复codecheck

Signed-off-by: renguang1116 <renguang@huawei.com>
This commit is contained in:
renguang1116
2022-01-13 15:43:58 +08:00
parent 83d08c0a42
commit 44c100bb71
4 changed files with 29 additions and 38 deletions
+2 -3
View File
@@ -21,7 +21,7 @@ namespace DistributedHardware {
#define DEVICE_MANAGER_SERVICE_NAME "dev_mgr_svc"
#define MAX_DM_IPC_LEN 2048
#define DECLARE_IPC_MODEL(className) do { \
#define DECLARE_IPC_MODEL(className) \
public: \
className() = default; \
virtual ~className() = default; \
@@ -30,8 +30,7 @@ public: \
className(const className &) = delete; \
className &operator=(const className &) = delete; \
className(className &&) = delete; \
className &operator=(className &&) = delete \
} while(0)
className &operator=(className &&) = delete
#define DECLARE_IPC_INTERFACE(className) DECLARE_IPC_MODEL(className)
+13 -16
View File
@@ -18,7 +18,7 @@
namespace OHOS {
namespace DistributedHardware {
#define DECLARE_SINGLE_INSTANCE_BASE(className) do { \
#define DECLARE_SINGLE_INSTANCE_BASE(className) \
public: \
static className &GetInstance(); \
\
@@ -26,23 +26,20 @@ private: \
className(const className &) = delete; \
className &operator=(const className &) = delete; \
className(className &&) = delete; \
className &operator=(className &&) = delete; \
} while(0)
className &operator=(className &&) = delete;
#define DECLARE_SINGLE_INSTANCE(className) do { \
DECLARE_SINGLE_INSTANCE_BASE(className) \
private: \
className() = default; \
~className() = default; \
} while(0)
#define DECLARE_SINGLE_INSTANCE(className) \
DECLARE_SINGLE_INSTANCE_BASE(className) \
private: \
className() = default; \
~className() = default;
#define IMPLEMENT_SINGLE_INSTANCE(className) do { \
className &className::GetInstance() \
{ \
static auto instance = new className(); \
return *instance; \
} \
} while(0)
#define IMPLEMENT_SINGLE_INSTANCE(className) \
className &className::GetInstance() \
{ \
static auto instance = new className(); \
return *instance; \
}
}; // namespace DistributedHardware
}; // namespace OHOS
@@ -26,13 +26,12 @@
using namespace OHOS::DistributedHardware;
namespace {
#define GET_PARAMS(env, info, num) do { \
size_t argc = num; \
napi_value argv[num] = {nullptr}; \
napi_value thisVar = nullptr; \
void *data = nullptr; \
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, &data)) \
} while(0)
#define GET_PARAMS(env, info, num) \
size_t argc = num; \
napi_value argv[num] = {nullptr}; \
napi_value thisVar = nullptr; \
void *data = nullptr; \
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, &data))
const std::string DM_NAPI_EVENT_DEVICE_STATE_CHANGE = "deviceStateChange";
const std::string DM_NAPI_EVENT_DEVICE_FOUND = "deviceFound";
+8 -12
View File
@@ -27,7 +27,7 @@
namespace OHOS {
namespace DistributedHardware {
#define ON_IPC_SET_REQUEST(cmdCode, paraA, paraB, paraC, paraD) do { \
#define ON_IPC_SET_REQUEST(cmdCode, paraA, paraB, paraC, paraD) \
static int32_t IpcSetRequest##cmdCode(paraA, paraB, paraC, paraD); \
struct IpcRegisterSetRequestFunc##cmdCode { \
IpcRegisterSetRequestFunc##cmdCode() \
@@ -36,10 +36,9 @@ namespace DistributedHardware {
} \
}; \
IpcRegisterSetRequestFunc##cmdCode g_IpcRegisterSetRequestFunc##cmdCode; \
static int32_t IpcSetRequest##cmdCode(paraA, paraB, paraC, paraD) \
} while(0)
static int32_t IpcSetRequest##cmdCode(paraA, paraB, paraC, paraD)
#define ON_IPC_READ_RESPONSE(cmdCode, paraA, paraB) do { \
#define ON_IPC_READ_RESPONSE(cmdCode, paraA, paraB) \
static int32_t IpcReadResponse##cmdCode(paraA, paraB); \
struct IpcRegisterReadResponseFunc##cmdCode { \
IpcRegisterReadResponseFunc##cmdCode() \
@@ -48,10 +47,9 @@ namespace DistributedHardware {
} \
}; \
IpcRegisterReadResponseFunc##cmdCode g_IpcRegisterReadResponseFunc##cmdCode; \
static int32_t IpcReadResponse##cmdCode(paraA, paraB) \
} while(0)
static int32_t IpcReadResponse##cmdCode(paraA, paraB)
#define ON_IPC_CMD(cmdCode, paraA) do { \
#define ON_IPC_CMD(cmdCode, paraA) \
static void IpcCmdProcess##cmdCode(paraA); \
struct IpcRegisterCmdProcessFunc##cmdCode { \
IpcRegisterCmdProcessFunc##cmdCode() \
@@ -60,10 +58,9 @@ namespace DistributedHardware {
} \
}; \
IpcRegisterCmdProcessFunc##cmdCode g_IpcRegisterCmdProcessFunc##cmdCode; \
static void IpcCmdProcess##cmdCode(paraA) \
} while(0)
static void IpcCmdProcess##cmdCode(paraA)
#define ON_IPC_SERVER_CMD(cmdCode, paraA, paraB) do { \
#define ON_IPC_SERVER_CMD(cmdCode, paraA, paraB) \
static void IpcServerCmdProcess##cmdCode(paraA, paraB); \
class IpcRegisterServerCmdProcessFunc##cmdCode { \
public: \
@@ -73,8 +70,7 @@ namespace DistributedHardware {
} \
}; \
IpcRegisterServerCmdProcessFunc##cmdCode g_IpcRegisterServerCmdProcessFunc##cmdCode; \
static void IpcServerCmdProcess##cmdCode(paraA, paraB) \
} while(0)
static void IpcServerCmdProcess##cmdCode(paraA, paraB)
using SetIpcRequestFunc = int32_t (*)(std::shared_ptr<IpcReq> pBaseReq, IpcIo &request, uint8_t *buffer,
size_t bufferLen);