From 740bc65fec83e5410d4fc9e5b389e8be65c943ec Mon Sep 17 00:00:00 2001
From: muyuying1 <muyuying1@huawei.com>
Date: Thu, 3 Aug 2023 17:06:02 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9compile=E7=9B=B8=E5=85=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../include/ikvstore_data_service.h           | 22 +++++-----
 .../innerkitsimpl/kvdb/src/system_api.cpp     | 40 +++++++++----------
 .../innerkitsimpl/rdb/include/rdb_notifier.h  |  4 +-
 frameworks/libs/distributeddb/BUILD.gn        |  6 +--
 .../src/kv_store_delegate_manager.cpp         |  6 +++
 .../storage/src/result_entries_window.cpp     |  2 +-
 6 files changed, 43 insertions(+), 37 deletions(-)

diff --git a/frameworks/innerkitsimpl/distributeddatafwk/include/ikvstore_data_service.h b/frameworks/innerkitsimpl/distributeddatafwk/include/ikvstore_data_service.h
index b67e248..af25e6b 100644
--- a/frameworks/innerkitsimpl/distributeddatafwk/include/ikvstore_data_service.h
+++ b/frameworks/innerkitsimpl/distributeddatafwk/include/ikvstore_data_service.h
@@ -64,17 +64,17 @@ private:
 
     using RequestHandler = int32_t(KvStoreDataServiceStub::*)(MessageParcel&, MessageParcel&);
     static constexpr RequestHandler HANDLERS[SERVICE_CMD_LAST] = {
-        [GET_FEATURE_INTERFACE] = &KvStoreDataServiceStub::GetFeatureInterfaceOnRemote,
-        [REGISTERCLIENTDEATHOBSERVER] = &KvStoreDataServiceStub::RegisterClientDeathObserverOnRemote,
-        [CLOSEKVSTORE] = &KvStoreDataServiceStub::NoSupport,
-        [CLOSEALLKVSTORE] = &KvStoreDataServiceStub::NoSupport,
-        [DELETEKVSTORE] = &KvStoreDataServiceStub::NoSupport,
-        [DELETEALLKVSTORE] = &KvStoreDataServiceStub::NoSupport,
-        [GETSINGLEKVSTORE] = &KvStoreDataServiceStub::NoSupport,
-        [GETLOCALDEVICE] = &KvStoreDataServiceStub::NoSupport,
-        [GETREMOTEDEVICES] = &KvStoreDataServiceStub::NoSupport,
-        [STARTWATCHDEVICECHANGE] = &KvStoreDataServiceStub::NoSupport,
-        [STOPWATCHDEVICECHANGE] = &KvStoreDataServiceStub::NoSupport,
+        /* [GET_FEATURE_INTERFACE] =  */&KvStoreDataServiceStub::GetFeatureInterfaceOnRemote,
+        /* [REGISTERCLIENTDEATHOBSERVER] =  */&KvStoreDataServiceStub::RegisterClientDeathObserverOnRemote,
+        /* [CLOSEKVSTORE] =  */&KvStoreDataServiceStub::NoSupport,
+        /* [CLOSEALLKVSTORE] =  */&KvStoreDataServiceStub::NoSupport,
+        /* [DELETEKVSTORE] =  */&KvStoreDataServiceStub::NoSupport,
+        /* [DELETEALLKVSTORE] =  */&KvStoreDataServiceStub::NoSupport,
+        /* [GETSINGLEKVSTORE] =  */&KvStoreDataServiceStub::NoSupport,
+        /* [GETLOCALDEVICE] =  */&KvStoreDataServiceStub::NoSupport,
+        /* [GETREMOTEDEVICES] =  */&KvStoreDataServiceStub::NoSupport,
+        /* [STARTWATCHDEVICECHANGE] =  */&KvStoreDataServiceStub::NoSupport,
+        /* [STOPWATCHDEVICECHANGE] =  */&KvStoreDataServiceStub::NoSupport,
     };
 };
 
