!7828 fix:replace the int by int32_t in test files

Merge pull request !7828 from vb6174/master
This commit is contained in:
openharmony_ci 2024-09-23 02:26:30 +00:00 committed by Gitee
commit 6b5d68ef89
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
345 changed files with 1978 additions and 1955 deletions

View File

@ -33,13 +33,13 @@ public:
this->identifier = identifier;
}
bool Update(int idParam)
bool Update(int32_t idParam)
{
this->id = idParam;
return true;
}
testing::AssertionResult Expect(int idParam)
testing::AssertionResult Expect(int32_t idParam)
{
testing::AssertionResult result = testing::AssertionSuccess();
if (this->id != idParam) {
@ -53,14 +53,14 @@ protected:
// static c string
const char *identifier;
private:
int id;
int32_t id;
};
class StRecordCtx : public RecordCtx {
public:
explicit StRecordCtx(const char *identifier) : RecordCtx(identifier), st(-1) {}
bool Update(int id, int stParam)
bool Update(int32_t id, int32_t stParam)
{
if (!RecordCtx::Update(id)) {
return false;
@ -69,7 +69,7 @@ public:
return true;
}
testing::AssertionResult Expect(int id, int stParam)
testing::AssertionResult Expect(int32_t id, int32_t stParam)
{
auto result = RecordCtx::Expect(id);
if (!result) {
@ -86,7 +86,7 @@ public:
return result;
}
private:
int st;
int32_t st;
};
class BtAddrRecordCtx : public StRecordCtx {
@ -96,7 +96,7 @@ public:
Reset();
}
bool Update(int id, const SoftBusBtAddr *addr, int st = 0)
bool Update(int32_t id, const SoftBusBtAddr *addr, int32_t st = 0)
{
if (!StRecordCtx::Update(id, st)) {
return false;
@ -105,7 +105,7 @@ public:
return true;
}
testing::AssertionResult Expect(int id, SoftBusBtAddr *addrParam, int st = 0)
testing::AssertionResult Expect(int32_t id, SoftBusBtAddr *addrParam, int32_t st = 0)
{
auto result = StRecordCtx::Expect(id, st);
if (!result) {
@ -132,7 +132,7 @@ class IntRecordCtx : public StRecordCtx {
public:
explicit IntRecordCtx(const char *identifier) : StRecordCtx(identifier), val(-1) {}
bool Update(int id, int st, int valParam)
bool Update(int32_t id, int32_t st, int32_t valParam)
{
if (!StRecordCtx::Update(id, st)) {
return false;
@ -141,14 +141,14 @@ public:
return true;
}
testing::AssertionResult Expect(int id, int st, int valParam)
testing::AssertionResult Expect(int32_t id, int32_t st, int32_t valParam)
{
auto result = StRecordCtx::Expect(id, st);
if (!result) {
goto ClEANUP;
}
if (this->val != valParam) {
result = testing::AssertionFailure() << identifier << " is call by unexpectedly int value,"
result = testing::AssertionFailure() << identifier << " is call by unexpectedly int32_t value,"
<< "want: " << valParam << ", actual: " << this->val;
} else {
result = testing::AssertionSuccess();
@ -158,7 +158,7 @@ public:
return result;
}
private:
int val;
int32_t val;
};
#endif

View File

@ -26,13 +26,13 @@ BtGapCallBacks *MockBluetooth::btGapCallback = nullptr;
BtGattCallbacks *MockBluetooth::btGattCallback = nullptr;
BleScanCallbacks *MockBluetooth::bleScanCallback = nullptr;
static int ActionGapRegisterCallbacks(BtGapCallBacks *func)
static int32_t ActionGapRegisterCallbacks(BtGapCallBacks *func)
{
MockBluetooth::btGapCallback = func;
return OHOS_BT_STATUS_SUCCESS;
}
static int ActionBleGattRegisterCallbacks(BtGattCallbacks *func)
static int32_t ActionBleGattRegisterCallbacks(BtGattCallbacks *func)
{
MockBluetooth::btGattCallback = func;
return OHOS_BT_STATUS_SUCCESS;
@ -81,160 +81,161 @@ bool SetLocalName(unsigned char *localName, unsigned char length)
return MockBluetooth::GetMocker()->SetLocalName(localName, length);
}
int GapRegisterCallbacks(BtGapCallBacks *func)
int32_t GapRegisterCallbacks(BtGapCallBacks *func)
{
return MockBluetooth::GetMocker()->GapRegisterCallbacks(func);
}
bool PairRequestReply(const BdAddr *bdAddr, int transport, bool accept)
bool PairRequestReply(const BdAddr *bdAddr, int32_t transport, bool accept)
{
return MockBluetooth::GetMocker()->PairRequestReply(bdAddr, transport, accept);
}
bool SetDevicePairingConfirmation(const BdAddr *bdAddr, int transport, bool accept)
bool SetDevicePairingConfirmation(const BdAddr *bdAddr, int32_t transport, bool accept)
{
return MockBluetooth::GetMocker()->SetDevicePairingConfirmation(bdAddr, transport, accept);
}
int BleGattRegisterCallbacks(BtGattCallbacks *func)
int32_t BleGattRegisterCallbacks(BtGattCallbacks *func)
{
return MockBluetooth::GetMocker()->BleGattRegisterCallbacks(func);
}
int BleStartScanEx(int scannerId, BleScanConfigs *configs, BleScanNativeFilter *filter, unsigned int filterSize)
int32_t BleStartScanEx(int32_t scannerId, BleScanConfigs *configs, BleScanNativeFilter *filter, unsigned int filterSize)
{
return MockBluetooth::GetMocker()->BleStartScanEx(scannerId, configs, filter, filterSize);
}
int BleStopScan(int scannerId)
int32_t BleStopScan(int32_t scannerId)
{
return MockBluetooth::GetMocker()->BleStopScan(scannerId);
}
int BleStartAdvEx(int *advId, const StartAdvRawData rawData, BleAdvParams advParam)
int32_t BleStartAdvEx(int32_t *advId, const StartAdvRawData rawData, BleAdvParams advParam)
{
return MockBluetooth::GetMocker()->BleStartAdvEx(advId, rawData, advParam);
}
int BleStopAdv(int advId)
int32_t BleStopAdv(int32_t advId)
{
return MockBluetooth::GetMocker()->BleStopAdv(advId);
}
int BleGattcRegister(BtUuid appUuid)
int32_t BleGattcRegister(BtUuid appUuid)
{
return MockBluetooth::GetMocker()->BleGattcRegister(appUuid);
}
int BleGattcConnect(
int clientId, BtGattClientCallbacks *func, const BdAddr *bdAddr, bool isAutoConnect, BtTransportType transport)
int32_t BleGattcConnect(
int32_t clientId, BtGattClientCallbacks *func, const BdAddr *bdAddr, bool isAutoConnect, BtTransportType transport)
{
return MockBluetooth::GetMocker()->BleGattcConnect(clientId, func, bdAddr, isAutoConnect, transport);
}
int BleGattcDisconnect(int clientId)
int32_t BleGattcDisconnect(int32_t clientId)
{
return MockBluetooth::GetMocker()->BleGattcDisconnect(clientId);
}
int BleGattcSearchServices(int clientId)
int32_t BleGattcSearchServices(int32_t clientId)
{
return MockBluetooth::GetMocker()->BleGattcSearchServices(clientId);
}
bool BleGattcGetService(int clientId, BtUuid serviceUuid)
bool BleGattcGetService(int32_t clientId, BtUuid serviceUuid)
{
return MockBluetooth::GetMocker()->BleGattcGetService(clientId, serviceUuid);
}
int BleGattcRegisterNotification(int clientId, BtGattCharacteristic characteristic, bool enable)
int32_t BleGattcRegisterNotification(int32_t clientId, BtGattCharacteristic characteristic, bool enable)
{
return MockBluetooth::GetMocker()->BleGattcRegisterNotification(clientId, characteristic, enable);
}
int BleGattcConfigureMtuSize(int clientId, int mtuSize)
int32_t BleGattcConfigureMtuSize(int32_t clientId, int32_t mtuSize)
{
return MockBluetooth::GetMocker()->BleGattcConfigureMtuSize(clientId, mtuSize);
}
int BleGattcWriteCharacteristic(
int clientId, BtGattCharacteristic characteristic, BtGattWriteType writeType, int len, const char *value)
int32_t BleGattcWriteCharacteristic(
int32_t clientId, BtGattCharacteristic characteristic, BtGattWriteType writeType, int32_t len, const char *value)
{
return MockBluetooth::GetMocker()->BleGattcWriteCharacteristic(clientId, characteristic, writeType, len, value);
}
int BleGattcUnRegister(int clientId)
int32_t BleGattcUnRegister(int32_t clientId)
{
return MockBluetooth::GetMocker()->BleGattcUnRegister(clientId);
}
int BleGattcSetFastestConn(int clientId, bool fastestConnFlag)
int32_t BleGattcSetFastestConn(int32_t clientId, bool fastestConnFlag)
{
return MockBluetooth::GetMocker()->BleGattcSetFastestConn(clientId, fastestConnFlag);
}
int BleGattcSetPriority(int clientId, const BdAddr *bdAddr, BtGattPriority priority)
int32_t BleGattcSetPriority(int32_t clientId, const BdAddr *bdAddr, BtGattPriority priority)
{
return MockBluetooth::GetMocker()->BleGattcSetPriority(clientId, bdAddr, priority);
}
int BleGattsRegisterCallbacks(BtGattServerCallbacks *func)
int32_t BleGattsRegisterCallbacks(BtGattServerCallbacks *func)
{
return MockBluetooth::GetMocker()->BleGattsRegisterCallbacks(func);
}
int BleGattsRegister(BtUuid appUuid)
int32_t BleGattsRegister(BtUuid appUuid)
{
return MockBluetooth::GetMocker()->BleGattsRegister(appUuid);
}
int BleGattsAddService(int serverId, BtUuid srvcUuid, bool isPrimary, int number)
int32_t BleGattsAddService(int32_t serverId, BtUuid srvcUuid, bool isPrimary, int32_t number)
{
return MockBluetooth::GetMocker()->BleGattsAddService(serverId, srvcUuid, isPrimary, number);
}
int BleGattsUnRegister(int serverId)
int32_t BleGattsUnRegister(int32_t serverId)
{
return MockBluetooth::GetMocker()->BleGattsUnRegister(serverId);
}
int BleGattsAddCharacteristic(int serverId, int srvcHandle, BtUuid characUuid, int properties, int permissions)
int32_t BleGattsAddCharacteristic(int32_t serverId, int32_t srvcHandle,
BtUuid characUuid, int32_t properties, int32_t permissions)
{
return MockBluetooth::GetMocker()->BleGattsAddCharacteristic(
serverId, srvcHandle, characUuid, properties, permissions);
}
int BleGattsAddDescriptor(int serverId, int srvcHandle, BtUuid descUuid, int permissions)
int32_t BleGattsAddDescriptor(int32_t serverId, int32_t srvcHandle, BtUuid descUuid, int32_t permissions)
{
return MockBluetooth::GetMocker()->BleGattsAddDescriptor(serverId, srvcHandle, descUuid, permissions);
}
int BleGattsStartService(int serverId, int srvcHandle)
int32_t BleGattsStartService(int32_t serverId, int32_t srvcHandle)
{
return MockBluetooth::GetMocker()->BleGattsStartService(serverId, srvcHandle);
}
int BleGattsStopService(int serverId, int srvcHandle)
int32_t BleGattsStopService(int32_t serverId, int32_t srvcHandle)
{
return MockBluetooth::GetMocker()->BleGattsStopService(serverId, srvcHandle);
}
int BleGattsDeleteService(int serverId, int srvcHandle)
int32_t BleGattsDeleteService(int32_t serverId, int32_t srvcHandle)
{
return MockBluetooth::GetMocker()->BleGattsDeleteService(serverId, srvcHandle);
}
int BleGattsDisconnect(int serverId, BdAddr bdAddr, int connId)
int32_t BleGattsDisconnect(int32_t serverId, BdAddr bdAddr, int32_t connId)
{
return MockBluetooth::GetMocker()->BleGattsDisconnect(serverId, bdAddr, connId);
}
int BleGattsSendResponse(int serverId, GattsSendRspParam *param)
int32_t BleGattsSendResponse(int32_t serverId, GattsSendRspParam *param)
{
return MockBluetooth::GetMocker()->BleGattsSendResponse(serverId, param);
}
int BleGattsSendIndication(int serverId, GattsSendIndParam *param)
int32_t BleGattsSendIndication(int32_t serverId, GattsSendIndParam *param)
{
return MockBluetooth::GetMocker()->BleGattsSendIndication(serverId, param);
}
}

View File

@ -26,12 +26,12 @@ static int32_t g_advId = 0;
static int32_t g_listenerId = 0;
static void ActionOfSoftbusBleAdapterInit(void);
int ActionOfSoftBusAddBtStateListener(const SoftBusBtStateListener *listener)
int32_t ActionOfSoftBusAddBtStateListener(const SoftBusBtStateListener *listener)
{
return SOFTBUS_OK;
}
int ActionOfSoftBusRemoveBtStateListener(int listenerId)
int32_t ActionOfSoftBusRemoveBtStateListener(int32_t listenerId)
{
return SOFTBUS_OK;
}
@ -69,12 +69,12 @@ static int32_t MockDeInit(void)
return SOFTBUS_OK;
}
int SoftBusAddBtStateListener(const SoftBusBtStateListener *listener)
int32_t SoftBusAddBtStateListener(const SoftBusBtStateListener *listener)
{
return ManagerMock::GetMock()->SoftBusAddBtStateListener(listener);
}
int SoftBusRemoveBtStateListener(int listenerId)
int32_t SoftBusRemoveBtStateListener(int32_t listenerId)
{
return ManagerMock::GetMock()->SoftBusRemoveBtStateListener(listenerId);
}

View File

@ -26,8 +26,8 @@
class BleGattInterface {
public:
virtual void SoftbusBleAdapterInit() = 0;
virtual int SoftBusAddBtStateListener(const SoftBusBtStateListener *listener) = 0;
virtual int SoftBusRemoveBtStateListener(int listenerId) = 0;
virtual int32_t SoftBusAddBtStateListener(const SoftBusBtStateListener *listener) = 0;
virtual int32_t SoftBusRemoveBtStateListener(int32_t listenerId) = 0;
};
class ManagerMock : public BleGattInterface {
@ -39,7 +39,7 @@ public:
MOCK_METHOD(void, SoftbusBleAdapterInit, (), (override));
MOCK_METHOD(int, SoftBusAddBtStateListener, (const SoftBusBtStateListener *listener), (override));
MOCK_METHOD(int, SoftBusRemoveBtStateListener, (int listenerId), (override));
MOCK_METHOD(int, SoftBusRemoveBtStateListener, (int32_t listenerId), (override));
static const SoftbusBroadcastCallback *broadcastCallback;
static const SoftbusScanCallback *scanCallback;

View File

@ -99,7 +99,7 @@ static BcScanFilter *GetBcScanFilter(void)
{
unsigned char serviceData[] = {0x04, 0x05, 0x90};
unsigned char serviceDataMask[] = {0xFF, 0xFF, 0xFF};
int serviceDataLength = sizeof(serviceData);
int32_t serviceDataLength = sizeof(serviceData);
BcScanFilter *filter = static_cast<BcScanFilter *>(SoftBusCalloc(sizeof(BcScanFilter)));
DISC_CHECK_AND_RETURN_RET_LOGW(filter != nullptr, nullptr, DISC_TEST, "malloc filter failed");
@ -128,41 +128,41 @@ EXIT:
return nullptr;
}
static void BleBcEnableCallback(int channel, int status)
static void BleBcEnableCallback(int32_t channel, int32_t status)
{
DISC_LOGI(DISC_TEST, "channel=%{public}d, status=%{public}d", channel, status);
}
static void BleBcDisableCallback(int channel, int status)
static void BleBcDisableCallback(int32_t channel, int32_t status)
{
DISC_LOGI(DISC_TEST, "channel=%{public}d, status=%{public}d", channel, status);
}
static void BleBcUpdateCallback(int channel, int status)
static void BleBcUpdateCallback(int32_t channel, int32_t status)
{
DISC_LOGI(DISC_TEST, "channel=%{public}d, status=%{public}d", channel, status);
}
static void BleBcDataCallback(int channel, int status)
static void BleBcDataCallback(int32_t channel, int32_t status)
{
DISC_LOGI(DISC_TEST, "channel=%{public}d, status=%{public}d", channel, status);
}
static void BleOnScanStart(int listenerId, int status)
static void BleOnScanStart(int32_t listenerId, int32_t status)
{
(void)listenerId;
(void)status;
DISC_LOGI(DISC_TEST, "BleOnScanStart");
}
static void BleOnScanStop(int listenerId, int status)
static void BleOnScanStop(int32_t listenerId, int32_t status)
{
(void)listenerId;
(void)status;
DISC_LOGI(DISC_TEST, "BleOnScanStop");
}
static void BleScanResultCallback(int listenerId, const BroadcastReportInfo *reportInfo)
static void BleScanResultCallback(int32_t listenerId, const BroadcastReportInfo *reportInfo)
{
(void)listenerId;
}

View File

@ -41,8 +41,8 @@ public:
Reset();
}
bool Update(int id, int st, SoftBusGattcNotify *param);
testing::AssertionResult Expect(int id, int st, SoftBusGattcNotify *param);
bool Update(int32_t id, int32_t st, SoftBusGattcNotify *param);
testing::AssertionResult Expect(int32_t id, int32_t st, SoftBusGattcNotify *param);
private:
SoftBusGattcNotify notify;
void Reset();
@ -61,15 +61,15 @@ public:
static SoftBusGattcCallback *GetStubGattcCallback();
int ActionBleGattcRegister(BtUuid appUuid)
int32_t ActionBleGattcRegister(BtUuid appUuid)
{
(void)appUuid;
static int idGenerator = 0;
static int32_t idGenerator = 0;
return ++idGenerator;
}
int ActionBleGattcConnect(
int clientId, BtGattClientCallbacks *func, const BdAddr *bdAddr, bool isAutoConnect, BtTransportType transport)
int32_t ActionBleGattcConnect(
int32_t clientId, BtGattClientCallbacks *func, const BdAddr *bdAddr, bool isAutoConnect, BtTransportType transport)
{
(void)clientId;
(void)bdAddr;
@ -352,7 +352,7 @@ HWTEST_F(AdapterBleGattClientTest, GattClientConnectCycle1, TestSize.Level3)
gattClientCallback->registerNotificationCb(clientId, OHOS_BT_STATUS_SUCCESS);
ASSERT_TRUE(registNotificationCtx.Expect(clientId, OHOS_BT_STATUS_SUCCESS));
int mtu = 512;
int32_t mtu = 512;
ASSERT_EQ(SoftbusGattcConfigureMtuSize(clientId, mtu), SOFTBUS_OK);
gattClientCallback->configureMtuSizeCb(clientId, mtu, OHOS_BT_STATUS_SUCCESS);
ASSERT_TRUE(configureMtuSizeCtx.Expect(clientId, OHOS_BT_STATUS_SUCCESS, mtu));
@ -476,7 +476,7 @@ void GattcNotifyRecordCtx::Reset()
(void)memset_s(&notify, sizeof(SoftBusGattcNotify), 0, sizeof(SoftBusGattcNotify));
}
bool GattcNotifyRecordCtx::Update(int id, int st, SoftBusGattcNotify *param)
bool GattcNotifyRecordCtx::Update(int32_t id, int32_t st, SoftBusGattcNotify *param)
{
if (!StRecordCtx::Update(id, st)) {
return false;
@ -503,7 +503,7 @@ bool GattcNotifyRecordCtx::Update(int id, int st, SoftBusGattcNotify *param)
return true;
}
testing::AssertionResult GattcNotifyRecordCtx::Expect(int id, int st, SoftBusGattcNotify *param)
testing::AssertionResult GattcNotifyRecordCtx::Expect(int32_t id, int32_t st, SoftBusGattcNotify *param)
{
auto result = StRecordCtx::Expect(id, st);
if (!result) {
@ -543,7 +543,7 @@ void StubServiceCompleteCallback(int32_t clientId, int32_t status)
AdapterBleGattClientTest::serviceCompleteStateCtx.Update(clientId, status);
}
void StubRegistNotificationCallback(int32_t clientId, int status)
void StubRegistNotificationCallback(int32_t clientId, int32_t status)
{
AdapterBleGattClientTest::registNotificationCtx.Update(clientId, status);
}
@ -553,7 +553,7 @@ void StubNotificationReceiveCallback(int32_t clientId, SoftBusGattcNotify *param
AdapterBleGattClientTest::notificationReceiveCtx.Update(clientId, status, param);
}
void StubConfigureMtuSizeCallback(int clientId, int mtuSize, int status)
void StubConfigureMtuSizeCallback(int32_t clientId, int32_t mtuSize, int32_t status)
{
AdapterBleGattClientTest::configureMtuSizeCtx.Update(clientId, status, mtuSize);
}

View File

@ -38,8 +38,8 @@ class BtUuidRecordCtx : public StRecordCtx {
public:
explicit BtUuidRecordCtx(const char *identifier);
~BtUuidRecordCtx();
bool Update(int id, int st, SoftBusBtUuid *param);
testing::AssertionResult Expect(int id, int st, SoftBusBtUuid *param);
bool Update(int32_t id, int32_t st, SoftBusBtUuid *param);
testing::AssertionResult Expect(int32_t id, int32_t st, SoftBusBtUuid *param);
private:
SoftBusBtUuid uuid;
void Reset();
@ -48,10 +48,10 @@ private:
class BtGattRecordCtx : public BtUuidRecordCtx {
public:
explicit BtGattRecordCtx(const char *identifier);
bool Update(int id, int st, int handle, SoftBusBtUuid *param);
testing::AssertionResult Expect(int id, int st, int handle, SoftBusBtUuid *param);
bool Update(int32_t id, int32_t st, int32_t handle, SoftBusBtUuid *param);
testing::AssertionResult Expect(int32_t id, int32_t st, int32_t handle, SoftBusBtUuid *param);
private:
int handle;
int32_t handle;
};
class AdapterBleGattServerTest : public testing::Test {
@ -76,14 +76,14 @@ static SoftBusGattsCallback *GetStubGattsCallback();
static testing::AssertionResult ExpectGattReadRequest(SoftBusGattReadRequest actual, SoftBusGattReadRequest want);
static testing::AssertionResult ExpectGattWriteRequest(SoftBusGattWriteRequest actual, SoftBusGattWriteRequest want);
int ActionBleGattsRegisterCallbacks(BtGattServerCallbacks *func)
int32_t ActionBleGattsRegisterCallbacks(BtGattServerCallbacks *func)
{
AdapterBleGattServerTest::gattServerCallback = func;
return OHOS_BT_STATUS_SUCCESS;
}
// 回绕到注册通知中
int ActionBleGattsRegister(BtUuid appUuid)
int32_t ActionBleGattsRegister(BtUuid appUuid)
{
AdapterBleGattServerTest::gattServerCallback->registerServerCb(0, MOCK_GATT_SERVER_HANDLE, &appUuid);
return OHOS_BT_STATUS_SUCCESS;
@ -218,10 +218,10 @@ HWTEST_F(AdapterBleGattServerTest, SoftBusGattsAddCharacteristic, TestSize.Level
.uuidLen = 0,
.uuid = nullptr,
};
int properties = SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_READ | SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_WRITE_NO_RSP |
int32_t properties = SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_READ | SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_WRITE_NO_RSP |
SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_WRITE | SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_NOTIFY |
SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_INDICATE;
int permissions = SOFTBUS_GATT_PERMISSION_READ | SOFTBUS_GATT_PERMISSION_WRITE;
int32_t permissions = SOFTBUS_GATT_PERMISSION_READ | SOFTBUS_GATT_PERMISSION_WRITE;
ASSERT_EQ(
SoftBusGattsAddCharacteristic(MOCK_GATT_SERVICE_HANDLE, characteristic, properties, permissions),
SOFTBUS_INVALID_PARAM);
@ -260,7 +260,7 @@ HWTEST_F(AdapterBleGattServerTest, SoftBusGattsAddDescriptor, TestSize.Level3)
.uuidLen = 0,
.uuid = nullptr,
};
int permissions = SOFTBUS_GATT_PERMISSION_READ | SOFTBUS_GATT_PERMISSION_WRITE;
int32_t permissions = SOFTBUS_GATT_PERMISSION_READ | SOFTBUS_GATT_PERMISSION_WRITE;
ASSERT_EQ(SoftBusGattsAddDescriptor(MOCK_GATT_SERVICE_HANDLE, desciptor, permissions), SOFTBUS_INVALID_PARAM);
const char *connDesciptor = "00002902-0000-1000-8000-00805F9B34FB";
@ -363,7 +363,7 @@ HWTEST_F(AdapterBleGattServerTest, SoftBusGattsDisconnect, TestSize.Level3)
MockAll(mocker);
ASSERT_EQ(SoftBusRegisterGattsCallbacks(GetStubGattsCallback(), service), SOFTBUS_OK);
int connId = 1;
int32_t connId = 1;
SoftBusBtAddr addr = {
.addr = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66},
};
@ -456,10 +456,10 @@ HWTEST_F(AdapterBleGattServerTest, GattServerLifeCycle1, TestSize.Level3)
.uuidLen = strlen(netCharacteristic),
.uuid = (char *)netCharacteristic,
};
int properties = SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_READ | SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_WRITE_NO_RSP |
int32_t properties = SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_READ | SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_WRITE_NO_RSP |
SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_WRITE | SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_NOTIFY |
SOFTBUS_GATT_CHARACTER_PROPERTY_BIT_INDICATE;
int charaPermissions = SOFTBUS_GATT_PERMISSION_READ | SOFTBUS_GATT_PERMISSION_WRITE;
int32_t charaPermissions = SOFTBUS_GATT_PERMISSION_READ | SOFTBUS_GATT_PERMISSION_WRITE;
ASSERT_EQ(SoftBusGattsAddCharacteristic(MOCK_GATT_SERVICE_HANDLE, characteristic, properties, charaPermissions),
SOFTBUS_OK);
BtUuid btCharacteristic = {
@ -491,7 +491,7 @@ HWTEST_F(AdapterBleGattServerTest, GattServerLifeCycle2, TestSize.Level3)
// 注册desciptor
const char *connDesciptor = "00002902-0000-1000-8000-00805F9B34FB";
int descriptorPermissions = SOFTBUS_GATT_PERMISSION_READ | SOFTBUS_GATT_PERMISSION_WRITE;
int32_t descriptorPermissions = SOFTBUS_GATT_PERMISSION_READ | SOFTBUS_GATT_PERMISSION_WRITE;
SoftBusBtUuid descriptor = {
.uuidLen = strlen(connDesciptor),
.uuid = (char *)connDesciptor,
@ -642,7 +642,7 @@ void BtUuidRecordCtx::Reset()
uuid.uuidLen = 0;
}
bool BtUuidRecordCtx::Update(int id, int st, SoftBusBtUuid *param)
bool BtUuidRecordCtx::Update(int32_t id, int32_t st, SoftBusBtUuid *param)
{
if (!StRecordCtx::Update(id, st)) {
return false;
@ -658,7 +658,7 @@ bool BtUuidRecordCtx::Update(int id, int st, SoftBusBtUuid *param)
return true;
}
testing::AssertionResult BtUuidRecordCtx::Expect(int id, int st, SoftBusBtUuid *param)
testing::AssertionResult BtUuidRecordCtx::Expect(int32_t id, int32_t st, SoftBusBtUuid *param)
{
auto result = StRecordCtx::Expect(id, st);
if (!result) {
@ -679,7 +679,7 @@ BtGattRecordCtx::BtGattRecordCtx(const char *identifier) : BtUuidRecordCtx(ident
handle = -1;
}
bool BtGattRecordCtx::Update(int id, int st, int handleParam, SoftBusBtUuid *param)
bool BtGattRecordCtx::Update(int32_t id, int32_t st, int32_t handleParam, SoftBusBtUuid *param)
{
if (!BtUuidRecordCtx::Update(id, st, param)) {
return false;
@ -688,7 +688,7 @@ bool BtGattRecordCtx::Update(int id, int st, int handleParam, SoftBusBtUuid *par
return true;
}
testing::AssertionResult BtGattRecordCtx::Expect(int id, int st, int handleParam, SoftBusBtUuid *param)
testing::AssertionResult BtGattRecordCtx::Expect(int32_t id, int32_t st, int32_t handleParam, SoftBusBtUuid *param)
{
auto result = BtUuidRecordCtx::Expect(id, st, param);
if (!result) {
@ -720,42 +720,43 @@ StRecordCtx AdapterBleGattServerTest::responseConfirmationCtx("ResponseConfirmat
StRecordCtx AdapterBleGattServerTest::notifySentCtx("NotifySentCallback");
StRecordCtx AdapterBleGattServerTest::mtuChangeCtx("MtuChangeCallback");
static void StubServiceAddCallback(int status, SoftBusBtUuid *uuid, int srvcHandle)
static void StubServiceAddCallback(int32_t status, SoftBusBtUuid *uuid, int32_t srvcHandle)
{
AdapterBleGattServerTest::serviceAddCtx.Update(srvcHandle, status, uuid);
}
static void StubCharacteristicAddCallback(int status, SoftBusBtUuid *uuid, int srvcHandle, int characteristicHandle)
static void StubCharacteristicAddCallback(int32_t status, SoftBusBtUuid *uuid,
int32_t srvcHandle, int32_t characteristicHandle)
{
AdapterBleGattServerTest::characteristicAddCtx.Update(srvcHandle, status, characteristicHandle, uuid);
}
static void StubDescriptorAddCallback(int status, SoftBusBtUuid *uuid, int srvcHandle, int descriptorHandle)
static void StubDescriptorAddCallback(int32_t status, SoftBusBtUuid *uuid, int32_t srvcHandle, int32_t descriptorHandle)
{
AdapterBleGattServerTest::descriptorAddCtx.Update(srvcHandle, status, descriptorHandle, uuid);
}
static void StubServiceStartCallback(int status, int srvcHandle)
static void StubServiceStartCallback(int32_t status, int32_t srvcHandle)
{
AdapterBleGattServerTest::serviceStartCtx.Update(srvcHandle, status);
}
static void StubServiceStopCallback(int status, int srvcHandle)
static void StubServiceStopCallback(int32_t status, int32_t srvcHandle)
{
AdapterBleGattServerTest::serviceStopCtx.Update(srvcHandle, status);
}
static void StubServiceDeleteCallback(int status, int srvcHandle)
static void StubServiceDeleteCallback(int32_t status, int32_t srvcHandle)
{
AdapterBleGattServerTest::serviceDeleteCtx.Update(srvcHandle, status);
}
static void StubConnectServerCallback(int connId, const SoftBusBtAddr *btAddr)
static void StubConnectServerCallback(int32_t connId, const SoftBusBtAddr *btAddr)
{
AdapterBleGattServerTest::connectServerCtx.Update(connId, btAddr);
}
static void StubDisconnectServerCallback(int connId, const SoftBusBtAddr *btAddr)
static void StubDisconnectServerCallback(int32_t connId, const SoftBusBtAddr *btAddr)
{
AdapterBleGattServerTest::disconnectServerCtx.Update(connId, btAddr);
}
@ -770,15 +771,15 @@ static void StubRequestWriteCallback(SoftBusGattWriteRequest writeCbPara)
AdapterBleGattServerTest::requestWriteCtx = writeCbPara;
}
static void StubResponseConfirmationCallback(int status, int handle)
static void StubResponseConfirmationCallback(int32_t status, int32_t handle)
{
AdapterBleGattServerTest::responseConfirmationCtx.Update(handle, status);
}
static void StubNotifySentCallback(int connId, int status)
static void StubNotifySentCallback(int32_t connId, int32_t status)
{
AdapterBleGattServerTest::notifySentCtx.Update(connId, status);
}
static void StubMtuChangeCallback(int connId, int mtu)
static void StubMtuChangeCallback(int32_t connId, int32_t mtu)
{
AdapterBleGattServerTest::mtuChangeCtx.Update(connId, mtu);
}
@ -832,4 +833,4 @@ static testing::AssertionResult ExpectGattReadRequest(SoftBusGattReadRequest act
return testing::AssertionSuccess();
}
} // namespace OHOS
} // namespace OHOS

View File

@ -111,7 +111,7 @@ HWTEST(AdapterBtCommonTest, SoftBusSetBtName, TestSize.Level3)
EXPECT_EQ(SoftBusSetBtName(name), SOFTBUS_COMM_BLUETOOTH_UNDERLAY_SET_NAME_ERR);
}
static testing::AssertionResult PrepareBtStateListener(MockBluetooth &mocker, int *outlistenerId)
static testing::AssertionResult PrepareBtStateListener(MockBluetooth &mocker, int32_t *outlistenerId)
{
EXPECT_CALL(mocker, BleStopScan).WillRepeatedly(Return(OHOS_BT_STATUS_SUCCESS));
auto listenerId = SoftBusAddBtStateListener(GetMockBtStateListener());
@ -137,7 +137,7 @@ static testing::AssertionResult PrepareBtStateListener(MockBluetooth &mocker, in
*/
HWTEST(AdapterBtCommonTest, StateChangeCallback, TestSize.Level3)
{
int listenerId = -1;
int32_t listenerId = -1;
MockBluetooth mocker;
auto prepareResult = PrepareBtStateListener(mocker, &listenerId);
ASSERT_TRUE(prepareResult);
@ -186,7 +186,7 @@ HWTEST(AdapterBtCommonTest, StateChangeCallback, TestSize.Level3)
*/
HWTEST(AdapterBtCommonTest, AclStateChangedCallbak, TestSize.Level3)
{
int listenerId = -1;
int32_t listenerId = -1;
MockBluetooth mocker;
auto prepareResult = PrepareBtStateListener(mocker, &listenerId);
ASSERT_TRUE(prepareResult);
@ -240,7 +240,7 @@ HWTEST(AdapterBtCommonTest, PairRequestedCallback, TestSize.Level3)
.WillOnce(Return(false))
.WillOnce(Return(true));
int listenerId = -1;
int32_t listenerId = -1;
auto prepareResult = PrepareBtStateListener(mocker, &listenerId);
ASSERT_TRUE(prepareResult);
@ -266,7 +266,7 @@ HWTEST(AdapterBtCommonTest, PairConfiremedCallback, TestSize.Level3)
.Times(AtLeast(2))
.WillOnce(Return(false))
.WillRepeatedly(Return(true));
int listenerId = -1;
int32_t listenerId = -1;
auto prepareResult = PrepareBtStateListener(mocker, &listenerId);
ASSERT_TRUE(prepareResult);

View File

@ -28,13 +28,13 @@ public:
this->identifier = identifier;
}
bool Update(int idParam)
bool Update(int32_t idParam)
{
this->id = idParam;
return true;
}
testing::AssertionResult Expect(int idParam)
testing::AssertionResult Expect(int32_t idParam)
{
testing::AssertionResult result = testing::AssertionSuccess();
if (this->id != idParam) {
@ -48,14 +48,14 @@ protected:
// static c string
const char *identifier;
private:
int id;
int32_t id;
};
class StRecordCtx : public RecordCtx {
public:
explicit StRecordCtx(const char *identifier) : RecordCtx(identifier), st(-1) {}
bool Update(int id, int stParam)
bool Update(int32_t id, int32_t stParam)
{
if (!RecordCtx::Update(id)) {
return false;
@ -64,7 +64,7 @@ public:
return true;
}
testing::AssertionResult Expect(int id, int stParam)
testing::AssertionResult Expect(int32_t id, int32_t stParam)
{
auto result = RecordCtx::Expect(id);
if (!result) {
@ -81,7 +81,7 @@ public:
return result;
}
private:
int st;
int32_t st;
};
class BtAddrRecordCtx : public StRecordCtx {
@ -91,7 +91,7 @@ public:
Reset();
}
bool Update(int id, const SoftbusMacAddr *addr, int st = 0)
bool Update(int32_t id, const SoftbusMacAddr *addr, int32_t st = 0)
{
if (!StRecordCtx::Update(id, st)) {
return false;
@ -100,7 +100,7 @@ public:
return true;
}
testing::AssertionResult Expect(int id, SoftbusMacAddr *addrParam, int st = 0)
testing::AssertionResult Expect(int32_t id, SoftbusMacAddr *addrParam, int32_t st = 0)
{
auto result = StRecordCtx::Expect(id, st);
if (!result) {
@ -127,7 +127,7 @@ class IntRecordCtx : public StRecordCtx {
public:
explicit IntRecordCtx(const char *identifier) : StRecordCtx(identifier), val(-1) {}
bool Update(int id, int st, int valParam)
bool Update(int32_t id, int32_t st, int32_t valParam)
{
if (!StRecordCtx::Update(id, st)) {
return false;
@ -136,14 +136,14 @@ public:
return true;
}
testing::AssertionResult Expect(int id, int st, int valParam)
testing::AssertionResult Expect(int32_t id, int32_t st, int32_t valParam)
{
auto result = StRecordCtx::Expect(id, st);
if (!result) {
goto ClEANUP;
}
if (this->val != valParam) {
result = testing::AssertionFailure() << identifier << " is call by unexpectedly int value,"
result = testing::AssertionFailure() << identifier << " is call by unexpectedly int32_t value,"
<< "want: " << valParam << ", actual: " << this->val;
} else {
result = testing::AssertionSuccess();
@ -153,7 +153,7 @@ public:
return result;
}
private:
int val;
int32_t val;
};
#endif

View File

@ -23,25 +23,25 @@ BtGattCallbacks *MockBluetooth::btGattCallback = nullptr;
BleScanCallbacks *MockBluetooth::bleScanCallback = nullptr;
const SoftbusBroadcastMediumInterface *MockBluetooth::interface = nullptr;
static int ActionGapRegisterCallbacks(BtGapCallBacks *func)
static int32_t ActionGapRegisterCallbacks(BtGapCallBacks *func)
{
MockBluetooth::btGapCallback = func;
return OHOS_BT_STATUS_SUCCESS;
}
static int ActionBleGattRegisterCallbacks(BtGattCallbacks *func)
static int32_t ActionBleGattRegisterCallbacks(BtGattCallbacks *func)
{
MockBluetooth::btGattCallback = func;
return OHOS_BT_STATUS_SUCCESS;
}
static int ActionBleRegisterScanCallbacks(BleScanCallbacks *func, int32_t *scannerId)
static int32_t ActionBleRegisterScanCallbacks(BleScanCallbacks *func, int32_t *scannerId)
{
MockBluetooth::bleScanCallback = func;
return OHOS_BT_STATUS_SUCCESS;
}
static int ActionBleDeregisterScanCallbacks(int32_t scannerId)
static int32_t ActionBleDeregisterScanCallbacks(int32_t scannerId)
{
MockBluetooth::bleScanCallback = nullptr;
return OHOS_BT_STATUS_SUCCESS;
@ -100,197 +100,198 @@ bool SetLocalName(unsigned char *localName, unsigned char length)
return MockBluetooth::GetMocker()->SetLocalName(localName, length);
}
int GapRegisterCallbacks(BtGapCallBacks *func)
int32_t GapRegisterCallbacks(BtGapCallBacks *func)
{
return MockBluetooth::GetMocker()->GapRegisterCallbacks(func);
}
bool PairRequestReply(const BdAddr *bdAddr, int transport, bool accept)
bool PairRequestReply(const BdAddr *bdAddr, int32_t transport, bool accept)
{
return MockBluetooth::GetMocker()->PairRequestReply(bdAddr, transport, accept);
}
bool SetDevicePairingConfirmation(const BdAddr *bdAddr, int transport, bool accept)
bool SetDevicePairingConfirmation(const BdAddr *bdAddr, int32_t transport, bool accept)
{
return MockBluetooth::GetMocker()->SetDevicePairingConfirmation(bdAddr, transport, accept);
}
int BleGattRegisterCallbacks(BtGattCallbacks *func)
int32_t BleGattRegisterCallbacks(BtGattCallbacks *func)
{
return MockBluetooth::GetMocker()->BleGattRegisterCallbacks(func);
}
int BleRegisterScanCallbacks(BleScanCallbacks *func, int32_t *scannerId)
int32_t BleRegisterScanCallbacks(BleScanCallbacks *func, int32_t *scannerId)
{
return MockBluetooth::GetMocker()->BleRegisterScanCallbacks(func, scannerId);
}
int BleDeregisterScanCallbacks(int32_t scannerId)
int32_t BleDeregisterScanCallbacks(int32_t scannerId)
{
return MockBluetooth::GetMocker()->BleDeregisterScanCallbacks(scannerId);
}
int BleStartScanEx(int32_t scannerId, const BleScanConfigs *configs, const BleScanNativeFilter *filter,
int32_t BleStartScanEx(int32_t scannerId, const BleScanConfigs *configs, const BleScanNativeFilter *filter,
uint32_t filterSize)
{
return MockBluetooth::GetMocker()->BleStartScanEx(scannerId, configs, filter, filterSize);
}
int BleStopScan(int scannerId)
int32_t BleStopScan(int32_t scannerId)
{
return MockBluetooth::GetMocker()->BleStopScan(scannerId);
}
int GetAdvHandle(int32_t btAdvId, int32_t *bcHandle)
int32_t GetAdvHandle(int32_t btAdvId, int32_t *bcHandle)
{
return OHOS_BT_STATUS_SUCCESS;
}
int EnableSyncDataToLpDevice()
int32_t EnableSyncDataToLpDevice()
{
return OHOS_BT_STATUS_SUCCESS;
}
int DisableSyncDataToLpDevice()
int32_t DisableSyncDataToLpDevice()
{
return OHOS_BT_STATUS_SUCCESS;
}
int SetLpDeviceAdvParam(int32_t duration, int32_t maxExtAdvEvents, int32_t window,
int32_t SetLpDeviceAdvParam(int32_t duration, int32_t maxExtAdvEvents, int32_t window,
int32_t interval, int32_t bcHandle)
{
return OHOS_BT_STATUS_SUCCESS;
}
int BleStartAdvEx(int *advId, const StartAdvRawData rawData, BleAdvParams advParam)
int32_t BleStartAdvEx(int32_t *advId, const StartAdvRawData rawData, BleAdvParams advParam)
{
return MockBluetooth::GetMocker()->BleStartAdvEx(advId, rawData, advParam);
}
int BleStopAdv(int advId)
int32_t BleStopAdv(int32_t advId)
{
return OHOS_BT_STATUS_SUCCESS;
}
int BleGattcRegister(BtUuid appUuid)
int32_t BleGattcRegister(BtUuid appUuid)
{
return MockBluetooth::GetMocker()->BleGattcRegister(appUuid);
}
int BleGattcConnect(
int clientId, BtGattClientCallbacks *func, const BdAddr *bdAddr, bool isAutoConnect, BtTransportType transport)
int32_t BleGattcConnect(
int32_t clientId, BtGattClientCallbacks *func, const BdAddr *bdAddr, bool isAutoConnect, BtTransportType transport)
{
return MockBluetooth::GetMocker()->BleGattcConnect(clientId, func, bdAddr, isAutoConnect, transport);
}
int BleGattcDisconnect(int clientId)
int32_t BleGattcDisconnect(int32_t clientId)
{
return MockBluetooth::GetMocker()->BleGattcDisconnect(clientId);
}
int BleGattcSearchServices(int clientId)
int32_t BleGattcSearchServices(int32_t clientId)
{
return MockBluetooth::GetMocker()->BleGattcSearchServices(clientId);
}
bool BleGattcGetService(int clientId, BtUuid serviceUuid)
bool BleGattcGetService(int32_t clientId, BtUuid serviceUuid)
{
return MockBluetooth::GetMocker()->BleGattcGetService(clientId, serviceUuid);
}
int BleGattcRegisterNotification(int clientId, BtGattCharacteristic characteristic, bool enable)
int32_t BleGattcRegisterNotification(int32_t clientId, BtGattCharacteristic characteristic, bool enable)
{
return MockBluetooth::GetMocker()->BleGattcRegisterNotification(clientId, characteristic, enable);
}
int BleGattcConfigureMtuSize(int clientId, int mtuSize)
int32_t BleGattcConfigureMtuSize(int32_t clientId, int32_t mtuSize)
{
return MockBluetooth::GetMocker()->BleGattcConfigureMtuSize(clientId, mtuSize);
}
int BleGattcWriteCharacteristic(
int clientId, BtGattCharacteristic characteristic, BtGattWriteType writeType, int len, const char *value)
int32_t BleGattcWriteCharacteristic(
int32_t clientId, BtGattCharacteristic characteristic, BtGattWriteType writeType, int32_t len, const char *value)
{
return MockBluetooth::GetMocker()->BleGattcWriteCharacteristic(clientId, characteristic, writeType, len, value);
}
int BleGattcUnRegister(int clientId)
int32_t BleGattcUnRegister(int32_t clientId)
{
return MockBluetooth::GetMocker()->BleGattcUnRegister(clientId);
}
int BleGattcSetFastestConn(int clientId, bool fastestConnFlag)
int32_t BleGattcSetFastestConn(int32_t clientId, bool fastestConnFlag)
{
return MockBluetooth::GetMocker()->BleGattcSetFastestConn(clientId, fastestConnFlag);
}
int BleGattcSetPriority(int clientId, const BdAddr *bdAddr, BtGattPriority priority)
int32_t BleGattcSetPriority(int32_t clientId, const BdAddr *bdAddr, BtGattPriority priority)
{
return MockBluetooth::GetMocker()->BleGattcSetPriority(clientId, bdAddr, priority);
}
int BleGattsRegisterCallbacks(BtGattServerCallbacks *func)
int32_t BleGattsRegisterCallbacks(BtGattServerCallbacks *func)
{
return MockBluetooth::GetMocker()->BleGattsRegisterCallbacks(func);
}
int BleGattsRegister(BtUuid appUuid)
int32_t BleGattsRegister(BtUuid appUuid)
{
return MockBluetooth::GetMocker()->BleGattsRegister(appUuid);
}
int BleGattsAddService(int serverId, BtUuid srvcUuid, bool isPrimary, int number)
int32_t BleGattsAddService(int32_t serverId, BtUuid srvcUuid, bool isPrimary, int32_t number)
{
return MockBluetooth::GetMocker()->BleGattsAddService(serverId, srvcUuid, isPrimary, number);
}
int BleGattsUnRegister(int serverId)
int32_t BleGattsUnRegister(int32_t serverId)
{
return MockBluetooth::GetMocker()->BleGattsUnRegister(serverId);
}
int BleGattsAddCharacteristic(int serverId, int srvcHandle, BtUuid characUuid, int properties, int permissions)
int32_t BleGattsAddCharacteristic(int32_t serverId, int32_t srvcHandle,
BtUuid characUuid, int32_t properties, int32_t permissions)
{
return MockBluetooth::GetMocker()->BleGattsAddCharacteristic(
serverId, srvcHandle, characUuid, properties, permissions);
}
int BleGattsAddDescriptor(int serverId, int srvcHandle, BtUuid descUuid, int permissions)
int32_t BleGattsAddDescriptor(int32_t serverId, int32_t srvcHandle, BtUuid descUuid, int32_t permissions)
{
return MockBluetooth::GetMocker()->BleGattsAddDescriptor(serverId, srvcHandle, descUuid, permissions);
}
int BleGattsStartService(int serverId, int srvcHandle)
int32_t BleGattsStartService(int32_t serverId, int32_t srvcHandle)
{
return MockBluetooth::GetMocker()->BleGattsStartService(serverId, srvcHandle);
}
int BleGattsStopService(int serverId, int srvcHandle)
int32_t BleGattsStopService(int32_t serverId, int32_t srvcHandle)
{
return MockBluetooth::GetMocker()->BleGattsStopService(serverId, srvcHandle);
}
int BleGattsDeleteService(int serverId, int srvcHandle)
int32_t BleGattsDeleteService(int32_t serverId, int32_t srvcHandle)
{
return MockBluetooth::GetMocker()->BleGattsDeleteService(serverId, srvcHandle);
}
int BleGattsDisconnect(int serverId, BdAddr bdAddr, int connId)
int32_t BleGattsDisconnect(int32_t serverId, BdAddr bdAddr, int32_t connId)
{
return MockBluetooth::GetMocker()->BleGattsDisconnect(serverId, bdAddr, connId);
}
int BleGattsSendResponse(int serverId, GattsSendRspParam *param)
int32_t BleGattsSendResponse(int32_t serverId, GattsSendRspParam *param)
{
return MockBluetooth::GetMocker()->BleGattsSendResponse(serverId, param);
}
int BleGattsSendIndication(int serverId, GattsSendIndParam *param)
int32_t BleGattsSendIndication(int32_t serverId, GattsSendIndParam *param)
{
return MockBluetooth::GetMocker()->BleGattsSendIndication(serverId, param);
}
int SoftBusAddBtStateListener(const SoftBusBtStateListener *listener)
int32_t SoftBusAddBtStateListener(const SoftBusBtStateListener *listener)
{
return MockBluetooth::GetMocker()->SoftBusAddBtStateListener(listener);
}

View File

@ -34,58 +34,60 @@ public:
virtual bool IsBleEnabled() = 0;
virtual bool GetLocalAddr(unsigned char *mac, unsigned int len) = 0;
virtual bool SetLocalName(unsigned char *localName, unsigned char length) = 0;
virtual int GapRegisterCallbacks(BtGapCallBacks *func) = 0;
virtual bool PairRequestReply(const BdAddr *bdAddr, int transport, bool accept) = 0;
virtual bool SetDevicePairingConfirmation(const BdAddr *bdAddr, int transport, bool accept) = 0;
virtual int32_t GapRegisterCallbacks(BtGapCallBacks *func) = 0;
virtual bool PairRequestReply(const BdAddr *bdAddr, int32_t transport, bool accept) = 0;
virtual bool SetDevicePairingConfirmation(const BdAddr *bdAddr, int32_t transport, bool accept) = 0;
// BLE广播相关
virtual int BleGattRegisterCallbacks(BtGattCallbacks *func) = 0;
virtual int BleRegisterScanCallbacks(BleScanCallbacks *func, int32_t *scannerId) = 0;
virtual int BleDeregisterScanCallbacks(int32_t scannerId) = 0;
virtual int BleStartScanEx(int32_t scannerId, const BleScanConfigs *configs, const BleScanNativeFilter *filter,
virtual int32_t BleGattRegisterCallbacks(BtGattCallbacks *func) = 0;
virtual int32_t BleRegisterScanCallbacks(BleScanCallbacks *func, int32_t *scannerId) = 0;
virtual int32_t BleDeregisterScanCallbacks(int32_t scannerId) = 0;
virtual int32_t BleStartScanEx(int32_t scannerId, const BleScanConfigs *configs, const BleScanNativeFilter *filter,
uint32_t filterSize) = 0;
virtual int BleStopScan(int scannerId) = 0;
virtual int BleStartAdvEx(int *advId, const StartAdvRawData rawData, BleAdvParams advParam) = 0;
virtual int BleStopAdv(int advId) = 0;
virtual int GetAdvHandle(int32_t btAdvId, int32_t *bcHandle) = 0;
virtual int EnableSyncDataToLpDevice() = 0;
virtual int DisableSyncDataToLpDevice() = 0;
virtual int SetLpDeviceAdvParam(
virtual int32_t BleStopScan(int32_t scannerId) = 0;
virtual int32_t BleStartAdvEx(int32_t *advId, const StartAdvRawData rawData, BleAdvParams advParam) = 0;
virtual int32_t BleStopAdv(int32_t advId) = 0;
virtual int32_t GetAdvHandle(int32_t btAdvId, int32_t *bcHandle) = 0;
virtual int32_t EnableSyncDataToLpDevice() = 0;
virtual int32_t DisableSyncDataToLpDevice() = 0;
virtual int32_t SetLpDeviceAdvParam(
int32_t duration, int32_t maxExtAdvEvents, int32_t window, int32_t interval, int32_t bcHandle) = 0;
// GATT Client相关
virtual int BleGattcRegister(BtUuid appUuid) = 0;
virtual int BleGattcConnect(int clientId, BtGattClientCallbacks *func, const BdAddr *bdAddr, bool isAutoConnect,
BtTransportType transport) = 0;
virtual int BleGattcDisconnect(int clientId) = 0;
virtual int BleGattcSearchServices(int clientId) = 0;
virtual bool BleGattcGetService(int clientId, BtUuid serviceUuid) = 0;
virtual int BleGattcRegisterNotification(int clientId, BtGattCharacteristic characteristic, bool enable) = 0;
virtual int BleGattcConfigureMtuSize(int clientId, int mtuSize) = 0;
virtual int BleGattcWriteCharacteristic(
int clientId, BtGattCharacteristic characteristic, BtGattWriteType writeType, int len, const char *value) = 0;
virtual int BleGattcUnRegister(int clientId) = 0;
virtual int BleGattcSetFastestConn(int clientId, bool fastestConnFlag) = 0;
virtual int BleGattcSetPriority(int clientId, const BdAddr *bdAddr, BtGattPriority priority) = 0;
virtual int32_t BleGattcRegister(BtUuid appUuid) = 0;
virtual int32_t BleGattcConnect(int32_t clientId, BtGattClientCallbacks *func,
const BdAddr *bdAddr, bool isAutoConnect, BtTransportType transport) = 0;
virtual int32_t BleGattcDisconnect(int32_t clientId) = 0;
virtual int32_t BleGattcSearchServices(int32_t clientId) = 0;
virtual bool BleGattcGetService(int32_t clientId, BtUuid serviceUuid) = 0;
virtual int32_t BleGattcRegisterNotification(int32_t clientId,
BtGattCharacteristic characteristic, bool enable) = 0;
virtual int32_t BleGattcConfigureMtuSize(int32_t clientId, int32_t mtuSize) = 0;
virtual int32_t BleGattcWriteCharacteristic(int32_t clientId, BtGattCharacteristic characteristic,
BtGattWriteType writeType, int32_t len, const char *value) = 0;
virtual int32_t BleGattcUnRegister(int32_t clientId) = 0;
virtual int32_t BleGattcSetFastestConn(int32_t clientId, bool fastestConnFlag) = 0;
virtual int32_t BleGattcSetPriority(int32_t clientId, const BdAddr *bdAddr, BtGattPriority priority) = 0;
// GATT Server相关
virtual int BleGattsRegisterCallbacks(BtGattServerCallbacks *func) = 0;
virtual int BleGattsRegister(BtUuid appUuid);
virtual int BleGattsAddService(int serverId, BtUuid srvcUuid, bool isPrimary, int number) = 0;
virtual int BleGattsUnRegister(int serverId);
virtual int BleGattsAddCharacteristic(
int serverId, int srvcHandle, BtUuid characUuid, int properties, int permissions) = 0;
virtual int BleGattsAddDescriptor(int serverId, int srvcHandle, BtUuid descUuid, int permissions) = 0;
virtual int BleGattsStartService(int serverId, int srvcHandle) = 0;
virtual int BleGattsStopService(int serverId, int srvcHandle) = 0;
virtual int BleGattsDeleteService(int serverId, int srvcHandle) = 0;
virtual int BleGattsDisconnect(int serverId, BdAddr bdAddr, int connId) = 0;
virtual int BleGattsSendResponse(int serverId, GattsSendRspParam *param) = 0;
virtual int BleGattsSendIndication(int serverId, GattsSendIndParam *param) = 0;
virtual int32_t BleGattsRegisterCallbacks(BtGattServerCallbacks *func) = 0;
virtual int32_t BleGattsRegister(BtUuid appUuid);
virtual int32_t BleGattsAddService(int32_t serverId, BtUuid srvcUuid, bool isPrimary, int32_t number) = 0;
virtual int32_t BleGattsUnRegister(int32_t serverId);
virtual int32_t BleGattsAddCharacteristic(
int32_t serverId, int32_t srvcHandle, BtUuid characUuid, int32_t properties, int32_t permissions) = 0;
virtual int32_t BleGattsAddDescriptor(int32_t serverId,
int32_t srvcHandle, BtUuid descUuid, int32_t permissions) = 0;
virtual int32_t BleGattsStartService(int32_t serverId, int32_t srvcHandle) = 0;
virtual int32_t BleGattsStopService(int32_t serverId, int32_t srvcHandle) = 0;
virtual int32_t BleGattsDeleteService(int32_t serverId, int32_t srvcHandle) = 0;
virtual int32_t BleGattsDisconnect(int32_t serverId, BdAddr bdAddr, int32_t connId) = 0;
virtual int32_t BleGattsSendResponse(int32_t serverId, GattsSendRspParam *param) = 0;
virtual int32_t BleGattsSendIndication(int32_t serverId, GattsSendIndParam *param) = 0;
virtual int32_t RegisterBroadcastMediumFunction(SoftbusMediumType type,
const SoftbusBroadcastMediumInterface *interface) = 0;
virtual int SoftBusAddBtStateListener(const SoftBusBtStateListener *listener) = 0;
virtual int32_t SoftBusAddBtStateListener(const SoftBusBtStateListener *listener) = 0;
};
class MockBluetooth : public BluetoothInterface {
@ -99,17 +101,17 @@ public:
MOCK_METHOD(bool, GetLocalAddr, (unsigned char *mac, unsigned int len), (override));
MOCK_METHOD(bool, SetLocalName, (unsigned char *localName, unsigned char length), (override));
MOCK_METHOD(int, GapRegisterCallbacks, (BtGapCallBacks *func), (override));
MOCK_METHOD(bool, PairRequestReply, (const BdAddr *bdAddr, int transport, bool accept), (override));
MOCK_METHOD(bool, SetDevicePairingConfirmation, (const BdAddr *bdAddr, int transport, bool accept), (override));
MOCK_METHOD(bool, PairRequestReply, (const BdAddr *bdAddr, int32_t transport, bool accept), (override));
MOCK_METHOD(bool, SetDevicePairingConfirmation, (const BdAddr *bdAddr, int32_t transport, bool accept), (override));
MOCK_METHOD(int, BleGattRegisterCallbacks, (BtGattCallbacks *func), (override));
MOCK_METHOD(int, BleRegisterScanCallbacks, (BleScanCallbacks *func, int32_t *scannerId), (override));
MOCK_METHOD(int, BleDeregisterScanCallbacks, (int32_t scannerId), (override));
MOCK_METHOD(int, BleStartScanEx, (int32_t scannerId, const BleScanConfigs *configs,
const BleScanNativeFilter *filter, uint32_t filterSize), (override));
MOCK_METHOD(int, BleStopScan, (int scannerId), (override));
MOCK_METHOD(int, BleStartAdvEx, (int *advId, const StartAdvRawData rawData, BleAdvParams advParam), (override));
MOCK_METHOD(int, BleStopAdv, (int advId), (override));
MOCK_METHOD(int, BleStopScan, (int32_t scannerId), (override));
MOCK_METHOD(int, BleStartAdvEx, (int32_t *advId, const StartAdvRawData rawData, BleAdvParams advParam), (override));
MOCK_METHOD(int, BleStopAdv, (int32_t advId), (override));
MOCK_METHOD(int, GetAdvHandle, (int32_t btAdvId, int32_t *bcHandle), (override));
MOCK_METHOD(int, EnableSyncDataToLpDevice, (), (override));
MOCK_METHOD(int, DisableSyncDataToLpDevice, (), (override));
@ -118,36 +120,40 @@ public:
MOCK_METHOD(int, BleGattcRegister, (BtUuid appUuid), (override));
MOCK_METHOD(int, BleGattcConnect,
(int clientId, BtGattClientCallbacks *func, const BdAddr *bdAddr, bool isAutoConnect,
(int32_t clientId, BtGattClientCallbacks *func, const BdAddr *bdAddr, bool isAutoConnect,
BtTransportType transport),
(override));
MOCK_METHOD(int, BleGattcDisconnect, (int clientId), (override));
MOCK_METHOD(int, BleGattcSearchServices, (int clientId), (override));
MOCK_METHOD(bool, BleGattcGetService, (int clientId, BtUuid serviceUuid), (override));
MOCK_METHOD(int, BleGattcRegisterNotification, (int clientId, BtGattCharacteristic characteristic, bool enable),
MOCK_METHOD(int, BleGattcDisconnect, (int32_t clientId), (override));
MOCK_METHOD(int, BleGattcSearchServices, (int32_t clientId), (override));
MOCK_METHOD(bool, BleGattcGetService, (int32_t clientId, BtUuid serviceUuid), (override));
MOCK_METHOD(int, BleGattcRegisterNotification, (int32_t clientId, BtGattCharacteristic characteristic, bool enable),
(override));
MOCK_METHOD(int, BleGattcConfigureMtuSize, (int clientId, int mtuSize), (override));
MOCK_METHOD(int, BleGattcConfigureMtuSize, (int32_t clientId, int32_t mtuSize), (override));
MOCK_METHOD(int, BleGattcWriteCharacteristic,
(int clientId, BtGattCharacteristic characteristic, BtGattWriteType writeType, int len, const char *value),
(int32_t clientId, BtGattCharacteristic characteristic, BtGattWriteType writeType,
int32_t len, const char *value),
(override));
MOCK_METHOD(int, BleGattcUnRegister, (int clientId), (override));
MOCK_METHOD(int, BleGattcSetFastestConn, (int clientId, bool fastestConnFlag), (override));
MOCK_METHOD(int, BleGattcSetPriority, (int clientId, const BdAddr *bdAddr, BtGattPriority priority), (override));
MOCK_METHOD(int, BleGattcUnRegister, (int32_t clientId), (override));
MOCK_METHOD(int, BleGattcSetFastestConn, (int32_t clientId, bool fastestConnFlag), (override));
MOCK_METHOD(int, BleGattcSetPriority, (int32_t clientId,
const BdAddr *bdAddr, BtGattPriority priority), (override));
MOCK_METHOD(int, BleGattsRegisterCallbacks, (BtGattServerCallbacks *func), (override));
MOCK_METHOD(int, BleGattsRegister, (BtUuid appUuid), (override));
MOCK_METHOD(int, BleGattsAddService, (int serverId, BtUuid srvcUuid, bool isPrimary, int number), (override));
MOCK_METHOD(int, BleGattsUnRegister, (int serverId), (override));
MOCK_METHOD(int, BleGattsAddService, (int32_t serverId, BtUuid srvcUuid,
bool isPrimary, int32_t number), (override));
MOCK_METHOD(int, BleGattsUnRegister, (int32_t serverId), (override));
MOCK_METHOD(int, BleGattsAddCharacteristic,
(int serverId, int srvcHandle, BtUuid characUuid, int properties, int permissions), (override));
MOCK_METHOD(
int, BleGattsAddDescriptor, (int serverId, int srvcHandle, BtUuid descUuid, int permissions), (override));
MOCK_METHOD(int, BleGattsStartService, (int serverId, int srvcHandle), (override));
MOCK_METHOD(int, BleGattsStopService, (int serverId, int srvcHandle), (override));
MOCK_METHOD(int, BleGattsDeleteService, (int serverId, int srvcHandle), (override));
MOCK_METHOD(int, BleGattsDisconnect, (int serverId, BdAddr bdAddr, int connId), (override));
MOCK_METHOD(int, BleGattsSendResponse, (int serverId, GattsSendRspParam *param), (override));
MOCK_METHOD(int, BleGattsSendIndication, (int serverId, GattsSendIndParam *param), (override));
(int32_t serverId, int32_t srvcHandle, BtUuid characUuid,
int32_t properties, int32_t permissions), (override));
MOCK_METHOD(int, BleGattsAddDescriptor,
(int32_t serverId, int32_t srvcHandle, BtUuid descUuid, int32_t permissions), (override));
MOCK_METHOD(int, BleGattsStartService, (int32_t serverId, int32_t srvcHandle), (override));
MOCK_METHOD(int, BleGattsStopService, (int32_t serverId, int32_t srvcHandle), (override));
MOCK_METHOD(int, BleGattsDeleteService, (int32_t serverId, int32_t srvcHandle), (override));
MOCK_METHOD(int, BleGattsDisconnect, (int32_t serverId, BdAddr bdAddr, int32_t connId), (override));
MOCK_METHOD(int, BleGattsSendResponse, (int32_t serverId, GattsSendRspParam *param), (override));
MOCK_METHOD(int, BleGattsSendIndication, (int32_t serverId, GattsSendIndParam *param), (override));
MOCK_METHOD(int32_t, RegisterBroadcastMediumFunction, (SoftbusMediumType type,
const SoftbusBroadcastMediumInterface *interface), (override));
MOCK_METHOD(int, SoftBusAddBtStateListener, (const SoftBusBtStateListener *listener), (override));
@ -162,4 +168,4 @@ private:
static MockBluetooth *targetMocker;
};
#endif
#endif

View File

@ -53,7 +53,7 @@ public:
static StRecordCtx advDisableCtx;
static StRecordCtx advDataCtx;
static StRecordCtx advUpdateCtx;
static int btInnerAdvId;
static int32_t btInnerAdvId;
static void SetUpTestCase(void);
};
@ -64,7 +64,7 @@ StRecordCtx SoftbusBleGattTest::advEnableCtx("AdvEnableCallback");
StRecordCtx SoftbusBleGattTest::advDisableCtx("AdvDisableCallback");
StRecordCtx SoftbusBleGattTest::advDataCtx("AdvDataCallback");
StRecordCtx SoftbusBleGattTest::advUpdateCtx("AdvUpdateCallback");
int SoftbusBleGattTest::btInnerAdvId = -1;
int32_t SoftbusBleGattTest::btInnerAdvId = -1;
void SoftbusBleGattTest::SetUpTestCase()
{
@ -89,22 +89,22 @@ static SoftbusScanCallback *GetStubScanListener()
return &listener;
}
static void StubAdvEnableCallback(int advId, int status)
static void StubAdvEnableCallback(int32_t advId, int32_t status)
{
SoftbusBleGattTest::advEnableCtx.Update(advId, status);
}
static void StubAdvDisableCallback(int advId, int status)
static void StubAdvDisableCallback(int32_t advId, int32_t status)
{
SoftbusBleGattTest::advDisableCtx.Update(advId, status);
}
static void StubAdvUpdateCallback(int advId, int status)
static void StubAdvUpdateCallback(int32_t advId, int32_t status)
{
SoftbusBleGattTest::advUpdateCtx.Update(advId, status);
}
static void StubAdvDataCallback(int advId, int status)
static void StubAdvDataCallback(int32_t advId, int32_t status)
{
SoftbusBleGattTest::advDataCtx.Update(advId, status);
}
@ -120,7 +120,7 @@ SoftbusBroadcastCallback *GetStubAdvCallback()
return &callback;
}
static testing::AssertionResult PrepareScanListener(int *scannerId)
static testing::AssertionResult PrepareScanListener(int32_t *scannerId)
{
int32_t ret = MockBluetooth::interface->RegisterScanListener(scannerId, GetStubScanListener());
if (ret != SOFTBUS_OK) {
@ -135,7 +135,7 @@ static testing::AssertionResult PrepareScanListener(int *scannerId)
static SoftBusBcScanFilter *CreateScanFilter()
{
unsigned char serviceData[] = {0xE, 0xE, 0xF, 0xF, 0x04, 0x05};
int len = sizeof(serviceData);
int32_t len = sizeof(serviceData);
SoftBusBcScanFilter *filter = static_cast<SoftBusBcScanFilter *>(SoftBusCalloc(sizeof(SoftBusBcScanFilter)));
unsigned char *serviceDataPtr = static_cast<unsigned char *>(SoftBusCalloc(len));
@ -1122,7 +1122,7 @@ HWTEST_F(SoftbusBleGattTest, TestSoftbusSetLpParam, TestSize.Level1)
HWTEST_F(SoftbusBleGattTest, RegisterScanListener, TestSize.Level3)
{
MockBluetooth mocker;
int scannerId = -1;
int32_t scannerId = -1;
ASSERT_EQ(MockBluetooth::interface->RegisterScanListener(&scannerId, nullptr), SOFTBUS_INVALID_PARAM);
int32_t scanListerIds[GATT_SCAN_MAX_NUM] = {};
int32_t ret = SOFTBUS_ERR;
@ -1148,7 +1148,7 @@ HWTEST_F(SoftbusBleGattTest, RegisterScanListener, TestSize.Level3)
HWTEST_F(SoftbusBleGattTest, UnRegisterScanListener, TestSize.Level3)
{
MockBluetooth mocker;
int scannerId = -1;
int32_t scannerId = -1;
auto result = PrepareScanListener(&scannerId);
ASSERT_EQ(MockBluetooth::interface->UnRegisterScanListener(-1), SOFTBUS_INVALID_PARAM);
@ -1165,7 +1165,7 @@ HWTEST_F(SoftbusBleGattTest, UnRegisterScanListener, TestSize.Level3)
HWTEST_F(SoftbusBleGattTest, ScanLifecycle, TestSize.Level3)
{
MockBluetooth mocker;
int scannerId = -1;
int32_t scannerId = -1;
auto result = PrepareScanListener(&scannerId);
auto filter = CreateScanFilter();
@ -1197,7 +1197,7 @@ HWTEST_F(SoftbusBleGattTest, ScanLifecycle, TestSize.Level3)
HWTEST_F(SoftbusBleGattTest, ScanResultCb, TestSize.Level3)
{
MockBluetooth mocker;
int scannerId = -1;
int32_t scannerId = -1;
auto result = PrepareScanListener(&scannerId);
auto filter = CreateScanFilter();
@ -1252,9 +1252,9 @@ HWTEST_F(SoftbusBleGattTest, ScanResultCb, TestSize.Level3)
*/
HWTEST_F(SoftbusBleGattTest, RegisterBroadcaster, TestSize.Level3)
{
int advId = -1;
int32_t advId = -1;
ASSERT_EQ(MockBluetooth::interface->RegisterBroadcaster(&advId, nullptr), SOFTBUS_INVALID_PARAM);
int advIds[GATT_ADV_MAX_NUM];
int32_t advIds[GATT_ADV_MAX_NUM];
for (size_t i = 0; i < GATT_ADV_MAX_NUM; i++) {
ASSERT_EQ(MockBluetooth::interface->RegisterBroadcaster(&advIds[i], GetStubAdvCallback()), SOFTBUS_LOCK_ERR);
}
@ -1282,7 +1282,7 @@ void ScanResultCtx::Reset()
scanResult.data.rspData.payload = nullptr;
}
bool ScanResultCtx::Update(int id, const SoftBusBcScanResult *scanResult)
bool ScanResultCtx::Update(int32_t id, const SoftBusBcScanResult *scanResult)
{
if (!RecordCtx::Update(id)) {
return false;
@ -1304,7 +1304,7 @@ bool ScanResultCtx::Update(int id, const SoftBusBcScanResult *scanResult)
return true;
}
testing::AssertionResult ScanResultCtx::Expect(int id, const SoftBusBcScanResult *scanResultParam)
testing::AssertionResult ScanResultCtx::Expect(int32_t id, const SoftBusBcScanResult *scanResultParam)
{
auto result = RecordCtx::Expect(id);
if (!result) {

View File

@ -195,7 +195,7 @@ HWTEST(SoftbusBleUtilsTest, DumpBleScanFilter, TestSize.Level3)
*/
HWTEST(SoftbusBleUtilsTest, GetBtScanMode, TestSize.Level3)
{
int scanMode = GetBtScanMode(SOFTBUS_BC_SCAN_INTERVAL_P2, SOFTBUS_BC_SCAN_WINDOW_P2);
int32_t scanMode = GetBtScanMode(SOFTBUS_BC_SCAN_INTERVAL_P2, SOFTBUS_BC_SCAN_WINDOW_P2);
EXPECT_EQ(scanMode, OHOS_BLE_SCAN_MODE_OP_P2_60_3000);
scanMode = GetBtScanMode(SOFTBUS_BC_SCAN_INTERVAL_P10, SOFTBUS_BC_SCAN_WINDOW_P10);

View File

@ -53,7 +53,7 @@ void SoftBusAdapterHiSysEventFuzzTest(const uint8_t* data, size_t size)
} // namespace OHOS
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
if (data == nullptr || size < sizeof(int32_t)) {
return 0;

View File

@ -44,7 +44,7 @@ static void SoftBusAdapterRangeFuzzTest(const uint8_t* data, size_t size)
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
if (data == nullptr || size < sizeof(int32_t)) {
return 0;

View File

@ -145,7 +145,7 @@ bool SoftBusAesCfbEncryptFuzzTest(const uint8_t *data, size_t size)
} // namespace OHOS
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
if (data == nullptr || size == 0) {
return 0;

View File

@ -160,25 +160,25 @@ static LpScanParam BuildLpScanParam(const uint8_t* data, size_t size)
return lpScanParam;
}
static void BleAdvEnableCallback(int channel, int status)
static void BleAdvEnableCallback(int32_t channel, int32_t status)
{
(void)channel;
(void)status;
}
static void BleAdvDisableCallback(int channel, int status)
static void BleAdvDisableCallback(int32_t channel, int32_t status)
{
(void)channel;
(void)status;
}
static void BleAdvDataCallback(int channel, int status)
static void BleAdvDataCallback(int32_t channel, int32_t status)
{
(void)channel;
(void)status;
}
static void BleAdvUpdateCallback(int channel, int status)
static void BleAdvUpdateCallback(int32_t channel, int32_t status)
{
(void)channel;
(void)status;
@ -191,19 +191,19 @@ static BroadcastCallback g_advCallback = {
.OnSetBroadcastingCallback = BleAdvDataCallback,
};
static void BleOnScanStart(int listenerId, int status)
static void BleOnScanStart(int32_t listenerId, int32_t status)
{
(void)listenerId;
(void)status;
}
static void BleOnScanStop(int listenerId, int status)
static void BleOnScanStop(int32_t listenerId, int32_t status)
{
(void)listenerId;
(void)status;
}
static void BleScanResultCallback(int listenerId, const BroadcastReportInfo *reportInfo)
static void BleScanResultCallback(int32_t listenerId, const BroadcastReportInfo *reportInfo)
{
(void)listenerId;
(void)reportInfo;
@ -306,7 +306,7 @@ void BroadcastSetLpAdvParamFuzzTest()
} // OHOS namespace
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
if (size < MIN_DATA_LEN) {
return 0;

View File

@ -34,7 +34,7 @@ namespace OHOS {
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::SoftBusDecryptDataTest(data, size);

View File

@ -25,7 +25,7 @@
#include "softbus_adapter_mem.h"
namespace OHOS {
const int PROTOCOL_MAXLEN = 100;
const int32_t PROTOCOL_MAXLEN = 100;
struct SocketProtocol {
unsigned int cmd;
@ -160,7 +160,7 @@ void SoftBusSocketSendToFuzzTest(const uint8_t* data, size_t size)
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::SoftBusSocketRecvFuzzTest(data, size);

View File

@ -74,7 +74,7 @@ HWTEST_F(AdapterDsoftbusRangeTest, SoftBusBleRange001, TestSize.Level0)
HWTEST_F(AdapterDsoftbusRangeTest, SoftBusGetBlePower001, TestSize.Level0)
{
int8_t power = 0;
int ret = SoftBusGetBlePower(nullptr);
int32_t ret = SoftBusGetBlePower(nullptr);
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
ret = SoftBusGetBlePower(&power);
EXPECT_EQ(0, ret);

View File

@ -25,16 +25,16 @@ using namespace std;
using namespace testing::ext;
namespace OHOS {
const int PROTOCOL_MAXLEN = 100;
const int TEST_BUF_SIZE = 10;
const int TEST_PORT = 8888;
const int TEST_IPV6_PORT = 8089;
const int LOCAL_HOST_VALUE = 16777343;
const int CMD_EXIT = 0x11001100;
const int CMD_RECV = 0x22002200;
const int CMD_REPLY = 0x33003300;
const int SET_SIZE = 100;
const int WLAN_INDEX = 4;
const int32_t PROTOCOL_MAXLEN = 100;
const int32_t TEST_BUF_SIZE = 10;
const int32_t TEST_PORT = 8888;
const int32_t TEST_IPV6_PORT = 8089;
const int32_t LOCAL_HOST_VALUE = 16777343;
const int32_t CMD_EXIT = 0x11001100;
const int32_t CMD_RECV = 0x22002200;
const int32_t CMD_REPLY = 0x33003300;
const int32_t SET_SIZE = 100;
const int32_t WLAN_INDEX = 4;
SoftBusSockAddrIn g_serAddr = {
.sinFamily = SOFTBUS_AF_INET,
@ -73,13 +73,13 @@ void AdapterDsoftbusSocketTest::TearDown()
{
}
static void SocketServiceStart(int localFlag)
static void SocketServiceStart(int32_t localFlag)
{
int32_t socketFd = -1;
int32_t optVal = 1;
int32_t backLog = 2;
SoftBusSockAddrIn cliAddr = {0};
int acceptFd = -1;
int32_t acceptFd = -1;
struct SocketProtocol buf = {0};
int32_t ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
EXPECT_EQ(0, ret);
@ -135,7 +135,7 @@ static void SocketIpv6ServiceStart(int localFlag)
int32_t optVal = 1;
int32_t backLog = 2;
SoftBusSockAddrIn cliAddr = {0};
int acceptFd = -1;
int32_t acceptFd = -1;
struct SocketProtocol buf = {0};
int32_t ret = SoftBusSocketCreate(SOFTBUS_AF_INET6, SOFTBUS_SOCK_STREAM, 0, &socketFd);
EXPECT_EQ(0, ret);
@ -335,11 +335,11 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSetOptTest001, TestSize.Level0)
*/
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSetOptTest002, TestSize.Level0)
{
int socketFd;
int ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
int32_t socketFd;
int32_t ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
EXPECT_EQ(SOFTBUS_ADAPTER_OK, ret);
int optVal = 1;
int optValLen = sizeof(int);
int32_t optVal = 1;
int32_t optValLen = sizeof(int);
ret = SoftBusSocketSetOpt(socketFd, SOFTBUS_IPPROTO_IP, SOFTBUS_IP_TOS, &optVal, optValLen);
EXPECT_EQ(SOFTBUS_ADAPTER_OK, ret);
@ -355,12 +355,12 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSetOptTest002, TestSize.Level0)
*/
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSetOptTest003, TestSize.Level0)
{
int socketFd;
int ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
int32_t socketFd;
int32_t ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
EXPECT_EQ(SOFTBUS_ADAPTER_OK, ret);
int optVal = 1;
int optValLen = sizeof(int);
int32_t optVal = 1;
int32_t optValLen = sizeof(int);
ret = SoftBusSocketSetOpt(socketFd, SOFTBUS_SOL_SOCKET, SOFTBUS_SO_KEEPALIVE, &optVal, optValLen);
EXPECT_EQ(0, ret);
@ -376,9 +376,9 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSetOptTest003, TestSize.Level0)
*/
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSetOptTest004, TestSize.Level0)
{
int optVal = 1;
int optValLen = sizeof(int);
int ret = SoftBusSocketSetOpt(-1, SOFTBUS_SOL_SOCKET, SOFTBUS_SO_REUSEADDR, &optVal, optValLen);
int32_t optVal = 1;
int32_t optValLen = sizeof(int);
int32_t ret = SoftBusSocketSetOpt(-1, SOFTBUS_SOL_SOCKET, SOFTBUS_SO_REUSEADDR, &optVal, optValLen);
EXPECT_EQ(SOFTBUS_ADAPTER_ERR, ret);
}
@ -390,11 +390,11 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSetOptTest004, TestSize.Level0)
*/
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSetOptTest005, TestSize.Level0)
{
int socketFd;
int ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
int32_t socketFd;
int32_t ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
EXPECT_EQ(SOFTBUS_ADAPTER_OK, ret);
int optVal = 10;
int optValLen = sizeof(int);
int32_t optVal = 10;
int32_t optValLen = sizeof(int);
ret = SoftBusSocketSetOpt(socketFd, SOFTBUS_IPPROTO_IP, -1, &optVal, optValLen);
EXPECT_EQ(SOFTBUS_ADAPTER_ERR, ret);
@ -410,10 +410,10 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSetOptTest005, TestSize.Level0)
*/
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSetOptTest006, TestSize.Level0)
{
int socketFd;
int ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
int32_t socketFd;
int32_t ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
EXPECT_EQ(SOFTBUS_ADAPTER_OK, ret);
int optValLen = sizeof(int);
int32_t optValLen = sizeof(int);
ret = SoftBusSocketSetOpt(socketFd, SOFTBUS_IPPROTO_IP, SOFTBUS_IP_TOS, NULL, optValLen);
EXPECT_EQ(SOFTBUS_ADAPTER_ERR, ret);
@ -430,10 +430,10 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSetOptTest006, TestSize.Level0)
*/
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSetOptTest007, TestSize.Level0)
{
int socketFd;
int ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
int32_t socketFd;
int32_t ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
EXPECT_EQ(SOFTBUS_ADAPTER_OK, ret);
int optVal = 1;
int32_t optVal = 1;
ret = SoftBusSocketSetOpt(socketFd, SOFTBUS_IPPROTO_IP, SOFTBUS_IP_TOS, &optVal, -1);
EXPECT_EQ(-1, ret);
@ -450,10 +450,10 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSetOptTest007, TestSize.Level0)
*/
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetOptTest001, TestSize.Level0)
{
int socketFd;
int on = 1;
int onLen = sizeof(on);
int ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
int32_t socketFd;
int32_t on = 1;
int32_t onLen = sizeof(on);
int32_t ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
EXPECT_EQ(SOFTBUS_ADAPTER_OK, ret);
ret = SoftBusSocketGetOpt(socketFd, SOFTBUS_SOL_SOCKET, SOFTBUS_SO_REUSEADDR, &on, &onLen);
EXPECT_EQ(SOFTBUS_ADAPTER_OK, ret);
@ -469,9 +469,9 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetOptTest001, TestSize.Level0)
*/
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetOptTest002, TestSize.Level0)
{
int on = 1;
int onLen = sizeof(on);
int rc = SoftBusSocketGetOpt(-1, SOFTBUS_SOL_SOCKET, SOFTBUS_SO_REUSEADDR, &on, &onLen);
int32_t on = 1;
int32_t onLen = sizeof(on);
int32_t rc = SoftBusSocketGetOpt(-1, SOFTBUS_SOL_SOCKET, SOFTBUS_SO_REUSEADDR, &on, &onLen);
EXPECT_TRUE(rc == -1);
}
@ -484,7 +484,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetOptTest002, TestSize.Level0)
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetLocalNameTest001, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(1);
return;
@ -521,7 +521,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetLocalNameTest002, TestSize.L
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetLocalNameTest003, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -547,7 +547,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetLocalNameTest003, TestSize.L
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetLocalNameTest004, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -573,8 +573,8 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetLocalNameTest004, TestSize.L
*/
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetLocalNameTest005, TestSize.Level0)
{
int socketFd;
int ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
int32_t socketFd;
int32_t ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
EXPECT_EQ(SOFTBUS_ADAPTER_OK, ret);
SoftBusSockAddrIn clientAddr;
ret = SoftBusSocketGetLocalName(socketFd, (SoftBusSockAddr *)&clientAddr);
@ -607,7 +607,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetLocalNameTest006, TestSize.L
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetLocalNameTest007, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketIpv6ServiceStart(0);
return;
@ -634,7 +634,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetLocalNameTest007, TestSize.L
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetPeerNameTest001, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -666,7 +666,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetPeerNameTest001, TestSize.Le
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetPeerNameTest002, TestSize.Level0)
{
SoftBusSockAddr addr;
int rc = SoftBusSocketGetPeerName(-1, &addr);
int32_t rc = SoftBusSocketGetPeerName(-1, &addr);
EXPECT_TRUE(rc == -1);
}
@ -679,7 +679,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetPeerNameTest002, TestSize.Le
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetPeerNameTest003, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -705,7 +705,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetPeerNameTest003, TestSize.Le
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetPeerNameTest004, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -732,8 +732,8 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetPeerNameTest004, TestSize.Le
*/
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetPeerNameTest005, TestSize.Level0)
{
int socketFd;
int ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
int32_t socketFd;
int32_t ret = SoftBusSocketCreate(SOFTBUS_AF_INET, SOFTBUS_SOCK_STREAM, 0, &socketFd);
EXPECT_EQ(SOFTBUS_ADAPTER_OK, ret);
SoftBusSockAddrIn serviceAddr;
ret = SoftBusSocketGetPeerName(socketFd, (SoftBusSockAddr *)&serviceAddr);
@ -752,7 +752,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetPeerNameTest005, TestSize.Le
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketGetPeerNameTest006, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketIpv6ServiceStart(0);
return;
@ -976,7 +976,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketListen004, TestSize.Level0)
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketAccept001, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -1052,7 +1052,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketAccept003, TestSize.Level0)
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketConnect001, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(1);
return;
@ -1219,7 +1219,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketFdIssetTest001, TestSize.Level0
{
SoftBusFdSet set;
SoftBusSocketFdSet(1, &set);
int ret = SoftBusSocketFdIsset(1, &set);
int32_t ret = SoftBusSocketFdIsset(1, &set);
EXPECT_TRUE(ret == 1);
}
@ -1233,7 +1233,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketFdIssetTest002, TestSize.Level0
{
SoftBusFdSet set = {0};
SoftBusSocketFdClr(1, &set);
int ret = SoftBusSocketFdIsset(1, &set);
int32_t ret = SoftBusSocketFdIsset(1, &set);
EXPECT_TRUE(ret == 0);
}
@ -1245,7 +1245,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketFdIssetTest002, TestSize.Level0
*/
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketFdIssetTest003, TestSize.Level0)
{
int ret = SoftBusSocketFdIsset(1, NULL);
int32_t ret = SoftBusSocketFdIsset(1, NULL);
EXPECT_TRUE(ret == 0);
}
@ -1482,7 +1482,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendTest001, TestSize.Level0)
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendTest002, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -1520,7 +1520,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendTest002, TestSize.Level0)
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendTest003, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -1560,7 +1560,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendTest003, TestSize.Level0)
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendTest004, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -1604,7 +1604,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendToTest001, TestSize.Level0)
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendToTest002, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -1634,7 +1634,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendToTest002, TestSize.Level0)
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendToTest003, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -1662,7 +1662,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendToTest003, TestSize.Level0)
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendToTest004, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -1687,7 +1687,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendToTest004, TestSize.Level0)
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendToTest005, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -1716,7 +1716,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendToTest005, TestSize.Level0)
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendToTest006, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketServiceStart(0);
return;
@ -1744,7 +1744,7 @@ HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendToTest006, TestSize.Level0)
HWTEST_F(AdapterDsoftbusSocketTest, SoftBusSocketSendTest007, TestSize.Level0)
{
sleep(1);
int pid = -1;
int32_t pid = -1;
if ((pid = fork()) == 0) {
SocketIpv6ServiceStart(0);
return;

View File

@ -40,7 +40,7 @@ void AdapterDsoftbusWifiTest::SetUpTestCase(void) { }
void AdapterDsoftbusWifiTest::TearDownTestCase(void) { }
void AdapterDsoftbusWifiTest::SetUp() { }
void AdapterDsoftbusWifiTest::TearDown() { }
void OnSoftBusWifiScanResult(int state, int size) { }
void OnSoftBusWifiScanResult(int32_t state, int32_t size) { }
/*
* @tc.name: SoftBusGetWifiDeviceConfig
* @tc.desc: softbus wifi test

View File

@ -54,7 +54,7 @@ bool SoftBusRsaDecryptFuzzTest(const uint8_t *data, size_t size)
} // namespace OHOS
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
if (data == nullptr || size == 0) {
return 0;

View File

@ -263,12 +263,12 @@ HWTEST_F(AdapterDsoftbusRsaCryptoTest, SoftBusRsaDecrypt003, TestSize.Level0)
*/
HWTEST_F(AdapterDsoftbusRsaCryptoTest, DataBusNativeVirtual001, TestSize.Level0)
{
int channelId = 0;
int32_t channelId = 0;
int32_t ret = NotifyNearByUpdateMigrateOption(channelId);
EXPECT_EQ(SOFTBUS_OK, ret);
const char *peerDeviceId = NULL;
int routeType = 0;
int32_t routeType = 0;
bool isUpgrade = true;
ret = NotifyNearByOnMigrateEvents(peerDeviceId, routeType, isUpgrade);
EXPECT_EQ(SOFTBUS_OK, ret);

View File

@ -74,7 +74,7 @@ OHOS::ErrCode OHOS::AccountSA::OsAccountManager::QueryActiveOsAccountIds(std::ve
return mock->QueryActiveOsAccountIds(ids);
}
OHOS::ErrCode OHOS::AccountSA::OsAccountManager::IsOsAccountVerified(const int id, bool &isVerified)
OHOS::ErrCode OHOS::AccountSA::OsAccountManager::IsOsAccountVerified(const int32_t id, bool &isVerified)
{
auto mock = OHOS::AccountSA::OsAccountManagerMock::GetMock();
if (mock == nullptr) {

View File

@ -57,7 +57,7 @@ public:
virtual ~OsAccountManager() = default;
virtual OHOS::ErrCode QueryActiveOsAccountIds(std::vector<int32_t> &ids);
virtual OHOS::ErrCode IsOsAccountVerified(const int id, bool &isVerified);
virtual OHOS::ErrCode IsOsAccountVerified(const int32_t id, bool &isVerified);
};
class OsAccountManagerMock : public AccountSA::OsAccountManager {
@ -65,7 +65,7 @@ public:
OsAccountManagerMock();
~OsAccountManagerMock() override;
MOCK_METHOD1(QueryActiveOsAccountIds, OHOS::ErrCode(std::vector<int32_t> &ids));
MOCK_METHOD2(IsOsAccountVerified, OHOS::ErrCode(const int id, bool &isVerified));
MOCK_METHOD2(IsOsAccountVerified, OHOS::ErrCode(const int32_t id, bool &isVerified));
static OsAccountManagerMock *GetMock()
{

View File

@ -37,7 +37,7 @@ static SettingDataEventMonitorDepsInterface *GetSettingDataEventMonitorDepsInter
}
extern "C" {
SoftBusLooper *GetLooper(int looper)
SoftBusLooper *GetLooper(int32_t looper)
{
return GetSettingDataEventMonitorDepsInterface()->GetLooper(looper);
}

View File

@ -29,7 +29,7 @@ public:
SettingDataEventMonitorDepsInterface() {};
virtual ~SettingDataEventMonitorDepsInterface() {};
virtual SoftBusLooper *GetLooper(int looper) = 0;
virtual SoftBusLooper *GetLooper(int32_t looper) = 0;
virtual int32_t LnnAsyncCallbackHelper(SoftBusLooper *looper, LnnAsyncCallbackFunc callback, void *para) = 0;
virtual int32_t GetActiveOsAccountIds(void) = 0;
virtual void UpdateDeviceName(void *p) = 0;

View File

@ -72,7 +72,7 @@ void LnnSettingdataEventMonitorTest::TearDown(void)
*/
HWTEST_F(LnnSettingdataEventMonitorTest, LnnGetSettingDeviceNameTest001, TestSize.Level1)
{
int ret = LnnGetSettingDeviceName(DEVICE_NAME1, DEVICE_NAME_BUF_LEN);
int32_t ret = LnnGetSettingDeviceName(DEVICE_NAME1, DEVICE_NAME_BUF_LEN);
EXPECT_NE(ret, SOFTBUS_OK);
}
@ -85,7 +85,7 @@ HWTEST_F(LnnSettingdataEventMonitorTest, LnnGetSettingDeviceNameTest001, TestSiz
HWTEST_F(LnnSettingdataEventMonitorTest, LnnGetSettingDeviceNameTest002, TestSize.Level1)
{
LnnDeviceNameHandler handler = NULL;
int ret = LnnInitGetDeviceName(handler);
int32_t ret = LnnInitGetDeviceName(handler);
EXPECT_NE(ret, SOFTBUS_OK);
}

View File

@ -159,7 +159,7 @@ void AuthMetaStartVerifyFuzzTest(const uint8_t* data, size_t size)
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::AuthDataFuzzTest(data, size);

View File

@ -23,7 +23,7 @@
namespace OHOS {
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
static bool isFirst = true;

View File

@ -35,7 +35,7 @@ namespace OHOS {
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::UnpackAuthDataFuzzTest(data, size);

View File

@ -140,7 +140,7 @@ HWTEST_F(AuthHichainTest, ON_DEVICE_NOT_TRUSTED_TEST_001, TestSize.Level1)
HWTEST_F(AuthHichainTest, ON_REQUEST_TEST_001, TestSize.Level1)
{
int64_t authSeq = 0;
int operationCode = 0;
int32_t operationCode = 0;
const char *reqParams = "testdata";
char *msgStr = OnRequest(authSeq, operationCode, reqParams);

View File

@ -27,7 +27,7 @@ static const std::string DATA_TAG = "TEData";
static const std::string DEVICE_ID_TAG = "TEDeviceId";
static const std::string DATA_BUF_SIZE_TAG = "DataBufSize";
static const std::string SOFT_BUS_VERSION_TAG = "softbusVersion";
static const int PACKET_SIZE = (64 * 1024);
static const int32_t PACKET_SIZE = (64 * 1024);
using namespace testing;
using namespace testing::ext;

View File

@ -639,7 +639,7 @@ HWTEST_F(AuthOtherTest, ON_COMM_DATA_RECEIVED_TEST_001, TestSize.Level1)
ConnModule moduleId = MODULE_DEVICE_AUTH;
int64_t seq = 0;
char *data = reinterpret_cast<char *>(malloc(1024));
const int SEND_DATA_SIZE_1KB = 1024;
const int32_t SEND_DATA_SIZE_1KB = 1024;
ASSERT_NE(data, nullptr);
const char *testData = "{\"data\":\"open session test!!!\"}";
int32_t len = 2;
@ -705,7 +705,7 @@ HWTEST_F(AuthOtherTest, ON_COMM_DATA_RECEVIED_TEST_001, TestSize.Level1)
ASSERT_NE(data, nullptr);
OnCommDataReceived(connectionId, moduleId, seq, data, len);
const int SEND_DATA_SIZE_1KB = 1024;
const int32_t SEND_DATA_SIZE_1KB = 1024;
const char *testData = "{\"data\":\"open session test!!!\"}";
len = 2;
moduleId = MODULE_CONNECTION;

View File

@ -85,7 +85,7 @@ HWTEST_F(AuthSessionMessageTest, PackFastAuthValue_TEST_001, TestSize.Level1)
JSON_AddStringToObject(json, FAST_AUTH, "jsontest");
OptString(json, DEVICE_ID, target, 10, "");
OptString(json, FAST_AUTH, target, 10, "");
int val = 0;
int32_t val = 0;
OptInt(json, P2P_ROLE, &val, 0);
JSON_AddInt32ToObject(json, SOFTBUS_VERSION_TAG, 123);
OptInt(json, SOFTBUS_VERSION_TAG, &val, 0);

View File

@ -2155,7 +2155,7 @@ HWTEST_F(AuthTest, AUTH_SET_TCP_KEEPALIVE_OPTION_Test_003, TestSize.Level1)
const SocketInterface *tcp = GetTcpProtocol();
ASSERT_NE(tcp, nullptr);
int port = CLIENT_PORT;
int32_t port = CLIENT_PORT;
char ipAddress[] = "127.0.0.1";
LocalListenerInfo info = {};
info.type = CONNECT_TCP;
@ -2163,7 +2163,7 @@ HWTEST_F(AuthTest, AUTH_SET_TCP_KEEPALIVE_OPTION_Test_003, TestSize.Level1)
info.socketOption.moduleId = DIRECT_CHANNEL_SERVER_WIFI;
info.socketOption.protocol = LNN_PROTOCOL_IP;
(void)strcpy_s(info.socketOption.addr, sizeof(info.socketOption.addr), ipAddress);
int fd = tcp->OpenServerSocket(&info);
int32_t fd = tcp->OpenServerSocket(&info);
int32_t ret = AuthSetTcpKeepaliveOption(fd, HIGH_FREQ_CYCLE);
EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM);

View File

@ -60,7 +60,7 @@ const AuthConnCallback g_connCallback = {
.onConnOpened = LnnConnectInterfaceMock::onConnOpened,
.onConnOpenFailed = LnnConnectInterfaceMock::onConnOpenFailed,
};
static const int MILLIS = 15;
static const int32_t MILLIS = 15;
class AuthEnhanceMockTest : public testing::Test {
public:

View File

@ -58,8 +58,8 @@ static const ConnModule MODULE_ID = MODULE_DEVICE_AUTH;
static const uint8_t DEVICE_INFO[5] = { 0x10, 0x2, 0x14, 0x08, 0x06 };
uint8_t g_sessionKey[SESSION_KEY_LENGTH];
static const int32_t TEST_DATA_LEN = 600;
static const int OPER_CODE = 0;
static const int DELAY_TIME = 15;
static const int32_t OPER_CODE = 0;
static const int32_t DELAY_TIME = 15;
static const char *g_retData = nullptr;
static uint64_t g_connId = 8590065691;
const AuthConnInfo g_connInfo = {
@ -203,7 +203,7 @@ bool WaitForSignal()
return false;
}
if (!AuthNetLedgertInterfaceMock::isRuned) {
int ret = SoftBusCondWait(&LnnHichainInterfaceMock::cond, &LnnHichainInterfaceMock::mutex, &tv);
int32_t ret = SoftBusCondWait(&LnnHichainInterfaceMock::cond, &LnnHichainInterfaceMock::mutex, &tv);
(void)SoftBusMutexUnlock(&LnnHichainInterfaceMock::mutex);
return (ret == SOFTBUS_OK);
} else {

View File

@ -64,7 +64,7 @@ void LnnNotifyDiscoveryDeviceFuzzTest(const uint8_t* data, size_t size)
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::LnnNotifyDiscoveryDeviceFuzzTest(data, size);

View File

@ -83,7 +83,7 @@ void LnnSendP2pSyncInfoMsgFuzzTest(const uint8_t* data, size_t size)
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::LnnSendSyncInfoMsgFuzzTest(data, size);

View File

@ -68,7 +68,7 @@ public:
virtual int32_t AuthGetHmlConnInfo(const char *uuid, AuthConnInfo *connInfo, bool isMeta) = 0;
virtual int32_t AuthOpenConn(const AuthConnInfo *info, uint32_t requestId,
const AuthConnCallback *callback, bool isMeta) = 0;
virtual int SoftBusFrequencyToChannel(int frequency) = 0;
virtual int32_t SoftBusFrequencyToChannel(int32_t frequency) = 0;
virtual NodeInfo *LnnGetNodeInfoById(const char *id, IdCategory type) = 0;
virtual const NodeInfo *LnnGetLocalNodeInfo(void) = 0;
virtual void AuthCloseConn(AuthHandle authHandle) = 0;
@ -110,7 +110,7 @@ public:
virtual void AuthDeviceGetLatestIdByUuid(const char *uuid, AuthLinkType type, AuthHandle *authHandle) = 0;
virtual int32_t LnnGetOsTypeByNetworkId(const char *networkId, int32_t *osType) = 0;
virtual void DeleteNetworkResourceByLaneId(uint64_t laneId) = 0;
virtual int SoftBusGetBtState() = 0;
virtual int32_t SoftBusGetBtState() = 0;
virtual int32_t LnnGetAllOnlineNodeInfo(NodeBasicInfo **info, int32_t *infoNum) = 0;
virtual void AddNetworkResource(NetworkResource *networkResource) = 0;
virtual int32_t LnnRequestCheckOnlineStatus(const char *networkId, uint64_t timeout) = 0;
@ -132,7 +132,7 @@ public:
MOCK_METHOD3(AuthGetP2pConnInfo, int32_t (const char*, AuthConnInfo*, bool));
MOCK_METHOD3(AuthGetHmlConnInfo, int32_t (const char*, AuthConnInfo*, bool));
MOCK_METHOD4(AuthOpenConn, int32_t (const AuthConnInfo*, uint32_t, const AuthConnCallback*, bool));
MOCK_METHOD1(SoftBusFrequencyToChannel, int (int));
MOCK_METHOD1(SoftBusFrequencyToChannel, int32_t (int));
MOCK_METHOD2(LnnGetLocalNumInfo, int32_t (InfoKey, int32_t*));
MOCK_METHOD3(LnnGetRemoteNumInfo, int32_t (const char*, InfoKey, int32_t*));
MOCK_METHOD2(LnnGetNodeInfoById, NodeInfo* (const char*, IdCategory));
@ -175,7 +175,7 @@ public:
MOCK_METHOD3(AuthDeviceGetLatestIdByUuid, void (const char *uuid, AuthLinkType type, AuthHandle *authHandle));
MOCK_METHOD2(LnnGetOsTypeByNetworkId, int32_t (const char *, int32_t *));
MOCK_METHOD1(DeleteNetworkResourceByLaneId, void (uint64_t laneId));
MOCK_METHOD0(SoftBusGetBtState, int (void));
MOCK_METHOD0(SoftBusGetBtState, int32_t (void));
MOCK_METHOD2(LnnGetAllOnlineNodeInfo, int32_t (NodeBasicInfo **info, int32_t *infoNum));
MOCK_METHOD1(AddNetworkResource, void (NetworkResource *));
MOCK_METHOD2(LnnRequestCheckOnlineStatus, int32_t (const char *networkId, uint64_t timeout));

View File

@ -218,7 +218,7 @@ int32_t AuthOpenConn(const AuthConnInfo *info, uint32_t requestId,
return GetLaneDepsInterface()->AuthOpenConn(info, requestId, callback, isMeta);
}
int SoftBusFrequencyToChannel(int frequency)
int32_t SoftBusFrequencyToChannel(int32_t frequency)
{
return GetLaneDepsInterface()->SoftBusFrequencyToChannel(frequency);
}
@ -426,7 +426,7 @@ void DeleteNetworkResourceByLaneId(uint64_t laneId)
GetLaneDepsInterface()->DeleteNetworkResourceByLaneId(laneId);
}
int SoftBusGetBtState(void)
int32_t SoftBusGetBtState(void)
{
return GetLaneDepsInterface()->SoftBusGetBtState();
}

View File

@ -40,7 +40,7 @@ constexpr char PEER_IP_HML[] = "127.30.0.1";
constexpr char PEER_IP_P2P[] = "127.31.0.1";
constexpr uint64_t LANE_ID_P2P = 0x1000000000000001;
constexpr uint64_t LANE_ID_HML = 0x1000000000000002;
constexpr int CHANNEL_ID = 10;
constexpr int32_t CHANNEL_ID = 10;
constexpr char MAC_TEST[] = "testMac";
class LNNLaneListenerTest : public testing::Test {

View File

@ -69,7 +69,7 @@ public:
virtual void AuthHandleLeaveLNN(AuthHandle authHandle) = 0;
virtual LnnConnectionFsm *LnnCreateConnectionFsm(const ConnectionAddr *target,
const char *pkgName, bool isNeedConnect);
virtual int SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len);
virtual int32_t SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len);
virtual int32_t LnnSetLocalStrInfo(InfoKey key, const char *info);
virtual int32_t LnnSetLocalNumInfo(InfoKey key, int32_t info);
virtual int32_t LnnGetLocalStrInfo(InfoKey key, char *info, uint32_t len);
@ -86,7 +86,7 @@ public:
virtual bool LnnConvertAuthConnInfoToAddr(ConnectionAddr *addr,
const AuthConnInfo *connInfo, ConnectionAddrType hintType);
virtual bool AddStringToJsonObject(cJSON *json, const char * const string, const char *value);
virtual bool AddNumberToJsonObject(cJSON *json, const char * const string, int num);
virtual bool AddNumberToJsonObject(cJSON *json, const char * const string, int32_t num);
virtual int32_t LnnSendSyncInfoMsg(LnnSyncInfoType type, const char *networkId,
const uint8_t *msg, uint32_t len, LnnSyncInfoMsgComplete complete);
virtual NodeInfo *LnnGetNodeInfoById(const char *id, IdCategory type);
@ -112,7 +112,7 @@ public:
LnnSyncInfoMsgComplete complete);
virtual int32_t LnnAsyncCallbackDelayHelper(SoftBusLooper *looper, LnnAsyncCallbackFunc callback,
void *para, uint64_t delayMillis);
virtual SoftBusLooper *GetLooper(int looper);
virtual SoftBusLooper *GetLooper(int32_t looper);
virtual int32_t ConnDisconnectDeviceAllConn(const ConnectOption *option);
virtual int32_t LnnGenLocalIrk(unsigned char *irk, uint32_t len);
virtual int32_t LnnGenLocalUuid(char *uuid, uint32_t len);
@ -201,7 +201,7 @@ public:
MOCK_METHOD0(AuthGenRequestId, uint32_t ());
MOCK_METHOD0(LnnSetUnlockState, void ());
MOCK_METHOD1(AuthHandleLeaveLNN, void (AuthHandle));
MOCK_METHOD3(SoftbusGetConfig, int (ConfigType, unsigned char *, uint32_t));
MOCK_METHOD3(SoftbusGetConfig, int32_t (ConfigType, unsigned char *, uint32_t));
MOCK_METHOD2(LnnSetLocalStrInfo, int32_t (InfoKey, const char *));
MOCK_METHOD2(LnnSetLocalNumInfo, int32_t (InfoKey, int32_t));
MOCK_METHOD3(LnnGetLocalStrInfo, int32_t (InfoKey, char *, uint32_t));

View File

@ -40,7 +40,7 @@ public:
LnnConnFsmInterface() {};
virtual ~LnnConnFsmInterface() {};
virtual void LnnNotifyDeviceVerified(const char *udid) = 0;
virtual int SoftBusGetBtState(void) = 0;
virtual int32_t SoftBusGetBtState(void) = 0;
virtual int32_t LnnGenerateBtMacHash(const char *btMac, int32_t brMacLen, char *brMacHash, int32_t hashLen) = 0;
virtual void DeleteFromProfile(const char *udid) = 0;
virtual void SendDeviceStateToMlps(void *para) = 0;
@ -69,7 +69,7 @@ public:
LnnConnFsmInterfaceMock();
~LnnConnFsmInterfaceMock() override;
MOCK_METHOD1(LnnNotifyDeviceVerified, void (const char *));
MOCK_METHOD0(SoftBusGetBtState, int (void));
MOCK_METHOD0(SoftBusGetBtState, int32_t (void));
MOCK_METHOD4(LnnGenerateBtMacHash, int32_t (const char *, int32_t, char *, int32_t));
MOCK_METHOD1(DeleteFromProfile, void (const char *));
MOCK_METHOD1(SendDeviceStateToMlps, void (void *));

View File

@ -69,7 +69,7 @@ public:
virtual void AuthHandleLeaveLNN(AuthHandle authHandle) = 0;
virtual LnnConnectionFsm *LnnCreateConnectionFsm(const ConnectionAddr *target,
const char *pkgName, bool isNeedConnect);
virtual int SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len);
virtual int32_t SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len);
virtual int32_t LnnSetLocalStrInfo(InfoKey key, const char *info);
virtual int32_t LnnSetLocalNumInfo(InfoKey key, int32_t info);
virtual int32_t LnnGetLocalStrInfo(InfoKey key, char *info, uint32_t len);
@ -86,7 +86,7 @@ public:
virtual bool LnnConvertAuthConnInfoToAddr(ConnectionAddr *addr,
const AuthConnInfo *connInfo, ConnectionAddrType hintType);
virtual bool AddStringToJsonObject(cJSON *json, const char * const string, const char *value);
virtual bool AddNumberToJsonObject(cJSON *json, const char * const string, int num);
virtual bool AddNumberToJsonObject(cJSON *json, const char * const string, int32_t num);
virtual int32_t LnnSendSyncInfoMsg(LnnSyncInfoType type, const char *networkId,
const uint8_t *msg, uint32_t len, LnnSyncInfoMsgComplete complete);
virtual NodeInfo *LnnGetNodeInfoById(const char *id, IdCategory type);
@ -112,7 +112,7 @@ public:
LnnSyncInfoMsgComplete complete);
virtual int32_t LnnAsyncCallbackDelayHelper(SoftBusLooper *looper, LnnAsyncCallbackFunc callback,
void *para, uint64_t delayMillis);
virtual SoftBusLooper *GetLooper(int looper);
virtual SoftBusLooper *GetLooper(int32_t looper);
virtual int32_t ConnDisconnectDeviceAllConn(const ConnectOption *option);
virtual int32_t LnnGenLocalIrk(unsigned char *irk, uint32_t len);
virtual int32_t LnnGenLocalUuid(char *uuid, uint32_t len);
@ -203,7 +203,7 @@ public:
MOCK_METHOD0(AuthGenRequestId, uint32_t ());
MOCK_METHOD0(LnnSetUnlockState, void ());
MOCK_METHOD1(AuthHandleLeaveLNN, void (AuthHandle));
MOCK_METHOD3(SoftbusGetConfig, int (ConfigType, unsigned char *, uint32_t));
MOCK_METHOD3(SoftbusGetConfig, int32_t (ConfigType, unsigned char *, uint32_t));
MOCK_METHOD2(LnnSetLocalStrInfo, int32_t (InfoKey, const char *));
MOCK_METHOD2(LnnSetLocalNumInfo, int32_t (InfoKey, int32_t));
MOCK_METHOD3(LnnGetLocalStrInfo, int32_t (InfoKey, char *, uint32_t));

View File

@ -72,7 +72,7 @@ public:
virtual void AuthHandleLeaveLNN(AuthHandle authHandle) = 0;
virtual LnnConnectionFsm *LnnCreateConnectionFsm(const ConnectionAddr *target,
const char *pkgName, bool isNeedConnect);
virtual int SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len);
virtual int32_t SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len);
virtual int32_t LnnSetLocalStrInfo(InfoKey key, const char *info);
virtual int32_t LnnSetLocalNumInfo(InfoKey key, int32_t info);
virtual int32_t LnnGetLocalStrInfo(InfoKey key, char *info, uint32_t len);
@ -89,7 +89,7 @@ public:
virtual bool LnnConvertAuthConnInfoToAddr(ConnectionAddr *addr,
const AuthConnInfo *connInfo, ConnectionAddrType hintType);
virtual bool AddStringToJsonObject(cJSON *json, const char * const string, const char *value);
virtual bool AddNumberToJsonObject(cJSON *json, const char * const string, int num);
virtual bool AddNumberToJsonObject(cJSON *json, const char * const string, int32_t num);
virtual int32_t LnnSendSyncInfoMsg(LnnSyncInfoType type, const char *networkId,
const uint8_t *msg, uint32_t len, LnnSyncInfoMsgComplete complete);
virtual NodeInfo *LnnGetNodeInfoById(const char *id, IdCategory type);
@ -115,7 +115,7 @@ public:
LnnSyncInfoMsgComplete complete);
virtual int32_t LnnAsyncCallbackDelayHelper(SoftBusLooper *looper, LnnAsyncCallbackFunc callback,
void *para, uint64_t delayMillis);
virtual SoftBusLooper *GetLooper(int looper);
virtual SoftBusLooper *GetLooper(int32_t looper);
virtual int32_t ConnDisconnectDeviceAllConn(const ConnectOption *option);
virtual int32_t LnnGenLocalIrk(unsigned char *irk, uint32_t len);
virtual int32_t LnnGenLocalUuid(char *uuid, uint32_t len);
@ -213,7 +213,7 @@ public:
MOCK_METHOD0(AuthGenRequestId, uint32_t ());
MOCK_METHOD0(LnnSetUnlockState, void ());
MOCK_METHOD1(AuthHandleLeaveLNN, void (AuthHandle));
MOCK_METHOD3(SoftbusGetConfig, int (ConfigType, unsigned char *, uint32_t));
MOCK_METHOD3(SoftbusGetConfig, int32_t (ConfigType, unsigned char *, uint32_t));
MOCK_METHOD2(LnnSetLocalStrInfo, int32_t (InfoKey, const char *));
MOCK_METHOD2(LnnSetLocalNumInfo, int32_t (InfoKey, int32_t));
MOCK_METHOD3(LnnGetLocalStrInfo, int32_t (InfoKey, char *, uint32_t));

View File

@ -80,7 +80,7 @@ public:
virtual void LnnRemoveNode(const char *udid) = 0;
virtual int32_t LnnGetNetworkIdByBtMac(const char *btMac, char *buf, uint32_t len) = 0;
virtual int32_t LnnSetLocalNum64Info(InfoKey key, int64_t info) = 0;
virtual int32_t LnnGetNodeKeyInfo(const char *networkId, int key, uint8_t *info, uint32_t infoLen) = 0;
virtual int32_t LnnGetNodeKeyInfo(const char *networkId, int32_t key, uint8_t *info, uint32_t infoLen) = 0;
virtual int32_t LnnGetRemoteNumInfo(const char *netWorkId, InfoKey key, int32_t *info) = 0;
virtual int32_t LnnGetLocalDeviceInfo(NodeBasicInfo *info) = 0;
virtual int32_t LnnGetLocalByteInfo(InfoKey key, uint8_t *info, uint32_t len) = 0;

View File

@ -91,7 +91,7 @@ public:
virtual void LnnNotifyLocalNetworkIdChanged(void);
virtual int32_t LnnGetSettingNickName(const char *defaultName,
const char *unifiedName, char *nickName, uint32_t len);
virtual int SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len) = 0;
virtual int32_t SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len) = 0;
virtual int32_t LnnSubscribeAccountBootEvent(AccountEventHandle handle) = 0;
};
@ -140,7 +140,7 @@ public:
MOCK_METHOD1(LnnSetLocalUnifiedName, int32_t (const char *));
MOCK_METHOD0(LnnNotifyLocalNetworkIdChanged, void ());
MOCK_METHOD4(LnnGetSettingNickName, int32_t (const char *, const char *, char *, uint32_t));
MOCK_METHOD3(SoftbusGetConfig, int (ConfigType, unsigned char *, uint32_t));
MOCK_METHOD3(SoftbusGetConfig, int32_t (ConfigType, unsigned char *, uint32_t));
MOCK_METHOD1(LnnSubscribeAccountBootEvent, int32_t (AccountEventHandle handle));
static int32_t ActionOfLnnRegisterEventHandler(LnnEventType event, LnnEventHandler handler);
static int32_t ActionOfLnnInitGetDeviceName(LnnDeviceNameHandler handler);

View File

@ -98,7 +98,7 @@ void AuthHandleLeaveLNN(AuthHandle authHandle)
return GetNetBuilderDepsInterface()->AuthHandleLeaveLNN(authHandle);
}
int SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len)
int32_t SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len)
{
return GetNetBuilderDepsInterface()->SoftbusGetConfig(type, val, len);
}
@ -178,7 +178,7 @@ bool AddStringToJsonObject(cJSON *json, const char * const string, const char *v
return GetNetBuilderDepsInterface()->AddStringToJsonObject(json, string, value);
}
bool AddNumberToJsonObject(cJSON *json, const char * const string, int num)
bool AddNumberToJsonObject(cJSON *json, const char * const string, int32_t num)
{
return GetNetBuilderDepsInterface()->AddNumberToJsonObject(json, string, num);
}
@ -286,7 +286,7 @@ int32_t LnnAsyncCallbackDelayHelper(SoftBusLooper *looper, LnnAsyncCallbackFunc
return GetNetBuilderDepsInterface()->LnnAsyncCallbackDelayHelper(looper, callback, para, delayMillis);
}
SoftBusLooper *GetLooper(int looper)
SoftBusLooper *GetLooper(int32_t looper)
{
return GetNetBuilderDepsInterface()->GetLooper(looper);
}

View File

@ -98,7 +98,7 @@ void AuthHandleLeaveLNN(AuthHandle authHandle)
return GetNetBuilderDepsInterface()->AuthHandleLeaveLNN(authHandle);
}
int SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len)
int32_t SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len)
{
return GetNetBuilderDepsInterface()->SoftbusGetConfig(type, val, len);
}
@ -178,7 +178,7 @@ bool AddStringToJsonObject(cJSON *json, const char * const string, const char *v
return GetNetBuilderDepsInterface()->AddStringToJsonObject(json, string, value);
}
bool AddNumberToJsonObject(cJSON *json, const char * const string, int num)
bool AddNumberToJsonObject(cJSON *json, const char * const string, int32_t num)
{
return GetNetBuilderDepsInterface()->AddNumberToJsonObject(json, string, num);
}
@ -286,7 +286,7 @@ int32_t LnnAsyncCallbackDelayHelper(SoftBusLooper *looper, LnnAsyncCallbackFunc
return GetNetBuilderDepsInterface()->LnnAsyncCallbackDelayHelper(looper, callback, para, delayMillis);
}
SoftBusLooper *GetLooper(int looper)
SoftBusLooper *GetLooper(int32_t looper)
{
return GetNetBuilderDepsInterface()->GetLooper(looper);
}

View File

@ -41,7 +41,7 @@ void LnnNotifyDeviceVerified(const char *udid)
return GetLnnConnInterface()->LnnNotifyDeviceVerified(udid);
}
int SoftBusGetBtState(void)
int32_t SoftBusGetBtState(void)
{
return GetLnnConnInterface()->SoftBusGetBtState();
}

View File

@ -117,7 +117,7 @@ void AuthHandleLeaveLNN(AuthHandle authHandle)
return GetNetBuilderDepsInterface()->AuthHandleLeaveLNN(authHandle);
}
int SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len)
int32_t SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len)
{
return GetNetBuilderDepsInterface()->SoftbusGetConfig(type, val, len);
}
@ -197,7 +197,7 @@ bool AddStringToJsonObject(cJSON *json, const char * const string, const char *v
return GetNetBuilderDepsInterface()->AddStringToJsonObject(json, string, value);
}
bool AddNumberToJsonObject(cJSON *json, const char * const string, int num)
bool AddNumberToJsonObject(cJSON *json, const char * const string, int32_t num)
{
return GetNetBuilderDepsInterface()->AddNumberToJsonObject(json, string, num);
}
@ -305,7 +305,7 @@ int32_t LnnAsyncCallbackDelayHelper(SoftBusLooper *looper, LnnAsyncCallbackFunc
return GetNetBuilderDepsInterface()->LnnAsyncCallbackDelayHelper(looper, callback, para, delayMillis);
}
SoftBusLooper *GetLooper(int looper)
SoftBusLooper *GetLooper(int32_t looper)
{
return GetNetBuilderDepsInterface()->GetLooper(looper);
}

View File

@ -468,7 +468,7 @@ int32_t LnnSetLocalNum64Info(InfoKey key, int64_t info)
return GetNetLedgerInterface()->LnnSetLocalNum64Info(key, info);
}
int32_t LnnGetNodeKeyInfo(const char *networkId, int key, uint8_t *info, uint32_t infoLen)
int32_t LnnGetNodeKeyInfo(const char *networkId, int32_t key, uint8_t *info, uint32_t infoLen)
{
return GetNetLedgerInterface()->LnnGetNodeKeyInfo(networkId, key, info, infoLen);
}

View File

@ -250,7 +250,7 @@ int32_t LnnGetSettingNickName(const char *defaultName, const char *unifiedName,
return GetServiceInterface()->LnnGetSettingNickName(defaultName, unifiedName, nickName, len);
}
int SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len)
int32_t SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len)
{
return GetServiceInterface()->SoftbusGetConfig(type, val, len);
}

View File

@ -132,7 +132,7 @@ HWTEST_F(LNNTopoManagerTest, LNN_INIT_TOPO_MANAGER_TEST_001, TestSize.Level1)
HWTEST_F(LNNTopoManagerTest, LNN_GET_RELATION_TEST_001, TestSize.Level1)
{
uint8_t relation[CONNECTION_ADDR_MAX + 1] = { 0 };
int ret = LnnGetRelation(UDID, PEER_UDID, relation, CONNECTION_ADDR_MAX + 1);
int32_t ret = LnnGetRelation(UDID, PEER_UDID, relation, CONNECTION_ADDR_MAX + 1);
EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
ret = LnnGetRelation(nullptr, PEER_UDID, relation, CONNECTION_ADDR_MAX);
EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);

View File

@ -59,12 +59,12 @@ int32_t LnnRequestLeaveByAddrType(const bool *type, uint32_t typeLen)
return GetLnnBtNetworkImplInterface()->LnnRequestLeaveByAddrType(type, typeLen);
}
int SoftBusGetBtState(void)
int32_t SoftBusGetBtState(void)
{
return GetLnnBtNetworkImplInterface()->SoftBusGetBtState();
}
int SoftBusGetBtMacAddr(SoftBusBtAddr *mac)
int32_t SoftBusGetBtMacAddr(SoftBusBtAddr *mac)
{
return GetLnnBtNetworkImplInterface()->SoftBusGetBtMacAddr(mac);
}

View File

@ -33,8 +33,8 @@ public:
virtual ~LnnBtNetworkImplInterface() {};
virtual int32_t LnnRequestLeaveSpecific(const char *networkId, ConnectionAddrType addrType) = 0;
virtual int32_t LnnRequestLeaveByAddrType(const bool *type, uint32_t typeLen) = 0;
virtual int SoftBusGetBtState(void) = 0;
virtual int SoftBusGetBtMacAddr(SoftBusBtAddr *mac) = 0;
virtual int32_t SoftBusGetBtState(void) = 0;
virtual int32_t SoftBusGetBtMacAddr(SoftBusBtAddr *mac) = 0;
virtual int32_t ConvertBtMacToStr(char *strMac, uint32_t strMacLen, const uint8_t *binMac, uint32_t binMacLen) = 0;
virtual int32_t LnnRegisterEventHandler(LnnEventType event, LnnEventHandler handler) = 0;
virtual int32_t LnnGetNetIfTypeByName(const char *ifName, LnnNetIfType *type) = 0;
@ -49,8 +49,8 @@ public:
~LnnBtNetworkImplInterfaceMock() override;
MOCK_METHOD2(LnnRequestLeaveSpecific, int32_t (const char *, ConnectionAddrType));
MOCK_METHOD2(LnnRequestLeaveByAddrType, int32_t (const bool *, uint32_t));
MOCK_METHOD0(SoftBusGetBtState, int (void));
MOCK_METHOD1(SoftBusGetBtMacAddr, int (SoftBusBtAddr *));
MOCK_METHOD0(SoftBusGetBtState, int32_t (void));
MOCK_METHOD1(SoftBusGetBtMacAddr, int32_t (SoftBusBtAddr *));
MOCK_METHOD4(ConvertBtMacToStr, int32_t (char *, uint32_t, const uint8_t *, uint32_t));
MOCK_METHOD2(LnnRegisterEventHandler, int32_t (LnnEventType, LnnEventHandler));
MOCK_METHOD2(LnnGetNetIfTypeByName, int32_t (const char *, LnnNetIfType *));

View File

@ -71,7 +71,7 @@ HWTEST_F(LNNBtNetworkImplMockTest, LNN_BT_NETWORK_IMPL_TEST_001, TestSize.Level1
NiceMock<LnnBtNetworkImplInterfaceMock> btMock;
EXPECT_CALL(btMock, LnnRegisterEventHandler(_, _)).WillOnce(Return(SOFTBUS_ERR)).
WillRepeatedly(Return(SOFTBUS_OK));
int ret = LnnInitBtProtocol(nullptr);
int32_t ret = LnnInitBtProtocol(nullptr);
EXPECT_TRUE(ret == SOFTBUS_ERR);
ret = LnnInitBtProtocol(nullptr);
EXPECT_TRUE(ret == SOFTBUS_OK);
@ -149,7 +149,7 @@ HWTEST_F(LNNBtNetworkImplMockTest, LNN_BT_NETWORK_IMPL_TEST_004, TestSize.Level1
LnnNetIfMgr netifMgr = {
.ifName = "name",
};
int ret = LnnEnableBtProtocol(&self, nullptr);
int32_t ret = LnnEnableBtProtocol(&self, nullptr);
EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM);
ret = LnnEnableBtProtocol(&self, &netifMgr);
EXPECT_TRUE(ret == SOFTBUS_ERR);
@ -227,7 +227,7 @@ HWTEST_F(LNNBtNetworkImplMockTest, LNN_BT_NETWORK_IMPL_TEST_007, TestSize.Level1
EXPECT_CALL(btMock, SoftBusGetBtMacAddr).WillOnce(Return(SOFTBUS_ERR)).WillRepeatedly(Return(SOFTBUS_OK));
EXPECT_CALL(btMock, ConvertBtMacToStr).WillOnce(Return(SOFTBUS_ERR)).WillRepeatedly(Return(SOFTBUS_OK));
int ret = GetAvailableBtMac(macStr, NETWORK_ID_BUF_LEN);
int32_t ret = GetAvailableBtMac(macStr, NETWORK_ID_BUF_LEN);
EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM);
ret = GetAvailableBtMac(macStr, BT_MAC_LEN);

View File

@ -92,7 +92,7 @@ HWTEST_F(LNNIpNetworkImplMockTest, LNN_IP_NETWORK_IMPL_TEST_001, TestSize.Level1
memset_s(&self, sizeof(LnnProtocolManager), 0, sizeof(LnnProtocolManager));
memset_s(&netifMgr, sizeof(LnnNetIfMgr), 0, sizeof(LnnNetIfMgr));
strcpy_s(netifMgr.ifName, sizeof("name"), "name");
int res = LnnEnableIpProtocol(nullptr, nullptr);
int32_t res = LnnEnableIpProtocol(nullptr, nullptr);
EXPECT_TRUE(res == SOFTBUS_ERR);
res = LnnEnableIpProtocol(&self, &netifMgr);
EXPECT_TRUE(res == SOFTBUS_ERR);
@ -165,7 +165,7 @@ HWTEST_F(LNNIpNetworkImplMockTest, LNN_IP_NETWORK_IMPL_TEST_003, TestSize.Level1
NiceMock<LnnIpNetworkImplInterfaceMock> ipMock;
NiceMock<LnnNetLedgertInterfaceMock> ledgerMock;
EXPECT_CALL(ipMock, GetNetworkIpByIfName).WillOnce(Return(SOFTBUS_ERR)).WillRepeatedly(Return(SOFTBUS_OK));
int ret = GetAvailableIpAddr(IFNAME_TEST0, const_cast<char *>(WLAN_IP1), SIZE);
int32_t ret = GetAvailableIpAddr(IFNAME_TEST0, const_cast<char *>(WLAN_IP1), SIZE);
EXPECT_TRUE(ret == SOFTBUS_ERR);
ret = GetAvailableIpAddr(IFNAME_TEST1, const_cast<char *>(WLAN_IP2), SIZE);
EXPECT_TRUE(ret == SOFTBUS_OK);
@ -199,7 +199,7 @@ HWTEST_F(LNNIpNetworkImplMockTest, LNN_IP_NETWORK_IMPL_TEST_004, TestSize.Level1
EXPECT_CALL(ledgerMock, LnnGetLocalStrInfo).WillOnce(Return(SOFTBUS_ERR)).
WillRepeatedly(LnnNetLedgertInterfaceMock::ActionOfLnnGetLocalStrInfo2);
EXPECT_CALL(ledgerMock, LnnSetLocalStrInfo).WillOnce(Return(SOFTBUS_ERR)).WillRepeatedly(Return(SOFTBUS_OK));
int ret = RequestMainPort("lo", "127.0.0.1");
int32_t ret = RequestMainPort("lo", "127.0.0.1");
EXPECT_TRUE(ret == SOFTBUS_ERR);
ret = RequestMainPort("lol", "127.0.0.1");
EXPECT_TRUE(ret == SOFTBUS_ERR);
@ -251,7 +251,7 @@ HWTEST_F(LNNIpNetworkImplMockTest, LNN_IP_NETWORK_IMPL_TEST_005, TestSize.Level1
EXPECT_CALL(ledgerMock, LnnGetLocalStrInfo).WillOnce(Return(SOFTBUS_ERR)).
WillRepeatedly(LnnNetLedgertInterfaceMock::ActionOfLnnGetLocalStrInfo2);
EXPECT_CALL(ledgerMock, LnnSetLocalStrInfo).WillOnce(Return(SOFTBUS_ERR)).WillRepeatedly(Return(SOFTBUS_OK));
int ret = ReleaseMainPort("deviceName");
int32_t ret = ReleaseMainPort("deviceName");
EXPECT_TRUE(ret == SOFTBUS_ERR);
ret = ReleaseMainPort("deviceName1");
EXPECT_TRUE(ret == SOFTBUS_ERR);

View File

@ -61,7 +61,7 @@ int32_t LnnStartDiscovery(void)
return GetNetworkManagerInterface()->LnnStartDiscovery();
}
int SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len)
int32_t SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len)
{
return GetNetworkManagerInterface()->SoftbusGetConfig(type, val, len);
}

View File

@ -40,7 +40,7 @@ public:
virtual void LnnOnOhosAccountChanged(void) =0;
virtual void LnnStopDiscovery(void) = 0;
virtual int32_t LnnStartDiscovery(void) = 0;
virtual int SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len) = 0;
virtual int32_t SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len) = 0;
virtual void DiscLinkStatusChanged(LinkStatus status, ExchangeMedium medium) = 0;
virtual void LnnStopPublish(void) = 0;
virtual int32_t LnnStartPublish(void) = 0;
@ -68,7 +68,7 @@ public:
MOCK_METHOD0(LnnOnOhosAccountChanged, void (void));
MOCK_METHOD0(LnnStopDiscovery, void (void));
MOCK_METHOD0(LnnStartDiscovery, int32_t (void));
MOCK_METHOD3(SoftbusGetConfig, int (ConfigType, unsigned char *, uint32_t));
MOCK_METHOD3(SoftbusGetConfig, int32_t (ConfigType, unsigned char *, uint32_t));
MOCK_METHOD2(DiscLinkStatusChanged, void (LinkStatus, ExchangeMedium));
MOCK_METHOD0(LnnStopPublish, void (void));
MOCK_METHOD0(LnnStartPublish, int32_t (void));

View File

@ -125,7 +125,7 @@ HWTEST_F(LNNNetworkManagerMockTest, LNN_NETWORK_MANAGER_TEST_001, TestSize.Level
EXPECT_CALL(ledgerMock, LnnSetLocalNum64Info).WillOnce(Return(SOFTBUS_ERR)).
WillRepeatedly(Return(SOFTBUS_OK));
EXPECT_CALL(managerMock, LnnRegisterEventHandler).WillRepeatedly(Return(SOFTBUS_OK));
int ret = LnnInitNetworkManager();
int32_t ret = LnnInitNetworkManager();
EXPECT_TRUE(ret != SOFTBUS_OK);
ret = LnnInitNetworkManager();
EXPECT_TRUE(ret != SOFTBUS_OK);
@ -180,7 +180,7 @@ HWTEST_F(LNNNetworkManagerMockTest, LNN_NETWORK_MANAGER_TEST_003, TestSize.Level
{
NiceMock<LnnNetworkManagerInterfaceMock> managerMock;
EXPECT_CALL(managerMock, SoftbusGetConfig).WillRepeatedly(Return(SOFTBUS_OK));
int ret = LnnRegistProtocol(nullptr);
int32_t ret = LnnRegistProtocol(nullptr);
EXPECT_TRUE(ret != SOFTBUS_OK);
LnnProtocolManager protocolMgr;
@ -233,7 +233,7 @@ HWTEST_F(LNNNetworkManagerMockTest, LNN_NETWORK_MANAGER_TEST_003, TestSize.Level
*/
HWTEST_F(LNNNetworkManagerMockTest, LNN_NETWORK_MANAGER_TEST_004, TestSize.Level1)
{
int len = 0;
int32_t len = 0;
char buf[] = "nullptr";
NiceMock<LnnNetworkManagerInterfaceMock> managerMock;
NiceMock<LnnNetLedgertInterfaceMock> ledgerMock;
@ -246,7 +246,7 @@ HWTEST_F(LNNNetworkManagerMockTest, LNN_NETWORK_MANAGER_TEST_004, TestSize.Level
EXPECT_TRUE(ret == false);
EXPECT_CALL(managerMock, SoftbusGetConfig).WillRepeatedly(Return(SOFTBUS_OK));
int res = LnnInitManagerByConfig();
int32_t res = LnnInitManagerByConfig();
EXPECT_TRUE(res != SOFTBUS_OK);
EXPECT_CALL(managerMock, SoftbusGetConfig).WillRepeatedly(Return(SOFTBUS_ERR));

View File

@ -75,7 +75,7 @@ HWTEST_F(LNNPhysicalSubnetManagerTest, LNN_REGIST_PHYSICAL_SUBNET_001, TestSize.
HWTEST_F(LNNPhysicalSubnetManagerTest, LNN_REGIST_PHYSICAL_SUBNET_002, TestSize.Level1)
{
int32_t ret = SOFTBUS_OK;
for (int i = 0; i <= 6; i++)
for (int32_t i = 0; i <= 6; i++)
{
LnnProtocolManager lnnProtocolManager = {
.id = LNN_PROTOCOL_IP,

View File

@ -116,7 +116,7 @@ int32_t UpdateDbPassword(DbContext *ctx, const uint8_t *password, uint32_t len)
return GetDecisionDbDepsInterface()->UpdateDbPassword(ctx, password, len);
}
int32_t QueryRecordByKey(DbContext *ctx, TableNameID id, uint8_t *data, uint8_t **replyInfo, int infoNum)
int32_t QueryRecordByKey(DbContext *ctx, TableNameID id, uint8_t *data, uint8_t **replyInfo, int32_t infoNum)
{
return GetDecisionDbDepsInterface()->QueryRecordByKey(ctx, id, data, replyInfo, infoNum);
}

View File

@ -55,7 +55,8 @@ public:
virtual int32_t GetRecordNumByKey(DbContext *ctx, TableNameID id, uint8_t *data);
virtual int32_t EncryptedDb(DbContext *ctx, const uint8_t *password, uint32_t len);
virtual int32_t UpdateDbPassword(DbContext *ctx, const uint8_t *password, uint32_t len);
virtual int32_t QueryRecordByKey(DbContext *ctx, TableNameID id, uint8_t *data, uint8_t **replyInfo, int infoNum);
virtual int32_t QueryRecordByKey(DbContext *ctx, TableNameID id, uint8_t *data,
uint8_t **replyInfo, int32_t infoNum);
virtual int32_t LnnGetFullStoragePath(LnnFileId id, char *path, uint32_t len);
virtual int32_t SoftBusReadFullFile(const char *fileName, char *readBuf, uint32_t maxLen);
virtual int32_t SoftBusWriteFile(const char *fileName, const char *writeBuf, uint32_t len);

View File

@ -143,12 +143,12 @@ int32_t GetDeviceSecurityLevel(int32_t *level)
return GetLocalLedgerDepsInterface()->GetDeviceSecurityLevel(level);
}
int SoftBusGetBtState(void)
int32_t SoftBusGetBtState(void)
{
return GetLocalLedgerDepsInterface()->SoftBusGetBtState();
}
int SoftBusGetBtMacAddr(SoftBusBtAddr *mac)
int32_t SoftBusGetBtMacAddr(SoftBusBtAddr *mac)
{
return GetLocalLedgerDepsInterface()->SoftBusGetBtMacAddr(mac);
}

View File

@ -48,8 +48,8 @@ public:
virtual int32_t GetCommonOsVersion(char *value, uint32_t len);
virtual int32_t GetCommonDeviceVersion(char *value, uint32_t len);
virtual int32_t GetDeviceSecurityLevel(int32_t *level);
virtual int SoftBusGetBtState(void) = 0;
virtual int SoftBusGetBtMacAddr(SoftBusBtAddr *mac) = 0;
virtual int32_t SoftBusGetBtState(void) = 0;
virtual int32_t SoftBusGetBtMacAddr(SoftBusBtAddr *mac) = 0;
};
class LocalLedgerDepsInterfaceMock : public LocalLedgerDepsInterface {
public:
@ -67,8 +67,8 @@ public:
MOCK_METHOD2(GetCommonOsVersion, int32_t (char *, uint32_t));
MOCK_METHOD2(GetCommonDeviceVersion, int32_t (char *, uint32_t));
MOCK_METHOD1(GetDeviceSecurityLevel, int32_t (int32_t *));
MOCK_METHOD0(SoftBusGetBtState, int (void));
MOCK_METHOD1(SoftBusGetBtMacAddr, int (SoftBusBtAddr *));
MOCK_METHOD0(SoftBusGetBtState, int32_t (void));
MOCK_METHOD1(SoftBusGetBtMacAddr, int32_t (SoftBusBtAddr *));
static int32_t LedgerGetCommonDevInfo(const CommonDeviceKey key, char *value, uint32_t len);
static int32_t LedgerSoftBusRegBusCenterVarDump(char *dumpVar, SoftBusVarDumpCb cb);

View File

@ -110,7 +110,7 @@ static void ConstructRemoteNode(void)
LnnSetNetCapability(&cap, BIT_WIFI_24G);
LnnSetNetCapability(&cap, BIT_WIFI_5G);
g_nodeInfo.netCapacity = cap;
int ret = strncpy_s(g_nodeInfo.networkId, NETWORK_ID_BUF_LEN, NODE_NETWORK_ID, strlen(NODE_NETWORK_ID));
int32_t ret = strncpy_s(g_nodeInfo.networkId, NETWORK_ID_BUF_LEN, NODE_NETWORK_ID, strlen(NODE_NETWORK_ID));
EXPECT_TRUE(ret == EOK);
ret = LnnSetDeviceUdid(&g_nodeInfo, NODE_UDID);
EXPECT_TRUE(ret == SOFTBUS_OK);

View File

@ -238,7 +238,7 @@ static void GetWiFiLocalInfo(void)
*/
HWTEST_F(LedgerLaneHubTest, SOFTBUS_DUMP_PRINT_NET_CAPACITY_Test_001, TestSize.Level1)
{
int fd = 0;
int32_t fd = 0;
NodeBasicInfo nodeInfo;
(void)memset_s(&nodeInfo, sizeof(NodeBasicInfo), 0, sizeof(NodeBasicInfo));
@ -261,7 +261,7 @@ HWTEST_F(LedgerLaneHubTest, SOFTBUS_DUMP_PRINT_NET_CAPACITY_Test_001, TestSize.L
*/
HWTEST_F(LedgerLaneHubTest, SOFTBUS_DUMP_PRINT_NET_TYPE_Test_001, TestSize.Level1)
{
int fd = 0;
int32_t fd = 0;
NodeBasicInfo nodeInfo;
(void)memset_s(&nodeInfo, sizeof(NodeBasicInfo), 0, sizeof(NodeBasicInfo));
@ -427,7 +427,7 @@ HWTEST_F(LedgerLaneHubTest, LEDGER_DistributedLedgerChangeName_Test_001, TestSiz
bool result = LnnSetDLDeviceInfoName(NODE2_UDID, CHANGE_DEVICE_NAME);
EXPECT_TRUE(result);
// STRING_KEY_DEV_NAME
int ret = LnnGetRemoteStrInfo(NODE2_NETWORK_ID, STRING_KEY_DEV_NAME, deviceName, DEVICE_NAME_BUF_LEN);
int32_t ret = LnnGetRemoteStrInfo(NODE2_NETWORK_ID, STRING_KEY_DEV_NAME, deviceName, DEVICE_NAME_BUF_LEN);
EXPECT_TRUE(ret == SOFTBUS_OK);
EXPECT_TRUE(strcmp(deviceName, CHANGE_DEVICE_NAME) == 0);
LnnRemoveNode(NODE2_UDID);

View File

@ -48,7 +48,7 @@
namespace OHOS {
using namespace testing::ext;
static int InitServer()
static int32_t InitServer()
{
if (ConnServerInit() == SOFTBUS_ERR) {
printf("softbus conn server init failed.");
@ -109,9 +109,9 @@ void NetBusCenterTest::TearDown()
{
}
static int SetIpaddr(const std::string &ip)
static int32_t SetIpaddr(const std::string &ip)
{
int sockFd = -1;
int32_t sockFd = -1;
struct sockaddr_in addr;
struct ifreq ifr;
if (memset_s((void *)&addr, sizeof(addr), 0, sizeof(addr)) != EOK) {
@ -157,9 +157,9 @@ static int SetIpaddr(const std::string &ip)
return SOFTBUS_OK;
}
static int SetIpDown()
static int32_t SetIpDown()
{
int sockFd = -1;
int32_t sockFd = -1;
struct ifreq ifr;
if (memset_s((void *)&ifr, sizeof(ifr), 0, sizeof(ifr)) != EOK) {
printf("memset_s 1 fail\n");

View File

@ -53,11 +53,11 @@ public:
int32_t osAccountId, int64_t authReqId, const char *authParams, const DeviceAuthCallback *gaCallback);
static int32_t InvokeDataChangeListener(const char *appId, const DataChangeListener *listener);
static int32_t InvokeGetJoinedGroups1(
int32_t osAccountId, const char *appId, int groupType, char **returnGroupVec, uint32_t *groupNum);
int32_t osAccountId, const char *appId, int32_t groupType, char **returnGroupVec, uint32_t *groupNum);
static int32_t InvokeGetJoinedGroups2(
int32_t osAccountId, const char *appId, int groupType, char **returnGroupVec, uint32_t *groupNum);
int32_t osAccountId, const char *appId, int32_t groupType, char **returnGroupVec, uint32_t *groupNum);
static int32_t InvokeGetJoinedGroups3(
int32_t osAccountId, const char *appId, int groupType, char **returnGroupVec, uint32_t *groupNum);
int32_t osAccountId, const char *appId, int32_t groupType, char **returnGroupVec, uint32_t *groupNum);
static int32_t ActionofunRegDataChangeListener(const char *appId);
static int32_t ActionOfProcessData(
int64_t authSeq, const uint8_t *data, uint32_t len, const DeviceAuthCallback *gaCallback);

View File

@ -27,7 +27,7 @@ public:
LnnTransInterface() {};
virtual ~LnnTransInterface() {};
virtual int TransRegisterNetworkingChannelListener(const INetworkingListener *listener) = 0;
virtual int32_t TransRegisterNetworkingChannelListener(const INetworkingListener *listener) = 0;
virtual int32_t TransOpenNetWorkingChannel(const char *sessionName, const char *peerNetworkId) = 0;
virtual int32_t TransSendNetworkingMessage(
int32_t channelId, const char *data, uint32_t dataLen, int32_t priority) = 0;

View File

@ -54,8 +54,8 @@ public:
virtual int32_t LnnAsyncCallbackHelper(SoftBusLooper *looper, LnnAsyncCallbackFunc callback, void *para) = 0;
virtual void LnnNotifyBtAclStateChangeEvent(const char *btMac, SoftBusBtAclState state) = 0;
virtual int32_t ConvertBtMacToStr(char *strMac, uint32_t strMacLen, const uint8_t *binMac, uint32_t binMacLen) = 0;
virtual int SoftBusAddBtStateListener(const SoftBusBtStateListener *listener) = 0;
virtual int SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len) = 0;
virtual int32_t SoftBusAddBtStateListener(const SoftBusBtStateListener *listener) = 0;
virtual int32_t SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len) = 0;
virtual void LnnNotifyBtStateChangeEvent(void *state) = 0;
};
class NetworkInterfaceMock : public NetworkInterface {

View File

@ -36,10 +36,10 @@ public:
virtual WifiErrorCode RegisterWifiEvent(WifiEvent *event) = 0;
virtual WifiErrorCode GetScanInfoList(WifiScanInfo *result, unsigned int *size) = 0;
virtual WifiErrorCode UnRegisterWifiEvent(WifiEvent *event) = 0;
virtual WifiErrorCode Hid2dGetChannelListFor5G(int *chanList, int len) = 0;
virtual WifiErrorCode Hid2dGetChannelListFor5G(int32_t *chanList, int32_t len) = 0;
virtual WifiErrorCode GetLinkedInfo(WifiLinkedInfo *info) = 0;
virtual WifiErrorCode GetCurrentGroup(WifiP2pGroupInfo* groupInfo) = 0;
virtual int IsWifiActive(void) = 0;
virtual int32_t IsWifiActive(void) = 0;
virtual WifiErrorCode GetWifiDetailState(WifiDetailState *state) = 0;
virtual WifiErrorCode GetP2pEnableStatus(P2pState *state) = 0;
};
@ -54,7 +54,7 @@ public:
MOCK_METHOD1(RegisterWifiEvent, WifiErrorCode(WifiEvent *));
MOCK_METHOD2(GetScanInfoList, WifiErrorCode(WifiScanInfo *, unsigned int *));
MOCK_METHOD1(UnRegisterWifiEvent, WifiErrorCode(WifiEvent *));
MOCK_METHOD2(Hid2dGetChannelListFor5G, WifiErrorCode(int *, int));
MOCK_METHOD2(Hid2dGetChannelListFor5G, WifiErrorCode(int32_t *, int));
MOCK_METHOD1(GetLinkedInfo, WifiErrorCode(WifiLinkedInfo *));
MOCK_METHOD1(GetCurrentGroup, WifiErrorCode(WifiP2pGroupInfo*));
MOCK_METHOD0(IsWifiActive, int(void));

View File

@ -111,7 +111,7 @@ int32_t LnnHichainInterfaceMock::InvokeDataChangeListener(const char *appId, con
return SOFTBUS_OK;
}
int32_t LnnHichainInterfaceMock::InvokeGetJoinedGroups1(int32_t osAccountId, const char *appId, int groupType,
int32_t LnnHichainInterfaceMock::InvokeGetJoinedGroups1(int32_t osAccountId, const char *appId, int32_t groupType,
char **returnGroupVec, uint32_t *groupNum)
{
(void)osAccountId;
@ -131,7 +131,7 @@ int32_t LnnHichainInterfaceMock::InvokeGetJoinedGroups1(int32_t osAccountId, con
return HC_SUCCESS;
}
int32_t LnnHichainInterfaceMock::InvokeGetJoinedGroups2(int32_t osAccountId, const char *appId, int groupType,
int32_t LnnHichainInterfaceMock::InvokeGetJoinedGroups2(int32_t osAccountId, const char *appId, int32_t groupType,
char **returnGroupVec, uint32_t *groupNum)
{
(void)osAccountId;
@ -143,7 +143,7 @@ int32_t LnnHichainInterfaceMock::InvokeGetJoinedGroups2(int32_t osAccountId, con
return HC_ERR_INVALID_PARAMS;
}
int32_t LnnHichainInterfaceMock::InvokeGetJoinedGroups3(int32_t osAccountId, const char *appId, int groupType,
int32_t LnnHichainInterfaceMock::InvokeGetJoinedGroups3(int32_t osAccountId, const char *appId, int32_t groupType,
char **returnGroupVec, uint32_t *groupNum)
{
(void)osAccountId;

View File

@ -39,7 +39,7 @@ static LnnTransInterfaceMock *GetTransInterface()
}
extern "C" {
int TransRegisterNetworkingChannelListener(const char *sessionName, const INetworkingListener *listener)
int32_t TransRegisterNetworkingChannelListener(const char *sessionName, const INetworkingListener *listener)
{
return GetTransInterface()->TransRegisterNetworkingChannelListener(listener);
}

View File

@ -83,12 +83,12 @@ void LnnNotifyBtAclStateChangeEvent(const char *btMac, SoftBusBtAclState state)
return GetNetworkInterface()->LnnNotifyBtAclStateChangeEvent(btMac, state);
}
int SoftBusAddBtStateListener(const SoftBusBtStateListener *listener)
int32_t SoftBusAddBtStateListener(const SoftBusBtStateListener *listener)
{
return GetNetworkInterface()->SoftBusAddBtStateListener(listener);
}
int SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len)
int32_t SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len)
{
return GetNetworkInterface()->SoftbusGetConfig(type, val, len);
}

View File

@ -68,7 +68,7 @@ WifiErrorCode UnRegisterWifiEvent(WifiEvent *event)
return GetWifiInterface()->UnRegisterWifiEvent(event);
}
WifiErrorCode Hid2dGetChannelListFor5G(int *chanList, int len)
WifiErrorCode Hid2dGetChannelListFor5G(int32_t *chanList, int32_t len)
{
return GetWifiInterface()->Hid2dGetChannelListFor5G(chanList, len);
}
@ -83,7 +83,7 @@ WifiErrorCode GetCurrentGroup(WifiP2pGroupInfo* groupInfo)
return GetWifiInterface()->GetCurrentGroup(groupInfo);
}
int IsWifiActive(void)
int32_t IsWifiActive(void)
{
return GetWifiInterface()->IsWifiActive();
}

View File

@ -177,7 +177,7 @@ bool LnnNotifySingleOffLineEventFuzzTest(const uint8_t* data, size_t size)
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::LnnNotifyOnlineStateFuzzTest(data, size);

View File

@ -42,7 +42,7 @@ bool GetWatchdogFlag(void)
return GetBusCenterManagerDepsInterface()->GetWatchdogFlag();
}
SoftBusLooper *GetLooper(int looper)
SoftBusLooper *GetLooper(int32_t looper)
{
return GetBusCenterManagerDepsInterface()->GetLooper(looper);
}

View File

@ -29,7 +29,7 @@ public:
virtual ~BusCenterManagerDepsInterface() {};
virtual bool GetWatchdogFlag(void) = 0;
virtual SoftBusLooper *GetLooper(int looper);
virtual SoftBusLooper *GetLooper(int32_t looper);
virtual SoftBusLooper *CreateNewLooper(const char *name);
virtual int32_t LnnInitNetLedger(void);
virtual int32_t LnnInitDecisionCenter(uint32_t version);

View File

@ -92,7 +92,7 @@ HWTEST_F(BusCenterManagerTest, BusCenterManagerTest002, TestSize.Level1)
{
NiceMock<BusCenterManagerDepsInterfaceMock> BusCenterManagerMock;
EXPECT_CALL(BusCenterManagerMock, CreateNewLooper(_)).WillOnce(Return(NULL));
int ret = LnnInitLnnLooper();
int32_t ret = LnnInitLnnLooper();
EXPECT_NE(ret, SOFTBUS_OK);
}
@ -106,7 +106,7 @@ HWTEST_F(BusCenterManagerTest, BusCenterManagerTest003, TestSize.Level1)
{
NiceMock<BusCenterManagerDepsInterfaceMock> BusCenterManagerMock;
EXPECT_CALL(BusCenterManagerMock, CreateNewLooper(_)).WillOnce(Return(NULL));
int ret = BusCenterServerInit();
int32_t ret = BusCenterServerInit();
EXPECT_NE(ret, SOFTBUS_OK);
}
@ -132,7 +132,7 @@ HWTEST_F(BusCenterManagerTest, BusCenterManagerTest004, TestSize.Level1)
EXPECT_CALL(BusCenterManagerMock, IsActiveOsAccountUnlocked()).WillOnce(Return(false));
EXPECT_CALL(BusCenterManagerMock, SoftBusRunPeriodicalTask(_, _, _, _)).WillOnce(Return());
EXPECT_CALL(BusCenterManagerMock, LnnInitLaneHub()).WillOnce(Return(SOFTBUS_ERR));
int ret = BusCenterServerInit();
int32_t ret = BusCenterServerInit();
EXPECT_NE(ret, SOFTBUS_OK);
}
@ -148,7 +148,7 @@ HWTEST_F(BusCenterManagerTest, BusCenterManagerTest005, TestSize.Level1)
SoftBusLooper loop;
EXPECT_CALL(BusCenterManagerMock, CreateNewLooper(_)).WillRepeatedly(Return(&loop));
EXPECT_CALL(BusCenterManagerMock, LnnInitNetLedger()).WillOnce(Return(SOFTBUS_ERR));
int ret = BusCenterServerInit();
int32_t ret = BusCenterServerInit();
EXPECT_NE(ret, SOFTBUS_OK);
EXPECT_CALL(BusCenterManagerMock, LnnInitNetLedger()).WillRepeatedly(Return(SOFTBUS_OK));
EXPECT_CALL(BusCenterManagerMock, LnnInitDecisionCenter(_)).WillOnce(Return(SOFTBUS_ERR));
@ -208,7 +208,7 @@ HWTEST_F(BusCenterManagerTest, BusCenterManagerTest006, TestSize.Level1)
.WillRepeatedly(Return());
EXPECT_CALL(BusCenterManagerMock, LnnInitLaneHub()).WillRepeatedly(Return(SOFTBUS_OK));
EXPECT_CALL(BusCenterManagerMock, LnnAsyncCallbackDelayHelper(_, _, _, _)).WillOnce(Return(SOFTBUS_ERR));
int ret = BusCenterServerInit();
int32_t ret = BusCenterServerInit();
EXPECT_NE(ret, SOFTBUS_OK);
EXPECT_CALL(BusCenterManagerMock, LnnInitDecisionCenter(_)).WillOnce(Return(SOFTBUS_OK));
EXPECT_CALL(BusCenterManagerMock, LnnAsyncCallbackDelayHelper(_, _, _, _)).WillRepeatedly(Return(SOFTBUS_OK));

View File

@ -247,7 +247,7 @@ HWTEST_F(HeartBeatMediumTest, HbUpdateOfflineTimingTest_01, TestSize.Level1)
ON_CALL(disLedgerMock, LnnSetDLHeartbeatTimestamp).WillByDefault(Return(SOFTBUS_OK));
ON_CALL(hbStrateMock, LnnStopOfflineTimingStrategy).WillByDefault(Return(SOFTBUS_OK));
ON_CALL(hbStrateMock, LnnStartOfflineTimingStrategy).WillByDefault(Return(SOFTBUS_OK));
int ret =
int32_t ret =
HbUpdateOfflineTimingByRecvInfo(TEST_NETWORK_ID, CONNECTION_ADDR_BR, HEARTBEAT_TYPE_BLE_V1, TEST_RECVTIME_LAST);
EXPECT_TRUE(ret == SOFTBUS_OK);
EXPECT_CALL(disLedgerMock, LnnSetDLHeartbeatTimestamp)
@ -317,7 +317,7 @@ HWTEST_F(HeartBeatMediumTest, HbMediumMgrRecvProcessTest_01, TestSize.Level1)
ON_CALL(hbStrateMock, LnnStartOfflineTimingStrategy).WillByDefault(Return(SOFTBUS_OK));
EXPECT_CALL(hbStrateMock, IsNeedAuthLimit).WillRepeatedly(Return(false));
EXPECT_CALL(hbStrateMock, IsExistLnnDfxNodeByUdidHash).WillRepeatedly(Return(true));
int ret = HbMediumMgrRecvProcess(&device, &mediumWeight, HEARTBEAT_TYPE_BLE_V1, false, &hbResp);
int32_t ret = HbMediumMgrRecvProcess(&device, &mediumWeight, HEARTBEAT_TYPE_BLE_V1, false, &hbResp);
EXPECT_TRUE(ret == SOFTBUS_NETWORK_NOT_CONNECTABLE);
HbFirstSaveRecvTime(&storedInfo, &device,
mediumWeight.weight, mediumWeight.localMasterWeight, TEST_RECVTIME_FIRST);
@ -487,7 +487,7 @@ HWTEST_F(HeartBeatMediumTest, VisitHbMediumMgrSendBegin_TEST01, TestSize.Level1)
LnnHbMediumMgrInit();
ret = VisitHbMediumMgrSendBegin(nullptr, HEARTBEAT_TYPE_BLE_V0, reinterpret_cast<void *>(&data));
EXPECT_FALSE(ret);
int id = LnnConvertHbTypeToId(HEARTBEAT_TYPE_BLE_V0);
int32_t id = LnnConvertHbTypeToId(HEARTBEAT_TYPE_BLE_V0);
g_hbMeidumMgr[id] = nullptr;
ret = VisitHbMediumMgrSendBegin(nullptr, HEARTBEAT_TYPE_BLE_V0, reinterpret_cast<void *>(&data));
EXPECT_TRUE(ret);
@ -538,7 +538,7 @@ HWTEST_F(HeartBeatMediumTest, VisitHbMediumMgrSendEnd_TEST01, TestSize.Level1)
.WillOnce(Return(SOFTBUS_ERR))
.WillRepeatedly(Return(SOFTBUS_OK));
LnnHbMediumMgrInit();
int id = LnnConvertHbTypeToId(HB_MAX_TYPE_COUNT + 1);
int32_t id = LnnConvertHbTypeToId(HB_MAX_TYPE_COUNT + 1);
ret = VisitHbMediumMgrSendEnd(nullptr, HEARTBEAT_TYPE_BLE_V0, static_cast<void *>(&num));
EXPECT_FALSE(ret);
id = LnnConvertHbTypeToId(HEARTBEAT_TYPE_BLE_V0);
@ -570,7 +570,7 @@ HWTEST_F(HeartBeatMediumTest, VisitHbMediumMgrStop_TEST01, TestSize.Level1)
};
bool ret = VisitHbMediumMgrStop(nullptr, HEARTBEAT_TYPE_MAX, nullptr);
EXPECT_FALSE(ret);
int id = LnnConvertHbTypeToId(HEARTBEAT_TYPE_BLE_V1);
int32_t id = LnnConvertHbTypeToId(HEARTBEAT_TYPE_BLE_V1);
g_hbMeidumMgr[id] = nullptr;
ret = VisitHbMediumMgrStop(nullptr, HEARTBEAT_TYPE_BLE_V1, nullptr);
EXPECT_TRUE(ret);
@ -593,7 +593,7 @@ HWTEST_F(HeartBeatMediumTest, VisitHbMediumMgrStop_TEST01, TestSize.Level1)
*/
HWTEST_F(HeartBeatMediumTest, LnnHbMediumMgrSetParam_TEST01, TestSize.Level1)
{
int id = LnnConvertHbTypeToId(HEARTBEAT_TYPE_BLE_V1);
int32_t id = LnnConvertHbTypeToId(HEARTBEAT_TYPE_BLE_V1);
int32_t ret = LnnHbMediumMgrSetParam(nullptr);
EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM);
LnnHeartbeatMediumParam param = {
@ -615,7 +615,7 @@ HWTEST_F(HeartBeatMediumTest, LnnHbMediumMgrSetParam_TEST01, TestSize.Level1)
*/
HWTEST_F(HeartBeatMediumTest, LnnHbMediumMgrUpdateSendInfo_TEST01, TestSize.Level1)
{
int id = LnnConvertHbTypeToId(HEARTBEAT_TYPE_BLE_V1);
int32_t id = LnnConvertHbTypeToId(HEARTBEAT_TYPE_BLE_V1);
int32_t ret = LnnHbMediumMgrUpdateSendInfo(UPDATE_HB_NETWORK_INFO);
EXPECT_TRUE(ret == SOFTBUS_ERR);
LnnHeartbeatMediumMgr medMgr1 = {

View File

@ -34,7 +34,7 @@ public:
virtual int32_t LnnGetAllOnlineNodeInfo(NodeBasicInfo **info, int32_t *infoNum) = 0;
virtual bool LnnIsLSANode(const NodeBasicInfo *info) = 0;
virtual int32_t LnnGetLocalDeviceInfo(NodeBasicInfo *info) = 0;
virtual int32_t LnnGetNodeKeyInfo(const char *networkId, int key, uint8_t *info, uint32_t infoLen) = 0;
virtual int32_t LnnGetNodeKeyInfo(const char *networkId, int32_t key, uint8_t *info, uint32_t infoLen) = 0;
virtual int32_t LnnSetNodeDataChangeFlag(const char *networkId, uint16_t dataChangeFlag) = 0;
virtual int32_t LnnStartTimeSync(const char *pkgName, int32_t callingPid, const char *targetNetworkId,
TimeSyncAccuracy accuracy, TimeSyncPeriod period) = 0;

View File

@ -62,7 +62,7 @@ int32_t LnnGetLocalDeviceInfo(NodeBasicInfo *info)
return BusCenterIpcInterfaceInstance()->LnnGetLocalDeviceInfo(info);
}
int32_t LnnGetNodeKeyInfo(const char *networkId, int key, uint8_t *info, uint32_t infoLen)
int32_t LnnGetNodeKeyInfo(const char *networkId, int32_t key, uint8_t *info, uint32_t infoLen)
{
return BusCenterIpcInterfaceInstance()->LnnGetNodeKeyInfo(networkId, key, info, infoLen);
}

View File

@ -18,7 +18,7 @@
#include <string>
#include "anonymizer.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
std::string str(reinterpret_cast<const char *>(data), size);

View File

@ -104,7 +104,7 @@ private:
};
} // anonymous namespace
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
static TestEnv env;
if (!env.IsInited()) {

View File

@ -105,19 +105,19 @@ HWTEST_F(HidumperTest, SoftBusHiDumperInitTest001, TestSize.Level1)
}
// -------------------------------------------broadcast------------------------------------------ //
static int32_t BroadcastVarTest1Dumper(int fd)
static int32_t BroadcastVarTest1Dumper(int32_t fd)
{
COMM_LOGI(COMM_TEST, "BroadcastVarTest1Dumper called, fd=%{public}d", fd);
return SOFTBUS_OK;
}
static int32_t BroadcastVarTest2Dumper(int fd)
static int32_t BroadcastVarTest2Dumper(int32_t fd)
{
COMM_LOGI(COMM_TEST, "BroadcastVarTest2Dumper called, fd=%{public}d", fd);
return SOFTBUS_OK;
}
static int32_t BroadcastVarTest3Dumper(int fd)
static int32_t BroadcastVarTest3Dumper(int32_t fd)
{
COMM_LOGI(COMM_TEST, "BroadcastVarTest3Dumper called, fd=%{public}d", fd);
return SOFTBUS_OK;
@ -138,7 +138,7 @@ HWTEST_F(HidumperTest, SoftBusRegBroadcastVarDump001, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusRegBroadcastVarDump001, Start");
int32_t ret;
for (int i = 0; i < HIDUMPER_VAR_CASE_NUM; i++) {
for (int32_t i = 0; i < HIDUMPER_VAR_CASE_NUM; i++) {
ret = SoftBusRegBroadcastVarDump(testBroadcastVarArray[i].varName, testBroadcastVarArray[i].dumpCallback);
EXPECT_EQ(SOFTBUS_OK, ret);
}
@ -189,19 +189,19 @@ HWTEST_F(HidumperTest, SoftBusRegBroadcastVarDump004, TestSize.Level1)
}
// -------------------------------------------------disc----------------------------------------- //
static int32_t DiscVarTest1Dumper(int fd)
static int32_t DiscVarTest1Dumper(int32_t fd)
{
COMM_LOGI(COMM_TEST, "DiscVarTest1Dumper called, fd=%{public}d", fd);
return SOFTBUS_OK;
}
static int32_t DiscVarTest2Dumper(int fd)
static int32_t DiscVarTest2Dumper(int32_t fd)
{
COMM_LOGI(COMM_TEST, "DiscVarTest2Dumper called, fd=%{public}d", fd);
return SOFTBUS_OK;
}
static int32_t DiscVarTest3Dumper(int fd)
static int32_t DiscVarTest3Dumper(int32_t fd)
{
COMM_LOGI(COMM_TEST, "DiscVarTest3Dumper called, fd=%{public}d", fd);
return SOFTBUS_OK;
@ -222,7 +222,7 @@ HWTEST_F(HidumperTest, SoftBusRegDiscVarDump001, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusRegDiscVarDump001, Start");
int32_t ret;
for (int i = 0; i < HIDUMPER_VAR_CASE_NUM; i++) {
for (int32_t i = 0; i < HIDUMPER_VAR_CASE_NUM; i++) {
ret = SoftBusRegDiscVarDump(testDiscVarArray[i].varName, testDiscVarArray[i].dumpCallback);
EXPECT_EQ(SOFTBUS_OK, ret);
}
@ -273,19 +273,19 @@ HWTEST_F(HidumperTest, SoftBusRegDiscVarDump004, TestSize.Level1)
}
// -------------------------------------------------conn-----------------------------------------//
static int32_t ConnVarTest1Dumper(int fd)
static int32_t ConnVarTest1Dumper(int32_t fd)
{
COMM_LOGI(COMM_TEST, "ConnVarTest1Dumper called, fd=%{public}d", fd);
return SOFTBUS_OK;
}
static int32_t ConnVarTest2Dumper(int fd)
static int32_t ConnVarTest2Dumper(int32_t fd)
{
COMM_LOGI(COMM_TEST, "ConnVarTest2Dumper called, fd=%{public}d", fd);
return SOFTBUS_OK;
}
static int32_t ConnVarTest3Dumper(int fd)
static int32_t ConnVarTest3Dumper(int32_t fd)
{
COMM_LOGI(COMM_TEST, "ConnVarTest3Dumper called, fd=%{public}d", fd);
return SOFTBUS_OK;
@ -306,7 +306,7 @@ HWTEST_F(HidumperTest, SoftBusRegConnVarDump001, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusRegConnVarDump001, Start");
int32_t ret;
for (int i = 0; i < HIDUMPER_VAR_CASE_NUM; i++) {
for (int32_t i = 0; i < HIDUMPER_VAR_CASE_NUM; i++) {
ret = SoftBusRegConnVarDump(testConnVarArray[i].varName, testConnVarArray[i].dumpCallback);
EXPECT_EQ(SOFTBUS_OK, ret);
}
@ -357,19 +357,19 @@ HWTEST_F(HidumperTest, SoftBusRegConnVarDump004, TestSize.Level1)
}
// -------------------------------------------------buscenter-----------------------------------------//
static int32_t LnnVarTest1Dumper(int fd)
static int32_t LnnVarTest1Dumper(int32_t fd)
{
COMM_LOGI(COMM_TEST, "LnnVarTest1Dumper called, fd=%{public}d", fd);
return SOFTBUS_OK;
}
static int32_t LnnVarTest2Dumper(int fd)
static int32_t LnnVarTest2Dumper(int32_t fd)
{
COMM_LOGI(COMM_TEST, "LnnVarTest2Dumper called, fd=%{public}d", fd);
return SOFTBUS_OK;
}
static int32_t LnnVarTest3Dumper(int fd)
static int32_t LnnVarTest3Dumper(int32_t fd)
{
COMM_LOGI(COMM_TEST, "LnnVarTest3Dumper called, fd=%{public}d", fd);
return SOFTBUS_OK;
@ -390,7 +390,7 @@ HWTEST_F(HidumperTest, SoftBusRegBusCenterVarDump001, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusRegDiscVarDump001, Start");
int32_t ret;
for (int i = 0; i < HIDUMPER_VAR_CASE_NUM; i++) {
for (int32_t i = 0; i < HIDUMPER_VAR_CASE_NUM; i++) {
ret = SoftBusRegBusCenterVarDump(testLnnVarArray[i].varName, testLnnVarArray[i].dumpCallback);
EXPECT_EQ(SOFTBUS_OK, ret);
}
@ -467,7 +467,7 @@ HWTEST_F(HidumperTest, SoftBusDumpProcess001, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusDumpProcess001, Start");
int32_t ret;
for (int i = 0; i < DISC_DUMP_PROCESS_VALID_TEST_NUM; i++) {
for (int32_t i = 0; i < DISC_DUMP_PROCESS_VALID_TEST_NUM; i++) {
ret = SoftBusDumpProcess(testValidDiscCmdArray[i].fd, testValidDiscCmdArray[i].argc,
testValidDiscCmdArray[i].argv);
EXPECT_EQ(SOFTBUS_OK, ret);
@ -494,7 +494,7 @@ HWTEST_F(HidumperTest, SoftBusDumpProcess002, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusDumpProcess002, Start");
int32_t ret;
for (int i = 0; i < DISC_DUMP_PROCESS_VALID_TEST_NUM; i++) {
for (int32_t i = 0; i < DISC_DUMP_PROCESS_VALID_TEST_NUM; i++) {
ret = SoftBusDumpProcess(testInvalidDiscCmdArray[i].fd, testInvalidDiscCmdArray[i].argc,
testInvalidDiscCmdArray[i].argv);
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
@ -522,7 +522,7 @@ HWTEST_F(HidumperTest, SoftBusDumpProcess003, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusDumpProcess003, Start");
int32_t ret;
for (int i = 0; i < CONN_DUMP_PROCESS_VALID_TEST_NUM; i++) {
for (int32_t i = 0; i < CONN_DUMP_PROCESS_VALID_TEST_NUM; i++) {
ret = SoftBusDumpProcess(testValidConnCmdArray[i].fd, testValidConnCmdArray[i].argc,
testValidConnCmdArray[i].argv);
EXPECT_EQ(SOFTBUS_OK, ret);
@ -547,7 +547,7 @@ HWTEST_F(HidumperTest, SoftBusDumpProcess004, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusDumpProcess004, Start");
int32_t ret;
for (int i = 0; i < CONN_DUMP_PROCESS_INVALID_TEST_NUM; i++) {
for (int32_t i = 0; i < CONN_DUMP_PROCESS_INVALID_TEST_NUM; i++) {
ret = SoftBusDumpProcess(testInValidConnCmdArray[i].fd, testInValidConnCmdArray[i].argc,
testInValidConnCmdArray[i].argv);
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
@ -575,7 +575,7 @@ HWTEST_F(HidumperTest, SoftBusDumpProcess005, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusDumpProcess005, Start");
int32_t ret;
for (int i = 0; i < BUSCENTER_DUMP_PROCESS_VALID_TEST_NUM; i++) {
for (int32_t i = 0; i < BUSCENTER_DUMP_PROCESS_VALID_TEST_NUM; i++) {
ret = SoftBusDumpProcess(testValiBusCenterCmdArray[i].fd, testValiBusCenterCmdArray[i].argc,
testValiBusCenterCmdArray[i].argv);
EXPECT_EQ(SOFTBUS_OK, ret);
@ -600,7 +600,7 @@ HWTEST_F(HidumperTest, SoftBusDumpProcess006, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusDumpProcess006, Start");
int32_t ret;
for (int i = 0; i < BUSCENTER_DUMP_PROCESS_INVALID_TEST_NUM; i++) {
for (int32_t i = 0; i < BUSCENTER_DUMP_PROCESS_INVALID_TEST_NUM; i++) {
ret = SoftBusDumpProcess(testInValidBusCenterCmdArray[i].fd, testInValidBusCenterCmdArray[i].argc,
testInValidBusCenterCmdArray[i].argv);
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
@ -626,7 +626,7 @@ HWTEST_F(HidumperTest, SoftBusDumpProcess007, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusDumpProcess007, Start");
int32_t ret;
for (int i = 0; i < NSTACK_DUMP_PROCESS_VALID_TEST_NUM; i++) {
for (int32_t i = 0; i < NSTACK_DUMP_PROCESS_VALID_TEST_NUM; i++) {
ret = SoftBusDumpProcess(testValidNstackCmdArray[i].fd, testValidNstackCmdArray[i].argc,
testValidNstackCmdArray[i].argv);
EXPECT_EQ(SOFTBUS_OK, ret);
@ -648,7 +648,7 @@ HWTEST_F(HidumperTest, SoftBusDumpProcess008, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusDumpProcess008, Start");
int32_t ret;
for (int i = 0; i < STATS_DUMP_PROCESS_VALID_TEST_NUM; i++) {
for (int32_t i = 0; i < STATS_DUMP_PROCESS_VALID_TEST_NUM; i++) {
ret = SoftBusDumpProcess(testValidStatsCmdArray[i].fd, testValidStatsCmdArray[i].argc,
testValidStatsCmdArray[i].argv);
EXPECT_EQ(SOFTBUS_OK, ret);
@ -672,7 +672,7 @@ HWTEST_F(HidumperTest, SoftBusDumpProcess009, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusDumpProcess009, Start");
int32_t ret;
for (int i = 0; i < NSTACK_DUMP_PROCESS_VALID_TEST_NUM; i++) {
for (int32_t i = 0; i < NSTACK_DUMP_PROCESS_VALID_TEST_NUM; i++) {
ret = SoftBusDumpProcess(testInValidStatsCmdArray[i].fd, testInValidStatsCmdArray[i].argc,
testInValidStatsCmdArray[i].argv);
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
@ -696,7 +696,7 @@ HWTEST_F(HidumperTest, SoftBusDumpProcess010, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusDumpProcess010, Start");
int32_t ret;
for (int i = 0; i < ALARM_DUMP_PROCESS_VALID_TEST_NUM; i++) {
for (int32_t i = 0; i < ALARM_DUMP_PROCESS_VALID_TEST_NUM; i++) {
ret = SoftBusDumpProcess(testValidAlarmCmdArray[i].fd, testValidAlarmCmdArray[i].argc,
testValidAlarmCmdArray[i].argv);
EXPECT_EQ(SOFTBUS_OK, ret);
@ -720,7 +720,7 @@ HWTEST_F(HidumperTest, SoftBusDumpProcess011, TestSize.Level1)
};
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusDumpProcess011, Start");
int32_t ret;
for (int i = 0; i < ALARM_DUMP_PROCESS_INVALID_TEST_NUM; i++) {
for (int32_t i = 0; i < ALARM_DUMP_PROCESS_INVALID_TEST_NUM; i++) {
ret = SoftBusDumpProcess(testInValidAlarmCmdArray[i].fd, testInValidAlarmCmdArray[i].argc,
testInValidAlarmCmdArray[i].argv);
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
@ -730,7 +730,7 @@ HWTEST_F(HidumperTest, SoftBusDumpProcess011, TestSize.Level1)
COMM_LOGI(COMM_TEST, "HidumperTest, SoftBusDumpProcess011, end");
}
int32_t DumpHandlerTest1(int fd, int32_t argc, const char **argv)
int32_t DumpHandlerTest1(int32_t fd, int32_t argc, const char **argv)
{
COMM_LOGE(COMM_TEST, "DumpHandlerTest1:fd=%{public}d, argc=%{public}d", fd, argc);
return SOFTBUS_OK;

View File

@ -26,7 +26,7 @@
#include "softbus_hisysevt_transreporter.h"
namespace OHOS {
static constexpr int BUFF_MAX_LEN = 65;
static constexpr int32_t BUFF_MAX_LEN = 65;
int32_t ReportStatisticEvt()
{
return 0;
@ -127,7 +127,7 @@ void SoftBusHiSysEvtTransReporterFuzzTest(const uint8_t *data, size_t size)
} // namespace OHOS
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
if (data == nullptr || size < sizeof(uint64_t)) {
return 0;

View File

@ -66,7 +66,7 @@ void DiscConnDfxTest::TearDown(void)
*/
HWTEST_F(DiscConnDfxTest, SoftbusRecordFirstDiscTime_001, TestSize.Level0)
{
int ret = SOFTBUS_ERR;
int32_t ret = SOFTBUS_ERR;
ret = SoftbusRecordFirstDiscTime(SOFTBUS_HISYSEVT_DISC_MEDIUM_BLE, 1000);
EXPECT_EQ(SOFTBUS_OK, ret);
@ -100,7 +100,7 @@ HWTEST_F(DiscConnDfxTest, SoftbusRecordFirstDiscTime_001, TestSize.Level0)
HWTEST_F(DiscConnDfxTest, SoftbusRecordBleDiscDetails_001, TestSize.Level0)
{
int ret = SOFTBUS_ERR;
int32_t ret = SOFTBUS_ERR;
ret = SoftbusRecordBleDiscDetails(const_cast<char *>(g_moduleNameOne), 1000, 3, 2, 1);
EXPECT_EQ(SOFTBUS_OK, ret);
@ -130,7 +130,7 @@ HWTEST_F(DiscConnDfxTest, SoftbusRecordBleDiscDetails_001, TestSize.Level0)
HWTEST_F(DiscConnDfxTest, SoftbusRecordDiscBleRssi_001, TestSize.Level0)
{
int ret = SOFTBUS_ERR;
int32_t ret = SOFTBUS_ERR;
ret = SoftbusRecordDiscBleRssi(-30);
EXPECT_EQ(SOFTBUS_OK, ret);
@ -154,7 +154,7 @@ HWTEST_F(DiscConnDfxTest, SoftbusRecordDiscBleRssi_001, TestSize.Level0)
*/
HWTEST_F(DiscConnDfxTest, SoftbusRecordConnResult_001, TestSize.Level0)
{
int ret = SOFTBUS_ERR;
int32_t ret = SOFTBUS_ERR;
ret = SoftbusRecordConnResult(DEFAULT_PID, SOFTBUS_HISYSEVT_CONN_TYPE_BR, SOFTBUS_EVT_CONN_SUCC,
1000, SOFTBUS_HISYSEVT_CONN_OK);
@ -193,7 +193,7 @@ HWTEST_F(DiscConnDfxTest, SoftbusRecordConnResult_001, TestSize.Level0)
*/
HWTEST_F(DiscConnDfxTest, SoftbusRecordProccessDuration_001, TestSize.Level0)
{
int ret = SOFTBUS_ERR;
int32_t ret = SOFTBUS_ERR;
ProcessStepTime processStepTime = {
.totalTime = 3000,
.negotiationTime = 1000,
@ -217,7 +217,7 @@ HWTEST_F(DiscConnDfxTest, SoftbusRecordProccessDuration_001, TestSize.Level0)
*/
HWTEST_F(DiscConnDfxTest, SoftbusReportDiscFault_001, TestSize.Level0)
{
int ret = SOFTBUS_ERR;
int32_t ret = SOFTBUS_ERR;
ret = SoftbusReportDiscFault(SOFTBUS_HISYSEVT_DISC_MEDIUM_BLE, -100);
EXPECT_EQ(SOFTBUS_OK, ret);
@ -234,7 +234,7 @@ HWTEST_F(DiscConnDfxTest, SoftbusReportDiscFault_001, TestSize.Level0)
HWTEST_F(DiscConnDfxTest, InitDiscConnDfx001, TestSize.Level0)
{
int ret = InitConnStatisticSysEvt();
int32_t ret = InitConnStatisticSysEvt();
EXPECT_EQ(SOFTBUS_OK, ret);
DeinitConnStatisticSysEvt();

View File

@ -72,7 +72,7 @@ void LnnDfxTest::TearDown(void)
*/
HWTEST_F(LnnDfxTest, LnnDfxTest_SoftBusRecordDiscoveryResult_001, TestSize.Level0)
{
int ret = SOFTBUS_ERR;
int32_t ret = SOFTBUS_ERR;
ret = SoftBusRecordDiscoveryResult(START_DISCOVERY, NULL);
EXPECT_EQ(SOFTBUS_OK, ret);
ret = SoftBusRecordDiscoveryResult(SEND_BROADCAST, NULL);
@ -111,7 +111,7 @@ HWTEST_F(LnnDfxTest, LnnDfxTest_SoftBusRecordDiscoveryResult_001, TestSize.Level
HWTEST_F(LnnDfxTest, SoftBusRecordDevOnlineDurResult001, TestSize.Level0)
{
int ret = SOFTBUS_ERR;
int32_t ret = SOFTBUS_ERR;
ret = SoftBusRecordDevOnlineDurResult(11);
EXPECT_EQ(SOFTBUS_OK, ret);
ret = SoftBusRecordDevOnlineDurResult(31);
@ -138,7 +138,7 @@ HWTEST_F(LnnDfxTest, SoftBusRecordDevOnlineDurResult001, TestSize.Level0)
HWTEST_F(LnnDfxTest, SoftBusRecordBusCenterResult001, TestSize.Level0)
{
int ret = SOFTBUS_ERR;
int32_t ret = SOFTBUS_ERR;
ret = SoftBusRecordBusCenterResult(SOFTBUS_HISYSEVT_LINK_TYPE_BR, 900);
EXPECT_EQ(SOFTBUS_OK, ret);
ret = SoftBusRecordBusCenterResult(SOFTBUS_HISYSEVT_LINK_TYPE_BLE, 1100);
@ -165,7 +165,7 @@ HWTEST_F(LnnDfxTest, SoftBusRecordBusCenterResult001, TestSize.Level0)
HWTEST_F(LnnDfxTest, SoftBusRecordAuthResult001, TestSize.Level0)
{
int ret = SOFTBUS_ERR;
int32_t ret = SOFTBUS_ERR;
ret = SoftBusRecordAuthResult(SOFTBUS_HISYSEVT_LINK_TYPE_BR, 0, 2100, AUTH_STAGE_BUTT);
EXPECT_EQ(SOFTBUS_OK, ret);
ret = SoftBusRecordAuthResult(SOFTBUS_HISYSEVT_LINK_TYPE_BLE, 1, 2100, AUTH_CONNECT_STAGE);
@ -194,7 +194,7 @@ HWTEST_F(LnnDfxTest, SoftBusRecordAuthResult001, TestSize.Level0)
HWTEST_F(LnnDfxTest, SoftBusReportBusCenterFaultEvt001, TestSize.Level0)
{
int ret = SOFTBUS_ERR;
int32_t ret = SOFTBUS_ERR;
SoftBusFaultEvtInfo info = {0};
info.moduleType = MODULE_TYPE_DISCOVERY;
info.linkType = SOFTBUS_HISYSEVT_LINK_TYPE_BLE;
@ -231,7 +231,7 @@ HWTEST_F(LnnDfxTest, SoftBusReportBusCenterFaultEvt001, TestSize.Level0)
HWTEST_F(LnnDfxTest, SoftBusReportDevOnlineEvt001, TestSize.Level0)
{
int ret = SOFTBUS_ERR;
int32_t ret = SOFTBUS_ERR;
OnlineDeviceInfo devInfo = {0};
devInfo.onlineDevNum = 10;
devInfo.btOnlineDevNum = 10;
@ -261,7 +261,7 @@ HWTEST_F(LnnDfxTest, SoftBusReportDevOnlineEvt001, TestSize.Level0)
HWTEST_F(LnnDfxTest, InitBusCenterDfx001, TestSize.Level0)
{
int ret = InitBusCenterDfx();
int32_t ret = InitBusCenterDfx();
EXPECT_EQ(SOFTBUS_OK, ret);
DeinitBusCenterDfx();
}

View File

@ -81,25 +81,25 @@ static AppInfo g_testAppInfo = {
.fileProtocol = 1
};
static int32_t TransRegisterSessionTest1(int fd)
static int32_t TransRegisterSessionTest1(int32_t fd)
{
SoftBusTransDumpRegisterSession(fd, g_testPkgName, g_testSessionName, TEST_TRANS_UID, TEST_TRANS_PID);
return SOFTBUS_OK;
}
static int32_t TransRunningSessionInfo1(int fd)
static int32_t TransRunningSessionInfo1(int32_t fd)
{
SoftBusTransDumpRunningSession(fd, DUMPER_LANE_BR, &g_testAppInfo);
return SOFTBUS_OK;
}
static int32_t TransRegisterSessionTest2(int fd)
static int32_t TransRegisterSessionTest2(int32_t fd)
{
SoftBusTransDumpRegisterSession(fd, nullptr, g_testSessionName, TEST_TRANS_UID, TEST_TRANS_PID);
return SOFTBUS_OK;
}
static int32_t TransRunningSessionInfo2(int fd)
static int32_t TransRunningSessionInfo2(int32_t fd)
{
SoftBusTransDumpRunningSession(fd, DUMPER_LANE_BR, nullptr);
return SOFTBUS_OK;
@ -133,10 +133,10 @@ HWTEST_F(TransDfxTest, SoftbusReportTransInfoEvt001, TestSize.Level0)
*/
HWTEST_F(TransDfxTest, SoftBusTransDumpHandler_001, TestSize.Level1)
{
int fd = 1;
int argc = 1;
int32_t fd = 1;
int32_t argc = 1;
const char* argv = "aaa";
int ret = SoftBusTransDumpHandler(fd, argc, &argv);
int32_t ret = SoftBusTransDumpHandler(fd, argc, &argv);
EXPECT_EQ(SOFTBUS_OK, ret);
}

View File

@ -16,10 +16,10 @@
#include "hilog_mock.h"
namespace {
constexpr int ARG_COUNT = 1;
constexpr int32_t ARG_COUNT = 1;
}
int HilogMock::HiLogPrint(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...)
int32_t HilogMock::HiLogPrint(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...)
{
return 0;
}
@ -33,12 +33,12 @@ HilogMock::~HilogMock()
mock.store(nullptr);
}
int HiLogPrint(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...)
int32_t HiLogPrint(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...)
{
char *args;
va_list va_args;
va_start(va_args, fmt);
for (int i = 0; i < ARG_COUNT; ++i) {
for (int32_t i = 0; i < ARG_COUNT; ++i) {
args = va_arg(va_args, char *);
}
va_end(va_args);
@ -46,7 +46,7 @@ int HiLogPrint(LogType type, LogLevel level, unsigned int domain, const char *ta
}
#ifdef HILOG_RAWFORMAT
int HiLogPrintDictNew(const LogType type, const LogLevel level, const unsigned int domain, const char *tag,
int32_t HiLogPrintDictNew(const LogType type, const LogLevel level, const unsigned int domain, const char *tag,
const unsigned int uuid, const unsigned int fmtOffset, const char *fmt, ...)
{
(void)uuid;
@ -54,7 +54,7 @@ int HiLogPrintDictNew(const LogType type, const LogLevel level, const unsigned i
char *args;
va_list va_args;
va_start(va_args, fmt);
for (int i = 0; i < ARG_COUNT; ++i) {
for (int32_t i = 0; i < ARG_COUNT; ++i) {
args = va_arg(va_args, char *);
}
va_end(va_args);

View File

@ -22,7 +22,7 @@
namespace OHOS {
#define TEST_JSON "{\"errcode\":1}"
static constexpr int MSG_BUFF_MAX_LEN = 100;
static constexpr int32_t MSG_BUFF_MAX_LEN = 100;
static void DoJsonUtilsFuzz(const char *data)
{
char buffer[MSG_BUFF_MAX_LEN] = TEST_JSON;
@ -51,7 +51,7 @@ static void DoJsonUtilsFuzz(const char *data)
} // namespace OHOS
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
if (data == nullptr || size < sizeof(int32_t)) {
return 0;

View File

@ -33,7 +33,7 @@ void DoMessageHandlerFuzz(const uint8_t *data, size_t size)
} // namespace OHOS
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
if (data == nullptr || size < sizeof(int32_t)) {
return 0;

View File

@ -51,8 +51,8 @@ void CommonCoreNetworkTest::TearDownTestCase(void) {}
*/
HWTEST_F(CommonCoreNetworkTest, SoftBusChannelToFrequencyTest001, TestSize.Level0)
{
int channel = -1;
int ret = SoftBusChannelToFrequency(channel);
int32_t channel = -1;
int32_t ret = SoftBusChannelToFrequency(channel);
EXPECT_NE(SOFTBUS_ERR, ret);
channel = TEST_2G_CHANNEL;
@ -72,8 +72,8 @@ HWTEST_F(CommonCoreNetworkTest, SoftBusChannelToFrequencyTest001, TestSize.Level
*/
HWTEST_F(CommonCoreNetworkTest, SoftBusFrequencyToChannelTest001, TestSize.Level0)
{
int frequency = -1;
int ret = SoftBusFrequencyToChannel(frequency);
int32_t frequency = -1;
int32_t ret = SoftBusFrequencyToChannel(frequency);
EXPECT_NE(SOFTBUS_ERR, ret);
frequency = TEST_2G_FREQUENCY;
@ -93,7 +93,7 @@ HWTEST_F(CommonCoreNetworkTest, SoftBusFrequencyToChannelTest001, TestSize.Level
*/
HWTEST_F(CommonCoreNetworkTest, SoftBusBandCheckTest001, TestSize.Level0)
{
int frequency = -1;
int32_t frequency = -1;
bool result = SoftBusIs5GBand(frequency);
EXPECT_NE(true, result);

View File

@ -58,7 +58,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_NormalCase_002, Te
seqInfo.minSeq = INT32_MIN + 1;
seqInfo.maxSeq = INT32_MIN + 1;
int32_t recvSeq = INT32_MIN + 1;
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq++);
EXPECT_EQ(ret, true);
}
@ -78,7 +78,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_NormalCase_003, Te
seqInfo.maxSeq = INT32_MAX - 2;
int32_t recvSeq = INT32_MAX - 2;
for (volatile int i = 0; i < 2; i++) {
for (volatile int32_t i = 0; i < 2; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq++);
EXPECT_EQ(ret, true);
}
@ -97,7 +97,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_NormalCase_004, Te
seqInfo.minSeq = -2;
seqInfo.maxSeq = -2;
int32_t recvSeq = -2;
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq++);
EXPECT_EQ(ret, true);
}
@ -113,7 +113,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_DisorderCase_001,
{
SeqVerifyInfo seqInfo = {0};
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {0, 1, 4, 3, 2};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
EXPECT_EQ(ret, true);
}
@ -129,7 +129,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_DisorderCase_002,
{
SeqVerifyInfo seqInfo = {0};
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {0, 1, 11, 8, 7};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
EXPECT_EQ(ret, true);
}
@ -145,7 +145,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_DisorderCase_003,
{
SeqVerifyInfo seqInfo = {0};
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {0, 1, 62, 8, 7};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i < 2) {
EXPECT_EQ(ret, true);
@ -169,7 +169,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_DisorderCase_004,
seqInfo.minSeq = -100;
seqInfo.maxSeq = -100;
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {-100, -99, -39, -56, -50};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
EXPECT_EQ(ret, true);
}
@ -187,7 +187,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_DisorderCase_005,
seqInfo.minSeq = -100;
seqInfo.maxSeq = -100;
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {-100, -99, -38, -96, -90};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i < 2) {
EXPECT_EQ(ret, true);
@ -212,7 +212,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_DisorderCase_006,
seqInfo.minSeq = INT32_MAX - 2;
seqInfo.maxSeq = INT32_MAX - 2;
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {INT32_MAX - 2, INT32_MAX - 1, 58, 0, 7};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i < 2) {
EXPECT_EQ(ret, true);
@ -235,7 +235,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_DisorderCase_007,
seqInfo.minSeq = INT32_MAX - 2;
seqInfo.maxSeq = INT32_MAX - 2;
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {INT32_MAX - 2, INT32_MAX - 1, 59, 0, 7};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i < 2) {
EXPECT_EQ(ret, true);
@ -258,7 +258,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_DisorderCase_008,
seqInfo.minSeq = -30;
seqInfo.maxSeq = -30;
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {-30, -29, 31, 10, 5};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
EXPECT_EQ(ret, true);
}
@ -277,7 +277,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_DisorderCase_009,
seqInfo.minSeq = -30;
seqInfo.maxSeq = -30;
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {-30, -29, 32, 0, -3};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i < 2) {
EXPECT_EQ(ret, true);
@ -299,7 +299,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_RepeatCase_001, Te
{
SeqVerifyInfo seqInfo = {0};
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {2, 10, 2, 3, 3};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i < 2 || i == 3) {
EXPECT_EQ(ret, true);
@ -319,7 +319,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_RepeatCase_002, Te
{
SeqVerifyInfo seqInfo = {0};
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {0, 10, 1, 5, 5};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i < 4) {
EXPECT_EQ(ret, true);
@ -341,7 +341,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_RepeatCase_003, Te
seqInfo.minSeq = INT32_MAX - 2;
seqInfo.maxSeq = INT32_MAX - 2;
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {INT32_MAX - 2, INT32_MAX - 1, 5, INT32_MAX - 1, 3};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i < 2) {
EXPECT_EQ(ret, true);
@ -363,7 +363,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_RepeatCase_004, Te
seqInfo.minSeq = INT32_MAX - 2;
seqInfo.maxSeq = INT32_MAX - 2;
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {INT32_MAX - 2, 0, 5, 0, 3};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i < 1) {
EXPECT_EQ(ret, true);
@ -385,7 +385,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_RepeatCase_005, Te
seqInfo.minSeq = -10;
seqInfo.maxSeq = -10;
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {-10, -1, 10, -1, 3};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i < 3 || i == 4) {
EXPECT_EQ(ret, true);
@ -407,7 +407,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_RepeatCase_006, Te
seqInfo.minSeq = -10;
seqInfo.maxSeq = -10;
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {-10, 1, 10, 1, 3};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i < 3 || i == 4) {
EXPECT_EQ(ret, true);
@ -429,7 +429,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_RepeatCase_007, Te
seqInfo.minSeq = 0;
seqInfo.maxSeq = 0;
int32_t recvSeq[12] = {0, 1, 2, 3, 4, 3, 3, 10, 5, 5, 5, 5};
for (int i = 0; i < 12; i++) {
for (int32_t i = 0; i < 12; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i < 5 || i == 7 || i == 8) {
EXPECT_EQ(ret, true);
@ -449,7 +449,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_LessThanMinCase_00
{
SeqVerifyInfo seqInfo = {0};
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {-10, -2, 10, 1, 3};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i >= 2) {
EXPECT_EQ(ret, true);
@ -471,7 +471,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_LessThanMinCase_00
seqInfo.minSeq = -10;
seqInfo.maxSeq = -10;
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {-15, -12, 10, 1, 3};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i >= 2) {
EXPECT_EQ(ret, true);
@ -493,7 +493,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_LessThanMinCase_00
seqInfo.minSeq = -10;
seqInfo.maxSeq = 10;
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {-15, -12, 10, 1, 3};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
if (i >= 2) {
EXPECT_EQ(ret, true);
@ -515,7 +515,7 @@ HWTEST_F(SequenceVerificationTest, Softbus_SeqVerifyTest_Test_LessThanMinCase_00
seqInfo.minSeq = INT32_MAX - 2;
seqInfo.maxSeq = INT32_MIN + 10;
int32_t recvSeq[MAX_RECEIVE_SEQUENCE] = {INT32_MAX - 10, INT32_MAX - 5, 0, 1, 3};
for (int i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
for (int32_t i = 0; i < MAX_RECEIVE_SEQUENCE; i++) {
bool ret = IsPassSeqCheck(&seqInfo, recvSeq[i]);
EXPECT_EQ(ret, false);
}

View File

@ -35,7 +35,7 @@ namespace OHOS {
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
extern "C" int32_t LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
/* Run your code on data */
OHOS::DoSomethingInterestingWithMyAPI(data, size);

Some files were not shown because too many files have changed in this diff Show More