Skip to content

Commit

Permalink
Address some RN build warnings
Browse files Browse the repository at this point in the history
Summary:
Addresses build warnings for some additional compiler flags.

Changelog: [Internal]

Reviewed By: nlutsenko

Differential Revision: D34299822

fbshipit-source-id: d3d873fb600990a869cb0e6fbe9fff4ebc8c5d0e
  • Loading branch information
Amy Lee authored and facebook-github-bot committed Feb 18, 2022
1 parent c1db41f commit 16feabf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RCTCXXBRIDGE_PUBLIC_HEADERS = {
"JSCExecutorFactory.h",
"NSDataBigString.h",
"RCTCxxBridgeDelegate.h",
"RCTJSIExecutorRuntimeInstaller.h",
"RCTMessageThread.h",
]
}
Expand Down
8 changes: 4 additions & 4 deletions Libraries/Image/RCTImageLoader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -614,7 +614,7 @@ - (RCTImageURLLoaderRequest *)_loadImageOrDataWithURLRequest:(NSURLRequest *)req
});

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;
}
Expand Down Expand Up @@ -754,7 +754,7 @@ - (RCTImageURLLoaderRequest *)loadImageWithURLRequest:(NSURLRequest *)imageURLRe
__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;
}
Expand Down Expand Up @@ -904,7 +904,7 @@ - (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)data
} 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ + (UILocalNotification *)UILocalNotification:(id)json

@end
#else
@interface RCTPushNotificationManager () <NativePushNotificationManagerIOS>
@interface RCTPushNotificationManager () <NativePushNotificationManagerIOSSpec>
@end
#endif // TARGET_OS_UIKITFORMAC

Expand Down
2 changes: 1 addition & 1 deletion React/Base/Surface/RCTSurface.mm
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ - (BOOL)synchronouslyWaitForStage:(RCTSurfaceStage)stage timeout:(NSTimeInterval
@"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);
Expand Down

0 comments on commit 16feabf

Please sign in to comment.