diff --git a/frameworks/innerkitsimpl/kvdb/src/system_api.cpp b/frameworks/innerkitsimpl/kvdb/src/system_api.cpp
index b1d147d..f6cd62f 100644
--- a/frameworks/innerkitsimpl/kvdb/src/system_api.cpp
+++ b/frameworks/innerkitsimpl/kvdb/src/system_api.cpp
@@ -18,12 +18,12 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include "log_print.h"
-#include "security_label.h"
+// #include "security_label.h"
 #include "store_util.h"
 namespace OHOS::DistributedKv {
 using Label = DistributedDB::SecurityLabel;
 using Flag = DistributedDB::SecurityFlag;
-using SecurityLabel = DistributedFS::ModuleSecurityLabel::SecurityLabel;
+// using SecurityLabel = DistributedFS::ModuleSecurityLabel::SecurityLabel;
 SystemApi::SystemApi()
 {
 }
@@ -44,9 +44,9 @@ bool SystemApi::IsAccessControlled() const
 
 SystemApi::DBStatus SystemApi::SetSecurityOption(const std::string &filePath, const DBOption &option)
 {
-    if (filePath.empty() || option.securityLabel < Label::NOT_SET || option.securityLabel > Label::S4) {
-        return DBStatus::INVALID_ARGS;
-    }
+    // if (filePath.empty() || option.securityLabel < Label::NOT_SET || option.securityLabel > Label::S4) {
+    //     return DBStatus::INVALID_ARGS;
+    // }
 
     struct stat curStat;
     stat(filePath.c_str(), &curStat);
@@ -58,17 +58,17 @@ SystemApi::DBStatus SystemApi::SetSecurityOption(const std::string &filePath, co
         return DBStatus::INVALID_ARGS;
     }
 
-    if (option.securityLabel == Label::NOT_SET) {
-        return DBStatus::OK;
-    }
+    // if (option.securityLabel == Label::NOT_SET) {
+    //     return DBStatus::OK;
+    // }
 
     auto secLevel = std::string("s") + std::to_string(option.securityLabel - 1);
-    bool result = SecurityLabel::SetSecurityLabel(filePath, secLevel);
-    if (!result) {
-        ZLOGE("set label failed! level:%{public}s, file:%{public}s", secLevel.c_str(),
-            StoreUtil::Anonymous(filePath).c_str());
-        return DBStatus::DB_ERROR;
-    }
+    // bool result = SecurityLabel::SetSecurityLabel(filePath, secLevel);
+    // if (!result) {
+    //     ZLOGE("set label failed! level:%{public}s, file:%{public}s", secLevel.c_str(),
+    //         StoreUtil::Anonymous(filePath).c_str());
+    //     return DBStatus::DB_ERROR;
+    // }
 
     return DBStatus::OK;
 }
@@ -90,12 +90,12 @@ SystemApi::DBStatus SystemApi::GetSecurityOption(const std::string &filePath, DB
         return DBStatus::OK;
     }
 
-    std::string value = SecurityLabel::GetSecurityLabel(filePath);
-    if (!std::regex_match(value, std::regex("s([01234])"))) {
-        option = {Label::NOT_SET, Flag::ECE};
-        return DBStatus::OK;
-    }
-    option = { (value[1] - '0') + 1, value[1] == '3' ? Flag::SECE : Flag::ECE};
+    // std::string value = SecurityLabel::GetSecurityLabel(filePath);
+    // if (!std::regex_match(value, std::regex("s([01234])"))) {
+    //     option = {Label::NOT_SET, Flag::ECE};
+    //     return DBStatus::OK;
+    // }
+    // option = { (value[1] - '0') + 1, value[1] == '3' ? Flag::SECE : Flag::ECE};
     return DBStatus::OK;
 }
 
diff --git a/frameworks/innerkitsimpl/rdb/include/rdb_notifier.h b/frameworks/innerkitsimpl/rdb/include/rdb_notifier.h
index 4c0eb28..32fc087 100644
--- a/frameworks/innerkitsimpl/rdb/include/rdb_notifier.h
+++ b/frameworks/innerkitsimpl/rdb/include/rdb_notifier.h
@@ -73,8 +73,8 @@ private:
 
     using RequestHandle = int32_t (RdbNotifierStub::*)(MessageParcel&, MessageParcel&);
     static constexpr RequestHandle HANDLES[RDB_NOTIFIER_CMD_MAX] = {
-        [RDB_NOTIFIER_CMD_SYNC_COMPLETE] = &RdbNotifierStub::OnCompleteInner,
-        [RDB_NOTIFIER_CMD_DATA_CHANGE] = &RdbNotifierStub::OnChangeInner,
+        /* [RDB_NOTIFIER_CMD_SYNC_COMPLETE] =  */&RdbNotifierStub::OnCompleteInner,
+        /* [RDB_NOTIFIER_CMD_DATA_CHANGE] =  */&RdbNotifierStub::OnChangeInner,
     };
 
     RdbSyncCompleteNotifier completeNotifier_;
