fix:clean warning

Signed-off-by: lmq <leimingqiang7@huawei.com>
This commit is contained in:
lmq 2022-09-26 16:32:15 +08:00
parent cbc8f79d5d
commit 2393e246dd
10 changed files with 13 additions and 123 deletions

View File

@ -247,7 +247,7 @@ uint32_t CreateListenerModule(void)
if (g_listenerList[i] != NULL) {
continue;
}
int32_t ret = CreateSpecifiedListenerModule((ListenerModule)i);
ret = CreateSpecifiedListenerModule((ListenerModule)i);
if (ret != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "%s: create module %" PRIu32 " failed!ret=" PRId32,
__func__, i, ret);
@ -803,31 +803,6 @@ static void InitListenerInfo(SoftbusBaseListenerInfo *listenerInfo)
ListInit(&listenerInfo->node);
}
uint32_t RequireListenerModule(void)
{
uint32_t moduleId = CONN_INVALID_LISTENER_MODULE_ID;
if (SoftBusMutexLock(&g_listenerListLock) != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "%s:lock failed", __func__);
return CONN_INVALID_LISTENER_MODULE_ID;
}
for (uint32_t i = 0; i < UNUSE_BUTT; i++) {
if (g_listenerList[i] != NULL) {
continue;
}
int32_t ret = CreateSpecifiedListenerModule((ListenerModule)i);
if (ret != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "%s:create listener failed! ret=%" PRId32, __func__, ret);
break;
}
moduleId = i;
break;
}
(void)SoftBusMutexUnlock(&g_listenerListLock);
return moduleId;
}
static int32_t AddTriggerToSet(int32_t fd, TriggerType triggerType)
{

View File

@ -197,14 +197,6 @@ static void InnerP2pPeersChangedCallback(WifiP2pDevice* devices, int len)
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "InnerP2pPeersChangedCallback len %d.", len);
}
void P2pLinkEnableStub(void)
{
WifiErrorCode ret;
ret = EnableP2p();
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "wdf EnableP2p ret %d.", ret);
}
int32_t P2pLinkAdapterInit(const BroadcastRecvCb *cb)
{
WifiErrorCode ret;

View File

@ -82,8 +82,6 @@ void P2pLinkStopPeerDiscovery(void);
void P2pLinkRemoveGroup(void);
void P2pLinkRemoveGcGroup(void);
void P2pLinkEnableStub(void);
#ifdef __cplusplus
#if __cplusplus
}

View File

@ -33,7 +33,6 @@ void P2pLinkCommonClean(void);
void P2pLinkSetMyMacExpired(bool isExpired);
void P2pLinkSetMyIp(const char *ip);
void P2pLinkSetMyMac(const char *mac);
char* P2pLinkGetMyIp(void);
char* P2pLinkGetMyMac(void);
@ -46,9 +45,6 @@ int32_t P2pLinkGetGoPort(void);
void P2pLinkSetGcPort(int32_t port);
int32_t P2pLinkGetGcPort(void);
void P2pLinkSetInterface(const char *name);
char* P2pLinkGetInterface(void);
void P2pLinkSetState(bool state);
bool P2pLinkIsEnable(void);

View File

