mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-12-20 00:21:45 +00:00
modify complie warnings.
Signed-off-by: liangliang_ma <maliangliang1@huawei.com> Change-Id: I7562a2a346e4d2a6250012688b4f9fd23839abea
This commit is contained in:
parent
b66ae95bed
commit
35b673e538
@ -300,7 +300,8 @@ static void OnWiFiConnected(int32_t fd, bool isClient)
|
|||||||
static void OnWiFiDisconnected(int32_t fd)
|
static void OnWiFiDisconnected(int32_t fd)
|
||||||
{
|
{
|
||||||
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "OnWiFiDisconnected: fd=%d.", 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;
|
connInfo.type = AUTH_LINK_TYPE_WIFI;
|
||||||
NotifyDisconnected(GenConnId(connInfo.type, fd), &connInfo);
|
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(head);
|
||||||
CHECK_NULL_PTR_RETURN_VOID(data);
|
CHECK_NULL_PTR_RETURN_VOID(data);
|
||||||
bool fromServer = false;
|
bool fromServer = false;
|
||||||
AuthConnInfo connInfo = {0};
|
AuthConnInfo connInfo;
|
||||||
|
(void)memset_s(&connInfo, sizeof(AuthConnInfo), 0, sizeof(AuthConnInfo));
|
||||||
if (SocketGetConnInfo(fd, &connInfo, &fromServer) != SOFTBUS_OK) {
|
if (SocketGetConnInfo(fd, &connInfo, &fromServer) != SOFTBUS_OK) {
|
||||||
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "get connInfo fail, fd=%d.", fd);
|
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "get connInfo fail, fd=%d.", fd);
|
||||||
return;
|
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);
|
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "OnCommDisconnected: connectionId=%u.", connectionId);
|
||||||
CHECK_NULL_PTR_RETURN_VOID(info);
|
CHECK_NULL_PTR_RETURN_VOID(info);
|
||||||
AuthConnInfo connInfo = {0};
|
AuthConnInfo connInfo;
|
||||||
|
(void)memset_s(&connInfo, sizeof(AuthConnInfo), 0, sizeof(AuthConnInfo));
|
||||||
(void)ConvertToAuthConnInfo(info, &connInfo);
|
(void)ConvertToAuthConnInfo(info, &connInfo);
|
||||||
NotifyDisconnected(GenConnId(connInfo.type, connectionId), &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);
|
bool fromServer = ((seq % SEQ_INTERVAL) != 0);
|
||||||
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "RecvCommData: connectionId=%u, module=%d, seq=%" PRId64
|
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "RecvCommData: connectionId=%u, module=%d, seq=%" PRId64
|
||||||
", len=%d, from=%s.", connectionId, moduleId, seq, len, GetAuthSideStr(fromServer));
|
", 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) {
|
if (GetConnInfoByConnectionId(connectionId, &connInfo) != SOFTBUS_OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -389,10 +393,11 @@ static int32_t InitCommConn(void)
|
|||||||
|
|
||||||
static void OnCommConnectSucc(uint32_t requestId, uint32_t connectionId, const ConnectionInfo *info)
|
static void OnCommConnectSucc(uint32_t requestId, uint32_t connectionId, const ConnectionInfo *info)
|
||||||
{
|
{
|
||||||
AuthConnInfo connInfo = {0};
|
AuthConnInfo connInfo;
|
||||||
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO,
|
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO,
|
||||||
"OnCommConnectSucc: requestId=%u, connectionId=%u.", requestId, connectionId);
|
"OnCommConnectSucc: requestId=%u, connectionId=%u.", requestId, connectionId);
|
||||||
CHECK_NULL_PTR_RETURN_VOID(info);
|
CHECK_NULL_PTR_RETURN_VOID(info);
|
||||||
|
(void)memset_s(&connInfo, sizeof(AuthConnInfo), 0, sizeof(AuthConnInfo));
|
||||||
(void)ConvertToAuthConnInfo(info, &connInfo);
|
(void)ConvertToAuthConnInfo(info, &connInfo);
|
||||||
RemoveConnConnectTimeout(requestId);
|
RemoveConnConnectTimeout(requestId);
|
||||||
NotifyClientConnected(requestId, GenConnId(connInfo.type, connectionId), SOFTBUS_OK, &connInfo);
|
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)
|
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);
|
int32_t ret = ConvertToConnectOption(info, &option);
|
||||||
if (ret != SOFTBUS_OK) {
|
if (ret != SOFTBUS_OK) {
|
||||||
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "ConvertToConnectOption fail(=%d).", ret);
|
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 ConnectAuthDevice(uint32_t requestId, const AuthConnInfo *connInfo, ConnSideType sideType)
|
||||||
{
|
{
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
ConnCmdInfo info = {0};
|
|
||||||
CHECK_NULL_PTR_RETURN_VALUE(connInfo, SOFTBUS_INVALID_PARAM);
|
CHECK_NULL_PTR_RETURN_VALUE(connInfo, SOFTBUS_INVALID_PARAM);
|
||||||
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO,
|
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO,
|
||||||
"ConnectDevice: requestId=%u, connType=%d, sideType=%d.", requestId, connInfo->type, sideType);
|
"ConnectDevice: requestId=%u, connType=%d, sideType=%d.", requestId, connInfo->type, sideType);
|
||||||
PostConnConnectTimeout(requestId);
|
PostConnConnectTimeout(requestId);
|
||||||
switch (connInfo->type) {
|
switch (connInfo->type) {
|
||||||
case AUTH_LINK_TYPE_WIFI:
|
case AUTH_LINK_TYPE_WIFI: {
|
||||||
info.requestId = requestId,
|
ConnCmdInfo info = {
|
||||||
info.connInfo = *connInfo,
|
.requestId = requestId,
|
||||||
|
.connInfo = *connInfo
|
||||||
|
};
|
||||||
ret = PostAuthEvent(EVENT_CONNECT_CMD, HandleConnConnectCmd, &info, sizeof(ConnCmdInfo), 0);
|
ret = PostAuthEvent(EVENT_CONNECT_CMD, HandleConnConnectCmd, &info, sizeof(ConnCmdInfo), 0);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case AUTH_LINK_TYPE_BLE:
|
case AUTH_LINK_TYPE_BLE:
|
||||||
case AUTH_LINK_TYPE_BR:
|
case AUTH_LINK_TYPE_BR:
|
||||||
case AUTH_LINK_TYPE_P2P:
|
case AUTH_LINK_TYPE_P2P:
|
||||||
@ -558,7 +566,8 @@ ConnSideType GetConnSideType(uint64_t connId)
|
|||||||
"WiFi not supported, " CONN_INFO, CONN_DATA(connId));
|
"WiFi not supported, " CONN_INFO, CONN_DATA(connId));
|
||||||
return CONN_SIDE_ANY;
|
return CONN_SIDE_ANY;
|
||||||
}
|
}
|
||||||
ConnectionInfo info = {0};
|
ConnectionInfo info;
|
||||||
|
(void)memset_s(&info, sizeof(ConnectionInfo), 0, sizeof(ConnectionInfo));
|
||||||
if (ConnGetConnectionInfo(GetConnId(connId), &info)) {
|
if (ConnGetConnectionInfo(GetConnId(connId), &info)) {
|
||||||
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR,
|
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR,
|
||||||
"ConnGetConnectionInfo fail, " CONN_INFO, CONN_DATA(connId));
|
"ConnGetConnectionInfo fail, " CONN_INFO, CONN_DATA(connId));
|
||||||
@ -573,8 +582,9 @@ ConnSideType GetConnSideType(uint64_t connId)
|
|||||||
|
|
||||||
bool CheckActiveAuthConnection(const AuthConnInfo *connInfo)
|
bool CheckActiveAuthConnection(const AuthConnInfo *connInfo)
|
||||||
{
|
{
|
||||||
|
ConnectOption connOpt;
|
||||||
CHECK_NULL_PTR_RETURN_VALUE(connInfo, false);
|
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) {
|
if (ConvertToConnectOption(connInfo, &connOpt) != SOFTBUS_OK) {
|
||||||
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR,
|
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR,
|
||||||
"convert to connect option fail, connType=%d.", connInfo->type);
|
"convert to connect option fail, connType=%d.", connInfo->type);
|
||||||
|
@ -156,11 +156,13 @@ static int32_t ParseGroupInfo(const char *groupInfoStr, GroupInfo *groupInfo)
|
|||||||
cJSON_Delete(msg);
|
cJSON_Delete(msg);
|
||||||
return SOFTBUS_ERR;
|
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.");
|
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "get FIELD_GROUP_TYPE fail.");
|
||||||
cJSON_Delete(msg);
|
cJSON_Delete(msg);
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_ERR;
|
||||||
}
|
}
|
||||||
|
groupInfo->groupType = (GroupType)groupType;
|
||||||
cJSON_Delete(msg);
|
cJSON_Delete(msg);
|
||||||
return SOFTBUS_OK;
|
return SOFTBUS_OK;
|
||||||
}
|
}
|
||||||
|
@ -355,7 +355,7 @@ int32_t SocketConnectDevice(const char *ip, int32_t port, bool isBlockMode)
|
|||||||
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "ConnOpenClientSocket fail.");
|
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "ConnOpenClientSocket fail.");
|
||||||
return AUTH_INVALID_FD;
|
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) {
|
if (AddTrigger(AUTH, fd, triggerMode) != SOFTBUS_OK) {
|
||||||
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "AddTrigger fail.");
|
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "AddTrigger fail.");
|
||||||
ConnShutdownSocket(fd);
|
ConnShutdownSocket(fd);
|
||||||
|
@ -324,7 +324,7 @@ static void TryCancelJoinProcedure(LnnConnectionFsm *connFsm)
|
|||||||
static int32_t OnJoinLNN(LnnConnectionFsm *connFsm)
|
static int32_t OnJoinLNN(LnnConnectionFsm *connFsm)
|
||||||
{
|
{
|
||||||
int32_t rc;
|
int32_t rc;
|
||||||
AuthConnInfo authConn = {0};
|
AuthConnInfo authConn;
|
||||||
LnnConntionInfo *connInfo = &connFsm->connInfo;
|
LnnConntionInfo *connInfo = &connFsm->connInfo;
|
||||||
|
|
||||||
if (CheckDeadFlag(connFsm, true)) {
|
if (CheckDeadFlag(connFsm, true)) {
|
||||||
|
@ -1154,7 +1154,7 @@ static NodeInfo *DupNodeInfo(const NodeInfo *nodeInfo)
|
|||||||
|
|
||||||
static void OnDeviceVerifyPass(int64_t authId, const NodeInfo *info)
|
static void OnDeviceVerifyPass(int64_t authId, const NodeInfo *info)
|
||||||
{
|
{
|
||||||
AuthConnInfo connInfo = {0};
|
AuthConnInfo connInfo;
|
||||||
DeviceVerifyPassMsgPara *para = NULL;
|
DeviceVerifyPassMsgPara *para = NULL;
|
||||||
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_INFO, "verify passed passively, authId=%" PRId64, authId);
|
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_INFO, "verify passed passively, authId=%" PRId64, authId);
|
||||||
if (AuthGetConnInfo(authId, &connInfo) != SOFTBUS_OK) {
|
if (AuthGetConnInfo(authId, &connInfo) != SOFTBUS_OK) {
|
||||||
|
@ -56,7 +56,7 @@ static int32_t SetCipherOfHandshakeMsg(uint32_t channelId, uint8_t *cipher)
|
|||||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get authId fail");
|
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get authId fail");
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_ERR;
|
||||||
}
|
}
|
||||||
AuthConnInfo connInfo = {0};
|
AuthConnInfo connInfo;
|
||||||
if (AuthGetConnInfo(authId, &connInfo) != SOFTBUS_OK) {
|
if (AuthGetConnInfo(authId, &connInfo) != SOFTBUS_OK) {
|
||||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get auth connInfo fail");
|
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get auth connInfo fail");
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_ERR;
|
||||||
|
@ -119,7 +119,7 @@ static int32_t TransProxyGetAuthConnInfo(uint32_t connId, AuthConnInfo *connInfo
|
|||||||
|
|
||||||
static int64_t GetAuthIdByHandshakeMsg(uint32_t connId, uint8_t cipher)
|
static int64_t GetAuthIdByHandshakeMsg(uint32_t connId, uint8_t cipher)
|
||||||
{
|
{
|
||||||
AuthConnInfo connInfo = {0};
|
AuthConnInfo connInfo;
|
||||||
if (TransProxyGetAuthConnInfo(connId, &connInfo) != SOFTBUS_OK) {
|
if (TransProxyGetAuthConnInfo(connId, &connInfo) != SOFTBUS_OK) {
|
||||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get connInfo fail connId[%d]", connId);
|
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get connInfo fail connId[%d]", connId);
|
||||||
return AUTH_INVALID_ID;
|
return AUTH_INVALID_ID;
|
||||||
|
@ -48,7 +48,7 @@ uint32_t SwitchAuthLinkTypeToFlagType(AuthLinkType type)
|
|||||||
|
|
||||||
int32_t GetCipherFlagByAuthId(int64_t authId, uint32_t *flag, bool *isAuthServer)
|
int32_t GetCipherFlagByAuthId(int64_t authId, uint32_t *flag, bool *isAuthServer)
|
||||||
{
|
{
|
||||||
AuthConnInfo info = {0};
|
AuthConnInfo info;
|
||||||
if (AuthGetServerSide(authId, isAuthServer) != SOFTBUS_OK) {
|
if (AuthGetServerSide(authId, isAuthServer) != SOFTBUS_OK) {
|
||||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get auth server side fail %" PRId64, authId);
|
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get auth server side fail %" PRId64, authId);
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_ERR;
|
||||||
|
@ -481,7 +481,7 @@ static int64_t GetAuthIdByChannelInfo(int32_t channelId, uint64_t seq, uint32_t
|
|||||||
bool fromAuthServer = ((seq & AUTH_CONN_SERVER_SIDE) != 0);
|
bool fromAuthServer = ((seq & AUTH_CONN_SERVER_SIDE) != 0);
|
||||||
char p2pMac[P2P_MAC_LEN] = {0};
|
char p2pMac[P2P_MAC_LEN] = {0};
|
||||||
if (P2pLinkGetPeerMacByPeerIp(appInfo.peerData.addr, p2pMac, sizeof(p2pMac)) != SOFTBUS_OK) {
|
if (P2pLinkGetPeerMacByPeerIp(appInfo.peerData.addr, p2pMac, sizeof(p2pMac)) != SOFTBUS_OK) {
|
||||||
AuthConnInfo connInfo = {0};
|
AuthConnInfo connInfo;
|
||||||
connInfo.type = AUTH_LINK_TYPE_WIFI;
|
connInfo.type = AUTH_LINK_TYPE_WIFI;
|
||||||
if (strcpy_s(connInfo.info.ipInfo.ip, IP_LEN, appInfo.peerData.addr) != EOK) {
|
if (strcpy_s(connInfo.info.ipInfo.ip, IP_LEN, appInfo.peerData.addr) != EOK) {
|
||||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "copy ip addr fail");
|
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "copy ip addr fail");
|
||||||
|
Loading…
Reference in New Issue
Block a user