From 1026030818e4df41059fe984d9753e02c19882b2 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 17 May 2022 17:08:36 -0400 Subject: [PATCH] Fix CHIPTool build on iOS. (#18523) The compiler is not happy with nullability specified for only some things in a header, so have todo it for all of them. Also fixes incorrect nullability specifications in CHIPTestStorage. Fixes https://github.com/project-chip/connectedhomeip/issues/18518 --- .../CHIPTool/Framework Helpers/DefaultsUtils.h | 16 ++++++++-------- src/darwin/Framework/CHIPTests/CHIPTestStorage.h | 2 +- src/darwin/Framework/CHIPTests/CHIPTestStorage.m | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.h b/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.h index 3b01fe28218296..5d65540781b2da 100644 --- a/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.h +++ b/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.h @@ -18,15 +18,17 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + extern NSString * const kCHIPToolDefaultsDomain; extern NSString * const kNetworkSSIDDefaultsKey; extern NSString * const kNetworkPasswordDefaultsKey; extern NSString * const kFabricIdKey; -CHIPDeviceController * InitializeCHIP(void); -CHIPDeviceController * CHIPRestartController(CHIPDeviceController * controller); -id CHIPGetDomainValueForKey(NSString * domain, NSString * key); -BOOL CHIPSetDomainValueForKey(NSString * domain, NSString * key, id value); +CHIPDeviceController * _Nullable InitializeCHIP(void); +CHIPDeviceController * _Nullable CHIPRestartController(CHIPDeviceController * controller); +id _Nullable CHIPGetDomainValueForKey(NSString * domain, NSString * key); +BOOL CHIPSetDomainValueForKey(NSString * domain, NSString * key, id _Nullable value); void CHIPRemoveDomainValueForKey(NSString * domain, NSString * key); uint64_t CHIPGetNextAvailableDeviceID(void); NSString * KeyForPairedDevice(uint64_t id); @@ -37,12 +39,10 @@ BOOL CHIPIsDevicePaired(uint64_t id); BOOL CHIPGetConnectedDevice(CHIPDeviceConnectionCallback completionHandler); BOOL CHIPGetConnectedDeviceWithID(uint64_t deviceId, CHIPDeviceConnectionCallback completionHandler); void CHIPUnpairDeviceWithID(uint64_t deviceId); -CHIPDevice * CHIPGetDeviceBeingCommissioned(void); - -NS_ASSUME_NONNULL_BEGIN +CHIPDevice * _Nullable CHIPGetDeviceBeingCommissioned(void); @interface CHIPToolPersistentStorageDelegate : NSObject -- (NSData *)storageDataForKey:(NSString *)key; +- (nullable NSData *)storageDataForKey:(NSString *)key; - (BOOL)setStorageData:(NSData *)value forKey:(NSString *)key; - (BOOL)removeStorageDataForKey:(NSString *)key; @end diff --git a/src/darwin/Framework/CHIPTests/CHIPTestStorage.h b/src/darwin/Framework/CHIPTests/CHIPTestStorage.h index d1d70ebf141a6a..0ea9951d970371 100644 --- a/src/darwin/Framework/CHIPTests/CHIPTestStorage.h +++ b/src/darwin/Framework/CHIPTests/CHIPTestStorage.h @@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN @interface CHIPTestStorage : NSObject -- (NSData *)storageDataForKey:(NSString *)key; +- (nullable NSData *)storageDataForKey:(NSString *)key; - (BOOL)setStorageData:(NSData *)value forKey:(NSString *)key; - (BOOL)removeStorageDataForKey:(NSString *)key; @end diff --git a/src/darwin/Framework/CHIPTests/CHIPTestStorage.m b/src/darwin/Framework/CHIPTests/CHIPTestStorage.m index dc9b3ad1b7d4cb..45afe1d916f2bc 100644 --- a/src/darwin/Framework/CHIPTests/CHIPTestStorage.m +++ b/src/darwin/Framework/CHIPTests/CHIPTestStorage.m @@ -22,7 +22,7 @@ @interface CHIPTestStorage () @implementation CHIPTestStorage -- (NSData *)storageDataForKey:(NSString *)key +- (nullable NSData *)storageDataForKey:(NSString *)key { return _values[key]; }