From 2f788524112d59f62a295e7f4b0c1cfa0f6203fe Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Tue, 16 Aug 2016 07:22:45 -0700 Subject: [PATCH] Fix warning on unused return values in RCTSRWebSocket Summary: Assert that the return value of these methods is sane. Closes https://github.com/facebook/react-native/issues/8108 Reviewed By: majak Differential Revision: D3722629 fbshipit-source-id: 2a67daae6dc380721e5dad27acd2ab67f71d0c6c --- Libraries/LinkingIOS/RCTLinking.xcodeproj/project.pbxproj | 8 ++++++++ Libraries/WebSocket/RCTSRWebSocket.m | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Libraries/LinkingIOS/RCTLinking.xcodeproj/project.pbxproj b/Libraries/LinkingIOS/RCTLinking.xcodeproj/project.pbxproj index 844d94cf6..44002926a 100644 --- a/Libraries/LinkingIOS/RCTLinking.xcodeproj/project.pbxproj +++ b/Libraries/LinkingIOS/RCTLinking.xcodeproj/project.pbxproj @@ -157,6 +157,10 @@ MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; + WARNING_CFLAGS = ( + "-Werror", + "-Wall", + ); }; name = Debug; }; @@ -192,6 +196,10 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; + WARNING_CFLAGS = ( + "-Werror", + "-Wall", + ); }; name = Release; }; diff --git a/Libraries/WebSocket/RCTSRWebSocket.m b/Libraries/WebSocket/RCTSRWebSocket.m index 26bd54bcf..1d9525853 100644 --- a/Libraries/WebSocket/RCTSRWebSocket.m +++ b/Libraries/WebSocket/RCTSRWebSocket.m @@ -491,7 +491,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init) CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Host"), (__bridge CFStringRef)(_url.port ? [NSString stringWithFormat:@"%@:%@", _url.host, _url.port] : _url.host)); NSMutableData *keyBytes = [[NSMutableData alloc] initWithLength:16]; - SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes); + int result = SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes); + assert(result == 0); _secKey = [keyBytes base64EncodedStringWithOptions:0]; assert([_secKey length] == 24); @@ -1331,7 +1332,8 @@ static const size_t RCTSRFrameHeaderOverhead = 32; } } else { uint8_t *mask_key = frame_buffer + frame_buffer_size; - SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key); + int result = SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key); + assert(result == 0); frame_buffer_size += sizeof(uint32_t); // TODO: could probably optimize this with SIMD