From 5de6cf6931bd2050d197b8f3b01d2d7563941fc4 Mon Sep 17 00:00:00 2001 From: liqiao49 Date: Thu, 13 Jul 2023 09:47:27 +0800 Subject: [PATCH 1/4] fix null pointer is not verified Signed-off-by: liqiao49 --- interfaces/ipc/src/distributed_input_sink_stub.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interfaces/ipc/src/distributed_input_sink_stub.cpp b/interfaces/ipc/src/distributed_input_sink_stub.cpp index 306f6e4..04b77e3 100644 --- a/interfaces/ipc/src/distributed_input_sink_stub.cpp +++ b/interfaces/ipc/src/distributed_input_sink_stub.cpp @@ -138,6 +138,10 @@ int32_t DistributedInputSinkStub::NotifyStopDScreenInner(MessageParcel &data, Me int32_t DistributedInputSinkStub::RegisterSharingDhIdListenerInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("RegisterSharingDhIdListenerInner failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_SINK_STUB_REGISTER_SHARING_DHID_LISTENER_FAIL; + } sptr listener = iface_cast(data.ReadRemoteObject()); int32_t ret = RegisterSharingDhIdListener(listener); if (!reply.WriteInt32(ret)) { -- Gitee From 4370879155d15d2a1a80d21c0f08f169394f940e Mon Sep 17 00:00:00 2001 From: liqiao49 Date: Thu, 13 Jul 2023 09:59:26 +0800 Subject: [PATCH 2/4] fix null pointer is not verified Signed-off-by: liqiao49 --- common/include/dinput_errcode.h | 3 + .../ipc/src/distributed_input_sink_stub.cpp | 6 +- .../ipc/src/distributed_input_source_stub.cpp | 80 +++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/common/include/dinput_errcode.h b/common/include/dinput_errcode.h index bb93ecb..859b8ce 100644 --- a/common/include/dinput_errcode.h +++ b/common/include/dinput_errcode.h @@ -177,6 +177,9 @@ namespace DistributedInput { constexpr int32_t ERR_DH_INPUT_HIDUMP_INVALID_ARGS = -68000; constexpr int32_t ERR_DH_INPUT_HIDUMP_DUMP_PROCESS_FAIL = -68001; constexpr int32_t ERR_DH_INPUT_HIDUMP_DPRINTF_FAIL = -68002; + + // null pointer is not verified + constexpr int32_t ERR_DH_INPUT_NULLPTR_NOT_VERIFY = -69000; } // namespace DistributedInput } // namespace DistributedHardware } // namespace OHOS diff --git a/interfaces/ipc/src/distributed_input_sink_stub.cpp b/interfaces/ipc/src/distributed_input_sink_stub.cpp index 04b77e3..f7d1ba5 100644 --- a/interfaces/ipc/src/distributed_input_sink_stub.cpp +++ b/interfaces/ipc/src/distributed_input_sink_stub.cpp @@ -140,7 +140,7 @@ int32_t DistributedInputSinkStub::RegisterSharingDhIdListenerInner(MessageParcel { if (data.ReadRemoteObject() == nullptr) { DHLOGE("RegisterSharingDhIdListenerInner failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_SINK_STUB_REGISTER_SHARING_DHID_LISTENER_FAIL; + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; } sptr listener = iface_cast(data.ReadRemoteObject()); int32_t ret = RegisterSharingDhIdListener(listener); @@ -155,6 +155,10 @@ int32_t DistributedInputSinkStub::RegisterSharingDhIdListenerInner(MessageParcel int32_t DistributedInputSinkStub::RegisterGetSinkScreenInfosInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("RegisterGetSinkScreenInfosInner failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } sptr callback = iface_cast(data.ReadRemoteObject()); int32_t ret = RegisterGetSinkScreenInfosCallback(callback); diff --git a/interfaces/ipc/src/distributed_input_source_stub.cpp b/interfaces/ipc/src/distributed_input_source_stub.cpp index 1c7ec80..38d69d9 100644 --- a/interfaces/ipc/src/distributed_input_source_stub.cpp +++ b/interfaces/ipc/src/distributed_input_source_stub.cpp @@ -51,6 +51,10 @@ int32_t DistributedInputSourceStub::HandleReleaseDistributedHardware(MessageParc int32_t DistributedInputSourceStub::HandleRegisterDistributedHardware(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleRegisterDistributedHardware failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string devId = data.ReadString(); std::string dhId = data.ReadString(); std::string params = data.ReadString(); @@ -65,6 +69,10 @@ int32_t DistributedInputSourceStub::HandleRegisterDistributedHardware(MessagePar int32_t DistributedInputSourceStub::HandleUnregisterDistributedHardware(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleUnregisterDistributedHardware failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string devId = data.ReadString(); std::string dhId = data.ReadString(); sptr callback = iface_cast(data.ReadRemoteObject()); @@ -78,6 +86,10 @@ int32_t DistributedInputSourceStub::HandleUnregisterDistributedHardware(MessageP int32_t DistributedInputSourceStub::HandlePrepareRemoteInput(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandlePrepareRemoteInput failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string deviceId = data.ReadString(); sptr callback = iface_cast(data.ReadRemoteObject()); int32_t ret = PrepareRemoteInput(deviceId, callback); @@ -90,6 +102,10 @@ int32_t DistributedInputSourceStub::HandlePrepareRemoteInput(MessageParcel &data int32_t DistributedInputSourceStub::HandleUnprepareRemoteInput(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleUnprepareRemoteInput failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string deviceId = data.ReadString(); sptr callback = iface_cast(data.ReadRemoteObject()); int32_t ret = UnprepareRemoteInput(deviceId, callback); @@ -102,6 +118,10 @@ int32_t DistributedInputSourceStub::HandleUnprepareRemoteInput(MessageParcel &da int32_t DistributedInputSourceStub::HandleStartRemoteInput(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleStartRemoteInput failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string deviceId = data.ReadString(); uint32_t inputTypes = data.ReadUint32(); sptr callback = iface_cast(data.ReadRemoteObject()); @@ -115,6 +135,10 @@ int32_t DistributedInputSourceStub::HandleStartRemoteInput(MessageParcel &data, int32_t DistributedInputSourceStub::HandleStopRemoteInput(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleStopRemoteInput failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string deviceId = data.ReadString(); uint32_t inputTypes = data.ReadUint32(); sptr callback = iface_cast(data.ReadRemoteObject()); @@ -128,6 +152,10 @@ int32_t DistributedInputSourceStub::HandleStopRemoteInput(MessageParcel &data, M int32_t DistributedInputSourceStub::HandleStartRelayTypeRemoteInput(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleStartRelayTypeRemoteInput failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); uint32_t inputTypes = data.ReadUint32(); @@ -142,6 +170,10 @@ int32_t DistributedInputSourceStub::HandleStartRelayTypeRemoteInput(MessageParce int32_t DistributedInputSourceStub::HandleStopRelayTypeRemoteInput(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleStopRelayTypeRemoteInput failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); uint32_t inputTypes = data.ReadUint32(); @@ -156,6 +188,10 @@ int32_t DistributedInputSourceStub::HandleStopRelayTypeRemoteInput(MessageParcel int32_t DistributedInputSourceStub::HandlePrepareRelayRemoteInput(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandlePrepareRelayRemoteInput failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); sptr callback = iface_cast(data.ReadRemoteObject()); @@ -169,6 +205,10 @@ int32_t DistributedInputSourceStub::HandlePrepareRelayRemoteInput(MessageParcel int32_t DistributedInputSourceStub::HandleUnprepareRelayRemoteInput(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleUnprepareRelayRemoteInput failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); sptr callback = iface_cast(data.ReadRemoteObject()); @@ -182,6 +222,10 @@ int32_t DistributedInputSourceStub::HandleUnprepareRelayRemoteInput(MessageParce int32_t DistributedInputSourceStub::HandleStartDhidRemoteInput(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleStartDhidRemoteInput failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string sinkId = data.ReadString(); std::vector tempVector; @@ -211,6 +255,10 @@ int32_t DistributedInputSourceStub::HandleStartDhidRemoteInput(MessageParcel &da int32_t DistributedInputSourceStub::HandleStopDhidRemoteInput(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleStopDhidRemoteInput failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string sinkId = data.ReadString(); std::vector tempVector; @@ -240,6 +288,10 @@ int32_t DistributedInputSourceStub::HandleStopDhidRemoteInput(MessageParcel &dat int32_t DistributedInputSourceStub::HandleStartRelayDhidRemoteInput(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleStartRelayDhidRemoteInput failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); @@ -270,6 +322,10 @@ int32_t DistributedInputSourceStub::HandleStartRelayDhidRemoteInput(MessageParce int32_t DistributedInputSourceStub::HandleStopRelayDhidRemoteInput(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleStopRelayDhidRemoteInput failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); @@ -314,6 +370,10 @@ int32_t DistributedInputSourceStub::HandleSyncNodeInfoRemoteInput(MessageParcel int32_t DistributedInputSourceStub::HandleRegisterAddWhiteListCallback(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleRegisterAddWhiteListCallback failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } sptr callback = iface_cast(data.ReadRemoteObject()); int32_t ret = RegisterAddWhiteListCallback(callback); if (!reply.WriteInt32(ret)) { @@ -325,6 +385,10 @@ int32_t DistributedInputSourceStub::HandleRegisterAddWhiteListCallback(MessagePa int32_t DistributedInputSourceStub::HandleRegisterDelWhiteListCallback(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleRegisterDelWhiteListCallback failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGI("HandleRegisterDelWhiteListCallback callback is null"); @@ -340,6 +404,10 @@ int32_t DistributedInputSourceStub::HandleRegisterDelWhiteListCallback(MessagePa int32_t DistributedInputSourceStub::HandleRegisterInputNodeListener(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleRegisterInputNodeListener failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } sptr callback = iface_cast(data.ReadRemoteObject()); int32_t ret = RegisterInputNodeListener(callback); if (!reply.WriteInt32(ret)) { @@ -352,6 +420,10 @@ int32_t DistributedInputSourceStub::HandleRegisterInputNodeListener(MessageParce int32_t DistributedInputSourceStub::HandleUnRegisterInputNodeListener(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleUnRegisterInputNodeListener failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } sptr callback = iface_cast(data.ReadRemoteObject()); int32_t ret = RegisterInputNodeListener(callback); if (!reply.WriteInt32(ret)) { @@ -364,6 +436,10 @@ int32_t DistributedInputSourceStub::HandleUnRegisterInputNodeListener(MessagePar int32_t DistributedInputSourceStub::HandleRegisterSimulationEventListener(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleRegisterSimulationEventListener failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } sptr callback = iface_cast(data.ReadRemoteObject()); int32_t ret = RegisterSimulationEventListener(callback); if (!reply.WriteInt32(ret)) { @@ -376,6 +452,10 @@ int32_t DistributedInputSourceStub::HandleRegisterSimulationEventListener(Messag int32_t DistributedInputSourceStub::HandleUnregisterSimulationEventListener(MessageParcel &data, MessageParcel &reply) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("HandleUnregisterSimulationEventListener failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } sptr callback = iface_cast(data.ReadRemoteObject()); int32_t ret = UnregisterSimulationEventListener(callback); if (!reply.WriteInt32(ret)) { -- Gitee From 0c7bb3bbb960e79242404c7db3fa0b2c66b6333b Mon Sep 17 00:00:00 2001 From: liqiao49 Date: Thu, 13 Jul 2023 10:23:20 +0800 Subject: [PATCH 3/4] fix iface_cast is nullptr Signed-off-by: liqiao49 --- .../ipc/src/distributed_input_sink_stub.cpp | 14 +- .../ipc/src/distributed_input_source_stub.cpp | 162 +++++++++--------- 2 files changed, 86 insertions(+), 90 deletions(-) diff --git a/interfaces/ipc/src/distributed_input_sink_stub.cpp b/interfaces/ipc/src/distributed_input_sink_stub.cpp index f7d1ba5..9115425 100644 --- a/interfaces/ipc/src/distributed_input_sink_stub.cpp +++ b/interfaces/ipc/src/distributed_input_sink_stub.cpp @@ -138,11 +138,11 @@ int32_t DistributedInputSinkStub::NotifyStopDScreenInner(MessageParcel &data, Me int32_t DistributedInputSinkStub::RegisterSharingDhIdListenerInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("RegisterSharingDhIdListenerInner failed, data.ReadRemoteObject is nullptr."); + sptr listener = iface_cast(data.ReadRemoteObject()); + if (listener == nullptr) { + DHLOGE("RegisterSharingDhIdListenerInner failed, listener is nullptr."); return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; } - sptr listener = iface_cast(data.ReadRemoteObject()); int32_t ret = RegisterSharingDhIdListener(listener); if (!reply.WriteInt32(ret)) { DHLOGE("RegisterSharingDhIdListenerInner write ret failed, ret = %d", ret); @@ -155,12 +155,12 @@ int32_t DistributedInputSinkStub::RegisterSharingDhIdListenerInner(MessageParcel int32_t DistributedInputSinkStub::RegisterGetSinkScreenInfosInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("RegisterGetSinkScreenInfosInner failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("RegisterGetSinkScreenInfosInner failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = RegisterGetSinkScreenInfosCallback(callback); if (!reply.WriteInt32(ret)) { DHLOGE("write ret failed, ret = %d", ret); diff --git a/interfaces/ipc/src/distributed_input_source_stub.cpp b/interfaces/ipc/src/distributed_input_source_stub.cpp index 38d69d9..ff474b3 100644 --- a/interfaces/ipc/src/distributed_input_source_stub.cpp +++ b/interfaces/ipc/src/distributed_input_source_stub.cpp @@ -51,17 +51,17 @@ int32_t DistributedInputSourceStub::HandleReleaseDistributedHardware(MessageParc int32_t DistributedInputSourceStub::HandleRegisterDistributedHardware(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleRegisterDistributedHardware failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string devId = data.ReadString(); std::string dhId = data.ReadString(); std::string params = data.ReadString(); sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleRegisterDistributedHardware failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = RegisterDistributedHardware(devId, dhId, params, callback); if (!reply.WriteInt32(ret)) { - DHLOGE("DistributedInputSourceStub registerDistributedHardware write ret failed"); + DHLOGE("HandleRegisterDistributedHardware write ret failed"); return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; } return DH_SUCCESS; @@ -69,16 +69,16 @@ int32_t DistributedInputSourceStub::HandleRegisterDistributedHardware(MessagePar int32_t DistributedInputSourceStub::HandleUnregisterDistributedHardware(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleUnregisterDistributedHardware failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string devId = data.ReadString(); std::string dhId = data.ReadString(); sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleUnregisterDistributedHardware failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = UnregisterDistributedHardware(devId, dhId, callback); if (!reply.WriteInt32(ret)) { - DHLOGE("DistributedInputSourceStub unregisterDistributedHardware write ret failed"); + DHLOGE("HandleUnregisterDistributedHardware write ret failed"); return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; } return DH_SUCCESS; @@ -86,12 +86,12 @@ int32_t DistributedInputSourceStub::HandleUnregisterDistributedHardware(MessageP int32_t DistributedInputSourceStub::HandlePrepareRemoteInput(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandlePrepareRemoteInput failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string deviceId = data.ReadString(); sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandlePrepareRemoteInput failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = PrepareRemoteInput(deviceId, callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandlePrepareRemoteInput write ret failed"); @@ -102,12 +102,12 @@ int32_t DistributedInputSourceStub::HandlePrepareRemoteInput(MessageParcel &data int32_t DistributedInputSourceStub::HandleUnprepareRemoteInput(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleUnprepareRemoteInput failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string deviceId = data.ReadString(); sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleUnprepareRemoteInput failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = UnprepareRemoteInput(deviceId, callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandleUnprepareRemoteInput write ret failed"); @@ -118,16 +118,16 @@ int32_t DistributedInputSourceStub::HandleUnprepareRemoteInput(MessageParcel &da int32_t DistributedInputSourceStub::HandleStartRemoteInput(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleStartRemoteInput failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string deviceId = data.ReadString(); uint32_t inputTypes = data.ReadUint32(); sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleStartRemoteInput failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = StartRemoteInput(deviceId, inputTypes, callback); if (!reply.WriteInt32(ret)) { - DHLOGE("DistributedInputSourceStub startRemoteInput write ret failed"); + DHLOGE("HandleStartRemoteInput write ret failed"); return ERR_DH_INPUT_IPC_WRITE_VALID_FAIL; } return DH_SUCCESS; @@ -135,16 +135,16 @@ int32_t DistributedInputSourceStub::HandleStartRemoteInput(MessageParcel &data, int32_t DistributedInputSourceStub::HandleStopRemoteInput(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleStopRemoteInput failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string deviceId = data.ReadString(); uint32_t inputTypes = data.ReadUint32(); sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleStopRemoteInput failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = StopRemoteInput(deviceId, inputTypes, callback); if (!reply.WriteInt32(ret)) { - DHLOGE("DistributedInputSourceStub stopRemoteInput write ret failed"); + DHLOGE("HandleStopRemoteInput write ret failed"); return ERR_DH_INPUT_IPC_WRITE_VALID_FAIL; } return DH_SUCCESS; @@ -152,17 +152,17 @@ int32_t DistributedInputSourceStub::HandleStopRemoteInput(MessageParcel &data, M int32_t DistributedInputSourceStub::HandleStartRelayTypeRemoteInput(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleStartRelayTypeRemoteInput failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); uint32_t inputTypes = data.ReadUint32(); sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleStartRelayTypeRemoteInput failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = StartRemoteInput(srcId, sinkId, inputTypes, callback); if (!reply.WriteInt32(ret)) { - DHLOGE("DistributedInputSourceStub write ret failed"); + DHLOGE("HandleStartRelayTypeRemoteInput write ret failed"); return ERR_DH_INPUT_IPC_WRITE_VALID_FAIL; } return DH_SUCCESS; @@ -170,17 +170,17 @@ int32_t DistributedInputSourceStub::HandleStartRelayTypeRemoteInput(MessageParce int32_t DistributedInputSourceStub::HandleStopRelayTypeRemoteInput(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleStopRelayTypeRemoteInput failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); uint32_t inputTypes = data.ReadUint32(); sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleStopRelayTypeRemoteInput failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = StopRemoteInput(srcId, sinkId, inputTypes, callback); if (!reply.WriteInt32(ret)) { - DHLOGE("DistributedInputSourceStub write ret failed"); + DHLOGE("HandleStopRelayTypeRemoteInput write ret failed"); return ERR_DH_INPUT_IPC_WRITE_VALID_FAIL; } return DH_SUCCESS; @@ -188,13 +188,13 @@ int32_t DistributedInputSourceStub::HandleStopRelayTypeRemoteInput(MessageParcel int32_t DistributedInputSourceStub::HandlePrepareRelayRemoteInput(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandlePrepareRelayRemoteInput failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandlePrepareRelayRemoteInput failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = PrepareRemoteInput(srcId, sinkId, callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandlePrepareRelayRemoteInput write ret failed"); @@ -205,13 +205,13 @@ int32_t DistributedInputSourceStub::HandlePrepareRelayRemoteInput(MessageParcel int32_t DistributedInputSourceStub::HandleUnprepareRelayRemoteInput(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleUnprepareRelayRemoteInput failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleUnprepareRelayRemoteInput failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = UnprepareRemoteInput(srcId, sinkId, callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandleUnprepareRelayRemoteInput write ret failed"); @@ -222,10 +222,6 @@ int32_t DistributedInputSourceStub::HandleUnprepareRelayRemoteInput(MessageParce int32_t DistributedInputSourceStub::HandleStartDhidRemoteInput(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleStartDhidRemoteInput failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string sinkId = data.ReadString(); std::vector tempVector; @@ -245,6 +241,10 @@ int32_t DistributedInputSourceStub::HandleStartDhidRemoteInput(MessageParcel &da } sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleStartDhidRemoteInput failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = StartRemoteInput(sinkId, tempVector, callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandleStartDhidRemoteInput write ret failed"); @@ -255,10 +255,6 @@ int32_t DistributedInputSourceStub::HandleStartDhidRemoteInput(MessageParcel &da int32_t DistributedInputSourceStub::HandleStopDhidRemoteInput(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleStopDhidRemoteInput failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string sinkId = data.ReadString(); std::vector tempVector; @@ -278,6 +274,10 @@ int32_t DistributedInputSourceStub::HandleStopDhidRemoteInput(MessageParcel &dat } sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleStopDhidRemoteInput failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = StopRemoteInput(sinkId, tempVector, callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandleStopDhidRemoteInput write ret failed"); @@ -288,10 +288,6 @@ int32_t DistributedInputSourceStub::HandleStopDhidRemoteInput(MessageParcel &dat int32_t DistributedInputSourceStub::HandleStartRelayDhidRemoteInput(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleStartRelayDhidRemoteInput failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); @@ -312,6 +308,10 @@ int32_t DistributedInputSourceStub::HandleStartRelayDhidRemoteInput(MessageParce } sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleStartRelayDhidRemoteInput failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = StartRemoteInput(srcId, sinkId, tempVector, callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandleStartRelayDhidRemoteInput write ret failed"); @@ -322,10 +322,6 @@ int32_t DistributedInputSourceStub::HandleStartRelayDhidRemoteInput(MessageParce int32_t DistributedInputSourceStub::HandleStopRelayDhidRemoteInput(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleStopRelayDhidRemoteInput failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); @@ -346,6 +342,10 @@ int32_t DistributedInputSourceStub::HandleStopRelayDhidRemoteInput(MessageParcel } sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleStopRelayDhidRemoteInput failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + } int32_t ret = StopRemoteInput(srcId, sinkId, tempVector, callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandleStopRelayDhidRemoteInput write ret failed"); @@ -370,11 +370,11 @@ int32_t DistributedInputSourceStub::HandleSyncNodeInfoRemoteInput(MessageParcel int32_t DistributedInputSourceStub::HandleRegisterAddWhiteListCallback(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleRegisterAddWhiteListCallback failed, data.ReadRemoteObject is nullptr."); + sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleRegisterAddWhiteListCallback failed, callback is nullptr."); return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; } - sptr callback = iface_cast(data.ReadRemoteObject()); int32_t ret = RegisterAddWhiteListCallback(callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandleRegisterAddWhiteListCallback write ret failed"); @@ -385,15 +385,11 @@ int32_t DistributedInputSourceStub::HandleRegisterAddWhiteListCallback(MessagePa int32_t DistributedInputSourceStub::HandleRegisterDelWhiteListCallback(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleRegisterDelWhiteListCallback failed, data.ReadRemoteObject is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; - } sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { - DHLOGI("HandleRegisterDelWhiteListCallback callback is null"); + DHLOGE("HandleRegisterDelWhiteListCallback failed, callback is nullptr."); + return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; } - int32_t ret = RegisterDelWhiteListCallback(callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandleRegisterDelWhiteListCallback write ret failed"); @@ -404,11 +400,11 @@ int32_t DistributedInputSourceStub::HandleRegisterDelWhiteListCallback(MessagePa int32_t DistributedInputSourceStub::HandleRegisterInputNodeListener(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleRegisterInputNodeListener failed, data.ReadRemoteObject is nullptr."); + sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleRegisterInputNodeListener failed, callback is nullptr."); return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; } - sptr callback = iface_cast(data.ReadRemoteObject()); int32_t ret = RegisterInputNodeListener(callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandleRegisterInputNodeListener write ret failed"); @@ -420,11 +416,11 @@ int32_t DistributedInputSourceStub::HandleRegisterInputNodeListener(MessageParce int32_t DistributedInputSourceStub::HandleUnRegisterInputNodeListener(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleUnRegisterInputNodeListener failed, data.ReadRemoteObject is nullptr."); + sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleUnRegisterInputNodeListener failed, callback is nullptr."); return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; } - sptr callback = iface_cast(data.ReadRemoteObject()); int32_t ret = RegisterInputNodeListener(callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandleUnRegisterInputNodeListener write ret failed"); @@ -436,11 +432,11 @@ int32_t DistributedInputSourceStub::HandleUnRegisterInputNodeListener(MessagePar int32_t DistributedInputSourceStub::HandleRegisterSimulationEventListener(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleRegisterSimulationEventListener failed, data.ReadRemoteObject is nullptr."); + sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleRegisterSimulationEventListener failed, callback is nullptr."); return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; } - sptr callback = iface_cast(data.ReadRemoteObject()); int32_t ret = RegisterSimulationEventListener(callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandleRegisterSimulationEventListener write ret failed, ret = %d", ret); @@ -452,11 +448,11 @@ int32_t DistributedInputSourceStub::HandleRegisterSimulationEventListener(Messag int32_t DistributedInputSourceStub::HandleUnregisterSimulationEventListener(MessageParcel &data, MessageParcel &reply) { - if (data.ReadRemoteObject() == nullptr) { - DHLOGE("HandleUnregisterSimulationEventListener failed, data.ReadRemoteObject is nullptr."); + sptr callback = iface_cast(data.ReadRemoteObject()); + if (callback == nullptr) { + DHLOGE("HandleUnregisterSimulationEventListener failed, callback is nullptr."); return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; } - sptr callback = iface_cast(data.ReadRemoteObject()); int32_t ret = UnregisterSimulationEventListener(callback); if (!reply.WriteInt32(ret)) { DHLOGE("HandleUnregisterSimulationEventListener write ret failed, ret = %d", ret); -- Gitee From e2491397e5d332ce3c398abde6dd41719b9c9929 Mon Sep 17 00:00:00 2001 From: liqiao49 Date: Thu, 13 Jul 2023 14:02:53 +0800 Subject: [PATCH 4/4] fix const int32_t name Signed-off-by: liqiao49 --- common/include/dinput_errcode.h | 2 +- .../ipc/src/distributed_input_sink_stub.cpp | 4 +- .../ipc/src/distributed_input_source_stub.cpp | 40 +++++++++---------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/common/include/dinput_errcode.h b/common/include/dinput_errcode.h index 859b8ce..b19237e 100644 --- a/common/include/dinput_errcode.h +++ b/common/include/dinput_errcode.h @@ -179,7 +179,7 @@ namespace DistributedInput { constexpr int32_t ERR_DH_INPUT_HIDUMP_DPRINTF_FAIL = -68002; // null pointer is not verified - constexpr int32_t ERR_DH_INPUT_NULLPTR_NOT_VERIFY = -69000; + constexpr int32_t ERR_DH_INPUT_POINTER_NULL = -69000; } // namespace DistributedInput } // namespace DistributedHardware } // namespace OHOS diff --git a/interfaces/ipc/src/distributed_input_sink_stub.cpp b/interfaces/ipc/src/distributed_input_sink_stub.cpp index 9115425..767b7d2 100644 --- a/interfaces/ipc/src/distributed_input_sink_stub.cpp +++ b/interfaces/ipc/src/distributed_input_sink_stub.cpp @@ -141,7 +141,7 @@ int32_t DistributedInputSinkStub::RegisterSharingDhIdListenerInner(MessageParcel sptr listener = iface_cast(data.ReadRemoteObject()); if (listener == nullptr) { DHLOGE("RegisterSharingDhIdListenerInner failed, listener is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = RegisterSharingDhIdListener(listener); if (!reply.WriteInt32(ret)) { @@ -159,7 +159,7 @@ int32_t DistributedInputSinkStub::RegisterGetSinkScreenInfosInner(MessageParcel iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("RegisterGetSinkScreenInfosInner failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = RegisterGetSinkScreenInfosCallback(callback); if (!reply.WriteInt32(ret)) { diff --git a/interfaces/ipc/src/distributed_input_source_stub.cpp b/interfaces/ipc/src/distributed_input_source_stub.cpp index ff474b3..6475bca 100644 --- a/interfaces/ipc/src/distributed_input_source_stub.cpp +++ b/interfaces/ipc/src/distributed_input_source_stub.cpp @@ -57,7 +57,7 @@ int32_t DistributedInputSourceStub::HandleRegisterDistributedHardware(MessagePar sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleRegisterDistributedHardware failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = RegisterDistributedHardware(devId, dhId, params, callback); if (!reply.WriteInt32(ret)) { @@ -74,7 +74,7 @@ int32_t DistributedInputSourceStub::HandleUnregisterDistributedHardware(MessageP sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleUnregisterDistributedHardware failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = UnregisterDistributedHardware(devId, dhId, callback); if (!reply.WriteInt32(ret)) { @@ -90,7 +90,7 @@ int32_t DistributedInputSourceStub::HandlePrepareRemoteInput(MessageParcel &data sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandlePrepareRemoteInput failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = PrepareRemoteInput(deviceId, callback); if (!reply.WriteInt32(ret)) { @@ -106,7 +106,7 @@ int32_t DistributedInputSourceStub::HandleUnprepareRemoteInput(MessageParcel &da sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleUnprepareRemoteInput failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = UnprepareRemoteInput(deviceId, callback); if (!reply.WriteInt32(ret)) { @@ -123,7 +123,7 @@ int32_t DistributedInputSourceStub::HandleStartRemoteInput(MessageParcel &data, sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleStartRemoteInput failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = StartRemoteInput(deviceId, inputTypes, callback); if (!reply.WriteInt32(ret)) { @@ -140,7 +140,7 @@ int32_t DistributedInputSourceStub::HandleStopRemoteInput(MessageParcel &data, M sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleStopRemoteInput failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = StopRemoteInput(deviceId, inputTypes, callback); if (!reply.WriteInt32(ret)) { @@ -158,7 +158,7 @@ int32_t DistributedInputSourceStub::HandleStartRelayTypeRemoteInput(MessageParce sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleStartRelayTypeRemoteInput failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = StartRemoteInput(srcId, sinkId, inputTypes, callback); if (!reply.WriteInt32(ret)) { @@ -176,7 +176,7 @@ int32_t DistributedInputSourceStub::HandleStopRelayTypeRemoteInput(MessageParcel sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleStopRelayTypeRemoteInput failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = StopRemoteInput(srcId, sinkId, inputTypes, callback); if (!reply.WriteInt32(ret)) { @@ -193,7 +193,7 @@ int32_t DistributedInputSourceStub::HandlePrepareRelayRemoteInput(MessageParcel sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandlePrepareRelayRemoteInput failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = PrepareRemoteInput(srcId, sinkId, callback); if (!reply.WriteInt32(ret)) { @@ -210,7 +210,7 @@ int32_t DistributedInputSourceStub::HandleUnprepareRelayRemoteInput(MessageParce sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleUnprepareRelayRemoteInput failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = UnprepareRemoteInput(srcId, sinkId, callback); if (!reply.WriteInt32(ret)) { @@ -243,7 +243,7 @@ int32_t DistributedInputSourceStub::HandleStartDhidRemoteInput(MessageParcel &da sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleStartDhidRemoteInput failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = StartRemoteInput(sinkId, tempVector, callback); if (!reply.WriteInt32(ret)) { @@ -276,7 +276,7 @@ int32_t DistributedInputSourceStub::HandleStopDhidRemoteInput(MessageParcel &dat sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleStopDhidRemoteInput failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = StopRemoteInput(sinkId, tempVector, callback); if (!reply.WriteInt32(ret)) { @@ -310,7 +310,7 @@ int32_t DistributedInputSourceStub::HandleStartRelayDhidRemoteInput(MessageParce sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleStartRelayDhidRemoteInput failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = StartRemoteInput(srcId, sinkId, tempVector, callback); if (!reply.WriteInt32(ret)) { @@ -344,7 +344,7 @@ int32_t DistributedInputSourceStub::HandleStopRelayDhidRemoteInput(MessageParcel sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleStopRelayDhidRemoteInput failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = StopRemoteInput(srcId, sinkId, tempVector, callback); if (!reply.WriteInt32(ret)) { @@ -373,7 +373,7 @@ int32_t DistributedInputSourceStub::HandleRegisterAddWhiteListCallback(MessagePa sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleRegisterAddWhiteListCallback failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = RegisterAddWhiteListCallback(callback); if (!reply.WriteInt32(ret)) { @@ -388,7 +388,7 @@ int32_t DistributedInputSourceStub::HandleRegisterDelWhiteListCallback(MessagePa sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleRegisterDelWhiteListCallback failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = RegisterDelWhiteListCallback(callback); if (!reply.WriteInt32(ret)) { @@ -403,7 +403,7 @@ int32_t DistributedInputSourceStub::HandleRegisterInputNodeListener(MessageParce sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleRegisterInputNodeListener failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = RegisterInputNodeListener(callback); if (!reply.WriteInt32(ret)) { @@ -419,7 +419,7 @@ int32_t DistributedInputSourceStub::HandleUnRegisterInputNodeListener(MessagePar sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleUnRegisterInputNodeListener failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = RegisterInputNodeListener(callback); if (!reply.WriteInt32(ret)) { @@ -435,7 +435,7 @@ int32_t DistributedInputSourceStub::HandleRegisterSimulationEventListener(Messag sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleRegisterSimulationEventListener failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = RegisterSimulationEventListener(callback); if (!reply.WriteInt32(ret)) { @@ -451,7 +451,7 @@ int32_t DistributedInputSourceStub::HandleUnregisterSimulationEventListener(Mess sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("HandleUnregisterSimulationEventListener failed, callback is nullptr."); - return ERR_DH_INPUT_NULLPTR_NOT_VERIFY; + return ERR_DH_INPUT_POINTER_NULL; } int32_t ret = UnregisterSimulationEventListener(callback); if (!reply.WriteInt32(ret)) { -- Gitee