Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang-tidy] Fix -clang-analyzer-nullability.NullPassedToNonnull erro… #15575

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 19 additions & 30 deletions src/platform/Darwin/BlePlatformDelegateImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,14 @@
BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId)
{
bool found = false;
CBUUID * serviceId = nil;
CBUUID * characteristicId = nil;
CBPeripheral * peripheral = (__bridge CBPeripheral *) connObj;

if (NULL != svcId) {
serviceId = [UUIDHelper GetShortestServiceUUID:svcId];
if (NULL == svcId || NULL == charId) {
return found;
}

if (NULL != charId) {
characteristicId = [CBUUID UUIDWithData:[NSData dataWithBytes:charId->bytes length:sizeof(charId->bytes)]];
}
CBUUID * serviceId = [UUIDHelper GetShortestServiceUUID:svcId];
CBUUID * characteristicId = [CBUUID UUIDWithData:[NSData dataWithBytes:charId->bytes length:sizeof(charId->bytes)]];
CBPeripheral * peripheral = (__bridge CBPeripheral *) connObj;

for (CBService * service in peripheral.services) {
if ([service.UUID.data isEqualToData:serviceId.data]) {
Expand All @@ -76,17 +73,15 @@
BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId)
{
bool found = false;
CBUUID * serviceId = nil;
CBUUID * characteristicId = nil;
CBPeripheral * peripheral = (__bridge CBPeripheral *) connObj;

if (NULL != svcId) {
serviceId = [UUIDHelper GetShortestServiceUUID:svcId];
}
if (NULL != charId) {
characteristicId = [CBUUID UUIDWithData:[NSData dataWithBytes:charId->bytes length:sizeof(charId->bytes)]];
if (NULL == svcId || NULL == charId) {
return found;
}

CBUUID * serviceId = [UUIDHelper GetShortestServiceUUID:svcId];
CBUUID * characteristicId = characteristicId = [CBUUID UUIDWithData:[NSData dataWithBytes:charId->bytes
length:sizeof(charId->bytes)]];
CBPeripheral * peripheral = (__bridge CBPeripheral *) connObj;

for (CBService * service in peripheral.services) {
if ([service.UUID.data isEqualToData:serviceId.data]) {
for (CBCharacteristic * characteristic in service.characteristics) {
Expand Down Expand Up @@ -135,21 +130,15 @@
BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, PacketBufferHandle pBuf)
{
bool found = false;
CBUUID * serviceId = nil;
CBUUID * characteristicId = nil;
NSData * data = nil;
CBPeripheral * peripheral = (__bridge CBPeripheral *) connObj;

if (NULL != svcId) {
serviceId = [UUIDHelper GetShortestServiceUUID:svcId];
}
if (NULL != charId) {
characteristicId = [CBUUID UUIDWithData:[NSData dataWithBytes:charId->bytes length:sizeof(charId->bytes)]];
}
if (!pBuf.IsNull()) {
data = [NSData dataWithBytes:pBuf->Start() length:pBuf->DataLength()];
if (NULL == svcId || NULL == charId || pBuf.IsNull()) {
return found;
}

CBUUID * serviceId = [UUIDHelper GetShortestServiceUUID:svcId];
CBUUID * characteristicId = [CBUUID UUIDWithData:[NSData dataWithBytes:charId->bytes length:sizeof(charId->bytes)]];
NSData * data = [NSData dataWithBytes:pBuf->Start() length:pBuf->DataLength()];
CBPeripheral * peripheral = (__bridge CBPeripheral *) connObj;

for (CBService * service in peripheral.services) {
if ([service.UUID.data isEqualToData:serviceId.data]) {
for (CBCharacteristic * characteristic in service.characteristics) {
Expand Down