From a4498c5dad5197704427173174e8b9930347436e Mon Sep 17 00:00:00 2001 From: zhang-wenzhi821 Date: Thu, 16 May 2024 15:31:35 +0800 Subject: [PATCH] improve the judge empty codes Signed-off-by: zhangwenzhi --- frameworks/ipc/src/lib.rs | 1 + services/core_service/src/stub.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frameworks/ipc/src/lib.rs b/frameworks/ipc/src/lib.rs index 5409cf8..64fda2a 100644 --- a/frameworks/ipc/src/lib.rs +++ b/frameworks/ipc/src/lib.rs @@ -34,6 +34,7 @@ const MAX_VEC_CAPACITY: u32 = 0x10000; impl_enum_trait! { /// Code used to identify the function to be called. #[derive(Clone, Copy)] + #[derive(Eq, PartialEq)] pub enum IpcCode { /// Code for AddAsset. Add = ipc::FIRST_CALL_TRANSACTION, diff --git a/services/core_service/src/stub.rs b/services/core_service/src/stub.rs index 666d406..4f33d1b 100644 --- a/services/core_service/src/stub.rs +++ b/services/core_service/src/stub.rs @@ -94,7 +94,7 @@ fn on_app_request(code: &IpcCode, param_map: &AssetMap) -> Result<()> { _ => return Err(AssetError::new(ErrCode::BmsError, "[FATAL]Get calling package name failed.".to_string())) } - if *code == IpcCode::Remove && param_map.len() == 0 { + if code == &IpcCode::Remove && param_map.is_empty() { name.truncate(name_len as usize); return remove_all_ext_data(&user_id, &name, &app_index); }