From 16feabf676193e970e19cbfafa0540928b4e0049 Mon Sep 17 00:00:00 2001 From: Amy Lee Date: Thu, 17 Feb 2022 19:16:37 -0800 Subject: [PATCH] Address some RN build warnings Summary: Addresses build warnings for some additional compiler flags. Changelog: [Internal] Reviewed By: nlutsenko Differential Revision: D34299822 fbshipit-source-id: d3d873fb600990a869cb0e6fbe9fff4ebc8c5d0e --- BUCK | 1 + Libraries/Image/RCTImageLoader.mm | 8 ++++---- .../PushNotificationIOS/RCTPushNotificationManager.mm | 2 +- React/Base/Surface/RCTSurface.mm | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/BUCK b/BUCK index cdbf57b3994..b5f70c3feae 100644 --- a/BUCK +++ b/BUCK @@ -36,6 +36,7 @@ RCTCXXBRIDGE_PUBLIC_HEADERS = { "JSCExecutorFactory.h", "NSDataBigString.h", "RCTCxxBridgeDelegate.h", + "RCTJSIExecutorRuntimeInstaller.h", "RCTMessageThread.h", ] } diff --git a/Libraries/Image/RCTImageLoader.mm b/Libraries/Image/RCTImageLoader.mm index d0e3d9c1cff..8b2bfd1afc0 100644 --- a/Libraries/Image/RCTImageLoader.mm +++ b/Libraries/Image/RCTImageLoader.mm @@ -40,7 +40,7 @@ void RCTEnableImageLoadingPerfInstrumentation(BOOL enabled) static NSInteger RCTImageBytesForImage(UIImage *image) { - NSInteger singleImageBytes = image.size.width * image.size.height * image.scale * image.scale * 4; + NSInteger singleImageBytes = (NSInteger)(image.size.width * image.size.height * image.scale * image.scale * 4); return image.images ? image.images.count * singleImageBytes : singleImageBytes; } @@ -614,7 +614,7 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image, }); return [[RCTImageURLLoaderRequest alloc] initWithRequestId:requestId imageURL:request.URL cancellationBlock:^{ - BOOL alreadyCancelled = atomic_fetch_or(cancelled.get(), 1); + BOOL alreadyCancelled = atomic_fetch_or(cancelled.get(), 1) ? YES : NO; if (alreadyCancelled) { return; } @@ -754,7 +754,7 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image, __block dispatch_block_t cancelLoad = nil; __block NSLock *cancelLoadLock = [NSLock new]; dispatch_block_t cancellationBlock = ^{ - BOOL alreadyCancelled = atomic_fetch_or(cancelled.get(), 1); + BOOL alreadyCancelled = atomic_fetch_or(cancelled.get(), 1) ? YES : NO; if (alreadyCancelled) { return; } @@ -904,7 +904,7 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image, } else { dispatch_block_t decodeBlock = ^{ // Calculate the size, in bytes, that the decompressed image will require - NSInteger decodedImageBytes = (size.width * scale) * (size.height * scale) * 4; + NSInteger decodedImageBytes = (NSInteger)((size.width * scale) * (size.height * scale) * 4); // Mark these bytes as in-use self->_activeBytes += decodedImageBytes; diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm b/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm index d767641cd22..68b12010441 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +++ b/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm @@ -76,7 +76,7 @@ RCT_ENUM_CONVERTER(UIBackgroundFetchResult, (@{ @end #else -@interface RCTPushNotificationManager () +@interface RCTPushNotificationManager () @end #endif // TARGET_OS_UIKITFORMAC diff --git a/React/Base/Surface/RCTSurface.mm b/React/Base/Surface/RCTSurface.mm index 49890e732f8..18798ec588f 100644 --- a/React/Base/Surface/RCTSurface.mm +++ b/React/Base/Surface/RCTSurface.mm @@ -481,7 +481,7 @@ @"Only waiting for `RCTSurfaceStageSurfaceDidInitialRendering`, `RCTSurfaceStageSurfaceDidInitialLayout` and `RCTSurfaceStageSurfaceDidInitialMounting` stages are supported."); } - BOOL timeoutOccurred = dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, timeout * NSEC_PER_SEC)); + auto timeoutOccurred = dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, timeout * NSEC_PER_SEC)); // Atomic equivalent of `_waitingForMountingStageOnMainQueue = NO;`. atomic_fetch_and(&_waitingForMountingStageOnMainQueue, 0);