diff --git a/common/adaptor/src/file_operator.c b/common/adaptor/src/file_operator.c index dc13184359266806d8c5740b9cea7ee78ca79073..f6189119a8ef65af02a53096851fb804f892fa96 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 26ccf1e33cb43e681b1e9bfc533a9e7de6516252..dae560ffef5ceeb7083bdff0ae42b8f6074ba8d0 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 cb788b404ae35d9d3a5124f628aafc7c45c169ae..55ce421066f2a260f02330783f2bd3099c9cce28 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) @@ -45,7 +46,7 @@ static bool IsSessionExist() return true; } -static uint64_t GenerateChallenge() +static uint64_t GenerateChallenge(void) { uint64_t challenge = 0; @@ -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 +}