mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-12-25 19:18:02 +00:00
!2383 fix:clean warning
Merge pull request !2383 from WANGJINGEN/master
This commit is contained in:
commit
acf6708b0e
@ -87,7 +87,10 @@ typedef void (*HandleMessageFunc)(SoftBusMessage *msg);
|
||||
static inline SoftBusHandler* CreateHandler(SoftBusLooper *looper, HandleMessageFunc callback)
|
||||
{
|
||||
SoftBusHandler *handler = SoftBusMalloc(sizeof(SoftBusHandler));
|
||||
|
||||
if (handler == NULL) {
|
||||
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "create handler failed");
|
||||
return NULL;
|
||||
}
|
||||
handler->looper = looper;
|
||||
handler->name = "statisticEvtReportHandler";
|
||||
handler->HandleMessage = callback;
|
||||
@ -95,9 +98,13 @@ static inline SoftBusHandler* CreateHandler(SoftBusLooper *looper, HandleMessage
|
||||
return handler;
|
||||
}
|
||||
|
||||
static inline SoftBusMessage* CreateMessage(SoftBusLooper *looper, HandleMessageFunc callback)
|
||||
static SoftBusMessage* CreateMessage(SoftBusLooper *looper, HandleMessageFunc callback)
|
||||
{
|
||||
SoftBusMessage* msg = SoftBusMalloc(sizeof(SoftBusMessage));
|
||||
if (msg == NULL) {
|
||||
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "malloc softbus message failed");
|
||||
return NULL;
|
||||
}
|
||||
SoftBusHandler *handler = CreateHandler(looper, callback);
|
||||
|
||||
msg->what = MSG_STATISTIC_EVT_REPORT;
|
||||
|
@ -43,8 +43,7 @@ static int32_t GetTransHeader(char *value, uint32_t len, BleTransHeader *header)
|
||||
header->offset = ntohl(tmpHeader->offset);
|
||||
header->total = ntohl(tmpHeader->total);
|
||||
if ((header->size != len - sizeof(BleTransHeader)) ||
|
||||
(header->total < header->size + header->offset) ||
|
||||
(header->offset < 0) || (header->total > MAX_DATA_LEN)) {
|
||||
(header->total < header->size + header->offset) || (header->total > MAX_DATA_LEN)) {
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
|
@ -145,12 +145,11 @@ int32_t BrTransSend(const BrConnectionInfo *brConnInfo, const SppSocketDriver *s
|
||||
int32_t tempLen = (int32_t)len;
|
||||
while (tempLen > 0) {
|
||||
(void)pthread_mutex_lock(&brConnInfo->lock);
|
||||
while (brConnInfo->conGestState == BT_RFCOM_CONGEST_ON &&
|
||||
if (brConnInfo->conGestState == BT_RFCOM_CONGEST_ON &&
|
||||
(brConnInfo->state == BR_CONNECTION_STATE_CONNECTED || brConnInfo->state == BR_CONNECTION_STATE_CLOSING)) {
|
||||
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "wait congest condition, %d", brConnInfo->connectionId);
|
||||
pthread_cond_wait(&brConnInfo->congestCond, &brConnInfo->lock);
|
||||
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "free congest condition, %d", brConnInfo->connectionId);
|
||||
break;
|
||||
}
|
||||
(void)pthread_mutex_unlock(&brConnInfo->lock);
|
||||
|
||||
|
@ -25,7 +25,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
int32_t P2pLinkMessageInit(void);
|
||||
void P2pLinkMessageDeinit(void);
|
||||
|
||||
int32_t P2pLinkSendMessage(int64_t authId, char *data, uint32_t len);
|
||||
|
||||
|
@ -182,9 +182,4 @@ int32_t P2pLinkMessageInit(void)
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
void P2pLinkMessageDeinit(void)
|
||||
{
|
||||
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_INFO, "p2plink message deinit.");
|
||||
}
|
@ -95,7 +95,6 @@ typedef struct {
|
||||
} P2pLinkNegoCb;
|
||||
|
||||
int32_t P2pLinkNegoInit(const P2pLinkNegoCb *callback);
|
||||
void P2pLinkNegoDeinit(void);
|
||||
|
||||
void P2pLinkNegoStart(const P2pLinkNegoConnInfo *connInfo);
|
||||
void P2pLinkNegoStop(void);
|
||||
|
@ -1096,7 +1096,7 @@ static void OnGroupConnectSuccess(bool isNeedDhcp)
|
||||
}
|
||||
|
||||
if (g_p2pLinkNegoFsm.linkInfo.requestId == 0) {
|
||||
int32_t ret = PostConnResponse(g_p2pLinkNegoFsm.linkInfo.authId, CONTENT_TYPE_RESULT, SOFTBUS_OK);
|
||||
ret = PostConnResponse(g_p2pLinkNegoFsm.linkInfo.authId, CONTENT_TYPE_RESULT, SOFTBUS_OK);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "fail to post connect success response, ret = %d.", ret);
|
||||
P2pLinkRemoveGcGroup();
|
||||
@ -1411,14 +1411,4 @@ int32_t P2pLinkNegoInit(const P2pLinkNegoCb *callback)
|
||||
P2pLinkFsmStart(g_p2pLinkNegoFsm.fsm, g_p2pLinkNegoState + P2PLINK_NEG_IDLE);
|
||||
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
void P2pLinkNegoDeinit(void)
|
||||
{
|
||||
(void)memset_s(&g_p2pLinkNegoCb, sizeof(P2pLinkNegoCb), 0, sizeof(P2pLinkNegoCb));
|
||||
if (g_p2pLinkNegoFsm.fsm != NULL) {
|
||||
P2pLinkFsmDeinit(g_p2pLinkNegoFsm.fsm);
|
||||
SoftBusFree(g_p2pLinkNegoFsm.fsm);
|
||||
}
|
||||
(void)memset_s(&g_p2pLinkNegoFsm, sizeof(P2pLinkNegoFsm), 0, sizeof(P2pLinkNegoFsm));
|
||||
}
|
@ -49,13 +49,11 @@ typedef struct {
|
||||
|
||||
bool CheckBitMapEmpty(uint32_t capBitMapNum, const uint32_t *capBitMap);
|
||||
bool CheckCapBitMapExist(uint32_t capBitMapNum, const uint32_t *capBitMap, uint32_t pos);
|
||||
bool CheckCapBitMapEqual(const uint32_t *srcBitMap, const uint32_t *dstBitMap, uint32_t capBitMapNum);
|
||||
void SetCapBitMapPos(uint32_t capBitMapNum, uint32_t *capBitMap, uint32_t pos);
|
||||
void UnsetCapBitMapPos(uint32_t capBitMapNum, uint32_t *capBitMap, uint32_t pos);
|
||||
|
||||
int32_t DiscBleGetDeviceUdid(char *udid, uint32_t len);
|
||||
int32_t DiscBleGetDeviceName(char *deviceName);
|
||||
int32_t DiscBleGetHwAccount(char *hwAccount);
|
||||
uint8_t DiscBleGetDeviceType(void);
|
||||
int32_t DiscBleGetDeviceIdHash(unsigned char *hashStr);
|
||||
int32_t DiscBleGetShortUserIdHash(unsigned char *hashStr, uint32_t len);
|
||||
|
@ -483,7 +483,6 @@ static void ProcessDistributePacket(const SoftBusBleScanResult *scanResultData)
|
||||
|
||||
static void BleScanResultCallback(int listenerId, const SoftBusBleScanResult *scanResultData)
|
||||
{
|
||||
unsigned char distinguish[] = "ble rcv";
|
||||
(void)listenerId;
|
||||
if (scanResultData == NULL) {
|
||||
SoftBusLog(SOFTBUS_LOG_DISC, SOFTBUS_LOG_ERROR, "scanResultData is NULL");
|
||||
@ -497,6 +496,7 @@ static void BleScanResultCallback(int listenerId, const SoftBusBleScanResult *sc
|
||||
return;
|
||||
}
|
||||
if ((advData[POS_BUSINESS + ADV_HEAD_LEN] & DISTRIBUTE_BUSINESS) == DISTRIBUTE_BUSINESS) {
|
||||
unsigned char distinguish[] = "ble rcv";
|
||||
SignalingMsgPrint(distinguish, advData, scanResultData->advLen, SOFTBUS_LOG_DISC);
|
||||
ProcessDistributePacket(scanResultData);
|
||||
} else if ((advData[POS_BUSINESS + ADV_HEAD_LEN] & NEARBY_BUSINESS) == NEARBY_BUSINESS) {
|
||||
@ -575,16 +575,6 @@ static int32_t GetMaxExchangeFreq(void)
|
||||
return maxFreq;
|
||||
}
|
||||
|
||||
bool GetSameAccount(void)
|
||||
{
|
||||
for (uint32_t index = 0; index < CAPABILITY_MAX_BITNUM; index++) {
|
||||
if (g_bleInfoManager[BLE_SUBSCRIBE | BLE_ACTIVE].isSameAccount[index]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool GetWakeRemote(void)
|
||||
{
|
||||
for (uint32_t index = 0; index < CAPABILITY_MAX_BITNUM; index++) {
|
||||
|
@ -75,19 +75,6 @@ bool CheckCapBitMapExist(uint32_t capBitMapNum, const uint32_t *capBitMap, uint3
|
||||
return (capBitMap[index] >> (pos % INT32_MAX_BIT_NUM)) & 0x1 ? true : false;
|
||||
}
|
||||
|
||||
bool CheckCapBitMapEqual(const uint32_t *srcBitMap, const uint32_t *dstBitMap, uint32_t capBitMapNum)
|
||||
{
|
||||
if (srcBitMap == NULL || dstBitMap == NULL) {
|
||||
return false;
|
||||
}
|
||||
for (uint32_t i = 0; i < capBitMapNum; i++) {
|
||||
if (srcBitMap[i] != dstBitMap[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetCapBitMapPos(uint32_t capBitMapNum, uint32_t *capBitMap, uint32_t pos)
|
||||
{
|
||||
if (capBitMap == NULL) {
|
||||
@ -113,18 +100,6 @@ void UnsetCapBitMapPos(uint32_t capBitMapNum, uint32_t *capBitMap, uint32_t pos)
|
||||
capBitMap[index] = capBitMap[index] & mask;
|
||||
}
|
||||
|
||||
int32_t DiscBleGetHwAccount(char *hwAccount)
|
||||
{
|
||||
if (hwAccount == NULL) {
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
const char *account = "";
|
||||
if (memcpy_s(hwAccount, strlen(account) + 1, account, strlen(account) + 1) != EOK) {
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
int32_t DiscBleGetDeviceUdid(char *udid, uint32_t len)
|
||||
{
|
||||
if (udid == NULL) {
|
||||
|
@ -1181,7 +1181,7 @@ static void DiscMgrInfoListDeinit(SoftBusList *itemList, const ServiceType type,
|
||||
continue;
|
||||
}
|
||||
LIST_FOR_EACH_ENTRY_SAFE(infoNode, infoNodeNext, &itemNode->InfoList, DiscInfo, node) {
|
||||
IdContainer *container = CreateIdContainer(infoNode->id, itemNode->packageName);
|
||||
container = CreateIdContainer(infoNode->id, itemNode->packageName);
|
||||
if (container == NULL) {
|
||||
SoftBusLog(SOFTBUS_LOG_DISC, SOFTBUS_LOG_ERROR, "CreateIdContainer failed");
|
||||
goto CLEANUP;
|
||||
|
@ -54,7 +54,7 @@ void PublishServiceTest(const uint8_t* data, size_t size)
|
||||
.dataLen = sizeof("capdata2")
|
||||
};
|
||||
|
||||
if ((data == nullptr) || (size <= 0)) {
|
||||
if ((data == nullptr) || (size == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ void StartDiscoveryTest(const uint8_t* data, size_t size)
|
||||
.dataLen = sizeof("capdata3")
|
||||
};
|
||||
|
||||
if ((data == nullptr) || (size <= 0)) {
|
||||
if ((data == nullptr) || (size == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ void StopDiscoveryTest(const uint8_t* data, size_t size)
|
||||
.dataLen = sizeof("capdata3")
|
||||
};
|
||||
|
||||
if ((data == nullptr) || (size <= 0)) {
|
||||
if ((data == nullptr) || (size == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ void UnPublishServiceTest(const uint8_t* data, size_t size)
|
||||
.dataLen = sizeof("capdata2")
|
||||
};
|
||||
|
||||
if ((data == nullptr) || (size <= 0)) {
|
||||
if ((data == nullptr) || (size == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user