From e1b6c205723bd2345eff99be6bcd79ffd54673f5 Mon Sep 17 00:00:00 2001 From: zwx1271681 Date: Fri, 5 Jul 2024 11:39:45 +0800 Subject: [PATCH] feat: Modify the datashare module, add, delete, and modify the return value of the interface to pair Signed-off-by: zwx1271681 --- .../kits/js/file_share/grant_uri_permission.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/interfaces/kits/js/file_share/grant_uri_permission.cpp b/interfaces/kits/js/file_share/grant_uri_permission.cpp index 34fc2b20f..d0bb59a42 100644 --- a/interfaces/kits/js/file_share/grant_uri_permission.cpp +++ b/interfaces/kits/js/file_share/grant_uri_permission.cpp @@ -103,7 +103,6 @@ namespace ModuleFileShare { static int InsertByDatashare(const DataShareValuesBucket &valuesBucket, bool isApi10) { - int ret = -1; std::shared_ptr dataShareHelper = nullptr; sptr remote = new IRemoteStub(); if (remote == nullptr) { @@ -122,12 +121,12 @@ namespace ModuleFileShare { } Uri uri(uriStr); - ret = dataShareHelper->Insert(uri, valuesBucket); - if (ret < 0) { - LOGE("FileShare::InsertByDatashare insert failed with error code %{public}d!", ret); - return ret; + auto [errCode, status] = dataShareHelper->Insert(uri, valuesBucket); + if (errCode != 0) { + LOGE("FileShare::InsertByDatashare insert failed with error code %{public}d!", errCode); + return errCode; } - return ret; + return status; } static int InitValuesBucket(const UriPermissionInfo &uriPermInfo, Uri &uri, bool &isApi10, -- Gitee