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
This commit is contained in:
Pieter De Baets 2016-08-16 07:22:45 -07:00 коммит произвёл Facebook Github Bot 0
Родитель 1199c5ade9
Коммит 2f78852411
2 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -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;
};

Просмотреть файл

@ -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