Skip to content

Commit 95b187b

Browse files
generatedunixname89002005287564facebook-github-bot
authored andcommitted
Fix CQS signal readability-implicit-bool-conversion in xplat/js/react-native-github/packages (#53596)
Summary: Pull Request resolved: #53596 Reviewed By: rshest Differential Revision: D81574342 fbshipit-source-id: 9423d3341a9c349d7e7519b5acb7ee41f6ceb2b3
1 parent 7a4d5ad commit 95b187b

10 files changed

Lines changed: 37 additions & 37 deletions

packages/react-native/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.mm

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ @implementation RCTAnimatedNode {
1616

1717
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
1818
{
19-
if ((self = [super init])) {
19+
if ((self = [super init]) != nullptr) {
2020
_nodeTag = tag;
2121
_config = [config copy];
2222
}
@@ -37,42 +37,42 @@ - (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id>
3737

3838
- (void)addChild:(RCTAnimatedNode *)child
3939
{
40-
if (!_childNodes) {
40+
if (_childNodes == nullptr) {
4141
_childNodes = [NSMapTable strongToWeakObjectsMapTable];
4242
}
43-
if (child) {
43+
if (child != nullptr) {
4444
[_childNodes setObject:child forKey:child.nodeTag];
4545
[child onAttachedToNode:self];
4646
}
4747
}
4848

4949
- (void)removeChild:(RCTAnimatedNode *)child
5050
{
51-
if (!_childNodes) {
51+
if (_childNodes == nullptr) {
5252
return;
5353
}
54-
if (child) {
54+
if (child != nullptr) {
5555
[_childNodes removeObjectForKey:child.nodeTag];
5656
[child onDetachedFromNode:self];
5757
}
5858
}
5959

6060
- (void)onAttachedToNode:(RCTAnimatedNode *)parent
6161
{
62-
if (!_parentNodes) {
62+
if (_parentNodes == nullptr) {
6363
_parentNodes = [NSMapTable strongToWeakObjectsMapTable];
6464
}
65-
if (parent) {
65+
if (parent != nullptr) {
6666
[_parentNodes setObject:parent forKey:parent.nodeTag];
6767
}
6868
}
6969

7070
- (void)onDetachedFromNode:(RCTAnimatedNode *)parent
7171
{
72-
if (!_parentNodes) {
72+
if (_parentNodes == nullptr) {
7373
return;
7474
}
75-
if (parent) {
75+
if (parent != nullptr) {
7676
[_parentNodes removeObjectForKey:parent.nodeTag];
7777
}
7878
}

packages/react-native/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ @implementation RCTInterpolationAnimatedNode {
8686

8787
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
8888
{
89-
if ((self = [super initWithTag:tag config:config])) {
89+
if ((self = [super initWithTag:tag config:config]) != nullptr) {
9090
_inputRange = config[@"inputRange"];
9191

9292
NSArray *outputRangeConfig = config[@"outputRange"];
@@ -104,7 +104,7 @@ - (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id>
104104
switch (_outputType) {
105105
case RCTInterpolationOutputColor: {
106106
UIColor *color = [RCTConvert UIColor:value];
107-
[outputRange addObject:color ? color : [UIColor whiteColor]];
107+
[outputRange addObject:(color != nullptr) ? color : [UIColor whiteColor]];
108108
break;
109109
}
110110
case RCTInterpolationOutputString:
@@ -141,7 +141,7 @@ - (void)onDetachedFromNode:(RCTAnimatedNode *)parent
141141
- (void)performUpdate
142142
{
143143
[super performUpdate];
144-
if (!_parentNode) {
144+
if (_parentNode == nullptr) {
145145
return;
146146
}
147147

packages/react-native/Libraries/NativeAnimation/Nodes/RCTObjectAnimatedNode.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ - (id)_convertValue:(id)value
4848
if ([value isKindOfClass:[NSDictionary class]]) {
4949
NSDictionary<NSString *, id> *dict = (NSDictionary *)value;
5050
id nodeTag = [dict objectForKey:NODE_TAG_KEY];
51-
if (nodeTag && [nodeTag isKindOfClass:[NSNumber class]]) {
51+
if ((nodeTag != nullptr) && [nodeTag isKindOfClass:[NSNumber class]]) {
5252
RCTAnimatedNode *node = [self.parentNodes objectForKey:(NSNumber *)nodeTag];
5353
if ([node isKindOfClass:[RCTValueAnimatedNode class]]) {
5454
RCTValueAnimatedNode *valueNode = (RCTValueAnimatedNode *)node;

packages/react-native/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ @implementation RCTStyleAnimatedNode {
1818

1919
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
2020
{
21-
if ((self = [super initWithTag:tag config:config])) {
21+
if ((self = [super initWithTag:tag config:config]) != nullptr) {
2222
_propsDictionary = [NSMutableDictionary new];
2323
}
2424
return self;
@@ -36,11 +36,11 @@ - (void)performUpdate
3636
NSDictionary<NSString *, NSNumber *> *style = self.config[@"style"];
3737
[style enumerateKeysAndObjectsUsingBlock:^(NSString *property, NSNumber *nodeTag, __unused BOOL *stop) {
3838
RCTAnimatedNode *node = [self.parentNodes objectForKey:nodeTag];
39-
if (node) {
39+
if (node != nullptr) {
4040
if ([node isKindOfClass:[RCTValueAnimatedNode class]]) {
4141
RCTValueAnimatedNode *valueAnimatedNode = (RCTValueAnimatedNode *)node;
4242
id animatedObject = valueAnimatedNode.animatedObject;
43-
if (animatedObject) {
43+
if (animatedObject != nullptr) {
4444
_propsDictionary[property] = animatedObject;
4545
} else {
4646
_propsDictionary[property] = @(valueAnimatedNode.value);

packages/react-native/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ @implementation RCTTrackingAnimatedNode {
1818

1919
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
2020
{
21-
if ((self = [super initWithTag:tag config:config])) {
21+
if ((self = [super initWithTag:tag config:config]) != nullptr) {
2222
_animationId = config[@"animationId"];
2323
_toValueNodeTag = config[@"toValue"];
2424
_valueNodeTag = config[@"value"];

packages/react-native/Libraries/NativeAnimation/Nodes/RCTTransformAnimatedNode.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ @implementation RCTTransformAnimatedNode {
1414

1515
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
1616
{
17-
if ((self = [super initWithTag:tag config:config])) {
17+
if ((self = [super initWithTag:tag config:config]) != nullptr) {
1818
_propsDictionary = [NSMutableDictionary new];
1919
}
2020
return self;

packages/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.mm

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ @implementation RCTNativeAnimatedNodesManager {
5959
- (instancetype)initWithBridge:(nullable RCTBridge *)bridge
6060
surfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter
6161
{
62-
if ((self = [super init])) {
62+
if ((self = [super init]) != nullptr) {
6363
_bridge = bridge;
6464
_surfacePresenter = surfacePresenter;
6565
_animationNodes = [NSMutableDictionary new];
@@ -72,7 +72,7 @@ - (instancetype)initWithBridge:(nullable RCTBridge *)bridge
7272
- (BOOL)isNodeManagedByFabric:(NSNumber *)tag
7373
{
7474
RCTAnimatedNode *node = _animationNodes[tag];
75-
if (node) {
75+
if (node != nullptr) {
7676
return [node isManagedByFabric];
7777
}
7878
return false;
@@ -106,7 +106,7 @@ - (void)createAnimatedNode:(NSNumber *)tag config:(NSDictionary<NSString *, id>
106106
NSString *nodeType = [RCTConvert NSString:config[@"type"]];
107107

108108
Class nodeClass = map[nodeType];
109-
if (!nodeClass) {
109+
if (nodeClass == nullptr) {
110110
RCTLogError(@"Animated node type %@ not supported natively", nodeType);
111111
return;
112112
}
@@ -187,7 +187,7 @@ - (void)restoreDefaultValues:(NSNumber *)nodeTag
187187
- (void)dropAnimatedNode:(NSNumber *)tag
188188
{
189189
RCTAnimatedNode *node = _animationNodes[tag];
190-
if (node) {
190+
if (node != nullptr) {
191191
[node detachNode];
192192
[_animationNodes removeObjectForKey:tag];
193193
}
@@ -345,7 +345,7 @@ - (void)addAnimatedEventToView:(NSNumber *)viewTag
345345
NSNumber *nodeTag = [RCTConvert NSNumber:eventMapping[@"animatedValueTag"]];
346346
RCTAnimatedNode *node = _animationNodes[nodeTag];
347347

348-
if (!node) {
348+
if (node == nullptr) {
349349
RCTLogError(@"Animated node with tag %@ does not exist", nodeTag);
350350
return;
351351
}
@@ -407,7 +407,7 @@ - (void)handleAnimatedEvent:(id<RCTEvent>)event
407407

408408
NSString *key = [NSString stringWithFormat:@"%@%@", event.viewTag, RCTNormalizeAnimatedEventName(event.eventName)];
409409
NSMutableArray<RCTEventAnimation *> *driversForKey = _eventDrivers[key];
410-
if (driversForKey) {
410+
if (driversForKey != nullptr) {
411411
for (RCTEventAnimation *driver in driversForKey) {
412412
[self stopAnimationsForNode:driver.valueNode];
413413
[driver updateWithEvent:event];
@@ -439,7 +439,7 @@ - (void)stopListeningToAnimatedNodeValue:(NSNumber *)tag
439439

440440
- (void)startAnimationLoopIfNeeded
441441
{
442-
if (!_displayLink && _activeAnimations.count > 0) {
442+
if ((_displayLink == nullptr) && _activeAnimations.count > 0) {
443443
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(stepAnimations:)];
444444
[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
445445
}
@@ -454,7 +454,7 @@ - (void)stopAnimationLoopIfNeeded
454454

455455
- (void)stopAnimationLoop
456456
{
457-
if (_displayLink) {
457+
if (_displayLink != nullptr) {
458458
[_displayLink invalidate];
459459
_displayLink = nil;
460460
}
@@ -486,7 +486,7 @@ - (void)stepAnimations:(CADisplayLink *)displaylink
486486
NSArray<RCTEventAnimation *> *eventAnimations = _eventDrivers[key];
487487
for (RCTEventAnimation *animation in eventAnimations) {
488488
NSNumber *nodeTag = [animation.valueNode nodeTag];
489-
if (nodeTag) {
489+
if (nodeTag != nullptr) {
490490
[tags addObject:nodeTag];
491491
}
492492
for (NSNumber *childNodeKey in [animation.valueNode childNodes]) {

packages/react-native/Libraries/Network/RCTDataRequestHandler.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ @implementation RCTDataRequestHandler {
2525
- (void)invalidate
2626
{
2727
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
28-
if (_queue) {
28+
if (_queue != nullptr) {
2929
for (NSOperation *operation in _queue.operations) {
3030
if (!operation.isCancelled && !operation.isFinished) {
3131
[operation cancel];
@@ -44,7 +44,7 @@ - (NSOperation *)sendRequest:(NSURLRequest *)request withDelegate:(id<RCTURLRequ
4444
{
4545
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
4646
// Lazy setup
47-
if (!_queue) {
47+
if (_queue == nullptr) {
4848
_queue = [NSOperationQueue new];
4949
_queue.maxConcurrentOperationCount = 2;
5050
}
@@ -59,7 +59,7 @@ - (NSOperation *)sendRequest:(NSURLRequest *)request withDelegate:(id<RCTURLRequ
5959
// Get mime type
6060
NSRange firstSemicolon = [request.URL.resourceSpecifier rangeOfString:@";"];
6161
NSString *mimeType =
62-
firstSemicolon.length ? [request.URL.resourceSpecifier substringToIndex:firstSemicolon.location] : nil;
62+
(firstSemicolon.length != 0u) ? [request.URL.resourceSpecifier substringToIndex:firstSemicolon.location] : nil;
6363

6464
// Send response
6565
NSURLResponse *response = [[NSURLResponse alloc] initWithURL:request.URL
@@ -72,7 +72,7 @@ - (NSOperation *)sendRequest:(NSURLRequest *)request withDelegate:(id<RCTURLRequ
7272
// Load data
7373
NSError *error;
7474
NSData *data = [NSData dataWithContentsOfURL:request.URL options:NSDataReadingMappedIfSafe error:&error];
75-
if (data) {
75+
if (data != nullptr) {
7676
[delegate URLRequest:strongOp didReceiveData:data];
7777
}
7878
[delegate URLRequest:strongOp didCompleteWithError:error];

packages/react-native/Libraries/Network/RCTHTTPRequestHandler.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ - (void)invalidate
4646
- (BOOL)isValid
4747
{
4848
// if session == nil and delegates != nil, we've been invalidated
49-
return _session || !_delegates;
49+
return (_session != nullptr) || (_delegates == nullptr);
5050
}
5151

5252
#pragma mark - NSURLRequestHandler
@@ -67,7 +67,7 @@ - (NSURLSessionDataTask *)sendRequest:(NSURLRequest *)request withDelegate:(id<R
6767
{
6868
std::lock_guard<std::mutex> lock(_mutex);
6969
// Lazy setup
70-
if (!_session && [self isValid]) {
70+
if ((_session == nullptr) && [self isValid]) {
7171
// You can override default NSURLSession instance property allowsCellularAccess (default value YES)
7272
// by providing the following key to your RN project (edit ios/project/Info.plist file in Xcode):
7373
// <key>ReactNetworkForceWifiOnly</key> <true/>
@@ -80,12 +80,12 @@ - (NSURLSessionDataTask *)sendRequest:(NSURLRequest *)request withDelegate:(id<R
8080
callbackQueue.maxConcurrentOperationCount = 1;
8181
callbackQueue.underlyingQueue = [[_moduleRegistry moduleForName:"Networking"] methodQueue];
8282
NSURLSessionConfiguration *configuration;
83-
if (urlSessionConfigurationProvider) {
83+
if (urlSessionConfigurationProvider != nullptr) {
8484
configuration = urlSessionConfigurationProvider();
8585
} else {
8686
configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
8787
// Set allowsCellularAccess to NO ONLY if key ReactNetworkForceWifiOnly exists AND its value is YES
88-
if (useWifiOnly) {
88+
if (useWifiOnly != nullptr) {
8989
configuration.allowsCellularAccess = ![useWifiOnly boolValue];
9090
}
9191
[configuration setHTTPShouldSetCookies:YES];

packages/react-native/Libraries/Settings/RCTSettingsManager.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ - (instancetype)init
3939

4040
- (instancetype)initWithUserDefaults:(NSUserDefaults *)defaults
4141
{
42-
if ((self = [super init])) {
42+
if ((self = [super init]) != nullptr) {
4343
_defaults = defaults;
4444

4545
[[NSNotificationCenter defaultCenter] addObserver:self
@@ -84,7 +84,7 @@ - (void)userDefaultsDidChange:(NSNotification *)note
8484
_ignoringUpdates = YES;
8585
[values enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, BOOL *stop) {
8686
id plist = [RCTConvert NSPropertyList:json];
87-
if (plist) {
87+
if (plist != nullptr) {
8888
[self->_defaults setObject:plist forKey:key];
8989
} else {
9090
[self->_defaults removeObjectForKey:key];

0 commit comments

Comments
 (0)