modify complie warnings.

Signed-off-by: liangliang_ma <maliangliang1@huawei.com>
Change-Id: I7562a2a346e4d2a6250012688b4f9fd23839abea
This commit is contained in:
liangliang_ma 2022-09-03 10:20:58 +00:00
parent b66ae95bed
commit 35b673e538
9 changed files with 32 additions and 20 deletions

View File

@ -300,7 +300,8 @@ static void OnWiFiConnected(int32_t fd, bool isClient)
static void OnWiFiDisconnected(int32_t fd)
{
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "OnWiFiDisconnected: fd=%d.", fd);
AuthConnInfo connInfo = {0};
AuthConnInfo connInfo;
(void)memset_s(&connInfo, sizeof(AuthConnInfo), 0, sizeof(AuthConnInfo));
connInfo.type = AUTH_LINK_TYPE_WIFI;
NotifyDisconnected(GenConnId(connInfo.type, fd), &connInfo);
}
@ -310,7 +311,8 @@ static void OnWiFiDataReceived(int32_t fd, const AuthDataHead *head, const uint8
CHECK_NULL_PTR_RETURN_VOID(head);
CHECK_NULL_PTR_RETURN_VOID(data);
bool fromServer = false;
AuthConnInfo connInfo = {0};
AuthConnInfo connInfo;
(void)memset_s(&connInfo, sizeof(AuthConnInfo), 0, sizeof(AuthConnInfo));
if (SocketGetConnInfo(fd, &connInfo, &fromServer) != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "get connInfo fail, fd=%d.", fd);
return;
@ -338,7 +340,8 @@ static void OnCommDisconnected(uint32_t connectionId, const ConnectionInfo *info
{
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "OnCommDisconnected: connectionId=%u.", connectionId);
CHECK_NULL_PTR_RETURN_VOID(info);
AuthConnInfo connInfo = {0};
AuthConnInfo connInfo;
(void)memset_s(&connInfo, sizeof(AuthConnInfo), 0, sizeof(AuthConnInfo));
(void)ConvertToAuthConnInfo(info, &connInfo);
NotifyDisconnected(GenConnId(connInfo.type, connectionId), &connInfo);
}
@ -364,7 +367,8 @@ static void OnCommDataReceived(uint32_t connectionId, ConnModule moduleId, int64
bool fromServer = ((seq % SEQ_INTERVAL) != 0);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "RecvCommData: connectionId=%u, module=%d, seq=%" PRId64
", len=%d, from=%s.", connectionId, moduleId, seq, len, GetAuthSideStr(fromServer));
AuthConnInfo connInfo = {0};
AuthConnInfo connInfo;
(void)memset_s(&connInfo, sizeof(AuthConnInfo), 0, sizeof(AuthConnInfo));
if (GetConnInfoByConnectionId(connectionId, &connInfo) != SOFTBUS_OK) {
return;
}
@ -389,10 +393,11 @@ static int32_t InitCommConn(void)
static void OnCommConnectSucc(uint32_t requestId, uint32_t connectionId, const ConnectionInfo *info)
{
AuthConnInfo connInfo = {0};
AuthConnInfo connInfo;
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO,
"OnCommConnectSucc: requestId=%u, connectionId=%u.", requestId, connectionId);
CHECK_NULL_PTR_RETURN_VOID(info);
(void)memset_s(&connInfo, sizeof(AuthConnInfo), 0, sizeof(AuthConnInfo));
(void)ConvertToAuthConnInfo(info, &connInfo);
RemoveConnConnectTimeout(requestId);
NotifyClientConnected(requestId, GenConnId(connInfo.type, connectionId), SOFTBUS_OK, &connInfo);
@ -408,7 +413,8 @@ static void OnCommConnectFail(uint32_t requestId, int32_t reason)
static int32_t ConnectCommDevice(const AuthConnInfo *info, uint32_t requestId, ConnSideType sideType)
{
ConnectOption option = {0};
ConnectOption option;
(void)memset_s(&option, sizeof(ConnectOption), 0, sizeof(ConnectOption));
int32_t ret = ConvertToConnectOption(info, &option);
if (ret != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "ConvertToConnectOption fail(=%d).", ret);
@ -487,17 +493,19 @@ void AuthConnDeinit(void)
int32_t ConnectAuthDevice(uint32_t requestId, const AuthConnInfo *connInfo, ConnSideType sideType)
{
int32_t ret;
ConnCmdInfo info = {0};
CHECK_NULL_PTR_RETURN_VALUE(connInfo, SOFTBUS_INVALID_PARAM);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO,
"ConnectDevice: requestId=%u, connType=%d, sideType=%d.", requestId, connInfo->type, sideType);
PostConnConnectTimeout(requestId);
switch (connInfo->type) {
case AUTH_LINK_TYPE_WIFI:
info.requestId = requestId,
info.connInfo = *connInfo,
case AUTH_LINK_TYPE_WIFI: {
ConnCmdInfo info = {
.requestId = requestId,
.connInfo = *connInfo
};
ret = PostAuthEvent(EVENT_CONNECT_CMD, HandleConnConnectCmd, &info, sizeof(ConnCmdInfo), 0);
break;
}
case AUTH_LINK_TYPE_BLE:
case AUTH_LINK_TYPE_BR:
case AUTH_LINK_TYPE_P2P:
@ -558,7 +566,8 @@ ConnSideType GetConnSideType(uint64_t connId)
"WiFi not supported, " CONN_INFO, CONN_DATA(connId));
return CONN_SIDE_ANY;
}
ConnectionInfo info = {0};
ConnectionInfo info;
(void)memset_s(&info, sizeof(ConnectionInfo), 0, sizeof(ConnectionInfo));
if (ConnGetConnectionInfo(GetConnId(connId), &info)) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR,
"ConnGetConnectionInfo fail, " CONN_INFO, CONN_DATA(connId));
@ -573,8 +582,9 @@ ConnSideType GetConnSideType(uint64_t connId)
bool CheckActiveAuthConnection(const AuthConnInfo *connInfo)
{
ConnectOption connOpt;
CHECK_NULL_PTR_RETURN_VALUE(connInfo, false);
ConnectOption connOpt = {0};
(void)memset_s(&connOpt, sizeof(ConnectOption), 0, sizeof(ConnectOption));
if (ConvertToConnectOption(connInfo, &connOpt) != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR,
"convert to connect option fail, connType=%d.", connInfo->type);

View File

@ -156,11 +156,13 @@ static int32_t ParseGroupInfo(const char *groupInfoStr, GroupInfo *groupInfo)
cJSON_Delete(msg);
return SOFTBUS_ERR;
}
if (!GetJsonObjectNumberItem(msg, FIELD_GROUP_TYPE, &groupInfo->groupType)) {
int32_t groupType = 0;
if (!GetJsonObjectNumberItem(msg, FIELD_GROUP_TYPE, &groupType)) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "get FIELD_GROUP_TYPE fail.");
cJSON_Delete(msg);
return SOFTBUS_ERR;
}
groupInfo->groupType = (GroupType)groupType;
cJSON_Delete(msg);
return SOFTBUS_OK;
}

