From 1fbc2ae1059b460a9b819eca400d86dab397ec4a Mon Sep 17 00:00:00 2001 From: SimonLi Date: Sat, 15 Jan 2022 20:10:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3Werror=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E4=B8=AD=EF=BC=8Cint=E5=92=8Cint32=5Ft=E4=B8=8D?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #I4QWQF Signed-off-by: SimonLi --- common_lib/impl/src/json_utils.c | 2 +- common_lib/interfaces/json_utils.h | 2 +- .../inc/account_unrelated/base_sub_task.h | 2 +- .../inc/account_unrelated/das_module.h | 6 ++--- .../inc/account_unrelated/das_task_main.h | 4 ++-- .../inc/account_unrelated/das_token_manager.h | 4 ++-- .../inc/account_unrelated/das_version_util.h | 4 ++-- .../iso_task/iso_base_cur_task.h | 8 +++---- .../iso_client_bind_exchange_task.h | 2 +- .../iso_client_unbind_exchange_task.h | 2 +- .../iso_server_bind_exchange_task.h | 2 +- .../iso_server_unbind_exchange_task.h | 2 +- .../pake_task/pake_base_cur_task.h | 2 +- .../src/account_unrelated/das_module.c | 8 +++---- .../src/account_unrelated/das_task_common.c | 6 ++--- .../src/account_unrelated/das_task_main.c | 12 +++++----- .../iso_task/iso_client_task.c | 4 ++-- .../iso_client_protocol_task.c | 10 ++++---- .../iso_server_protocol_task.c | 9 +++---- .../iso_task/iso_server_task.c | 6 ++--- .../iso_task/iso_task_common.c | 4 ++-- .../iso_client_bind_exchange_task.c | 9 +++---- .../iso_client_unbind_exchange_task.c | 10 ++++---- .../iso_server_bind_exchange_task.c | 10 ++++---- .../iso_server_unbind_exchange_task.c | 10 ++++---- .../inc/module/dev_auth_module_manager.h | 8 +++---- .../frameworks/inc/session/base_session.h | 2 +- .../src/module/dev_auth_module_manager.c | 4 ++-- .../inc/session/auth_session_common_defines.h | 2 +- .../auth_session_common_lite.h | 2 +- .../auth_session/auth_session_client.c | 6 ++--- .../auth_session/auth_session_server.c | 10 ++++---- .../inc/group_operation_common.h | 2 +- .../group_operation/group_operation_common.c | 18 +++++++------- .../peer_to_peer_group/peer_to_peer_group.c | 4 ++-- .../bind_session/bind_session_client.c | 4 ++-- .../bind_session/bind_session_common.c | 24 +++++++++---------- .../bind_session/bind_session_server.c | 14 +++++------ .../src/session/bind_session_common_util.c | 2 +- 39 files changed, 122 insertions(+), 120 deletions(-) diff --git a/common_lib/impl/src/json_utils.c b/common_lib/impl/src/json_utils.c index 7fa0d94..3c44500 100644 --- a/common_lib/impl/src/json_utils.c +++ b/common_lib/impl/src/json_utils.c @@ -211,7 +211,7 @@ int32_t GetByteFromJson(const CJson *jsonObj, const char *key, uint8_t *byte, ui return ret; } -int32_t GetIntFromJson(const CJson *jsonObj, const char *key, int *value) +int32_t GetIntFromJson(const CJson *jsonObj, const char *key, int32_t *value) { if (jsonObj == NULL || key == NULL || value == NULL) { return CLIB_ERR_NULL_PTR; diff --git a/common_lib/interfaces/json_utils.h b/common_lib/interfaces/json_utils.h index e478c42..1b5597b 100644 --- a/common_lib/interfaces/json_utils.h +++ b/common_lib/interfaces/json_utils.h @@ -81,7 +81,7 @@ const char *GetStringFromJson(const CJson *jsonObj, const char *key); * This function will convert the hex string to byte, and then put it in param--byte in the form of byte. */ int32_t GetByteFromJson(const CJson *jsonObj, const char *key, uint8_t *byte, uint32_t len); -int32_t GetIntFromJson(const CJson *jsonObj, const char *key, int *value); +int32_t GetIntFromJson(const CJson *jsonObj, const char *key, int32_t *value); int32_t GetInt64FromJson(const CJson *jsonObj, const char *key, int64_t *value); int32_t GetBoolFromJson(const CJson *jsonObj, const char *key, bool *value); char *GetStringValue(const CJson *item); diff --git a/services/authenticators/inc/account_unrelated/base_sub_task.h b/services/authenticators/inc/account_unrelated/base_sub_task.h index 2306144..741c8fd 100644 --- a/services/authenticators/inc/account_unrelated/base_sub_task.h +++ b/services/authenticators/inc/account_unrelated/base_sub_task.h @@ -23,7 +23,7 @@ typedef struct SubTaskBaseT { int (*getTaskType)(const struct SubTaskBaseT *); void (*destroyTask)(struct SubTaskBaseT *); - int (*process)(struct SubTaskBaseT *, const CJson *in, CJson *out, int *status); + int (*process)(struct SubTaskBaseT *, const CJson *in, CJson *out, int32_t *status); VersionStruct curVersion; } SubTaskBase; diff --git a/services/authenticators/inc/account_unrelated/das_module.h b/services/authenticators/inc/account_unrelated/das_module.h index d57242c..ebbfaa0 100644 --- a/services/authenticators/inc/account_unrelated/das_module.h +++ b/services/authenticators/inc/account_unrelated/das_module.h @@ -22,9 +22,9 @@ typedef struct DasAuthModuleT { AuthModuleBase moduleBase; - int (*registerLocalIdentity)(const char *, const char *, Uint8Buff *, int); - int (*unregisterLocalIdentity)(const char *, const char *, Uint8Buff *, int); - int (*deletePeerAuthInfo)(const char *, const char *, Uint8Buff *, int); + int32_t (*registerLocalIdentity)(const char *, const char *, Uint8Buff *, int); + int32_t (*unregisterLocalIdentity)(const char *, const char *, Uint8Buff *, int); + int32_t (*deletePeerAuthInfo)(const char *, const char *, Uint8Buff *, int); } DasAuthModule; bool IsDasSupported(void); diff --git a/services/authenticators/inc/account_unrelated/das_task_main.h b/services/authenticators/inc/account_unrelated/das_task_main.h index ca75493..f208382 100644 --- a/services/authenticators/inc/account_unrelated/das_task_main.h +++ b/services/authenticators/inc/account_unrelated/das_task_main.h @@ -27,11 +27,11 @@ typedef struct TaskT { int taskId; VersionInfo versionInfo; void(*destroyTask)(struct TaskT *); - int(*processTask)(struct TaskT *, const CJson *in, CJson *out, int *status); + int(*processTask)(struct TaskT *, const CJson *in, CJson *out, int32_t *status); SubTaskVec vec; } Task; -Task *CreateTaskT(int *taskId, const CJson *in, CJson *out); +Task *CreateTaskT(int32_t *taskId, const CJson *in, CJson *out); int32_t InitDasProtocolEntities(void); void DestroyDasProtocolEntities(void); diff --git a/services/authenticators/inc/account_unrelated/das_token_manager.h b/services/authenticators/inc/account_unrelated/das_token_manager.h index 48e6419..6b80a62 100644 --- a/services/authenticators/inc/account_unrelated/das_token_manager.h +++ b/services/authenticators/inc/account_unrelated/das_token_manager.h @@ -21,8 +21,8 @@ typedef struct TokenManagerT { int (*registerLocalIdentity)(const char *, const char *, Uint8Buff *, int); - int (*unregisterLocalIdentity)(const char *, const char *, Uint8Buff *, int); - int (*deletePeerAuthInfo)(const char *, const char *, Uint8Buff *, int); + int32_t (*unregisterLocalIdentity)(const char *, const char *, Uint8Buff *, int); + int32_t (*deletePeerAuthInfo)(const char *, const char *, Uint8Buff *, int); int (*computeAndSavePsk)(const PakeParams *); } TokenManager; diff --git a/services/authenticators/inc/account_unrelated/das_version_util.h b/services/authenticators/inc/account_unrelated/das_version_util.h index d4413b3..eff5580 100644 --- a/services/authenticators/inc/account_unrelated/das_version_util.h +++ b/services/authenticators/inc/account_unrelated/das_version_util.h @@ -40,7 +40,7 @@ typedef enum { } VersionAgreementStatus; typedef struct VersionInfoT { - int opCode; + int32_t opCode; VersionAgreementStatus versionStatus; VersionStruct minVersion; VersionStruct curVersion; @@ -57,4 +57,4 @@ ProtocolType GetPrototolType(VersionStruct *curVersion, OperationCode opCode); PakeAlgType GetSupportedPakeAlg(VersionStruct *curVersion, ProtocolType protocolType); bool IsSupportedPsk(VersionStruct *curVersion); -#endif \ No newline at end of file +#endif diff --git a/services/authenticators/inc/account_unrelated/iso_task/iso_base_cur_task.h b/services/authenticators/inc/account_unrelated/iso_task/iso_base_cur_task.h index f6cf0b1..216ed70 100644 --- a/services/authenticators/inc/account_unrelated/iso_task/iso_base_cur_task.h +++ b/services/authenticators/inc/account_unrelated/iso_task/iso_base_cur_task.h @@ -42,12 +42,12 @@ typedef struct IsoParamsT { IsoBaseParams baseParams; Uint8Buff seed; - int selfUserType; - int peerUserType; + int32_t selfUserType; + int32_t peerUserType; char *packageName; char *serviceType; char *pinCodeString; - int opCode; + int32_t opCode; uint32_t keyLen; bool isClient; } IsoParams; @@ -55,7 +55,7 @@ typedef struct IsoParamsT { typedef struct SymBaseCurTaskT { CurTaskType (*getCurTaskType)(void); void (*destroyTask)(struct SymBaseCurTaskT *); - int(*process)(struct SymBaseCurTaskT *, IsoParams *params, const CJson *in, CJson *out, int *status); + int(*process)(struct SymBaseCurTaskT *, IsoParams *params, const CJson *in, CJson *out, int32_t *status); int taskStatus; } SymBaseCurTask; diff --git a/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_client_bind_exchange_task.h b/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_client_bind_exchange_task.h index 82e98ef..39df082 100644 --- a/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_client_bind_exchange_task.h +++ b/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_client_bind_exchange_task.h @@ -23,6 +23,6 @@ typedef struct { uint8_t challenge[CHALLENGE_SIZE]; } IsoClientBindExchangeTask; -SymBaseCurTask *CreateClientBindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int *status); +SymBaseCurTask *CreateClientBindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int32_t *status); #endif diff --git a/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_client_unbind_exchange_task.h b/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_client_unbind_exchange_task.h index c5e8569..28f0ae7 100644 --- a/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_client_unbind_exchange_task.h +++ b/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_client_unbind_exchange_task.h @@ -22,6 +22,6 @@ typedef struct { SymBaseCurTask taskBase; } IsoClientUnbindExchangeTask; -SymBaseCurTask *CreateClientUnbindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int *status); +SymBaseCurTask *CreateClientUnbindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int32_t *status); #endif diff --git a/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_server_bind_exchange_task.h b/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_server_bind_exchange_task.h index 37a1423..c79aece 100644 --- a/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_server_bind_exchange_task.h +++ b/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_server_bind_exchange_task.h @@ -22,6 +22,6 @@ typedef struct { SymBaseCurTask taskBase; } IsoServerBindExchangeTask; -SymBaseCurTask *CreateServerBindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int *status); +SymBaseCurTask *CreateServerBindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int32_t *status); #endif diff --git a/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_server_unbind_exchange_task.h b/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_server_unbind_exchange_task.h index b8956dd..1a3e886 100644 --- a/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_server_unbind_exchange_task.h +++ b/services/authenticators/inc/account_unrelated/iso_task/lite_exchange_task/iso_server_unbind_exchange_task.h @@ -22,6 +22,6 @@ typedef struct { SymBaseCurTask taskBase; } IsoServerUnbindExchangeTask; -SymBaseCurTask *CreateServerUnbindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int *status); +SymBaseCurTask *CreateServerUnbindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int32_t *status); #endif diff --git a/services/authenticators/inc/account_unrelated/pake_task/pake_base_cur_task.h b/services/authenticators/inc/account_unrelated/pake_task/pake_base_cur_task.h index 8d77db5..2049fbe 100644 --- a/services/authenticators/inc/account_unrelated/pake_task/pake_base_cur_task.h +++ b/services/authenticators/inc/account_unrelated/pake_task/pake_base_cur_task.h @@ -35,7 +35,7 @@ typedef struct PakeParamsT { bool isPskSupported; Uint8Buff returnKey; Uint8Buff nonce; - int opCode; + int32_t opCode; int32_t userType; int32_t userTypePeer; char *packageName; diff --git a/services/authenticators/src/account_unrelated/das_module.c b/services/authenticators/src/account_unrelated/das_module.c index f155f9c..4759203 100644 --- a/services/authenticators/src/account_unrelated/das_module.c +++ b/services/authenticators/src/account_unrelated/das_module.c @@ -46,8 +46,8 @@ static int32_t DeleteDasPeerAuthInfo(const char *pkgName, const char *serviceTyp bool IsDasMsgNeedIgnore(const CJson *in) { - uint32_t message = 0; - if (GetIntFromJson(in, FIELD_MESSAGE, (int *)&message) != HC_SUCCESS) { + int32_t message = 0; + if (GetIntFromJson(in, FIELD_MESSAGE, &message) != HC_SUCCESS) { LOGD("There is no message code."); // There is no message code in the client's createTask request params return false; } @@ -59,7 +59,7 @@ bool IsDasMsgNeedIgnore(const CJson *in) return true; } -static int CreateDasTask(int *taskId, const CJson *in, CJson *out) +static int CreateDasTask(int32_t *taskId, const CJson *in, CJson *out) { if (taskId == NULL || in == NULL || out == NULL) { LOGE("Params is null."); @@ -94,7 +94,7 @@ static void DestroyDasModule(AuthModuleBase *module) } } -static int ProcessDasTask(int taskId, const CJson* in, CJson* out, int *status) +static int ProcessDasTask(int32_t taskId, const CJson* in, CJson* out, int32_t *status) { if (status == NULL || in == NULL || out == NULL) { LOGE("Params is null."); diff --git a/services/authenticators/src/account_unrelated/das_task_common.c b/services/authenticators/src/account_unrelated/das_task_common.c index b83d500..b9e4b1c 100644 --- a/services/authenticators/src/account_unrelated/das_task_common.c +++ b/services/authenticators/src/account_unrelated/das_task_common.c @@ -104,8 +104,8 @@ void DasSendErrMsgToSelf(CJson *out, int errCode) uint32_t ProtocolMessageIn(const CJson *in) { - uint32_t message = 0; - if (GetIntFromJson(in, FIELD_MESSAGE, (int *)&message) != 0) { + int32_t message = 0; + if (GetIntFromJson(in, FIELD_MESSAGE, &message) != 0) { return INVALID_MESSAGE; } if (message == ERR_MESSAGE) { @@ -438,7 +438,7 @@ int32_t GetAndCheckKeyLenOnServer(const CJson *in, uint32_t *keyLen) return HC_ERR_JSON_GET; } uint32_t tmpKeyLen = 0; - if (GetIntFromJson(payload, FIELD_KEY_LENGTH, (int *)&tmpKeyLen) != HC_SUCCESS) { + if (GetIntFromJson(payload, FIELD_KEY_LENGTH, (int32_t *)&tmpKeyLen) != HC_SUCCESS) { LOGE("Get tmpKeyLen from payload failed."); return HC_ERR_JSON_GET; } diff --git a/services/authenticators/src/account_unrelated/das_task_main.c b/services/authenticators/src/account_unrelated/das_task_main.c index 88e50bf..d5f034a 100644 --- a/services/authenticators/src/account_unrelated/das_task_main.c +++ b/services/authenticators/src/account_unrelated/das_task_main.c @@ -127,7 +127,7 @@ static void DestroyTaskT(Task *task) HcFree(task); } -static int ProcessMultiTask(Task *task, const CJson *in, CJson *out, int *status) +static int ProcessMultiTask(Task *task, const CJson *in, CJson *out, int32_t *status) { int res; uint32_t index; @@ -175,7 +175,7 @@ ERR: return res; } -static int NegotiateAndProcessTask(Task *task, const CJson *in, CJson *out, int *status) +static int NegotiateAndProcessTask(Task *task, const CJson *in, CJson *out, int32_t *status) { VersionStruct curVersionPeer = { 0, 0, 0 }; VersionStruct minVersionPeer = { 0, 0, 0 }; @@ -224,7 +224,7 @@ static int NegotiateAndProcessTask(Task *task, const CJson *in, CJson *out, int static bool IsPeerErrMessage(const CJson *in, int32_t *res) { - int message = 0; + int32_t message = 0; if (GetIntFromJson(in, FIELD_MESSAGE, &message) != HC_SUCCESS) { LOGD("There is no message code."); return false; @@ -239,9 +239,9 @@ static bool IsPeerErrMessage(const CJson *in, int32_t *res) return true; } -static int ProcessTaskT(Task *task, const CJson *in, CJson *out, int *status) +static int ProcessTaskT(Task *task, const CJson *in, CJson *out, int32_t *status) { - int res; + int32_t res; if (IsPeerErrMessage(in, &res)) { LOGE("Receive error message from peer, errCode: %x.", res); DasSendErrMsgToSelf(out, HC_ERR_PEER_ERROR); @@ -351,7 +351,7 @@ static int CreateSingleSubTask(Task *task, const CJson *in) return HC_ERR_NOT_SUPPORT; } -Task *CreateTaskT(int *taskId, const CJson *in, CJson *out) +Task *CreateTaskT(int32_t *taskId, const CJson *in, CJson *out) { int res; Task *task = NULL; diff --git a/services/authenticators/src/account_unrelated/iso_task/iso_client_task.c b/services/authenticators/src/account_unrelated/iso_task/iso_client_task.c index 75095eb..b06d449 100644 --- a/services/authenticators/src/account_unrelated/iso_task/iso_client_task.c +++ b/services/authenticators/src/account_unrelated/iso_task/iso_client_task.c @@ -44,7 +44,7 @@ static void DestroyIsoClientTask(struct SubTaskBaseT *task) HcFree(innerTask); } -static int CreateNextTask(IsoClientTask *realTask, const CJson *in, CJson *out, int *status) +static int CreateNextTask(IsoClientTask *realTask, const CJson *in, CJson *out, int32_t *status) { int res = HC_SUCCESS; switch (realTask->params.opCode) { @@ -90,7 +90,7 @@ static int CreateNextTask(IsoClientTask *realTask, const CJson *in, CJson *out, return res; } -static int Process(struct SubTaskBaseT *task, const CJson *in, CJson *out, int *status) +static int Process(struct SubTaskBaseT *task, const CJson *in, CJson *out, int32_t *status) { IsoClientTask *realTask = (IsoClientTask *)task; if (realTask->curTask == NULL) { diff --git a/services/authenticators/src/account_unrelated/iso_task/iso_protocol_task/iso_client_protocol_task.c b/services/authenticators/src/account_unrelated/iso_task/iso_protocol_task/iso_client_protocol_task.c index 508da9f..e927e4d 100644 --- a/services/authenticators/src/account_unrelated/iso_task/iso_protocol_task/iso_client_protocol_task.c +++ b/services/authenticators/src/account_unrelated/iso_task/iso_protocol_task/iso_client_protocol_task.c @@ -77,7 +77,7 @@ ERR: return res; } -static int IsoClientStart(SymBaseCurTask *task, IsoParams *params, CJson *out, int *status) +static int IsoClientStart(SymBaseCurTask *task, IsoParams *params, CJson *out, int32_t *status) { if (task->taskStatus != TASK_STATUS_BEGIN) { LOGI("The message is repeated, ignore it, status: %d", task->taskStatus); @@ -149,7 +149,7 @@ static int ParseServerStartMessage(IsoParams *params, const CJson *in, Uint8Buff return HC_SUCCESS; } -static int CalculateTokenClient(SymBaseCurTask *task, IsoParams *params, const CJson *in, CJson *out, int *status) +static int CalculateTokenClient(SymBaseCurTask *task, IsoParams *params, const CJson *in, CJson *out, int32_t *status) { int res; if (task->taskStatus < TASK_STATUS_SERVER_RES_TOKEN) { @@ -199,7 +199,7 @@ static int CalculateTokenClient(SymBaseCurTask *task, IsoParams *params, const C return res; } -static int GenerateSessionKey(SymBaseCurTask *task, IsoParams *params, const CJson *in, int *status) +static int GenerateSessionKey(SymBaseCurTask *task, IsoParams *params, const CJson *in, int32_t *status) { if (task->taskStatus < TASK_STATUS_GEN_SESSION_KEY) { LOGE("Invalid taskStatus: %d", task->taskStatus); @@ -238,7 +238,7 @@ ERR: return res; } -static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson *in, CJson *out, int *status) +static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson *in, CJson *out, int32_t *status) { int res; uint32_t step = ProtocolMessageIn(in); @@ -285,4 +285,4 @@ SymBaseCurTask *CreateProtocolClientTask(void) task->taskBase.process = Process; task->taskBase.getCurTaskType = GetTaskType; return (SymBaseCurTask *)task; -} \ No newline at end of file +} diff --git a/services/authenticators/src/account_unrelated/iso_task/iso_protocol_task/iso_server_protocol_task.c b/services/authenticators/src/account_unrelated/iso_task/iso_protocol_task/iso_server_protocol_task.c index 4b7f6a7..14997a9 100644 --- a/services/authenticators/src/account_unrelated/iso_task/iso_protocol_task/iso_server_protocol_task.c +++ b/services/authenticators/src/account_unrelated/iso_task/iso_protocol_task/iso_server_protocol_task.c @@ -72,7 +72,7 @@ ERR: return res; } -static int IsoServerStart(SymBaseCurTask *task, IsoParams *params, const CJson *in, CJson *out, int *status) +static int IsoServerStart(SymBaseCurTask *task, IsoParams *params, const CJson *in, CJson *out, int32_t *status) { if (task->taskStatus != TASK_STATUS_BEGIN) { LOGI("The message is repeated, ignore it, status: %d", task->taskStatus); @@ -151,7 +151,8 @@ ERR: return res; } -static int CalTokenAndGenSessionKey(SymBaseCurTask *task, IsoParams *params, const CJson *in, CJson *out, int *status) +static int CalTokenAndGenSessionKey(SymBaseCurTask *task, IsoParams *params, const CJson *in, CJson *out, + int32_t *status) { int res; uint8_t *peerToken = NULL; @@ -207,7 +208,7 @@ ERR: return res; } -static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson *in, CJson *out, int *status) +static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson *in, CJson *out, int32_t *status) { int res; uint32_t step = ProtocolMessageIn(in); @@ -249,4 +250,4 @@ SymBaseCurTask *CreateProtocolServerTask() task->taskBase.process = Process; task->taskBase.getCurTaskType = GetTaskType; return (SymBaseCurTask *)task; -} \ No newline at end of file +} diff --git a/services/authenticators/src/account_unrelated/iso_task/iso_server_task.c b/services/authenticators/src/account_unrelated/iso_task/iso_server_task.c index f0eaa14..4c98335 100644 --- a/services/authenticators/src/account_unrelated/iso_task/iso_server_task.c +++ b/services/authenticators/src/account_unrelated/iso_task/iso_server_task.c @@ -44,9 +44,9 @@ static void DestroyIsoServerTask(struct SubTaskBaseT *task) HcFree(innerTask); } -static int CreateNextTask(IsoServerTask *realTask, const CJson *in, CJson *out, int *status) +static int CreateNextTask(IsoServerTask *realTask, const CJson *in, CJson *out, int32_t *status) { - int message = 0; + int32_t message = 0; if (GetIntFromJson(in, FIELD_MESSAGE, &message) != 0) { LOGE("Get message code failed."); return HC_ERR_JSON_GET; @@ -97,7 +97,7 @@ static int CreateNextTask(IsoServerTask *realTask, const CJson *in, CJson *out, return res; } -static int Process(struct SubTaskBaseT *task, const CJson *in, CJson *out, int *status) +static int Process(struct SubTaskBaseT *task, const CJson *in, CJson *out, int32_t *status) { IsoServerTask *realTask = (IsoServerTask *)task; if (realTask->curTask != NULL) { diff --git a/services/authenticators/src/account_unrelated/iso_task/iso_task_common.c b/services/authenticators/src/account_unrelated/iso_task/iso_task_common.c index aae3338..0292e9a 100644 --- a/services/authenticators/src/account_unrelated/iso_task/iso_task_common.c +++ b/services/authenticators/src/account_unrelated/iso_task/iso_task_common.c @@ -437,7 +437,7 @@ static int32_t GetKeyLength(IsoParams *params, const CJson *in) return HC_SUCCESS; } - if (GetIntFromJson(in, FIELD_KEY_LENGTH, (int *)&(params->keyLen)) != 0) { + if (GetIntFromJson(in, FIELD_KEY_LENGTH, (int32_t *)&(params->keyLen)) != 0) { LOGD("Get key length failed, use default."); params->keyLen = DEFAULT_RETURN_KEY_LENGTH; } @@ -616,4 +616,4 @@ ERR: HcFree(random); HcFree(input); return res; -} \ No newline at end of file +} diff --git a/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_client_bind_exchange_task.c b/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_client_bind_exchange_task.c index 603bb1f..31a97e9 100644 --- a/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_client_bind_exchange_task.c +++ b/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_client_bind_exchange_task.c @@ -121,7 +121,7 @@ ERR: return res; } -static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson *in, CJson *out, int *status) +static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson *in, CJson *out, int32_t *status) { IsoClientBindExchangeTask *realTask = (IsoClientBindExchangeTask *)task; if (realTask->taskBase.taskStatus < TASK_TYPE_BEGIN) { @@ -135,7 +135,7 @@ static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson return HC_SUCCESS; } int res; - int message = 0; + int32_t message = 0; res = GetIntFromJson(in, FIELD_MESSAGE, &message); if (res != 0 || message != ISO_SERVER_BIND_EXCHANGE_RET) { return HC_ERR_BAD_MESSAGE; @@ -192,7 +192,8 @@ static int ClientBindAesEncrypt(IsoClientBindExchangeTask *task, const IsoParams return res; } -static int ClientBindExchangeStart(const IsoParams *params, IsoClientBindExchangeTask *task, CJson *out, int *status) +static int ClientBindExchangeStart(const IsoParams *params, IsoClientBindExchangeTask *task, CJson *out, + int32_t *status) { uint8_t *nonce = NULL; uint8_t *encData = NULL; @@ -232,7 +233,7 @@ ERR: return res; } -SymBaseCurTask *CreateClientBindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int *status) +SymBaseCurTask *CreateClientBindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int32_t *status) { (void)in; IsoClientBindExchangeTask *task = (IsoClientBindExchangeTask *)HcMalloc(sizeof(IsoClientBindExchangeTask), 0); diff --git a/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_client_unbind_exchange_task.c b/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_client_unbind_exchange_task.c index 8acd1eb..79d6d69 100644 --- a/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_client_unbind_exchange_task.c +++ b/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_client_unbind_exchange_task.c @@ -33,7 +33,7 @@ static void DestroyClientUnbindExchangeTask(struct SymBaseCurTaskT *task) HcFree(task); } -static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson *in, CJson *out, int *status) +static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson *in, CJson *out, int32_t *status) { IsoClientUnbindExchangeTask *realTask = (IsoClientUnbindExchangeTask *)task; if (realTask->taskBase.taskStatus < TASK_TYPE_BEGIN) { @@ -48,7 +48,7 @@ static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson } int res; uint8_t *keyAlias = NULL; - int message = 0; + int32_t message = 0; res = GetIntFromJson(in, FIELD_MESSAGE, &message); if (res != 0 || message != ISO_SERVER_UNBIND_EXCHANGE_RET) { return HC_ERR_BAD_MESSAGE; @@ -167,7 +167,7 @@ ERR: static int ClientUnbindExchangeStart(const IsoParams *params, IsoClientUnbindExchangeTask *task, CJson *out, - int *status) + int32_t *status) { int res; uint8_t *nonce = NULL; @@ -196,7 +196,7 @@ ERR: return res; } -SymBaseCurTask *CreateClientUnbindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int *status) +SymBaseCurTask *CreateClientUnbindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int32_t *status) { (void)in; IsoClientUnbindExchangeTask *task = (IsoClientUnbindExchangeTask *)HcMalloc(sizeof(IsoClientUnbindExchangeTask), 0); @@ -212,4 +212,4 @@ SymBaseCurTask *CreateClientUnbindExchangeTask(IsoParams *params, const CJson *i return NULL; } return (SymBaseCurTask *)task; -} \ No newline at end of file +} diff --git a/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_server_bind_exchange_task.c b/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_server_bind_exchange_task.c index b7e2533..3648bf9 100644 --- a/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_server_bind_exchange_task.c +++ b/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_server_bind_exchange_task.c @@ -37,7 +37,7 @@ void DestroyServerBindExchangeTask(struct SymBaseCurTaskT *task) HcFree(task); } -static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson *in, CJson *out, int *status) +static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson *in, CJson *out, int32_t *status) { IsoServerBindExchangeTask *realTask = (IsoServerBindExchangeTask *)task; if (realTask->taskBase.taskStatus < TASK_TYPE_BEGIN) { @@ -51,7 +51,7 @@ static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson return HC_SUCCESS; } int res; - int message = 0; + int32_t message = 0; res = GetIntFromJson(in, FIELD_MESSAGE, &message); if (res != 0 || message != ISO_CLIENT_BIND_EXCHANGE_CONFIRM) { return HC_ERR_BAD_MESSAGE; @@ -219,7 +219,7 @@ ERR: } static int ServerBindExchangeStart(const IsoParams *params, IsoServerBindExchangeTask *task, - const CJson *in, CJson *out, int *status) + const CJson *in, CJson *out, int32_t *status) { int res; uint8_t *challenge = (uint8_t *)HcMalloc(CHALLENGE_SIZE, 0); @@ -244,7 +244,7 @@ ERR: return res; } -SymBaseCurTask *CreateServerBindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int *status) +SymBaseCurTask *CreateServerBindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int32_t *status) { IsoServerBindExchangeTask *task = (IsoServerBindExchangeTask *)HcMalloc(sizeof(IsoServerBindExchangeTask), 0); if (task == NULL) { @@ -259,4 +259,4 @@ SymBaseCurTask *CreateServerBindExchangeTask(IsoParams *params, const CJson *in, return NULL; } return (SymBaseCurTask *)task; -} \ No newline at end of file +} diff --git a/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_server_unbind_exchange_task.c b/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_server_unbind_exchange_task.c index b64e570..4156a73 100644 --- a/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_server_unbind_exchange_task.c +++ b/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/iso_server_unbind_exchange_task.c @@ -35,7 +35,7 @@ static void DestroyServerUnbindExchangeTask(struct SymBaseCurTaskT *task) HcFree(task); } -static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson *in, CJson *out, int *status) +static int Process(struct SymBaseCurTaskT *task, IsoParams *params, const CJson *in, CJson *out, int32_t *status) { (void)task; (void)params; @@ -52,7 +52,7 @@ static int CheckRemoveInfo(const Uint8Buff *removeInfoBuf, const IsoParams *para LOGE("Get remove info json failed"); return HC_ERR_JSON_GET; } - int userType = 0; + int32_t userType = 0; uint8_t *peerAuthId = NULL; int res = GetIntFromJson(removeInfoJson, FIELD_RMV_TYPE, &userType); if (res != HC_SUCCESS) { @@ -157,7 +157,7 @@ ERR: } static int ServerUnbindExchangeStart(IsoParams *param, IsoServerUnbindExchangeTask *task, - const CJson *in, CJson *out, int *status) + const CJson *in, CJson *out, int32_t *status) { int res = DecryptRemoveInfo(param, in); if (res != 0) { @@ -176,7 +176,7 @@ ERR: return res; } -SymBaseCurTask *CreateServerUnbindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int *status) +SymBaseCurTask *CreateServerUnbindExchangeTask(IsoParams *params, const CJson *in, CJson *out, int32_t *status) { (void)in; IsoServerUnbindExchangeTask *task = (IsoServerUnbindExchangeTask *)HcMalloc(sizeof(IsoServerUnbindExchangeTask), 0); @@ -192,4 +192,4 @@ SymBaseCurTask *CreateServerUnbindExchangeTask(IsoParams *params, const CJson *i return NULL; } return (SymBaseCurTask *)task; -} \ No newline at end of file +} diff --git a/services/frameworks/inc/module/dev_auth_module_manager.h b/services/frameworks/inc/module/dev_auth_module_manager.h index 5041a9d..535a96d 100644 --- a/services/frameworks/inc/module/dev_auth_module_manager.h +++ b/services/frameworks/inc/module/dev_auth_module_manager.h @@ -25,8 +25,8 @@ extern "C" { typedef struct AuthModuleBaseT { int moduleType; - int (*createTask)(int *, const CJson *in, CJson *out); - int (*processTask)(int, const CJson *in, CJson *out, int *status); + int (*createTask)(int32_t *, const CJson *in, CJson *out); + int (*processTask)(int32_t, const CJson *in, CJson *out, int32_t *status); void (*destroyTask)(int); void (*destroyModule)(struct AuthModuleBaseT *module); } AuthModuleBase; @@ -34,8 +34,8 @@ typedef struct AuthModuleBaseT { int32_t InitModules(void); void DestroyModules(void); -int32_t CreateTask(int *taskId, const CJson *in, CJson *out, int moduleType); -int32_t ProcessTask(int taskId, const CJson *in, CJson *out, int *status, int moduleType); +int32_t CreateTask(int32_t *taskId, const CJson *in, CJson *out, int moduleType); +int32_t ProcessTask(int taskId, const CJson *in, CJson *out, int32_t *status, int moduleType); void DestroyTask(int taskId, int moduleType); int32_t CheckMsgRepeatability(const CJson *in, int moduleType); diff --git a/services/frameworks/inc/session/base_session.h b/services/frameworks/inc/session/base_session.h index 381f25f..3c6292d 100644 --- a/services/frameworks/inc/session/base_session.h +++ b/services/frameworks/inc/session/base_session.h @@ -22,7 +22,7 @@ #include "json_utils.h" typedef struct SessionT { - int (*process)(struct SessionT *, CJson *); + int32_t (*process)(struct SessionT *, CJson *); void (*destroy)(struct SessionT *); const DeviceAuthCallback *callback; int type; diff --git a/services/frameworks/src/module/dev_auth_module_manager.c b/services/frameworks/src/module/dev_auth_module_manager.c index c93ff35..a58b396 100644 --- a/services/frameworks/src/module/dev_auth_module_manager.c +++ b/services/frameworks/src/module/dev_auth_module_manager.c @@ -146,7 +146,7 @@ int32_t DeletePeerAuthInfo(const char *pkgName, const char *serviceType, Uint8Bu return HC_SUCCESS; } -int32_t ProcessTask(int taskId, const CJson *in, CJson *out, int *status, int moduleType) +int32_t ProcessTask(int taskId, const CJson *in, CJson *out, int32_t *status, int moduleType) { if (in == NULL || out == NULL || status == NULL) { LOGE("Params is null."); @@ -175,7 +175,7 @@ int32_t ProcessTask(int taskId, const CJson *in, CJson *out, int *status, int mo return res; } -int32_t CreateTask(int *taskId, const CJson *in, CJson *out, int moduleType) +int32_t CreateTask(int32_t *taskId, const CJson *in, CJson *out, int moduleType) { if (in == NULL || out == NULL || taskId == NULL) { LOGE("Params is null."); diff --git a/services/group_auth/inc/session/auth_session_common_defines.h b/services/group_auth/inc/session/auth_session_common_defines.h index bb11cfa..1cb57d1 100644 --- a/services/group_auth/inc/session/auth_session_common_defines.h +++ b/services/group_auth/inc/session/auth_session_common_defines.h @@ -24,7 +24,7 @@ DECLARE_HC_VECTOR(ParamsVec, void*) typedef struct { Session base; - int curTaskId; + int32_t curTaskId; ParamsVec paramsList; uint32_t currentIndex; } AuthSession; diff --git a/services/group_auth/inc/session/auth_session_lite/auth_session_common_lite.h b/services/group_auth/inc/session/auth_session_lite/auth_session_common_lite.h index c3578a5..1773600 100644 --- a/services/group_auth/inc/session/auth_session_lite/auth_session_common_lite.h +++ b/services/group_auth/inc/session/auth_session_lite/auth_session_common_lite.h @@ -23,7 +23,7 @@ typedef struct AuthSessionLiteT { Session base; - int curTaskId; + int32_t curTaskId; CJson *authParams; } AuthSessionLite; diff --git a/services/group_auth/src/session/auth_session/auth_session_client.c b/services/group_auth/src/session/auth_session/auth_session_client.c index 4597ff6..4c8a62c 100644 --- a/services/group_auth/src/session/auth_session/auth_session_client.c +++ b/services/group_auth/src/session/auth_session/auth_session_client.c @@ -22,7 +22,7 @@ #include "json_utils.h" #include "session_common.h" -static int ProcessClientAuthSession(Session *session, CJson *in); +static int32_t ProcessClientAuthSession(Session *session, CJson *in); int32_t CheckInputAuthParams(const CJson *authParam) { @@ -86,7 +86,7 @@ static int32_t StartClientAuthTask(AuthSession *session) int32_t CheckClientGroupAuthMsg(AuthSession *session, const CJson *in) { int32_t groupErrMsg = 0; - if (GetIntFromJson(in, FIELD_GROUP_ERROR_MSG, (int *)&groupErrMsg) != HC_SUCCESS) { + if (GetIntFromJson(in, FIELD_GROUP_ERROR_MSG, &groupErrMsg) != HC_SUCCESS) { return HC_SUCCESS; } CJson *outData = CreateJson(); @@ -202,4 +202,4 @@ Session *CreateClientAuthSession(CJson *param, const DeviceAuthCallback *callbac } LOGD("End create client authSession."); return session; -} \ No newline at end of file +} diff --git a/services/group_auth/src/session/auth_session/auth_session_server.c b/services/group_auth/src/session/auth_session/auth_session_server.c index fa96cfc..67ca156 100644 --- a/services/group_auth/src/session/auth_session/auth_session_server.c +++ b/services/group_auth/src/session/auth_session/auth_session_server.c @@ -25,7 +25,7 @@ #include "hc_types.h" #include "session_common.h" -static int ProcessServerAuthSession(Session *session, CJson *in); +static int32_t ProcessServerAuthSession(Session *session, CJson *in); static int32_t CombineServerParams(const CJson *confirmationJson, CJson *dataFromClient) { @@ -108,7 +108,7 @@ static int32_t AddAuthParamByRequest(CJson *dataFromClient, const DeviceAuthCall LOGE("Failed to create json from string!"); return HC_ERR_JSON_FAIL; } - int serverConfirm = REQUEST_ACCEPTED; + int32_t serverConfirm = REQUEST_ACCEPTED; (void)GetIntFromJson(confirmationJson, FIELD_CONFIRMATION, &serverConfirm); if ((uint32_t)serverConfirm == REQUEST_REJECTED) { LOGE("Server reject to response."); @@ -184,14 +184,14 @@ static int32_t StartServerAuthTask(AuthSession *session, const CJson *receivedDa static int32_t CheckServerGroupAuthMsg(const CJson *in, const CJson *paramInSession, const DeviceAuthCallback *callback) { int32_t groupErrMsg = 0; - if (GetIntFromJson(in, FIELD_GROUP_ERROR_MSG, (int *)&groupErrMsg) != HC_SUCCESS) { + if (GetIntFromJson(in, FIELD_GROUP_ERROR_MSG, &groupErrMsg) != HC_SUCCESS) { return HC_SUCCESS; } InformLocalAuthError(paramInSession, callback); return HC_ERR_PEER_ERROR; } -static int ProcessServerAuthSession(Session *session, CJson *in) +static int32_t ProcessServerAuthSession(Session *session, CJson *in) { LOGI("Begin process server authSession."); if ((session == NULL) || (in == NULL)) { @@ -278,4 +278,4 @@ Session *CreateServerAuthSession(CJson *param, const DeviceAuthCallback *callbac return NULL; } return (Session *)session; -} \ No newline at end of file +} diff --git a/services/group_manager/inc/group_operation_common.h b/services/group_manager/inc/group_operation_common.h index a59c9e7..f926337 100644 --- a/services/group_manager/inc/group_operation_common.h +++ b/services/group_manager/inc/group_operation_common.h @@ -69,7 +69,7 @@ int32_t ConvertGroupIdToJsonStr(const char *groupId, char **returnJsonStr); int32_t GenerateBindSuccessData(const char *peerAuthId, const char *groupId, char **returnDataStr); int32_t GenerateUnbindSuccessData(const char *peerAuthId, const char *groupId, char **returnDataStr); -int32_t GetGroupTypeFromDb(const char *groupId, int *returnGroupType); +int32_t GetGroupTypeFromDb(const char *groupId, int32_t *returnGroupType); int32_t GetUserIdHashFromJson(const CJson *jsonParams, char **userIdHash); int32_t GetGroupIdFromJson(const CJson *jsonParams, const char **groupId); int32_t GetAppIdFromJson(const CJson *jsonParams, const char **appId); diff --git a/services/group_manager/src/group_operation/group_operation_common.c b/services/group_manager/src/group_operation/group_operation_common.c index 3a41a6f..29df55a 100644 --- a/services/group_manager/src/group_operation/group_operation_common.c +++ b/services/group_manager/src/group_operation/group_operation_common.c @@ -301,7 +301,7 @@ bool IsGroupVisibilityValid(int groupVisibility) int32_t CheckUserTypeIfExist(const CJson *jsonParams) { - int userType = DEVICE_TYPE_ACCESSORY; + int32_t userType = DEVICE_TYPE_ACCESSORY; (void)GetIntFromJson(jsonParams, FIELD_USER_TYPE, &userType); if (!IsUserTypeValid(userType)) { LOGE("The input userType is invalid! [UserType]: %d", userType); @@ -312,7 +312,7 @@ int32_t CheckUserTypeIfExist(const CJson *jsonParams) int32_t CheckGroupVisibilityIfExist(const CJson *jsonParams) { - int groupVisibility = GROUP_VISIBILITY_PUBLIC; + int32_t groupVisibility = GROUP_VISIBILITY_PUBLIC; (void)GetIntFromJson(jsonParams, FIELD_GROUP_VISIBILITY, &groupVisibility); if (!IsGroupVisibilityValid(groupVisibility)) { LOGE("The input groupVisibility is invalid! [GroupVisibility]: %d", groupVisibility); @@ -323,7 +323,7 @@ int32_t CheckGroupVisibilityIfExist(const CJson *jsonParams) int32_t CheckExpireTimeIfExist(const CJson *jsonParams) { - int expireTime = DEFAULT_EXPIRE_TIME; + int32_t expireTime = DEFAULT_EXPIRE_TIME; (void)GetIntFromJson(jsonParams, FIELD_EXPIRE_TIME, &expireTime); if (!IsExpireTimeValid(expireTime)) { LOGE("Invalid group expire time! [ExpireTime]: %d", expireTime); @@ -368,7 +368,7 @@ int32_t AddGroupTypeToParams(int groupType, GroupInfo *groupParams) int32_t AddGroupVisibilityOrDefault(const CJson *jsonParams, GroupInfo *groupParams) { /* Currently, only the public group and private group can be created. */ - int groupVisibility = GROUP_VISIBILITY_PUBLIC; + int32_t groupVisibility = GROUP_VISIBILITY_PUBLIC; (void)GetIntFromJson(jsonParams, FIELD_GROUP_VISIBILITY, &groupVisibility); groupParams->visibility = groupVisibility; return HC_SUCCESS; @@ -376,7 +376,7 @@ int32_t AddGroupVisibilityOrDefault(const CJson *jsonParams, GroupInfo *groupPar int32_t AddExpireTimeOrDefault(const CJson *jsonParams, GroupInfo *groupParams) { - int expireTime = DEFAULT_EXPIRE_TIME; + int32_t expireTime = DEFAULT_EXPIRE_TIME; (void)GetIntFromJson(jsonParams, FIELD_EXPIRE_TIME, &expireTime); groupParams->expireTime = expireTime; return HC_SUCCESS; @@ -433,7 +433,7 @@ int32_t AddAuthIdToParamsOrDefault(const CJson *jsonParams, DeviceInfo *devParam int32_t AddUserTypeToParamsOrDefault(const CJson *jsonParams, DeviceInfo *devParams) { - int userType = DEVICE_TYPE_ACCESSORY; + int32_t userType = DEVICE_TYPE_ACCESSORY; (void)GetIntFromJson(jsonParams, FIELD_USER_TYPE, &userType); devParams->devType = userType; return HC_SUCCESS; @@ -687,7 +687,7 @@ int32_t ProcessKeyPair(int action, const CJson *jsonParams, const char *groupId) } authId = udid; } - int userType = DEVICE_TYPE_ACCESSORY; + int32_t userType = DEVICE_TYPE_ACCESSORY; (void)GetIntFromJson(jsonParams, FIELD_USER_TYPE, &userType); Uint8Buff authIdBuff = { 0, 0 }; authIdBuff.length = HcStrlen(authId); @@ -715,7 +715,7 @@ int32_t ProcessKeyPair(int action, const CJson *jsonParams, const char *groupId) return result; } -int32_t GetGroupTypeFromDb(const char *groupId, int *returnGroupType) +int32_t GetGroupTypeFromDb(const char *groupId, int32_t *returnGroupType) { if ((groupId == NULL) || (returnGroupType == NULL)) { LOGE("The input parameters contains NULL value!"); @@ -824,4 +824,4 @@ int32_t GetHashResult(const uint8_t *info, uint32_t infoLen, char *hash, uint32_ HcFree(infoHash.val); HcFree(message.val); return result; -} \ No newline at end of file +} diff --git a/services/group_manager/src/group_operation/peer_to_peer_group/peer_to_peer_group.c b/services/group_manager/src/group_operation/peer_to_peer_group/peer_to_peer_group.c index c59844d..43bde7d 100644 --- a/services/group_manager/src/group_operation/peer_to_peer_group/peer_to_peer_group.c +++ b/services/group_manager/src/group_operation/peer_to_peer_group/peer_to_peer_group.c @@ -637,7 +637,7 @@ static int32_t AddMemberToGroup(int64_t requestId, CJson *jsonParams, const Devi return HC_ERR_INVALID_PARAMS; } int32_t result; - int operationCode = MEMBER_INVITE; + int32_t operationCode = MEMBER_INVITE; (void)GetIntFromJson(jsonParams, FIELD_OPERATION_CODE, &operationCode); result = CheckClientStatus(operationCode, jsonParams); if (result != HC_SUCCESS) { @@ -678,7 +678,7 @@ static int32_t ProcessData(int64_t requestId, CJson *jsonParams, const DeviceAut LOGE("The input parameters contains NULL value!"); return HC_ERR_INVALID_PARAMS; } - int operationCode = MEMBER_INVITE; + int32_t operationCode = MEMBER_INVITE; (void)(GetIntFromJson(jsonParams, FIELD_GROUP_OP, &operationCode)); int32_t result = CheckServerStatusIfNotInvite(operationCode, jsonParams); if (result != HC_SUCCESS) { diff --git a/services/group_manager/src/session/bind_session/bind_session_client.c b/services/group_manager/src/session/bind_session/bind_session_client.c index 84c11f2..6de2d38 100644 --- a/services/group_manager/src/session/bind_session/bind_session_client.c +++ b/services/group_manager/src/session/bind_session/bind_session_client.c @@ -145,7 +145,7 @@ static int32_t PrepareClient(const CJson *jsonParams, BindSession *session) Session *CreateClientBindSession(CJson *jsonParams, const DeviceAuthCallback *callback) { - int opCode = MEMBER_INVITE; + int32_t opCode = MEMBER_INVITE; if (GetIntFromJson(jsonParams, FIELD_OPERATION_CODE, &opCode) != HC_SUCCESS) { LOGE("Failed to get opCode from json!"); return NULL; @@ -183,4 +183,4 @@ Session *CreateClientBindSession(CJson *jsonParams, const DeviceAuthCallback *ca return NULL; } return (Session *)session; -} \ No newline at end of file +} diff --git a/services/group_manager/src/session/bind_session/bind_session_common.c b/services/group_manager/src/session/bind_session/bind_session_common.c index 1efe5cc..844e209 100644 --- a/services/group_manager/src/session/bind_session/bind_session_common.c +++ b/services/group_manager/src/session/bind_session/bind_session_common.c @@ -165,7 +165,7 @@ static int32_t AddGroupAndDevInfoToParams(const BindSession *session, CJson *mod LOGE("Failed to get authId from params!"); return HC_ERR_JSON_GET; } - int userType = DEVICE_TYPE_ACCESSORY; + int32_t userType = DEVICE_TYPE_ACCESSORY; if (GetIntFromJson(session->params, FIELD_USER_TYPE, &userType) != HC_SUCCESS) { LOGE("Failed to get userType from params!"); return HC_ERR_JSON_GET; @@ -243,7 +243,7 @@ static int32_t AddPeerAuthIdToParams(BindSession *session, CJson *moduleParams) static int32_t AddPeerUserTypeToParams(BindSession *session, CJson *moduleParams) { - int peerUserType = DEVICE_TYPE_ACCESSORY; + int32_t peerUserType = DEVICE_TYPE_ACCESSORY; if (GetIntFromJson(session->params, FIELD_PEER_USER_TYPE, &peerUserType) != HC_SUCCESS) { LOGE("Failed to get peerUserType from params!"); return HC_ERR_JSON_GET; @@ -269,7 +269,7 @@ static int32_t AddPeerAuthIdAndUserTypeToParamsIfNeed(BindSession *session, CJso static int32_t TryAddPeerUserTypeToParams(const CJson *jsonParams, BindSession *session) { - int peerUserType = DEVICE_TYPE_ACCESSORY; + int32_t peerUserType = DEVICE_TYPE_ACCESSORY; if (GetIntFromJson(jsonParams, FIELD_PEER_USER_TYPE, &peerUserType) == HC_SUCCESS) { if (AddIntToJson(session->params, FIELD_PEER_USER_TYPE, peerUserType) != HC_SUCCESS) { LOGE("Failed to add peerUserType to params!"); @@ -412,7 +412,7 @@ static int32_t AddGroupTypeIfValid(const CJson *jsonParams, CJson *params) static int32_t AddGroupVisibilityIfValidOrDefault(const CJson *jsonParams, CJson *params) { - int groupVisibility = GROUP_VISIBILITY_PUBLIC; + int32_t groupVisibility = GROUP_VISIBILITY_PUBLIC; (void)GetIntFromJson(jsonParams, FIELD_GROUP_VISIBILITY, &groupVisibility); if (!IsGroupVisibilityValid(groupVisibility)) { LOGE("The input groupVisibility is invalid!"); @@ -427,7 +427,7 @@ static int32_t AddGroupVisibilityIfValidOrDefault(const CJson *jsonParams, CJson static int32_t AddExpireTimeIfValidOrDefault(const CJson *jsonParams, CJson *params) { - int expireTime = DEFAULT_EXPIRE_TIME; + int32_t expireTime = DEFAULT_EXPIRE_TIME; (void)GetIntFromJson(jsonParams, FIELD_EXPIRE_TIME, &expireTime); if (!IsExpireTimeValid(expireTime)) { LOGE("The input expireTime is invalid!"); @@ -472,7 +472,7 @@ static int32_t CheckAuthIdAndUserTypeValid(int userType, const char *groupId, co static int32_t AddAuthIdAndUserTypeIfValidOrDefault(const char *groupId, const CJson *jsonParams, CJson *params) { - int userType = DEVICE_TYPE_ACCESSORY; + int32_t userType = DEVICE_TYPE_ACCESSORY; (void)GetIntFromJson(jsonParams, FIELD_USER_TYPE, &userType); if (!IsUserTypeValid(userType)) { LOGE("The input userType is invalid!"); @@ -516,7 +516,7 @@ static int32_t AddUdid(CJson *params) static int32_t AddUserTypeIfValidOrDefault(const CJson *jsonParams, CJson *params) { - int userType = DEVICE_TYPE_ACCESSORY; + int32_t userType = DEVICE_TYPE_ACCESSORY; (void)GetIntFromJson(jsonParams, FIELD_USER_TYPE, &userType); if (!IsUserTypeValid(userType)) { LOGE("The input userType is invalid!"); @@ -802,7 +802,7 @@ static int32_t SetGroupType(const CJson *params, GroupInfo *groupParams) static int32_t SetGroupVisibility(const CJson *params, GroupInfo *groupParams) { - int groupVisibility = GROUP_VISIBILITY_PUBLIC; + int32_t groupVisibility = GROUP_VISIBILITY_PUBLIC; (void)GetIntFromJson(params, FIELD_GROUP_VISIBILITY, &groupVisibility); groupParams->visibility = groupVisibility; return HC_SUCCESS; @@ -810,7 +810,7 @@ static int32_t SetGroupVisibility(const CJson *params, GroupInfo *groupParams) static int32_t SetGroupExpireTime(const CJson *params, GroupInfo *groupParams) { - int expireTime = DEFAULT_EXPIRE_TIME; + int32_t expireTime = DEFAULT_EXPIRE_TIME; (void)GetIntFromJson(params, FIELD_EXPIRE_TIME, &expireTime); groupParams->expireTime = expireTime; return HC_SUCCESS; @@ -830,7 +830,7 @@ static int32_t ForceDeletePeerKey(CJson *params) LOGE("Failed to get groupId from params!"); return HC_ERR_JSON_GET; } - int peerUserType = DEVICE_TYPE_ACCESSORY; + int32_t peerUserType = DEVICE_TYPE_ACCESSORY; (void)GetIntFromJson(params, FIELD_PEER_USER_TYPE, &peerUserType); Uint8Buff peerAuthIdBuff = { .val = (uint8_t *)peerAuthId, @@ -925,7 +925,7 @@ static int32_t AddGroupAndLocalDevIfNotExist(const char *groupId, const BindSess LOGI("No authId is found. The default value is udid!"); authId = udid; } - int userType = DEVICE_TYPE_ACCESSORY; + int32_t userType = DEVICE_TYPE_ACCESSORY; (void)GetIntFromJson(session->params, FIELD_USER_TYPE, &userType); return AddTrustDevToDatabase(authId, udid, groupId, userType); } @@ -943,7 +943,7 @@ static int32_t AddPeerDevToGroup(const char *peerAuthId, const char *peerUdid, } LOGI("Delete the original data successfully! RequestId: %" PRId64, session->reqId); } - int peerUserType = DEVICE_TYPE_ACCESSORY; + int32_t peerUserType = DEVICE_TYPE_ACCESSORY; (void)GetIntFromJson(session->params, FIELD_PEER_USER_TYPE, &peerUserType); int32_t result = AddTrustDevToDatabase(peerAuthId, peerUdid, groupId, peerUserType); if (result != HC_SUCCESS) { diff --git a/services/group_manager/src/session/bind_session/bind_session_server.c b/services/group_manager/src/session/bind_session/bind_session_server.c index d621cb2..b61a539 100644 --- a/services/group_manager/src/session/bind_session/bind_session_server.c +++ b/services/group_manager/src/session/bind_session/bind_session_server.c @@ -24,12 +24,12 @@ static int32_t AddRecvModuleDataToParams(CJson *jsonParams, CJson *moduleParams) { - int message = ERR_MESSAGE; + int32_t message = ERR_MESSAGE; if (GetIntFromJson(jsonParams, FIELD_MESSAGE, &message) != HC_SUCCESS) { LOGE("Failed to get message from in!"); return HC_ERR_JSON_GET; } - int authForm = ERR_AUTH_FORM; + int32_t authForm = ERR_AUTH_FORM; (void)GetIntFromJson(jsonParams, FIELD_AUTH_FORM, &authForm); CJson *payload = GetObjFromJson(jsonParams, FIELD_PAYLOAD); if (payload == NULL) { @@ -227,7 +227,7 @@ static int32_t AddAuthIdIfExist(const CJson *returnData, CJson *jsonParams) static int32_t AddUserTypeIfExistAndValid(const CJson *returnData, CJson *jsonParams) { - int userType = DEVICE_TYPE_ACCESSORY; + int32_t userType = DEVICE_TYPE_ACCESSORY; if (GetIntFromJson(returnData, FIELD_USER_TYPE, &userType) == HC_SUCCESS) { if (!IsUserTypeValid(userType)) { LOGE("The input userType is invalid!"); @@ -243,7 +243,7 @@ static int32_t AddUserTypeIfExistAndValid(const CJson *returnData, CJson *jsonPa static int32_t AddGroupVisibilityIfExistAndValid(const CJson *returnData, CJson *jsonParams) { - int groupVisibility = GROUP_VISIBILITY_PUBLIC; + int32_t groupVisibility = GROUP_VISIBILITY_PUBLIC; if (GetIntFromJson(returnData, FIELD_GROUP_VISIBILITY, &groupVisibility) == HC_SUCCESS) { if (!IsGroupVisibilityValid(groupVisibility)) { LOGE("The input groupVisibility invalid!"); @@ -259,7 +259,7 @@ static int32_t AddGroupVisibilityIfExistAndValid(const CJson *returnData, CJson static int32_t AddExpireTimeIfExistAndValid(const CJson *returnData, CJson *jsonParams) { - int expireTime = DEFAULT_EXPIRE_TIME; + int32_t expireTime = DEFAULT_EXPIRE_TIME; if (GetIntFromJson(returnData, FIELD_EXPIRE_TIME, &expireTime) == HC_SUCCESS) { if (!IsExpireTimeValid(expireTime)) { LOGE("The input expireTime invalid!"); @@ -444,7 +444,7 @@ static int32_t HandleRequest(CJson *jsonParams, BindSession *session, bool *isNe Session *CreateServerBindSession(CJson *jsonParams, const DeviceAuthCallback *callback) { - int opCode = MEMBER_INVITE; + int32_t opCode = MEMBER_INVITE; if (GetIntFromJson(jsonParams, FIELD_GROUP_OP, &opCode) != HC_SUCCESS) { LOGE("Failed to get opCode from jsonParams!"); return NULL; @@ -469,4 +469,4 @@ Session *CreateServerBindSession(CJson *jsonParams, const DeviceAuthCallback *ca return NULL; } return (Session *)session; -} \ No newline at end of file +} diff --git a/services/group_manager/src/session/bind_session_common_util.c b/services/group_manager/src/session/bind_session_common_util.c index 13e470f..0f0d9e3 100644 --- a/services/group_manager/src/session/bind_session_common_util.c +++ b/services/group_manager/src/session/bind_session_common_util.c @@ -170,7 +170,7 @@ int32_t SendBindSessionData(const BindSession *session, const CJson *sendData) int32_t CreateAndProcessModule(BindSession *session, const CJson *in, CJson *out) { - int status = 0; + int32_t status = 0; LOGI("Start to create and process module task! [ModuleType]: %d", session->moduleType); int32_t res = CreateTask(&(session->curTaskId), in, out, session->moduleType); if (res != HC_SUCCESS) {