From 1df4d5a3a43b57c9e86b4d10022348ad0b08ea34 Mon Sep 17 00:00:00 2001 From: li-tiangang4 Date: Thu, 16 Jan 2025 10:54:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9topic=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-tiangang4 --- .../inner_kits/src/ipc/distributed_hardware_proxy.cpp | 10 +++++----- .../inner_kits/src/ipc/publisher_listener_stub.cpp | 4 ++-- .../src/ipc/publisher_listener_proxy.cpp | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/interfaces/inner_kits/src/ipc/distributed_hardware_proxy.cpp b/interfaces/inner_kits/src/ipc/distributed_hardware_proxy.cpp index 68135245..415d8c81 100644 --- a/interfaces/inner_kits/src/ipc/distributed_hardware_proxy.cpp +++ b/interfaces/inner_kits/src/ipc/distributed_hardware_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -49,7 +49,7 @@ int32_t DistributedHardwareProxy::RegisterPublisherListener(const DHTopic topic, DHLOGE("remote service is null"); return ERR_DH_FWK_SERVICE_REMOTE_IS_NULL; } - if (topic < DHTopic::TOPIC_MIN || topic > DHTopic::TOPIC_MAX) { + if (topic <= DHTopic::TOPIC_MIN || topic => DHTopic::TOPIC_MAX) { DHLOGE("Topic is invalid!"); return ERR_DH_FWK_PARA_INVALID; } @@ -98,7 +98,7 @@ int32_t DistributedHardwareProxy::UnregisterPublisherListener(const DHTopic topi DHLOGE("remote service is null"); return ERR_DH_FWK_SERVICE_REMOTE_IS_NULL; } - if (topic < DHTopic::TOPIC_MIN || topic > DHTopic::TOPIC_MAX) { + if (topic <= DHTopic::TOPIC_MIN || topic >= DHTopic::TOPIC_MAX) { DHLOGE("Topic is invalid!"); return ERR_DH_FWK_PARA_INVALID; } @@ -141,7 +141,7 @@ int32_t DistributedHardwareProxy::PublishMessage(const DHTopic topic, const std: DHLOGE("remote service is null"); return ERR_DH_FWK_SERVICE_REMOTE_IS_NULL; } - if (topic < DHTopic::TOPIC_MIN || topic > DHTopic::TOPIC_MAX) { + if (topic <= DHTopic::TOPIC_MIN || topic >= DHTopic::TOPIC_MAX) { DHLOGE("Topic is invalid!"); return ERR_DH_FWK_PARA_INVALID; } @@ -187,7 +187,7 @@ std::string DistributedHardwareProxy::QueryLocalSysSpec(QueryLocalSysSpecType sp DHLOGE("remote service is null"); return ""; } - if (spec < QueryLocalSysSpecType::MIN || spec > QueryLocalSysSpecType::MAX) { + if (spec <= QueryLocalSysSpecType::MIN || spec >= QueryLocalSysSpecType::MAX) { DHLOGE("Sys spec type is invalid!"); return ""; } diff --git a/interfaces/inner_kits/src/ipc/publisher_listener_stub.cpp b/interfaces/inner_kits/src/ipc/publisher_listener_stub.cpp index db73fa8a..e56e56f7 100644 --- a/interfaces/inner_kits/src/ipc/publisher_listener_stub.cpp +++ b/interfaces/inner_kits/src/ipc/publisher_listener_stub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -40,7 +40,7 @@ int32_t PublisherListenerStub::OnRemoteRequest( switch (msgCode) { case IPublisherListener::Message::ON_MESSAGE: { DHTopic topic = static_cast(data.ReadUint32()); - if (topic < DHTopic::TOPIC_MIN || topic > DHTopic::TOPIC_MAX) { + if (topic <= DHTopic::TOPIC_MIN || topic >= DHTopic::TOPIC_MAX) { DHLOGE("Topic is invalid!"); return ERR_INVALID_DATA; } diff --git a/services/distributedhardwarefwkservice/src/ipc/publisher_listener_proxy.cpp b/services/distributedhardwarefwkservice/src/ipc/publisher_listener_proxy.cpp index fc281609..117c74e2 100644 --- a/services/distributedhardwarefwkservice/src/ipc/publisher_listener_proxy.cpp +++ b/services/distributedhardwarefwkservice/src/ipc/publisher_listener_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -36,7 +36,7 @@ void PublisherListenerProxy::OnMessage(const DHTopic topic, const std::string& m DHLOGE("Get Remote IRemoteObject failed"); return; } - if (topic < DHTopic::TOPIC_MIN || topic > DHTopic::TOPIC_MAX) { + if (topic <= DHTopic::TOPIC_MIN || topic >= DHTopic::TOPIC_MAX) { DHLOGE("Topic is invalid!"); return; } -- Gitee