fix:Modify code static scan alarm

Signed-off-by: 姚望 <yaopwang@huawei.com>
This commit is contained in:
姚望 2024-03-14 20:42:48 +08:00
parent 0019f8adae
commit f0b9a650ab
9 changed files with 13 additions and 12 deletions

View File

@ -379,7 +379,7 @@ static int32_t OpensslAesGcmDecrypt(
return SOFTBUS_MEM_ERR;
}
if (EVP_CIPHER_CTX_ctrl(
ctx, EVP_CTRL_GCM_SET_TAG, AES_GCM_TAG_LEN, (void *)(srcData + (srcDataLen - AES_GCM_TAG_LEN))) != 1) {
ctx, EVP_CTRL_GCM_SET_TAG, AES_GCM_TAG_LEN, (void *)(srcData + (srcDataLen - AES_GCM_TAG_LEN))) != 1) {
COMM_LOGE(COMM_ADAPTER, "EVP_CTRL_GCM_SET_TAG failed.");
EVP_CIPHER_CTX_free(ctx);
return SOFTBUS_ERR;

View File

@ -566,7 +566,7 @@ int32_t SoftbusRecordConnResult(uint32_t pId, SoftBusConnType connType, SoftBusC
SoftBusMutexUnlock(&g_connResApiLock);
errCode = GetErrorCodeEx(errCode);
COMM_CHECK_AND_RETURN_RET_LOGE(SoftbusReportConnFault(connType, errCode, pkgName) == SOFTBUS_OK, SOFTBUS_ERR,
COMM_EVENT, "report conn fault event fail!");
COMM_EVENT, "report conn fault event fail!");
return SOFTBUS_OK;
}
@ -580,7 +580,7 @@ int32_t SoftbusRecordProccessDuration(uint32_t pId, SoftBusConnType connType, So
}
SoftbusRecordConnResult(pId, connType, status, stepTime->totalTime, errCode);
COMM_CHECK_AND_RETURN_RET_LOGE(SoftBusMutexLock(&g_procStepLock) == SOFTBUS_OK, SOFTBUS_ERR, COMM_EVENT,
"record g_procStepLock fail");
"record g_procStepLock fail");
for (ProcessStep i = NEGOTIATION_STEP; i < STEP_BUTT; i++) {
uint64_t costTime = stepTime->connGroupTime;
switch (i) {
@ -625,7 +625,7 @@ static int32_t InitConnEvtMutexLock(void)
{
SoftBusMutexAttr mutexAttr = {SOFTBUS_MUTEX_RECURSIVE};
COMM_CHECK_AND_RETURN_RET_LOGE(SoftBusMutexInit(&g_pIdOfNameLock, &mutexAttr) == SOFTBUS_OK, SOFTBUS_ERR,
COMM_EVENT, "init pId of name lock fail");
COMM_EVENT, "init pId of name lock fail");
int32_t nRet = SoftBusMutexInit(&g_connResApiLock, &mutexAttr);
if (nRet != SOFTBUS_OK) {
COMM_LOGE(COMM_EVENT, "init conn res api lock fail");

View File

@ -501,7 +501,7 @@ int32_t SoftbusRecordDiscBleRssi(int32_t rssi)
return SOFTBUS_INVALID_PARAM;
}
COMM_CHECK_AND_RETURN_RET_LOGE(SoftBusMutexLock(&g_bleRssiRangeLock) == SOFTBUS_OK, SOFTBUS_LOCK_ERR, COMM_EVENT,
"ble rssi range lock fail");
"ble rssi range lock fail");
size_t rangeId = (MAX_RANGE_ID - rssi) / INTERVAL_OF_RSSI;
g_bleRssiRangeId[rangeId] = rangeId;
@ -523,7 +523,7 @@ static int32_t InitDiscEvtMutexLock(void)
{
SoftBusMutexAttr mutexAttr = {SOFTBUS_MUTEX_RECURSIVE};
COMM_CHECK_AND_RETURN_RET_LOGE(SoftBusMutexInit(&g_discDetailLock, &mutexAttr) == SOFTBUS_OK, SOFTBUS_ERR,
COMM_EVENT, "init disc detail lock fail");
COMM_EVENT, "init disc detail lock fail");
int32_t nRet = SoftBusMutexInit(&g_bleRssiRangeLock, &mutexAttr);
if (nRet != SOFTBUS_OK) {
COMM_LOGE(COMM_EVENT, "init ble rssi range lock fail");

View File

@ -57,7 +57,8 @@ extern "C" {
* @param addrInfo Indicates the pointer to the address information for the connection between devices.
* @param num Indicates the number of device connection records.
* @param mixAddr Indicates the pointer to the connection address information.
* If the address information passed by <b>addrInfo</b> is invalid, this parameter can be used to obtain the connection information.
* If the address information passed by <b>addrInfo</b> is invalid,
* this parameter can be used to obtain the connection information.
*
* @return Returns <b>SOFTBUS_INVALID_PARAM</b> if invalid parameters are detected.
* @return Returns <b>INVALID_SESSION_ID</b> if the session ID is invalid.

View File

@ -350,7 +350,7 @@ static int IsValidAddrInfoArr(const ConnectionAddr *addrInfo, int num)
int32_t wifiIndex = -1;
int32_t brIndex = -1;
int32_t bleIndex = -1;
for (int32_t index = 0; index < num; index++) {
for (int32_t index = 0; num > index; index++) {
if ((addrInfo[index].type == CONNECTION_ADDR_ETH || addrInfo[index].type == CONNECTION_ADDR_WLAN) &&
wifiIndex < 0) {
wifiIndex = index;

View File

@ -27,7 +27,7 @@ namespace SoftBus {
class RawStreamData : public IStream {
public:
RawStreamData() = default;
virtual ~RawStreamData() override = default;
~RawStreamData() override = default;
static constexpr int BYTE_TO_BIT = 8;
static constexpr int INT_TO_BYTE = 0xff;
static constexpr int FRAME_HEADER_LEN = 4;

View File

@ -32,7 +32,7 @@ public:
StreamCommonData() = default;
StreamCommonData(uint32_t streamId, uint16_t seq, const StreamFrameInfo& frameInfo);
virtual ~StreamCommonData() override = default;
~StreamCommonData() override = default;
// 应用调用生成流数据。
int InitStreamData(std::unique_ptr<char[]> inputBuf, ssize_t bufSize, std::unique_ptr<char[]> inputExt,

View File

@ -38,7 +38,7 @@ public:
explicit StreamSocketListener(std::shared_ptr<IStreamManagerListener> streamListener)
: listener_(streamListener) {}
StreamSocketListener() = delete;
virtual ~StreamSocketListener() override= default;
~StreamSocketListener() override = default;
void OnStreamReceived(std::unique_ptr<IStream> stream) override
{
listener_->OnStreamReceived(std::move(stream));

View File

@ -27,7 +27,7 @@ namespace SoftBus {
class StreamMsgManager : public std::enable_shared_from_this<StreamMsgManager>, public IStreamMsgManager {
public:
StreamMsgManager() = default;
virtual ~StreamMsgManager() override= default;
~StreamMsgManager() override = default;
bool Send(const HistoryStats &stats);
void Recv(const HistoryStats &stats);