From b877b4b6b210c165f764cf741ac20f54b3ef634d Mon Sep 17 00:00:00 2001 From: huangke11 Date: Fri, 15 Apr 2022 15:14:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=83=A8=E4=BB=B6=E5=8C=96=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huangke11 --- README.md | 2 +- README_zh.md | 2 +- bundle.json | 2 +- frameworks/config_policy/BUILD.gn | 2 +- frameworks/config_policy/src/config_policy_utils.c | 2 +- .../{innerkits => inner_api}/include/config_policy_impl.h | 0 .../{innerkits => inner_api}/include/config_policy_utils.h | 0 interfaces/kits/js/BUILD.gn | 5 +---- interfaces/kits/js/src/config_policy_napi.cpp | 2 +- test/unittest/BUILD.gn | 2 +- test/unittest/config_policy_utils_test.cpp | 2 +- 11 files changed, 9 insertions(+), 12 deletions(-) rename interfaces/{innerkits => inner_api}/include/config_policy_impl.h (100%) rename interfaces/{innerkits => inner_api}/include/config_policy_utils.h (100%) diff --git a/README.md b/README.md index 450fc00..15b855e 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Call the APIs of the config policy to obtain the configuration directories at di #include "config_policy_utils.h" const char *testPathSuffix = "user.xml"; // Set the name of the configuration file. -char buf[MAX_PATH_LEN]; +char buf[MAX_PATH_LEN] = {0}; char *filePath = GetOneCfgFile(testPathSuffix, buf, MAX_PATH_LEN); // Obtain the path of the configuration file with the highest priority. ``` diff --git a/README_zh.md b/README_zh.md index 70c0932..3254c9a 100644 --- a/README_zh.md +++ b/README_zh.md @@ -39,7 +39,7 @@ #include "config_policy_utils.h" const char *testPathSuffix = "user.xml"; //设置配置文件名称 -char buf[MAX_PATH_LEN]; +char buf[MAX_PATH_LEN] = {0}; char *filePath = GetOneCfgFile(testPathSuffix, buf, MAX_PATH_LEN); //获取最高优先级的配置文件路径 ``` diff --git a/bundle.json b/bundle.json index b89ab5b..c868d00 100644 --- a/bundle.json +++ b/bundle.json @@ -33,7 +33,7 @@ "inner_kits": [ { "header": { - "header_base": "//base/customization/config_policy/interfaces/innerkits/include", + "header_base": "//base/customization/config_policy/interfaces/inner_api/include", "header_files": [ "config_policy_utils.h" ] diff --git a/frameworks/config_policy/BUILD.gn b/frameworks/config_policy/BUILD.gn index 37567f3..43f9694 100644 --- a/frameworks/config_policy/BUILD.gn +++ b/frameworks/config_policy/BUILD.gn @@ -20,7 +20,7 @@ if (defined(ohos_lite)) { config_policy_sources = [ "src/config_policy_utils.c" ] config("config_policy_config") { include_dirs = [ - "//base/customization/config_policy/interfaces/innerkits/include", + "//base/customization/config_policy/interfaces/inner_api/include", "//third_party/bounds_checking_function/include", "//base/startup/init_lite/services/include", ] diff --git a/frameworks/config_policy/src/config_policy_utils.c b/frameworks/config_policy/src/config_policy_utils.c index e831dcd..1205777 100644 --- a/frameworks/config_policy/src/config_policy_utils.c +++ b/frameworks/config_policy/src/config_policy_utils.c @@ -97,7 +97,7 @@ CfgFiles *GetCfgFiles(const char *pathSuffix) if (pathSuffix == NULL) { return NULL; } - char buf[MAX_PATH_LEN]; + char buf[MAX_PATH_LEN] = {0}; CfgDir *dirs = GetCfgDirList(); if (dirs == NULL) { return NULL; diff --git a/interfaces/innerkits/include/config_policy_impl.h b/interfaces/inner_api/include/config_policy_impl.h similarity index 100% rename from interfaces/innerkits/include/config_policy_impl.h rename to interfaces/inner_api/include/config_policy_impl.h diff --git a/interfaces/innerkits/include/config_policy_utils.h b/interfaces/inner_api/include/config_policy_utils.h similarity index 100% rename from interfaces/innerkits/include/config_policy_utils.h rename to interfaces/inner_api/include/config_policy_utils.h diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index 5628b08..bc0e432 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -15,12 +15,9 @@ import("//build/ohos.gni") ohos_shared_library("configpolicy") { include_dirs = [ - "//base/customization/config_policy/interfaces/innerkits/include", + "//base/customization/config_policy/interfaces/inner_api/include", "//third_party/bounds_checking_function/include", "//base/customization/config_policy/interfaces/kits/js/include", - "//base/hiviewdfx/interfaces/native/innerkits/include", - "//foundation/ace/napi/native_engine", - "//foundation/ace/napi/interfaces/kits", ] sources = [ "src/config_policy_napi.cpp" ] diff --git a/interfaces/kits/js/src/config_policy_napi.cpp b/interfaces/kits/js/src/config_policy_napi.cpp index 7b44adf..070a881 100644 --- a/interfaces/kits/js/src/config_policy_napi.cpp +++ b/interfaces/kits/js/src/config_policy_napi.cpp @@ -161,7 +161,7 @@ void ConfigPolicyNapi::NativeGetOneCfgFile(napi_env env, void *data) return; } ConfigAsyncContext *asyncCallbackInfo = static_cast(data); - char outBuf[MAX_PATH_LEN]; + char outBuf[MAX_PATH_LEN] = {0}; GetOneCfgFile(asyncCallbackInfo->relPath_.c_str(), outBuf, MAX_PATH_LEN); asyncCallbackInfo->pathValue_ = std::string(outBuf); asyncCallbackInfo->createValueFunc_ = [](napi_env env, ConfigAsyncContext &context) -> napi_value { diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index 6d12c5d..c4f49e4 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -20,7 +20,7 @@ if (defined(ohos_lite)) { config_policy_sources = [ "config_policy_utils_test.cpp" ] config_policy_include_dirs = [ - "//base/customization/config_policy/interfaces/innerkits/include", + "//base/customization/config_policy/interfaces/inner_api/include", ] config_policy_deps = [ "//base/customization/config_policy/frameworks/config_policy:configpolicy_util" ] diff --git a/test/unittest/config_policy_utils_test.cpp b/test/unittest/config_policy_utils_test.cpp index 6c6106a..568370e 100644 --- a/test/unittest/config_policy_utils_test.cpp +++ b/test/unittest/config_policy_utils_test.cpp @@ -38,7 +38,7 @@ bool TestGetCfgFile(const char *testPathSuffix) } } FreeCfgFiles(cfgFiles); - char buf[MAX_PATH_LEN]; + char buf[MAX_PATH_LEN] = {0}; filePath = GetOneCfgFile(testPathSuffix, buf, MAX_PATH_LEN); if (filePath && *filePath != '\0') { std::cout << "one filePath: " << filePath << std::endl; -- Gitee From f0fb6e36825e9bfd8e07e9e409044e70bfb06332 Mon Sep 17 00:00:00 2001 From: huangke11 Date: Fri, 15 Apr 2022 16:42:16 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=83=A8=E4=BB=B6=E5=8C=96=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huangke11 --- test/unittest/BUILD.gn | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index c4f49e4..7623d03 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -19,9 +19,8 @@ if (defined(ohos_lite)) { } config_policy_sources = [ "config_policy_utils_test.cpp" ] -config_policy_include_dirs = [ - "//base/customization/config_policy/interfaces/inner_api/include", -] +config_policy_include_dirs = + [ "//base/customization/config_policy/interfaces/inner_api/include" ] config_policy_deps = [ "//base/customization/config_policy/frameworks/config_policy:configpolicy_util" ] if (defined(ohos_lite)) { @@ -40,6 +39,7 @@ if (defined(ohos_lite)) { sources = config_policy_sources include_dirs = config_policy_include_dirs deps = config_policy_deps - resource_config_file = "//base/customization/config_policy/test/resource/ohos_test.xml" + resource_config_file = + "//base/customization/config_policy/test/resource/ohos_test.xml" } } -- Gitee From 30a103179e16e7ad111e75908943ce76c070efd2 Mon Sep 17 00:00:00 2001 From: huangke11 Date: Fri, 15 Apr 2022 17:45:03 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=83=A8=E4=BB=B6=E5=8C=96=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huangke11 --- README.md | 2 +- README_zh.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 15b855e..79663ff 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The directory structure for the config policy is as follows: │ │ ├── config_policy # config policy │ │ │ └── src # Implementation code │ ├── interfaces # APIs of the config policy -│ │ ├── innerkits # APIs of the config policy for internal subsystems +│ │ ├── inner_api # APIs of the config policy for internal subsystems │ │ └── kits # JavaScript APIs │ └── test # Test code ``` diff --git a/README_zh.md b/README_zh.md index 3254c9a..ae7d939 100644 --- a/README_zh.md +++ b/README_zh.md @@ -26,7 +26,7 @@ │ │ ├── config_policy # 配置策略模块 │ │ │ └── src # 实现代码 │ ├── interfaces # 配置策略接口 -│ │ ├── innerkits # 子系统间接口 +│ │ ├── inner_api # 子系统间接口 │ │ └── kits # 配置策略JavaScript接口 │ └── test # 测试代码 ``` -- Gitee