From 9c751fe3bbcb77692236a2b8bd0f8033e4a84521 Mon Sep 17 00:00:00 2001 From: fuzikun Date: Mon, 20 Dec 2021 14:48:37 +0800 Subject: [PATCH] change function name Signed-off-by: fuzikun --- services/data_manager/src/database_manager.c | 7 ++++--- .../group_manager/inc/channel_manager/channel_manager.h | 2 +- .../group_manager/src/channel_manager/channel_manager.c | 2 +- .../peer_to_peer_group/peer_to_peer_group.c | 4 ++-- .../src/session/bind_session/bind_session_common.c | 2 +- .../session/bind_session_lite/bind_session_common_lite.c | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/services/data_manager/src/database_manager.c b/services/data_manager/src/database_manager.c index bde18f7..86951b4 100644 --- a/services/data_manager/src/database_manager.c +++ b/services/data_manager/src/database_manager.c @@ -1194,7 +1194,8 @@ bool IsSameNameGroupExist(const char *ownerName, const char *groupName) TrustedGroupEntry **entry = NULL; g_databaseMutex->lock(g_databaseMutex); FOR_EACH_HC_VECTOR(g_trustedGroupTable, index, entry) { - if (strcmp(StringGet(&(*entry)->name), groupName) != 0) { + if ((entry == NULL) || (*entry == NULL) || + (strcmp(StringGet(&(*entry)->name), groupName) != 0)) { continue; } if (HC_VECTOR_SIZE(&(*entry)->managers) > 0) { @@ -1216,7 +1217,7 @@ bool IsIdenticalGroupExist(void) TrustedGroupEntry **entry = NULL; g_databaseMutex->lock(g_databaseMutex); FOR_EACH_HC_VECTOR(g_trustedGroupTable, index, entry) { - if ((*entry)->type == IDENTICAL_ACCOUNT_GROUP) { + if ((entry != NULL) && (*entry != NULL) && ((*entry)->type == IDENTICAL_ACCOUNT_GROUP)) { g_databaseMutex->unlock(g_databaseMutex); return true; } @@ -1231,7 +1232,7 @@ bool IsAcrossAccountGroupExist(void) TrustedGroupEntry **entry = NULL; g_databaseMutex->lock(g_databaseMutex); FOR_EACH_HC_VECTOR(g_trustedGroupTable, index, entry) { - if ((*entry)->type == ACROSS_ACCOUNT_AUTHORIZE_GROUP) { + if ((entry != NULL) && (*entry != NULL) && ((*entry)->type == ACROSS_ACCOUNT_AUTHORIZE_GROUP)) { g_databaseMutex->unlock(g_databaseMutex); return true; } diff --git a/services/group_manager/inc/channel_manager/channel_manager.h b/services/group_manager/inc/channel_manager/channel_manager.h index 2ba41e0..7328919 100644 --- a/services/group_manager/inc/channel_manager/channel_manager.h +++ b/services/group_manager/inc/channel_manager/channel_manager.h @@ -33,7 +33,7 @@ int32_t OpenChannel(ChannelType channelType, const CJson *jsonParams, int64_t re void CloseChannel(ChannelType channelType, int64_t channelId); int32_t HcSendMsg(ChannelType channelType, int64_t requestId, int64_t channelId, const DeviceAuthCallback *callback, const char *data); -void SetAuthResult(ChannelType channelType, int64_t channelId); +void NotifyBindResult(ChannelType channelType, int64_t channelId); int32_t GetLocalConnectInfo(char *jsonAddrInfo, int32_t bufLen); #ifdef __cplusplus diff --git a/services/group_manager/src/channel_manager/channel_manager.c b/services/group_manager/src/channel_manager/channel_manager.c index 2a0b6fd..7573744 100644 --- a/services/group_manager/src/channel_manager/channel_manager.c +++ b/services/group_manager/src/channel_manager/channel_manager.c @@ -102,7 +102,7 @@ int32_t HcSendMsg(ChannelType channelType, int64_t requestId, int64_t channelId, } } -void SetAuthResult(ChannelType channelType, int64_t channelId) +void NotifyBindResult(ChannelType channelType, int64_t channelId) { if (channelType == SOFT_BUS) { GetSoftBusInstance()->notifyResult(channelId); 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 b773dee..8514d7d 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 @@ -340,7 +340,7 @@ static int32_t CheckInputGroupTypeValid(const CJson *jsonParams) return AssertPeerToPeerGroupType(groupType); } -static int32_t IsPeerDeviceIdNotSelf(const char *peerUdid) +static int32_t IsPeerDeviceNotSelf(const char *peerUdid) { if (peerUdid == NULL) { LOGE("The input peerUdid is NULL!"); @@ -376,7 +376,7 @@ static int32_t CheckPeerDeviceStatus(const char *groupId, const CJson *jsonParam DestroyDeviceInfoStruct(deviceInfo); return result; } - result = IsPeerDeviceIdNotSelf(StringGet(&deviceInfo->udid)); + result = IsPeerDeviceNotSelf(StringGet(&deviceInfo->udid)); DestroyDeviceInfoStruct(deviceInfo); return result; } 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 97e1c86..1efe5cc 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 @@ -1033,7 +1033,7 @@ static int32_t OnSessionFinish(const BindSession *session, CJson *jsonParams, CJ return result; } LOGI("The session completed successfully! [ReqId]: %" PRId64, session->reqId); - SetAuthResult(session->channelType, session->channelId); + NotifyBindResult(session->channelType, session->channelId); CloseChannel(session->channelType, session->channelId); return HC_SUCCESS; } diff --git a/services/group_manager/src/session/bind_session_lite/bind_session_common_lite.c b/services/group_manager/src/session/bind_session_lite/bind_session_common_lite.c index 3bd7fa9..747229d 100644 --- a/services/group_manager/src/session/bind_session_lite/bind_session_common_lite.c +++ b/services/group_manager/src/session/bind_session_lite/bind_session_common_lite.c @@ -62,7 +62,7 @@ static int32_t OnSessionFinish(const BindSession *session, CJson *out) ProcessFinishCallback(session->reqId, session->opCode, returnDataStr, session->base.callback); FreeJsonString(returnDataStr); LOGI("The session completed successfully! [ReqId]: %" PRId64, session->reqId); - SetAuthResult(session->channelType, session->channelId); + NotifyBindResult(session->channelType, session->channelId); CloseChannel(session->channelType, session->channelId); return HC_SUCCESS; }