Skip to content

Commit

Permalink
[clang-tidy] Fix -clang-analyzer-nullability.NullPassedToNonnull erro…
Browse files Browse the repository at this point in the history
…r in src/platform/Darwin/BlePlatformDelegateImpl.mm (#15575)
  • Loading branch information
vivien-apple authored and pull[bot] committed Feb 6, 2024
1 parent 04afe71 commit a9f8630
Showing 1 changed file with 19 additions and 30 deletions.
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

0 comments on commit a9f8630

Please sign in to comment.