From 0affc380a65a628d77a2d00bac8dca4b2a4a4776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=97=AD=E8=BE=89?= Date: Wed, 16 Oct 2024 05:16:40 +0000 Subject: [PATCH 1/4] update packing_tool/frameworks/BUILD.gn. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙旭辉 --- packing_tool/frameworks/BUILD.gn | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packing_tool/frameworks/BUILD.gn b/packing_tool/frameworks/BUILD.gn index 0c027908..0620aeaa 100644 --- a/packing_tool/frameworks/BUILD.gn +++ b/packing_tool/frameworks/BUILD.gn @@ -63,7 +63,6 @@ ohos_executable("ohos_packing_tool") { configs = [] cflags = [] external_deps = [ - "hilog:libhilog", "openssl:libcrypto_shared", "zlib:libz", ] @@ -72,10 +71,22 @@ ohos_executable("ohos_packing_tool") { "//build/lite/config/component/cJSON:cjson_static", "//third_party/bounds_checking_function:libsec_static", ] + if (ohos_kernel_type == "liteos_m") { + include_dirs = + "//base/hiviewdfx/hilog_lite/interfaces/native/kits" + deps += + "//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite" + } else { + include_dirs = + "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits" + deps += + "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared" + } } else { external_deps += [ "bounds_checking_function:libsec_static", "cJSON:cjson_static", + "hilog:libhilog", ] } install_enable = false -- Gitee From eaeae5d424bb70106ace5ba73ed2cbb94cd1cbdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=97=AD=E8=BE=89?= Date: Wed, 16 Oct 2024 05:17:56 +0000 Subject: [PATCH 2/4] update packing_tool/frameworks/src/zip_wrapper.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙旭辉 --- packing_tool/frameworks/src/zip_wrapper.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packing_tool/frameworks/src/zip_wrapper.cpp b/packing_tool/frameworks/src/zip_wrapper.cpp index ca437fe7..95cbbc66 100644 --- a/packing_tool/frameworks/src/zip_wrapper.cpp +++ b/packing_tool/frameworks/src/zip_wrapper.cpp @@ -183,11 +183,14 @@ int32_t ZipWrapper::AddFileToZip(const fs::path &fsFilePath, const fs::path &fsZ break; } auto bytesRead = file.gcount(); - if (bytesRead <= 0) { + if (bytesRead < 0) { LOGE("read file bytes error![filePath=%s][bytesRead=%u]", fsFilePath.c_str(), bytesRead); result = ZIP_ERR_FAILURE; break; } + if (bytesRead == 0) { + break; + } if (zipWriteInFileInZip(zipFile_, buffer, bytesRead) < 0) { LOGE("write file in zip failed!"); result = ZIP_ERR_FAILURE; -- Gitee From f22c224008329414256acd42ea7eb003d829aa02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=97=AD=E8=BE=89?= Date: Wed, 16 Oct 2024 05:33:30 +0000 Subject: [PATCH 3/4] update packing_tool/frameworks/BUILD.gn. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙旭辉 --- packing_tool/frameworks/BUILD.gn | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/packing_tool/frameworks/BUILD.gn b/packing_tool/frameworks/BUILD.gn index 0620aeaa..bcc9b059 100644 --- a/packing_tool/frameworks/BUILD.gn +++ b/packing_tool/frameworks/BUILD.gn @@ -72,15 +72,12 @@ ohos_executable("ohos_packing_tool") { "//third_party/bounds_checking_function:libsec_static", ] if (ohos_kernel_type == "liteos_m") { - include_dirs = - "//base/hiviewdfx/hilog_lite/interfaces/native/kits" - deps += - "//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite" + include_dirs = [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits" ] + deps += [ "//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite" ] } else { include_dirs = - "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits" - deps += - "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared" + [ "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits" ] + deps += [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared" ] } } else { external_deps += [ -- Gitee From 5e46b0c20bd8984ec5b870cdb5341febdfe22ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=97=AD=E8=BE=89?= Date: Wed, 16 Oct 2024 06:23:21 +0000 Subject: [PATCH 4/4] update packing_tool/frameworks/src/zip_wrapper.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙旭辉 --- packing_tool/frameworks/src/zip_wrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packing_tool/frameworks/src/zip_wrapper.cpp b/packing_tool/frameworks/src/zip_wrapper.cpp index 95cbbc66..e018e7df 100644 --- a/packing_tool/frameworks/src/zip_wrapper.cpp +++ b/packing_tool/frameworks/src/zip_wrapper.cpp @@ -175,7 +175,7 @@ int32_t ZipWrapper::AddFileToZip(const fs::path &fsFilePath, const fs::path &fsZ int32_t result = ZIP_ERR_SUCCESS; if (fs::file_size(fsFilePath) > 0) { result = ZIP_ERR_SUCCESS; - char buffer[MAX_ZIP_BUFFER_SIZE]; + char buffer[MAX_ZIP_BUFFER_SIZE] = { 0 }; while (!file.eof()) { file.read(buffer, sizeof(buffer)); if (file.fail() && !file.eof()) { -- Gitee