View File

@ -355,7 +355,7 @@ int32_t SocketConnectDevice(const char *ip, int32_t port, bool isBlockMode)
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "ConnOpenClientSocket fail.");
return AUTH_INVALID_FD;
}
int32_t triggerMode = isBlockMode ? READ_TRIGGER : WRITE_TRIGGER;
TriggerType triggerMode = isBlockMode ? READ_TRIGGER : WRITE_TRIGGER;
if (AddTrigger(AUTH, fd, triggerMode) != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "AddTrigger fail.");
ConnShutdownSocket(fd);

View File

@ -324,7 +324,7 @@ static void TryCancelJoinProcedure(LnnConnectionFsm *connFsm)
static int32_t OnJoinLNN(LnnConnectionFsm *connFsm)
{
int32_t rc;
AuthConnInfo authConn = {0};
AuthConnInfo authConn;
LnnConntionInfo *connInfo = &connFsm->connInfo;
if (CheckDeadFlag(connFsm, true)) {

View File

@ -1154,7 +1154,7 @@ static NodeInfo *DupNodeInfo(const NodeInfo *nodeInfo)
static void OnDeviceVerifyPass(int64_t authId, const NodeInfo *info)
{
AuthConnInfo connInfo = {0};
AuthConnInfo connInfo;
DeviceVerifyPassMsgPara *para = NULL;
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_INFO, "verify passed passively, authId=%" PRId64, authId);
if (AuthGetConnInfo(authId, &connInfo) != SOFTBUS_OK) {

View File

@ -56,7 +56,7 @@ static int32_t SetCipherOfHandshakeMsg(uint32_t channelId, uint8_t *cipher)
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get authId fail");
return SOFTBUS_ERR;
}
AuthConnInfo connInfo = {0};
AuthConnInfo connInfo;
if (AuthGetConnInfo(authId, &connInfo) != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get auth connInfo fail");
return SOFTBUS_ERR;

View File

@ -119,7 +119,7 @@ static int32_t TransProxyGetAuthConnInfo(uint32_t connId, AuthConnInfo *connInfo
static int64_t GetAuthIdByHandshakeMsg(uint32_t connId, uint8_t cipher)
{
AuthConnInfo connInfo = {0};
AuthConnInfo connInfo;
if (TransProxyGetAuthConnInfo(connId, &connInfo) != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get connInfo fail connId[%d]", connId);
return AUTH_INVALID_ID;

View File

@ -48,7 +48,7 @@ uint32_t SwitchAuthLinkTypeToFlagType(AuthLinkType type)
int32_t GetCipherFlagByAuthId(int64_t authId, uint32_t *flag, bool *isAuthServer)
{
AuthConnInfo info = {0};
AuthConnInfo info;
if (AuthGetServerSide(authId, isAuthServer) != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get auth server side fail %" PRId64, authId);
return SOFTBUS_ERR;

View File

@ -481,7 +481,7 @@ static int64_t GetAuthIdByChannelInfo(int32_t channelId, uint64_t seq, uint32_t
bool fromAuthServer = ((seq & AUTH_CONN_SERVER_SIDE) != 0);
char p2pMac[P2P_MAC_LEN] = {0};
if (P2pLinkGetPeerMacByPeerIp(appInfo.peerData.addr, p2pMac, sizeof(p2pMac)) != SOFTBUS_OK) {
AuthConnInfo connInfo = {0};
AuthConnInfo connInfo;
connInfo.type = AUTH_LINK_TYPE_WIFI;
if (strcpy_s(connInfo.info.ipInfo.ip, IP_LEN, appInfo.peerData.addr) != EOK) {
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "copy ip addr fail");