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 58aa7a9e016df30181ab504faff6ffd78591674e..b8cabb35017eb4b3062ec7d615a716ae011a4a71 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 df9965b4d17aa31ed0391247d7f5838b23ee3051..1c27444585459f92c5f94ce0474955953b8d18ee 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;