@ -55,15 +55,6 @@ void P2pLinkSetMyIp(const char *ip)
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "set my ip.");
}
void P2pLinkSetMyMac(const char *mac)
{
int32_t ret = strcpy_s(g_myMac, sizeof(g_myMac), mac);
if (ret != EOK) {
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "strcpy error");
}
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "set my mac");
}
char* P2pLinkGetMyIp(void)
{
return g_myIp;
@ -71,11 +62,10 @@ char* P2pLinkGetMyIp(void)
char* P2pLinkGetMyMac(void)
{
int32_t ret;
char myMac[P2P_MAC_LEN] = {0};
if (g_macExpired == true) {
ret = P2pLinkGetBaseMacAddress(myMac, sizeof(myMac));
int32_t ret = P2pLinkGetBaseMacAddress(myMac, sizeof(myMac));
if (ret == SOFTBUS_OK) {
ret = strcpy_s(g_myMac, sizeof(g_myMac), myMac);
if (ret != EOK) {
@ -147,18 +137,6 @@ void P2pLinkSetMyMacExpired(bool isExpired)
g_macExpired = isExpired;
}
void P2pLinkSetInterface(const char *name)
{
if (strcpy_s(g_interface, sizeof(g_interface), name) != EOK) {
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "strcpy error");
}
}
char* P2pLinkGetInterface(void)
{
return g_interface;
}
void P2pLinkSetState(bool state)
{
g_p2plinkState = state;

View File

@ -31,16 +31,14 @@
static void UpdateP2pGoGroup(const P2pLinkGroup *group)
{
char p2pIp[P2P_IP_LEN] = {0};
int32_t ret;
int32_t port;
P2pLinkUpdateDeviceByMagicGroups(group);
if (P2pLinkGetGoPort() <= 0) {
ret = P2pLinkGetP2pIpAddress(p2pIp, sizeof(p2pIp));
int32_t ret = P2pLinkGetP2pIpAddress(p2pIp, sizeof(p2pIp));
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "get my ip, ret %d", ret);
if (ret != SOFTBUS_ERR) {
P2pLinkSetMyIp(p2pIp);
port = AuthStartListening(AUTH_LINK_TYPE_P2P, p2pIp, 0);
int32_t port = AuthStartListening(AUTH_LINK_TYPE_P2P, p2pIp, 0);
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "p2p auth chan port %d", port);
P2pLinkSetGoPort(port);
}
@ -54,10 +52,9 @@ static void UpdateP2pGoGroup(const P2pLinkGroup *group)
static void UpdateP2pGcGroup(void)
{
char p2pIp[P2P_IP_LEN] = {0};
int32_t ret;
if (P2pLinkGetDhcpState() == true) {
ret = P2pLinkGetP2pIpAddress(p2pIp, sizeof(p2pIp));
int32_t ret = P2pLinkGetP2pIpAddress(p2pIp, sizeof(p2pIp));
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "get dhcp ip ret %d", ret);
if (ret != SOFTBUS_ERR) {
P2pLinkSetMyIp(p2pIp);
@ -108,7 +105,6 @@ static void LoopP2pStateChanged(P2pLoopMsg msgType, void *arg)
static void P2pStateChanged(bool state)
{
int32_t ret;
bool *arg = NULL;
arg = (bool *)SoftBusCalloc(sizeof(bool));
@ -117,7 +113,7 @@ static void P2pStateChanged(bool state)
return;
}
*arg = state;
ret = P2pLoopProc(LoopP2pStateChanged, (void *)arg, P2PLOOP_BROADCAST_P2PSTATE_CHANGED);
int32_t ret = P2pLoopProc(LoopP2pStateChanged, (void *)arg, P2PLOOP_BROADCAST_P2PSTATE_CHANGED);
if (ret != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "LoopP2pStateChanged Loop fail");
SoftBusFree(arg);
@ -205,7 +201,6 @@ static void LoopConnResult(P2pLoopMsg msgType, void *arg)
static void ConnResult(P2pLinkConnState state)
{
int32_t ret;
P2pLinkConnState *arg = NULL;
arg = (P2pLinkConnState *)SoftBusCalloc(sizeof(P2pLinkConnState));
@ -216,7 +211,7 @@ static void ConnResult(P2pLinkConnState state)
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "recv connect result %d", state);
*arg = state;
ret = P2pLoopProc(LoopConnResult, (void *)arg, P2PLOOP_BROADCAST_CONN_STATE);
int32_t ret = P2pLoopProc(LoopConnResult, (void *)arg, P2PLOOP_BROADCAST_CONN_STATE);
if (ret != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "LoopConnResult Loop fail");
SoftBusFree(arg);

View File

@ -145,26 +145,6 @@ static int32_t P2pLinkUnPackHandshake(const cJSON *root, char *mac, uint32_t mac
return SOFTBUS_OK;
}
char* P2pLinkPackWifiCfg(const char* wificfg)
{
char *buf = NULL;
cJSON *root = NULL;
root = cJSON_CreateObject();
if (root == NULL) {
return NULL;
}
if (!AddNumberToJsonObject(root, KEY_COMMAND_TYPE, CMD_GC_WIFI_CONFIG_STATE_CHANGE) ||
!AddStringToJsonObject(root, KEY_SELF_WIFI_CONFIG, wificfg)) {
cJSON_Delete(root);
return NULL;
}
buf = cJSON_PrintUnformatted(root);
cJSON_Delete(root);
return buf;
}
static int32_t P2pLinkUnPackWifiCfg(const cJSON *root, char *wificfg, uint32_t len)
{
if (!GetJsonObjectStringItem(root, KEY_SELF_WIFI_CONFIG, wificfg, len)) {

View File

@ -197,7 +197,6 @@ static void DevOnline(const P2pLinkGroup *group)
ConnectedNode *nItem = NULL;
char *onlineMacs = (char *)group->peerMacs;
char *onlineMac = NULL;
int32_t ret;
for (i = 0; i < group->peerMacNum; i++) {
onlineMac = onlineMacs + i * sizeof(P2pLinkPeerMacList);
@ -211,7 +210,7 @@ static void DevOnline(const P2pLinkGroup *group)
continue;
}
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "other app use dev");
ret = strcpy_s(nItem->peerMac, sizeof(nItem->peerMac), onlineMac);
int32_t ret = strcpy_s(nItem->peerMac, sizeof(nItem->peerMac), onlineMac);
if (ret != EOK) {
SoftBusFree(nItem);
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "strcpy fail");
@ -334,12 +333,11 @@ static int32_t P2pLinkStateTimeOut(P2pLinkMangerState state)
static void TimerPostReuse(ConnectingNode *item)
{
int32_t ret;
P2pLinkAuthId chan = {0};
chan.inAuthId = item->connInfo.authId;
ret = P2pLinkSendReuse(&chan, P2pLinkGetMyMac());
int32_t ret = P2pLinkSendReuse(&chan, P2pLinkGetMyMac());
if (ret != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "P2p Link send reuse fail.");
P2pLinkConningCallback(item, SOFTBUS_ERR, P2PLINK_P2P_SEND_REUSEFAIL);
@ -356,7 +354,6 @@ static void TimerNegoWatingProcess(ConnectingNode *conningDev)
ConnectedNode *connedDev = NULL;
P2pLinkConnectInfo *requestInfo = NULL;
P2pLinkNegoConnInfo negoInfo = {0};
int32_t ret;
if (P2pLinkIsDisconnectState() == true) {
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "p2pLink is disconnecting, retry next time");
@ -382,7 +379,7 @@ static void TimerNegoWatingProcess(ConnectingNode *conningDev)
negoInfo.authId = requestInfo->authId;
negoInfo.requestId = requestInfo->requestId;
negoInfo.expectRole = requestInfo->expectedRole;
ret = strcpy_s(negoInfo.peerMac, sizeof(negoInfo.peerMac), requestInfo->peerMac);
int32_t ret = strcpy_s(negoInfo.peerMac, sizeof(negoInfo.peerMac), requestInfo->peerMac);
if (ret != EOK) {
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "strcpy fail");
return;
@ -468,12 +465,10 @@ static void P2pLinkTimerDevProc(P2pLoopMsg msgType, void *arg)
void P2pLinkAddConningDev(ConnectingNode *item)
{
int32_t ret;
ListAdd(&g_connectingDevices, &item->node);
g_connectingCnt++;
if (g_connectingTimer == 0) {
ret = P2pLoopProcDelay(P2pLinkTimerDevProc, 0, CONNING_TIMER_1S, P2PLOOP_CONNINGDEV_TIMER);
int32_t ret = P2pLoopProcDelay(P2pLinkTimerDevProc, 0, CONNING_TIMER_1S, P2PLOOP_CONNINGDEV_TIMER);
if (ret == SOFTBUS_OK) {
g_connectingTimer = 1;
}

View File

@ -42,12 +42,6 @@
#define AUTH_P2P_KEEP_ALIVE_TIME 10
typedef struct {
int64_t authId;
int32_t pid;
char mac[P2P_MAC_LEN];
} DisConnInfo;
typedef struct {
int64_t authId;
uint32_t requestId;

View File

@ -163,17 +163,6 @@ void P2pLinkDelPidMacRef(int32_t pid, const char *mac)
}
}
int32_t P2pLinGetPidRefCnt(int32_t pid)
{
RefPidItem *pItem = NULL;
pItem = FindPidItem(pid);
if (pItem == NULL) {
return 0;
}
return pItem->refCnt;
}
int32_t P2pLinGetMacRefCnt(int32_t pid, const char *mac)
{
RefPidItem *pItem = NULL;
@ -221,7 +210,6 @@ void DisConnectByPid(int32_t pid)
RefMacItem *mItem = NULL;
RefMacItem *next = NULL;
ConnectedNode *connedItem = NULL;
int32_t ret;
int32_t i;
pItem = FindPidItem(pid);
@ -236,7 +224,7 @@ void DisConnectByPid(int32_t pid)
continue;
}
for (i = 0; i < mItem->refCnt; i++) {
ret = P2pLinkSendDisConnect(&connedItem->chanId, P2pLinkGetMyMac());
int32_t ret = P2pLinkSendDisConnect(&connedItem->chanId, P2pLinkGetMyMac());
if (ret != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "disconnect failed.");
}
@ -286,11 +274,10 @@ void P2pLinkRefClean(void)
void P2pLinkMyP2pRefClean(void)
{
int32_t i;
int32_t ret;
int32_t refCnt = P2pLinkGetMyP2pRef();
for (i = 0; i < refCnt; i++) {
ret = P2pLinkSharelinkRemoveGroup();
int32_t ret = P2pLinkSharelinkRemoveGroup();
if (ret != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "remove failed.");
} else {