Skip to content

Commit

Permalink
Fix CHIPTool build on iOS. (#18523)
Browse files Browse the repository at this point in the history
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 #18518
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Jul 13, 2023
1 parent 28197ff commit 2327218
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@
#import <CHIP/CHIP.h>
#import <Foundation/Foundation.h>

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);
Expand All @@ -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 <CHIPPersistentStorageDelegate>
- (NSData *)storageDataForKey:(NSString *)key;
- (nullable NSData *)storageDataForKey:(NSString *)key;
- (BOOL)setStorageData:(NSData *)value forKey:(NSString *)key;
- (BOOL)removeStorageDataForKey:(NSString *)key;
@end
Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIPTests/CHIPTestStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
NS_ASSUME_NONNULL_BEGIN

@interface CHIPTestStorage : NSObject <CHIPPersistentStorageDelegate>
- (NSData *)storageDataForKey:(NSString *)key;
- (nullable NSData *)storageDataForKey:(NSString *)key;
- (BOOL)setStorageData:(NSData *)value forKey:(NSString *)key;
- (BOOL)removeStorageDataForKey:(NSString *)key;
@end
Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIPTests/CHIPTestStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ @interface CHIPTestStorage ()

@implementation CHIPTestStorage

- (NSData *)storageDataForKey:(NSString *)key
- (nullable NSData *)storageDataForKey:(NSString *)key
{
return _values[key];
}
Expand Down

0 comments on commit 2327218

Please sign in to comment.