From 4274344278ed79973f69331742bde2da82059b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=BA=E5=B0=8F=E5=B8=85?= Date: Sat, 2 Apr 2022 22:50:39 +0800 Subject: [PATCH 1/2] Fix build for 64 bit. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id0e3e3b4e22848cf66887f48759b2a800dc4da14 Signed-off-by: 贺小帅 --- common/adaptor/src/file_operator.c | 4 ++-- common/hal_sdk/useridm_interface.cpp | 3 ++- common/idm/src/idm_session.c | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/common/adaptor/src/file_operator.c b/common/adaptor/src/file_operator.c index dc13184..f618911 100644 --- a/common/adaptor/src/file_operator.c +++ b/common/adaptor/src/file_operator.c @@ -35,7 +35,7 @@ static bool IsFileExist(const char *fileName) static int32_t ReadFile(const char *fileName, uint8_t *buf, uint32_t len) { - if ((fileName == NULL) || (buf == NULL) || (len == 0) || (len > SIZE_MAX)) { + if ((fileName == NULL) || (buf == NULL) || (len == 0) || (len > UINT32_MAX)) { LOG_ERROR("get bad params"); return RESULT_BAD_PARAM; } @@ -57,7 +57,7 @@ static int32_t ReadFile(const char *fileName, uint8_t *buf, uint32_t len) static int32_t WriteFile(const char *fileName, const uint8_t *buf, uint32_t len) { - if ((fileName == NULL) || (buf == NULL) || (len == 0) || (len > SIZE_MAX)) { + if ((fileName == NULL) || (buf == NULL) || (len == 0) || (len > UINT32_MAX)) { LOG_ERROR("get bad params"); return RESULT_BAD_PARAM; } diff --git a/common/hal_sdk/useridm_interface.cpp b/common/hal_sdk/useridm_interface.cpp index 26ccf1e..dae560f 100644 --- a/common/hal_sdk/useridm_interface.cpp +++ b/common/hal_sdk/useridm_interface.cpp @@ -15,6 +15,7 @@ #include "useridm_interface.h" +#include #include "userauth_interface.h" #include "securec.h" @@ -37,7 +38,7 @@ int32_t OpenSession(int32_t userId, uint64_t &challenge) { GlobalLock(); int32_t ret = OpenEditSession(userId, &challenge); - LOG_INFO("challenge is %{public}llu", challenge); + LOG_INFO("challenge is %{public}" PRIu64, challenge); GlobalUnLock(); return ret; } diff --git a/common/idm/src/idm_session.c b/common/idm/src/idm_session.c index cb788b4..ce752b2 100644 --- a/common/idm/src/idm_session.c +++ b/common/idm/src/idm_session.c @@ -20,6 +20,7 @@ #include "adaptor_log.h" #include "adaptor_memory.h" #include "adaptor_time.h" +#include "inttypes.h" #include "linked_list.h" #define SESSION_VALIDITY_PERIOD (10 * 60 * 1000) @@ -183,8 +184,8 @@ bool IsSessionTimeout(void) } uint64_t currentTime = GetSystemTime(); if (currentTime < g_session->time || currentTime - g_session->time > SESSION_VALIDITY_PERIOD) { - LOG_ERROR("timeout, %{public}llu, %{public}llu", currentTime, g_session->time); + LOG_ERROR("timeout, %{public}" PRIu64", %{public}" PRIu64, currentTime, g_session->time); return true; } return false; -} \ No newline at end of file +} -- Gitee From 4cb4a777cdb0686c0bea906dbb62021d774875be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=BA=E5=B0=8F=E5=B8=85?= Date: Sun, 3 Apr 2022 14:48:36 +0000 Subject: [PATCH 2/2] Fix code check. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 贺小帅 Change-Id: I9a76e48397f1217a9c4bad6fddf51aaf92543808 --- common/idm/src/idm_session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/idm/src/idm_session.c b/common/idm/src/idm_session.c index ce752b2..55ce421 100644 --- a/common/idm/src/idm_session.c +++ b/common/idm/src/idm_session.c @@ -46,7 +46,7 @@ static bool IsSessionExist() return true; } -static uint64_t GenerateChallenge() +static uint64_t GenerateChallenge(void) { uint64_t challenge = 0; -- Gitee