From ffc21a13fcc7da414796677b93b6be522d636e60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E5=BC=A0=E6=A5=B7?= Date: Tue, 2 Sep 2025 15:37:05 +0800 Subject: [PATCH] =?UTF-8?q?fix=20alarm=20Signed-off-by:=20=E9=BB=8E?= =?UTF-8?q?=E5=BC=A0=E6=A5=B7=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- interfaces/inner_api/file_access/src/file_access_helper.cpp | 2 +- interfaces/kits/js/src/common/file_info_shared_memory.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_api/file_access/src/file_access_helper.cpp b/interfaces/inner_api/file_access/src/file_access_helper.cpp index 58aa7a9e..b8cabb35 100644 --- a/interfaces/inner_api/file_access/src/file_access_helper.cpp +++ b/interfaces/inner_api/file_access/src/file_access_helper.cpp @@ -909,7 +909,7 @@ static int GetQueryResult(std::string &uri, std::vector &columns, s if (results[i].empty()) { results[i] = "0"; } - jsonObject[columns[i]] = std::stol(results[i]); + jsonObject[columns[i]] = std::atoi(results[i].c_str()); break; default: jsonObject[columns[i]] = " "; diff --git a/interfaces/kits/js/src/common/file_info_shared_memory.h b/interfaces/kits/js/src/common/file_info_shared_memory.h index df9965b4..1c274445 100644 --- a/interfaces/kits/js/src/common/file_info_shared_memory.h +++ b/interfaces/kits/js/src/common/file_info_shared_memory.h @@ -228,6 +228,10 @@ public: static bool CalculateMemSize(uint64_t &memSize, SharedMemoryInfo &memInfo) { + if (memInfo.totalDataCounts == 0) { + HILOG_ERROR("totalDataCounts is zero ,cannot calculate allocSize"); + return false; + } uint64_t allocSize = ((memInfo.leftDataCounts + memInfo.totalDataCounts - 1) / memInfo.totalDataCounts + 1) * DEFAULT_CAPACITY_200KB; -- Gitee