diff --git a/frameworks/libs/distributeddb/BUILD.gn b/frameworks/libs/distributeddb/BUILD.gn
index 209bf90..d08716e 100644
--- a/frameworks/libs/distributeddb/BUILD.gn
+++ b/frameworks/libs/distributeddb/BUILD.gn
@@ -46,7 +46,7 @@ config("distrdb_config") {
     "OMIT_FLATBUFFER",
     "RELATIONAL_STORE",
     "SQLITE_DISTRIBUTE_RELATIONAL",
-    "USE_DFX_ABILITY",
+    # "USE_DFX_ABILITY",
   ]
   if (is_debug) {
     defines += [ "TRACE_SQLITE_EXECUTE" ]
@@ -285,8 +285,8 @@ ohos_shared_library("distributeddb") {
 
   external_deps = [
     "c_utils:utils",
-    "hisysevent_native:libhisysevent",
-    "hitrace_native:hitrace_meter",
+    # "hisysevent_native:libhisysevent",
+    # "hitrace_native:hitrace_meter",
     "hiviewdfx_hilog_native:libhilog",
   ]
 
diff --git a/frameworks/libs/distributeddb/interfaces/src/kv_store_delegate_manager.cpp b/frameworks/libs/distributeddb/interfaces/src/kv_store_delegate_manager.cpp
index b075ed1..c18b390 100644
--- a/frameworks/libs/distributeddb/interfaces/src/kv_store_delegate_manager.cpp
+++ b/frameworks/libs/distributeddb/interfaces/src/kv_store_delegate_manager.cpp
@@ -251,6 +251,7 @@ bool KvStoreDelegateManager::GetKvStoreParamCheck(const std::string &storeId, co
     }
     if (!ParamCheckUtils::CheckStoreParameter(storeId, appId_, userId_) ||
         (GetKvStorePath().empty() && !option.isMemoryDb)) {
+        LOGE("[HP_DEBUG] GetKvStorePath is empty[%d], ismemorydb[%d]", GetKvStorePath().empty(), option.isMemoryDb);
         LOGE("[KvStoreMgr] Invalid id or path info for the store");
         callback(INVALID_ARGS, nullptr);
         return false;
@@ -294,6 +295,7 @@ void KvStoreDelegateManager::GetKvStore(const std::string &storeId, const KvStor
     const std::function<void(DBStatus, KvStoreNbDelegate *)> &callback)
 {
     if (!GetKvStoreParamCheck(storeId, option, callback)) {
+        LOGI("[HP_DEBUG] Param check failed!");
         return;
     }
     // check if schema is supported and valid
@@ -301,6 +303,7 @@ void KvStoreDelegateManager::GetKvStore(const std::string &storeId, const KvStor
     DBStatus retCode = CheckAndGetSchema(option.isMemoryDb, option.schema, schema);
     if (retCode != OK) {
         callback(retCode, nullptr);
+        LOGI("[HP_DEBUG] CheckAndGetSchema failed!");
         return;
     }
     KvDBProperties properties;
@@ -315,6 +318,7 @@ void KvStoreDelegateManager::GetKvStore(const std::string &storeId, const KvStor
     DBStatus status = TransferDBErrno(errCode);
     if (conn == nullptr) {
         callback(status, nullptr);
+        LOGI("[HP_DEBUG] GetOneConnectionWithRetry failed!");
         return;
     }
 
@@ -323,6 +327,7 @@ void KvStoreDelegateManager::GetKvStore(const std::string &storeId, const KvStor
         conn->Close();
         conn = nullptr;
         callback(DB_ERROR, nullptr);
+        LOGI("[HP_DEBUG] new KvStoreNbDelegateImpl failed!");
         return;
     }
 
@@ -330,6 +335,7 @@ void KvStoreDelegateManager::GetKvStore(const std::string &storeId, const KvStor
     if (status != OK) {
         CloseKvStore(kvStore);
         callback(status, nullptr);
+        LOGI("[HP_DEBUG] SetObserverNotifier failed!");
         return;
     }
 
diff --git a/frameworks/libs/distributeddb/storage/src/result_entries_window.cpp b/frameworks/libs/distributeddb/storage/src/result_entries_window.cpp
index 5709380..f01365b 100644
--- a/frameworks/libs/distributeddb/storage/src/result_entries_window.cpp
+++ b/frameworks/libs/distributeddb/storage/src/result_entries_window.cpp
@@ -176,7 +176,7 @@ int ResultEntriesWindow::LoadData(int begin, int target) const
             continue;
         }
         bufferSize += next.key.size() + next.value.size();
-        buffer_.push_back(move(next));
+        buffer_.push_back(std::move(next));
     }
     if (buffer_.size() == static_cast<size_t>(totalCount_)) {
         (void)(rawCursor_->Close());
-- 
2.24.3 (Apple Git-128)

