From 8d8452173a35ccb048dd5798aa631716ea2e6539 Mon Sep 17 00:00:00 2001 From: generatedunixname89002005287564 Date: Wed, 3 Sep 2025 08:12:28 -0700 Subject: [PATCH] Fix CQS signal readability-implicit-bool-conversion in xplat/js/react-native-github/packages (#53584) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53584 Reviewed By: rshest Differential Revision: D81565980 fbshipit-source-id: e9c7eeb3219ee56b693583a6cf8a7905ac360324 --- .../RCTSurfaceSizeMeasureMode.mm | 8 ++-- .../CoreModules/RCTActionSheetManager.mm | 20 +++++----- .../React/CoreModules/RCTAlertController.mm | 4 +- .../React/CoreModules/RCTAlertManager.mm | 4 +- .../React/CoreModules/RCTDevMenu.mm | 14 +++---- .../React/CoreModules/RCTEventDispatcher.mm | 18 +++++---- .../React/CoreModules/RCTExceptionsManager.mm | 14 +++---- .../React/CoreModules/RCTFPSGraph.mm | 6 +-- .../React/CoreModules/RCTLogBox.mm | 12 +++--- .../React/CoreModules/RCTLogBoxView.mm | 2 +- .../React/CoreModules/RCTPerfMonitor.mm | 38 +++++++++---------- 11 files changed, 71 insertions(+), 69 deletions(-) diff --git a/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm b/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm index 8bcb5d1d932..2b94f6cbeae 100644 --- a/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm +++ b/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm @@ -18,17 +18,17 @@ void RCTSurfaceMinimumSizeAndMaximumSizeFromSizeAndSizeMeasureMode( *minimumSize = CGSizeZero; *maximumSize = CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX); - if (sizeMeasureMode & RCTSurfaceSizeMeasureModeWidthExact) { + if ((sizeMeasureMode & RCTSurfaceSizeMeasureModeWidthExact) != 0) { minimumSize->width = size.width; maximumSize->width = size.width; - } else if (sizeMeasureMode & RCTSurfaceSizeMeasureModeWidthAtMost) { + } else if ((sizeMeasureMode & RCTSurfaceSizeMeasureModeWidthAtMost) != 0) { maximumSize->width = size.width; } - if (sizeMeasureMode & RCTSurfaceSizeMeasureModeHeightExact) { + if ((sizeMeasureMode & RCTSurfaceSizeMeasureModeHeightExact) != 0) { minimumSize->height = size.height; maximumSize->height = size.height; - } else if (sizeMeasureMode & RCTSurfaceSizeMeasureModeHeightAtMost) { + } else if ((sizeMeasureMode & RCTSurfaceSizeMeasureModeHeightAtMost) != 0) { maximumSize->height = size.height; } } diff --git a/packages/react-native/React/CoreModules/RCTActionSheetManager.mm b/packages/react-native/React/CoreModules/RCTActionSheetManager.mm index 658ec6b8b81..58e2b66f117 100644 --- a/packages/react-native/React/CoreModules/RCTActionSheetManager.mm +++ b/packages/react-native/React/CoreModules/RCTActionSheetManager.mm @@ -31,7 +31,7 @@ using namespace facebook::react; - (instancetype)init { self = [super init]; - if (self) { + if (self != nullptr) { _alertControllers = [NSMutableArray new]; } return self; @@ -53,7 +53,7 @@ RCT_EXPORT_MODULE() alertController.modalPresentationStyle = UIModalPresentationPopover; UIView *sourceView = parentViewController.view; - if (anchorViewTag) { + if (anchorViewTag != nullptr) { sourceView = [self.viewRegistry_DEPRECATED viewForReactTag:anchorViewTag]; } else { alertController.popoverPresentationController.permittedArrowDirections = 0; @@ -166,12 +166,12 @@ RCT_EXPORT_METHOD(showActionSheetWithOptions index++; } - if (disabledButtonIndices) { + if (disabledButtonIndices != nullptr) { for (NSNumber *disabledButtonIndex in disabledButtonIndices) { if ([disabledButtonIndex integerValue] < buttons.count) { UIAlertAction *action = alertController.actions[[disabledButtonIndex integerValue]]; [action setEnabled:false]; - if (disabledButtonTintColor) { + if (disabledButtonTintColor != nullptr) { [action setValue:disabledButtonTintColor forKey:@"titleTextColor"]; } } else { @@ -235,14 +235,14 @@ RCT_EXPORT_METHOD(showShareActionSheetWithOptions UIColor *tintColor = [RCTConvert UIColor:options.tintColor() ? @(*options.tintColor()) : nil]; dispatch_async(dispatch_get_main_queue(), ^{ - if (message) { + if (message != nullptr) { [items addObject:message]; } - if (URL) { + if (URL != nullptr) { if ([URL.scheme.lowercaseString isEqualToString:@"data"]) { NSError *error; NSData *data = [NSData dataWithContentsOfURL:URL options:(NSDataReadingOptions)0 error:&error]; - if (!data) { + if (data == nullptr) { failureCallback(@[ RCTJSErrorFromNSError(error) ]); return; } @@ -258,17 +258,17 @@ RCT_EXPORT_METHOD(showShareActionSheetWithOptions UIActivityViewController *shareController = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil]; - if (subject) { + if (subject != nullptr) { [shareController setValue:subject forKey:@"subject"]; } - if (excludedActivityTypes) { + if (excludedActivityTypes != nullptr) { shareController.excludedActivityTypes = excludedActivityTypes; } UIViewController *controller = RCTPresentedViewController(); shareController.completionWithItemsHandler = ^(NSString *activityType, BOOL completed, __unused NSArray *returnedItems, NSError *activityError) { - if (activityError) { + if (activityError != nullptr) { failureCallback(@[ RCTJSErrorFromNSError(activityError) ]); } else if (completed || activityType == nil) { successCallback(@[ @(completed), RCTNullIfNil(activityType) ]); diff --git a/packages/react-native/React/CoreModules/RCTAlertController.mm b/packages/react-native/React/CoreModules/RCTAlertController.mm index 3131ff4db59..b275ebc5c67 100644 --- a/packages/react-native/React/CoreModules/RCTAlertController.mm +++ b/packages/react-native/React/CoreModules/RCTAlertController.mm @@ -27,7 +27,7 @@ _alertWindow = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds]; } - if (_alertWindow) { + if (_alertWindow != nullptr) { _alertWindow.rootViewController = [UIViewController new]; _alertWindow.windowLevel = UIWindowLevelAlert + 1; } @@ -41,7 +41,7 @@ UIUserInterfaceStyle style = self.overrideUserInterfaceStyle; if (style == UIUserInterfaceStyleUnspecified) { UIUserInterfaceStyle overriddenStyle = RCTKeyWindow().overrideUserInterfaceStyle; - style = overriddenStyle ? overriddenStyle : UIUserInterfaceStyleUnspecified; + style = (overriddenStyle != 0) ? overriddenStyle : UIUserInterfaceStyleUnspecified; } self.overrideUserInterfaceStyle = style; diff --git a/packages/react-native/React/CoreModules/RCTAlertManager.mm b/packages/react-native/React/CoreModules/RCTAlertManager.mm index 415bb1f6fb8..2b9fc60c968 100644 --- a/packages/react-native/React/CoreModules/RCTAlertManager.mm +++ b/packages/react-native/React/CoreModules/RCTAlertManager.mm @@ -86,7 +86,7 @@ RCT_EXPORT_METHOD(alertWithArgs : (JS::NativeAlertManager::Args &)args callback UIKeyboardType keyboardType = [RCTConvert UIKeyboardType:args.keyboardType()]; UIUserInterfaceStyle userInterfaceStyle = [RCTConvert UIUserInterfaceStyle:args.userInterfaceStyle()]; - if (!title && !message) { + if ((title == nullptr) && (message == nullptr)) { RCTLogError(@"Must specify either an alert title, or message, or both"); return; } @@ -193,7 +193,7 @@ RCT_EXPORT_METHOD(alertWithArgs : (JS::NativeAlertManager::Args &)args callback } } - if (!self->_alertControllers) { + if (self->_alertControllers == nullptr) { self->_alertControllers = [NSHashTable weakObjectsHashTable]; } [self->_alertControllers addObject:alertController]; diff --git a/packages/react-native/React/CoreModules/RCTDevMenu.mm b/packages/react-native/React/CoreModules/RCTDevMenu.mm index 4a201fc1730..7282400cb3b 100644 --- a/packages/react-native/React/CoreModules/RCTDevMenu.mm +++ b/packages/react-native/React/CoreModules/RCTDevMenu.mm @@ -47,7 +47,7 @@ NSString *const RCTShowDevMenuNotification = @"RCTShowDevMenuNotification"; - (instancetype)initWithTitleBlock:(RCTDevMenuItemTitleBlock)titleBlock handler:(dispatch_block_t)handler { - if ((self = [super init])) { + if ((self = [super init]) != nullptr) { _titleBlock = [titleBlock copy]; _handler = [handler copy]; } @@ -72,14 +72,14 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init) - (void)callHandler { - if (_handler) { + if (_handler != nullptr) { _handler(); } } - (NSString *)title { - if (_titleBlock) { + if (_titleBlock != nullptr) { return _titleBlock(); } return nil; @@ -120,7 +120,7 @@ RCT_EXPORT_MODULE() - (instancetype)init { - if ((self = [super init])) { + if ((self = [super init]) != nullptr) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showOnShake) name:RCTShowDevMenuNotification @@ -214,7 +214,7 @@ RCT_EXPORT_MODULE() if (_actionSheet.isBeingPresented || _actionSheet.beingDismissed) { return; } - if (_actionSheet) { + if (_actionSheet != nullptr) { [_actionSheet dismissViewControllerAnimated:YES completion:^(void) { self->_actionSheet = nil; @@ -379,7 +379,7 @@ RCT_EXPORT_MODULE() RCT_EXPORT_METHOD(show) { - if (_actionSheet || RCTRunningInAppExtension()) { + if ((_actionSheet != nullptr) || RCTRunningInAppExtension()) { return; } @@ -412,7 +412,7 @@ RCT_EXPORT_METHOD(show) - (RCTDevMenuAlertActionHandler)alertActionHandlerForDevItem:(RCTDevMenuItem *__nullable)item { return ^(__unused UIAlertAction *action) { - if (item) { + if (item != nullptr) { [item callHandler]; } diff --git a/packages/react-native/React/CoreModules/RCTEventDispatcher.mm b/packages/react-native/React/CoreModules/RCTEventDispatcher.mm index dbb4e4b2111..770c746c0bf 100644 --- a/packages/react-native/React/CoreModules/RCTEventDispatcher.mm +++ b/packages/react-native/React/CoreModules/RCTEventDispatcher.mm @@ -71,12 +71,14 @@ RCT_EXPORT_MODULE() { [_callableJSModules invokeModule:@"RCTNativeAppEventEmitter" method:@"emit" - withArgs:body ? @[ name, body ] : @[ name ]]; + withArgs:(body != nullptr) ? @[ name, body ] : @[ name ]]; } - (void)sendDeviceEventWithName:(NSString *)name body:(id)body { - [_callableJSModules invokeModule:@"RCTDeviceEventEmitter" method:@"emit" withArgs:body ? @[ name, body ] : @[ name ]]; + [_callableJSModules invokeModule:@"RCTDeviceEventEmitter" + method:@"emit" + withArgs:(body != nullptr) ? @[ name, body ] : @[ name ]]; } - (void)sendTextEventWithType:(RCTTextEventType)type @@ -91,13 +93,13 @@ RCT_EXPORT_MODULE() @"eventCount" : @(eventCount), }]; - if (text) { + if (text != nullptr) { // We copy the string here because if it's a mutable string it may get released before we dispatch the event on a // different thread, causing a crash. body[@"text"] = [text copy]; } - if (key) { + if (key != nullptr) { if (key.length == 0) { key = @"Backspace"; // backspace } else { @@ -142,7 +144,7 @@ RCT_EXPORT_MODULE() if (event.canCoalesce) { eventID = RCTGetEventID(event.viewTag, event.eventName, event.coalescingKey); id previousEvent = _events[eventID]; - if (previousEvent) { + if (previousEvent != nullptr) { event = [previousEvent coalesceWithEvent:event]; } else { [_eventQueue addObject:eventID]; @@ -173,13 +175,13 @@ RCT_EXPORT_MODULE() [_eventQueueLock unlock]; if (scheduleEventsDispatch) { - if (_bridge) { + if (_bridge != nullptr) { [_bridge dispatchBlock:^{ [self flushEventsQueue]; } queue:RCTJSThread]; - } else if (_dispatchToJSThread) { + } else if (_dispatchToJSThread != nullptr) { _dispatchToJSThread(^{ [self flushEventsQueue]; }); @@ -236,7 +238,7 @@ RCT_EXPORT_MODULE() { NSDictionary *userInfo = notification.userInfo; id event = [userInfo objectForKey:@"event"]; - if (event) { + if (event != nullptr) { [self notifyObserversOfEvent:event]; } } diff --git a/packages/react-native/React/CoreModules/RCTExceptionsManager.mm b/packages/react-native/React/CoreModules/RCTExceptionsManager.mm index 2a6f3a5c461..dea805fddb2 100644 --- a/packages/react-native/React/CoreModules/RCTExceptionsManager.mm +++ b/packages/react-native/React/CoreModules/RCTExceptionsManager.mm @@ -30,7 +30,7 @@ RCT_EXPORT_MODULE() - (instancetype)initWithDelegate:(id)delegate { - if ((self = [self init])) { + if ((self = [self init]) != nullptr) { _delegate = delegate; } return self; @@ -46,7 +46,7 @@ RCT_EXPORT_MODULE() [redbox showErrorMessage:message withStack:stack errorCookie:(int)exceptionId]; } - if (_delegate) { + if (_delegate != nullptr) { [_delegate handleSoftJSExceptionWithMessage:message stack:stack exceptionId:[NSNumber numberWithDouble:exceptionId] @@ -64,7 +64,7 @@ RCT_EXPORT_MODULE() [redbox showErrorMessage:message withStack:stack errorCookie:(int)exceptionId]; } - if (_delegate) { + if (_delegate != nullptr) { [_delegate handleFatalJSExceptionWithMessage:message stack:stack exceptionId:[NSNumber numberWithDouble:exceptionId] @@ -107,13 +107,13 @@ RCT_EXPORT_METHOD(reportException : (JS::NativeExceptionsManager::ExceptionData { NSMutableDictionary *mutableErrorData = [NSMutableDictionary new]; mutableErrorData[@"message"] = data.message(); - if (data.originalMessage()) { + if (data.originalMessage() != nullptr) { mutableErrorData[@"originalMessage"] = data.originalMessage(); } - if (data.name()) { + if (data.name() != nullptr) { mutableErrorData[@"name"] = data.name(); } - if (data.componentStack()) { + if (data.componentStack() != nullptr) { mutableErrorData[@"componentStack"] = data.componentStack(); } @@ -141,7 +141,7 @@ RCT_EXPORT_METHOD(reportException : (JS::NativeExceptionsManager::ExceptionData mutableErrorData[@"id"] = @(data.id_()); mutableErrorData[@"isFatal"] = @(data.isFatal()); - if (data.extraData()) { + if (data.extraData() != nullptr) { mutableErrorData[@"extraData"] = data.extraData(); } diff --git a/packages/react-native/React/CoreModules/RCTFPSGraph.mm b/packages/react-native/React/CoreModules/RCTFPSGraph.mm index 1fc4bd24b9c..97333667c4f 100644 --- a/packages/react-native/React/CoreModules/RCTFPSGraph.mm +++ b/packages/react-native/React/CoreModules/RCTFPSGraph.mm @@ -37,7 +37,7 @@ - (instancetype)initWithFrame:(CGRect)frame color:(UIColor *)color { - if ((self = [super initWithFrame:frame])) { + if ((self = [super initWithFrame:frame]) != nullptr) { _frameCount = -1; _prevTime = -1; _maxFPS = 0; @@ -64,7 +64,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder) - (CAShapeLayer *)graph { - if (!_graph) { + if (_graph == nullptr) { _graph = [CAShapeLayer new]; _graph.frame = self.bounds; _graph.backgroundColor = [_color colorWithAlphaComponent:0.2].CGColor; @@ -76,7 +76,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder) - (UILabel *)label { - if (!_label) { + if (_label == nullptr) { _label = [[UILabel alloc] initWithFrame:self.bounds]; _label.font = [UIFont boldSystemFontOfSize:13]; _label.textAlignment = NSTextAlignmentCenter; diff --git a/packages/react-native/React/CoreModules/RCTLogBox.mm b/packages/react-native/React/CoreModules/RCTLogBox.mm index 70e48175cb3..c0b7448cda8 100644 --- a/packages/react-native/React/CoreModules/RCTLogBox.mm +++ b/packages/react-native/React/CoreModules/RCTLogBox.mm @@ -45,23 +45,23 @@ RCT_EXPORT_METHOD(show) __weak RCTLogBox *weakSelf = self; dispatch_async(dispatch_get_main_queue(), ^{ __strong RCTLogBox *strongSelf = weakSelf; - if (!strongSelf) { + if (strongSelf == nullptr) { return; } - if (strongSelf->_view) { + if (strongSelf->_view != nullptr) { [strongSelf->_view show]; return; } - if (strongSelf->_bridgelessSurfacePresenter) { + if (strongSelf->_bridgelessSurfacePresenter != nullptr) { strongSelf->_view = [[RCTLogBoxView alloc] initWithWindow:RCTKeyWindow() surfacePresenter:strongSelf->_bridgelessSurfacePresenter]; [strongSelf->_view show]; } #ifndef RCT_FIT_RM_OLD_RUNTIME - else if (strongSelf->_bridge && strongSelf->_bridge.valid) { - if (strongSelf->_bridge.surfacePresenter) { + else if ((strongSelf->_bridge != nullptr) && strongSelf->_bridge.valid) { + if (strongSelf->_bridge.surfacePresenter != nullptr) { strongSelf->_view = [[RCTLogBoxView alloc] initWithWindow:RCTKeyWindow() surfacePresenter:strongSelf->_bridge.surfacePresenter]; } else { @@ -80,7 +80,7 @@ RCT_EXPORT_METHOD(hide) __weak RCTLogBox *weakSelf = self; dispatch_async(dispatch_get_main_queue(), ^{ __strong RCTLogBox *strongSelf = weakSelf; - if (!strongSelf) { + if (strongSelf == nullptr) { return; } [strongSelf->_view setHidden:YES]; diff --git a/packages/react-native/React/CoreModules/RCTLogBoxView.mm b/packages/react-native/React/CoreModules/RCTLogBoxView.mm index fc0f24809ea..e1073a6b1d2 100644 --- a/packages/react-native/React/CoreModules/RCTLogBoxView.mm +++ b/packages/react-native/React/CoreModules/RCTLogBoxView.mm @@ -19,7 +19,7 @@ - (instancetype)initWithFrame:(CGRect)frame { - if ((self = [super initWithFrame:frame])) { + if ((self = [super initWithFrame:frame]) != nullptr) { self.windowLevel = UIWindowLevelStatusBar - 1; self.backgroundColor = [UIColor clearColor]; } diff --git a/packages/react-native/React/CoreModules/RCTPerfMonitor.mm b/packages/react-native/React/CoreModules/RCTPerfMonitor.mm index 86eabc6fb20..e67ef6a4076 100644 --- a/packages/react-native/React/CoreModules/RCTPerfMonitor.mm +++ b/packages/react-native/React/CoreModules/RCTPerfMonitor.mm @@ -134,7 +134,7 @@ RCT_EXPORT_MODULE() #if __has_include() - (RCTDevMenuItem *)devMenuItem { - if (!_devMenuItem) { + if (_devMenuItem == nullptr) { __weak __typeof__(self) weakSelf = self; __weak RCTDevSettings *devSettings = [self->_moduleRegistry moduleForName:"DevSettings"]; if (devSettings.isPerfMonitorShown) { @@ -161,7 +161,7 @@ RCT_EXPORT_MODULE() - (UIPanGestureRecognizer *)gestureRecognizer { - if (!_gestureRecognizer) { + if (_gestureRecognizer == nullptr) { _gestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(gesture:)]; } @@ -170,7 +170,7 @@ RCT_EXPORT_MODULE() - (UIView *)container { - if (!_container) { + if (_container == nullptr) { UIEdgeInsets safeInsets = RCTKeyWindow().safeAreaInsets; _container = @@ -188,7 +188,7 @@ RCT_EXPORT_MODULE() - (UILabel *)memory { - if (!_memory) { + if (_memory == nullptr) { _memory = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 44, RCTPerfMonitorBarHeight)]; _memory.font = [UIFont systemFontOfSize:12]; _memory.numberOfLines = 3; @@ -200,7 +200,7 @@ RCT_EXPORT_MODULE() - (UILabel *)heap { - if (!_heap) { + if (_heap == nullptr) { _heap = [[UILabel alloc] initWithFrame:CGRectMake(44, 0, 44, RCTPerfMonitorBarHeight)]; _heap.font = [UIFont systemFontOfSize:12]; _heap.numberOfLines = 3; @@ -212,7 +212,7 @@ RCT_EXPORT_MODULE() - (UILabel *)views { - if (!_views) { + if (_views == nullptr) { _views = [[UILabel alloc] initWithFrame:CGRectMake(88, 0, 44, RCTPerfMonitorBarHeight)]; _views.font = [UIFont systemFontOfSize:12]; _views.numberOfLines = 3; @@ -224,7 +224,7 @@ RCT_EXPORT_MODULE() - (RCTFPSGraph *)uiGraph { - if (!_uiGraph) { + if (_uiGraph == nullptr) { _uiGraph = [[RCTFPSGraph alloc] initWithFrame:CGRectMake(134, 14, 40, 30) color:[UIColor lightGrayColor]]; } return _uiGraph; @@ -232,7 +232,7 @@ RCT_EXPORT_MODULE() - (RCTFPSGraph *)jsGraph { - if (!_jsGraph) { + if (_jsGraph == nullptr) { _jsGraph = [[RCTFPSGraph alloc] initWithFrame:CGRectMake(178, 14, 40, 30) color:[UIColor lightGrayColor]]; } return _jsGraph; @@ -240,7 +240,7 @@ RCT_EXPORT_MODULE() - (UILabel *)uiGraphLabel { - if (!_uiGraphLabel) { + if (_uiGraphLabel == nullptr) { _uiGraphLabel = [[UILabel alloc] initWithFrame:CGRectMake(134, 3, 40, 10)]; _uiGraphLabel.font = [UIFont systemFontOfSize:11]; _uiGraphLabel.textAlignment = NSTextAlignmentCenter; @@ -252,7 +252,7 @@ RCT_EXPORT_MODULE() - (UILabel *)jsGraphLabel { - if (!_jsGraphLabel) { + if (_jsGraphLabel == nullptr) { _jsGraphLabel = [[UILabel alloc] initWithFrame:CGRectMake(178, 3, 38, 10)]; _jsGraphLabel.font = [UIFont systemFontOfSize:11]; _jsGraphLabel.textAlignment = NSTextAlignmentCenter; @@ -264,7 +264,7 @@ RCT_EXPORT_MODULE() - (UITableView *)metrics { - if (!_metrics) { + if (_metrics == nullptr) { _metrics = [[UITableView alloc] initWithFrame:CGRectMake( 0, RCTPerfMonitorBarHeight, @@ -281,7 +281,7 @@ RCT_EXPORT_MODULE() - (void)show { - if (_container) { + if (_container != nullptr) { return; } @@ -317,7 +317,7 @@ RCT_EXPORT_MODULE() - (void)hide { - if (!_container) { + if (_container == nullptr) { return; } @@ -360,7 +360,7 @@ RCT_EXPORT_MODULE() dispatch_io_set_low_water(_io, 20); dispatch_io_read(_io, 0, SIZE_MAX, _queue, ^(__unused bool done, dispatch_data_t data, __unused int error) { - if (!data) { + if (data == nullptr) { return; } @@ -391,7 +391,7 @@ RCT_EXPORT_MODULE() GCRegex = [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:nil]; }); - if (_remaining) { + if (_remaining != nullptr) { log = [_remaining stringByAppendingString:log]; _remaining = nil; } @@ -404,7 +404,7 @@ RCT_EXPORT_MODULE() for (NSString *line in lines) { NSTextCheckingResult *match = [GCRegex firstMatchInString:line options:0 range:NSMakeRange(0, line.length)]; - if (match) { + if (match != nullptr) { NSString *heapSizeStr = [line substringWithRange:[match rangeAtIndex:2]]; _heapSize = [heapSizeStr integerValue]; } @@ -417,7 +417,7 @@ RCT_EXPORT_MODULE() NSUInteger viewCount = views.count; NSUInteger visibleViewCount = 0; for (UIView *view in views.allValues) { - if (view.window || view.superview.window) { + if ((view.window != nullptr) || (view.superview.window != nullptr)) { visibleViewCount++; } } @@ -436,7 +436,7 @@ RCT_EXPORT_MODULE() __weak __typeof__(self) weakSelf = self; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ __strong __typeof__(weakSelf) strongSelf = weakSelf; - if (strongSelf && strongSelf->_container.superview) { + if ((strongSelf != nullptr) && (strongSelf->_container.superview != nullptr)) { [strongSelf updateStats]; } }); @@ -512,7 +512,7 @@ RCT_EXPORT_MODULE() UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:RCTPerfMonitorCellIdentifier forIndexPath:indexPath]; - if (!cell) { + if (cell == nullptr) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:RCTPerfMonitorCellIdentifier]; }