From ec55d7b06b3e978a332a52a8e82bf1fd113886d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E5=BC=A0=E6=A5=B7?= Date: Thu, 4 Sep 2025 11:30:27 +0800 Subject: [PATCH 1/2] =?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 --- .../file_access/src/file_access_helper.cpp | 20 ++++++++++++++++++- 1 file changed, 19 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 b8cabb35..2a245705 100644 --- a/interfaces/inner_api/file_access/src/file_access_helper.cpp +++ b/interfaces/inner_api/file_access/src/file_access_helper.cpp @@ -889,6 +889,21 @@ static int GetQueryResult(std::string &uri, std::vector &columns, s std::string &metaJson) { json jsonObject; + auto convertToLongLong = [](const std::string &str, long long& Value) -> bool { + char* end; + errno = 0; + value = std::strtoll(str.c_str(), &end, 10); + if (end == str.c_str()) { + return false; + } + if (error == ERANGE0) { + return false; + } + if (*end != '\0') { + return false; + } + return true; + } for (size_t i = 0; i < columns.size(); i++) { auto memberType = FILE_RESULT_TYPE.at(columns.at(i)); // Assign a default value based on the type, When fileIo obtains an invalid value. @@ -909,7 +924,10 @@ static int GetQueryResult(std::string &uri, std::vector &columns, s if (results[i].empty()) { results[i] = "0"; } - jsonObject[columns[i]] = std::atoi(results[i].c_str()); + long long num; + if (convertToLongLong(result[i], num)) { + jsonObject[colums[i]] = num; + } break; default: jsonObject[columns[i]] = " "; -- Gitee From 88735845db1861df3bc133bff4d64260937a23e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E5=BC=A0=E6=A5=B7?= Date: Thu, 4 Sep 2025 11:53:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix=20alarm=20Merge=20pull=20request=20!105?= =?UTF-8?q?6=20from=20=E9=BB=8E=E5=BC=A0=E6=A5=B7/master?= 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 +- 1 file changed, 1 insertion(+), 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 2a245705..9820dd59 100644 --- a/interfaces/inner_api/file_access/src/file_access_helper.cpp +++ b/interfaces/inner_api/file_access/src/file_access_helper.cpp @@ -892,7 +892,7 @@ static int GetQueryResult(std::string &uri, std::vector &columns, s auto convertToLongLong = [](const std::string &str, long long& Value) -> bool { char* end; errno = 0; - value = std::strtoll(str.c_str(), &end, 10); + Value = std::strtoll(str.c_str(), &end, 10); if (end == str.c_str()) { return false; } -- Gitee