improve the judge empty codes

Signed-off-by: zhangwenzhi <zhangwenzhi3@huawei.com>
This commit is contained in:
zhang-wenzhi821 2024-05-16 15:31:35 +08:00
parent 4bd686ae19
commit a4498c5dad
2 changed files with 2 additions and 1 deletions

View File

@ -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,

View File

@ -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);
}