diff --git a/common/utils/include/distributed_hardware_errno.h b/common/utils/include/distributed_hardware_errno.h index 2bab94971f8c7c74dbaab52cd959ee6a539b6d1c..ffc05fd2b19cf2a052b190bca3da1a7f11ec6420 100644 --- a/common/utils/include/distributed_hardware_errno.h +++ b/common/utils/include/distributed_hardware_errno.h @@ -82,6 +82,7 @@ namespace DistributedHardware { constexpr int32_t ERR_DH_FWK_SERVICE_STRING_IS_EMPTY = -10803; constexpr int32_t ERR_DH_FWK_SERVICE_LOCAL_VERSION_NOT_EXIST = -10804; constexpr int32_t ERR_DH_FWK_SERVICE_WRITE_TOKEN_FAIL = -10805; + constexpr int32_t ERR_DH_FWK_SERVICE_REMOTE_IS_NULL = -10806; /* AccessManager errno, range: [-10900, -10999] */ constexpr int32_t ERR_DH_FWK_ACCESS_INIT_DM_FAILED = -10900; diff --git a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_utils.h b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_utils.h index 03ba810c7ce1f1d1fe84266c25a4c4e6c577a1bc..f6e390853a5b8393b89406a727dff6b64aaaf963 100644 --- a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_utils.h +++ b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/capability_utils.h @@ -23,7 +23,7 @@ namespace OHOS { namespace DistributedHardware { -enum CapabilityInfoFilter : uint32_t { +enum class CapabilityInfoFilter : uint32_t { FILTER_DH_ID = 0, FILTER_DEVICE_ID = 1, FILTER_DEVICE_NAME = 2, diff --git a/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp b/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp index 10d940b1ee6e098e32096fcc16514debb397d084..604f5dd64edff02f46dc9d2198cd877f29f88880 100644 --- a/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp @@ -131,7 +131,7 @@ void *ComponentLoader::GetHandler(const std::string &soName) return nullptr; } char path[PATH_MAX + 1] = {0x00}; - if (soName.length() == 0 || soName.length() > PATH_MAX || realpath(soName.c_str(), path) == NULL) { + if (soName.length() == 0 || soName.length() > PATH_MAX || realpath(soName.c_str(), path) == nullptr) { DHLOGE("File canonicalization failed"); return nullptr; } diff --git a/services/distributedhardwarefwkserviceimpl/src/distributed_hardware_proxy.cpp b/services/distributedhardwarefwkserviceimpl/src/distributed_hardware_proxy.cpp index 72867751c7be97b7fb2bd5956523ed50cdb49a73..0ecce1d2931a211267e520df6eaba105368d1d56 100644 --- a/services/distributedhardwarefwkserviceimpl/src/distributed_hardware_proxy.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/distributed_hardware_proxy.cpp @@ -43,7 +43,12 @@ int32_t DistributedHardwareProxy::QuerySinkVersion(std::unordered_mapSendRequest(QUERY_SINK_VERSION, data, reply, option); + sptr remote = Remote(); + if (remote == nullptr) { + DHLOGE("remote service is null"); + return ERR_DH_FWK_SERVICE_REMOTE_IS_NULL; + } + int32_t error = remote->SendRequest(QUERY_SINK_VERSION, data, reply, option); if (error != NO_ERROR) { DHLOGE("SendRequest failed, errCode = %d", error); return ERR_DH_FWK_SERVICE_IPC_SEND_REQUEST_FAIL;