Fix format warnings for clang 5.0

Reviewed By: mzlee

Differential Revision: D5900751

fbshipit-source-id: 4e9aea068aab3d2d882b8fb103a8828e861da97c
This commit is contained in:
Jakub Grzmiel 2017-09-25 10:23:02 -07:00 committed by Facebook Github Bot
parent eae0241a7d
commit d005c8c08a
12 changed files with 22 additions and 22 deletions

View File

@ -51,7 +51,7 @@
CGPathAddArc(path, NULL, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE == 0); CGPathAddArc(path, NULL, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE == 0);
break; break;
default: default:
RCTLogError(@"Invalid CGPath type %zd at element %zd of %@", type, i, arr); RCTLogError(@"Invalid CGPath type %llu at element %llu of %@", (unsigned long long)type, (unsigned long long)i, arr);
CGPathRelease(path); CGPathRelease(path);
return NULL; return NULL;
} }
@ -158,7 +158,7 @@ RCT_ENUM_CONVERTER(CTTextAlignment, (@{
case 3: // pattern case 3: // pattern
return [[ARTPattern alloc] initWithArray:arr]; return [[ARTPattern alloc] initWithArray:arr];
default: default:
RCTLogError(@"Unknown brush type: %zd", type); RCTLogError(@"Unknown brush type: %llu", (unsigned long long)type);
return nil; return nil;
} }
} }
@ -167,7 +167,7 @@ RCT_ENUM_CONVERTER(CTTextAlignment, (@{
{ {
NSArray *arr = [self NSArray:json]; NSArray *arr = [self NSArray:json];
if (arr.count < offset + 2) { if (arr.count < offset + 2) {
RCTLogError(@"Too few elements in array (expected at least %zd): %@", 2 + offset, arr); RCTLogError(@"Too few elements in array (expected at least %llu): %@", (unsigned long long)(2 + offset), arr);
return CGPointZero; return CGPointZero;
} }
return (CGPoint){ return (CGPoint){
@ -180,7 +180,7 @@ RCT_ENUM_CONVERTER(CTTextAlignment, (@{
{ {
NSArray *arr = [self NSArray:json]; NSArray *arr = [self NSArray:json];
if (arr.count < offset + 4) { if (arr.count < offset + 4) {
RCTLogError(@"Too few elements in array (expected at least %zd): %@", 4 + offset, arr); RCTLogError(@"Too few elements in array (expected at least %llu): %@", (unsigned long long)(4 + offset), arr);
return CGRectZero; return CGRectZero;
} }
return (CGRect){ return (CGRect){
@ -193,7 +193,7 @@ RCT_ENUM_CONVERTER(CTTextAlignment, (@{
{ {
NSArray *arr = [self NSArray:json]; NSArray *arr = [self NSArray:json];
if (arr.count < offset + 4) { if (arr.count < offset + 4) {
RCTLogError(@"Too few elements in array (expected at least %zd): %@", 4 + offset, arr); RCTLogError(@"Too few elements in array (expected at least %llu): %@", (unsigned long long)(4 + offset), arr);
return NULL; return NULL;
} }
return [self CGColor:[arr subarrayWithRange:(NSRange){offset, 4}]]; return [self CGColor:[arr subarrayWithRange:(NSRange){offset, 4}]];
@ -203,7 +203,7 @@ RCT_ENUM_CONVERTER(CTTextAlignment, (@{
{ {
NSArray *arr = [self NSArray:json]; NSArray *arr = [self NSArray:json];
if (arr.count < offset) { if (arr.count < offset) {
RCTLogError(@"Too few elements in array (expected at least %zd): %@", offset, arr); RCTLogError(@"Too few elements in array (expected at least %llu): %@", (unsigned long long)offset, arr);
return NULL; return NULL;
} }
arr = [arr subarrayWithRange:(NSRange){offset, arr.count - offset}]; arr = [arr subarrayWithRange:(NSRange){offset, arr.count - offset}];

View File

@ -90,7 +90,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
notifyDelegate:YES]; notifyDelegate:YES];
} }
} else if (eventLag > RCTTextUpdateLagWarningThreshold) { } else if (eventLag > RCTTextUpdateLagWarningThreshold) {
RCTLogWarn(@"Native TextInput(%@) is %zd events ahead of JS - try to make your JS faster.", _backedTextInput.text, eventLag); RCTLogWarn(@"Native TextInput(%@) is %lld events ahead of JS - try to make your JS faster.", _backedTextInput.text, (long long)eventLag);
} }
} }

View File

@ -87,7 +87,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
if (eventLag == 0 && ![previousSelectedTextRange isEqual:selectedTextRange]) { if (eventLag == 0 && ![previousSelectedTextRange isEqual:selectedTextRange]) {
[backedTextInput setSelectedTextRange:selectedTextRange notifyDelegate:NO]; [backedTextInput setSelectedTextRange:selectedTextRange notifyDelegate:NO];
} else if (eventLag > RCTTextUpdateLagWarningThreshold) { } else if (eventLag > RCTTextUpdateLagWarningThreshold) {
RCTLogWarn(@"Native TextInput(%@) is %zd events ahead of JS - try to make your JS faster.", backedTextInput.text, eventLag); RCTLogWarn(@"Native TextInput(%@) is %lld events ahead of JS - try to make your JS faster.", backedTextInput.text, (long long)eventLag);
} }
} }

View File

@ -235,7 +235,7 @@ static NSAttributedString *removeReactTagFromString(NSAttributedString *string)
[self invalidateContentSize]; [self invalidateContentSize];
} else if (eventLag > RCTTextUpdateLagWarningThreshold) { } else if (eventLag > RCTTextUpdateLagWarningThreshold) {
RCTLogWarn(@"Native TextInput(%@) is %zd events ahead of JS - try to make your JS faster.", self.text, eventLag); RCTLogWarn(@"Native TextInput(%@) is %lld events ahead of JS - try to make your JS faster.", self.text, (long long)eventLag);
} }
} }

View File

@ -56,7 +56,7 @@ RCT_EXPORT_MODULE()
if (!_url) { if (!_url) {
NSInteger port = [[[_bridge bundleURL] port] integerValue] ?: 8081; NSInteger port = [[[_bridge bundleURL] port] integerValue] ?: 8081;
NSString *host = [[_bridge bundleURL] host] ?: @"localhost"; NSString *host = [[_bridge bundleURL] host] ?: @"localhost";
NSString *URLString = [NSString stringWithFormat:@"http://%@:%zd/debugger-proxy?role=client", host, port]; NSString *URLString = [NSString stringWithFormat:@"http://%@:%lld/debugger-proxy?role=client", host, (long long)port];
_url = [RCTConvert NSURL:URLString]; _url = [RCTConvert NSURL:URLString];
} }

View File

@ -68,7 +68,7 @@ RCT_CUSTOM_CONVERTER(NSData *, NSData, [json dataUsingEncoding:NSUTF8StringEncod
for (NSNumber *number in json) { for (NSNumber *number in json) {
NSInteger index = number.integerValue; NSInteger index = number.integerValue;
if (RCT_DEBUG && index < 0) { if (RCT_DEBUG && index < 0) {
RCTLogError(@"Invalid index value %zd. Indices must be positive.", index); RCTLogError(@"Invalid index value %lld. Indices must be positive.", (long long)index);
} }
[indexSet addIndex:index]; [indexSet addIndex:index];
} }
@ -403,7 +403,7 @@ static void convertCGStruct(const char *type, NSArray *fields, CGFloat *result,
NSUInteger count = fields.count; NSUInteger count = fields.count;
if ([json isKindOfClass:[NSArray class]]) { if ([json isKindOfClass:[NSArray class]]) {
if (RCT_DEBUG && [json count] != count) { if (RCT_DEBUG && [json count] != count) {
RCTLogError(@"Expected array with count %zd, but count is %zd: %@", count, [json count], json); RCTLogError(@"Expected array with count %llu, but count is %llu: %@", (unsigned long long)count, (unsigned long long)[json count], json);
} else { } else {
for (NSUInteger i = 0; i < count; i++) { for (NSUInteger i = 0; i < count; i++) {
result[i] = [RCTConvert CGFloat:RCTNilIfNull(json[i])]; result[i] = [RCTConvert CGFloat:RCTNilIfNull(json[i])];

View File

@ -68,8 +68,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
- (NSString *)description - (NSString *)description
{ {
return [NSString stringWithFormat:@"<%@:%p input=\"%@\" flags=%zd hasBlock=%@>", return [NSString stringWithFormat:@"<%@:%p input=\"%@\" flags=%lld hasBlock=%@>",
[self class], self, _keyCommand.input, _keyCommand.modifierFlags, [self class], self, _keyCommand.input, (long long)_keyCommand.modifierFlags,
_block ? @"YES" : @"NO"]; _block ? @"YES" : @"NO"];
} }

View File

@ -493,12 +493,12 @@ RCT_EXTERN_C_END
expectedCount -= 2; expectedCount -= 2;
} }
RCTLogError(@"%@.%s was called with %zd arguments but expects %zd arguments. " RCTLogError(@"%@.%s was called with %lld arguments but expects %lld arguments. "
@"If you haven\'t changed this method yourself, this usually means that " @"If you haven\'t changed this method yourself, this usually means that "
@"your versions of the native code and JavaScript code are out of sync. " @"your versions of the native code and JavaScript code are out of sync. "
@"Updating both should make this error go away.", @"Updating both should make this error go away.",
RCTBridgeModuleNameForClass(_moduleClass), self.JSMethodName, RCTBridgeModuleNameForClass(_moduleClass), self.JSMethodName,
actualCount, expectedCount); (long long)actualCount, (long long)expectedCount);
return nil; return nil;
} }
#endif #endif

View File

@ -30,7 +30,7 @@ static UIViewAnimationOptions UIViewAnimationOptionsFromRCTAnimationType(RCTAnim
// http://stackoverflow.com/questions/18870447/how-to-use-the-default-ios7-uianimation-curve // http://stackoverflow.com/questions/18870447/how-to-use-the-default-ios7-uianimation-curve
return (UIViewAnimationOptions)(_currentKeyboardAnimationCurve << 16); return (UIViewAnimationOptions)(_currentKeyboardAnimationCurve << 16);
default: default:
RCTLogError(@"Unsupported animation type %zd", type); RCTLogError(@"Unsupported animation type %lld", (long long)type);
return UIViewAnimationOptionCurveEaseInOut; return UIViewAnimationOptionCurveEaseInOut;
} }
} }

View File

@ -186,12 +186,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
- (NSString *)formatFrameSource:(RCTJSStackFrame *)stackFrame - (NSString *)formatFrameSource:(RCTJSStackFrame *)stackFrame
{ {
NSString *fileName = RCTNilIfNull(stackFrame.file) ? [stackFrame.file lastPathComponent] : @"<unknown file>"; NSString *fileName = RCTNilIfNull(stackFrame.file) ? [stackFrame.file lastPathComponent] : @"<unknown file>";
NSString *lineInfo = [NSString stringWithFormat:@"%@:%zd", NSString *lineInfo = [NSString stringWithFormat:@"%@:%lld",
fileName, fileName,
stackFrame.lineNumber]; (long long)stackFrame.lineNumber];
if (stackFrame.column != 0) { if (stackFrame.column != 0) {
lineInfo = [lineInfo stringByAppendingFormat:@":%zd", stackFrame.column]; lineInfo = [lineInfo stringByAppendingFormat:@":%lld", (long long)stackFrame.column];
} }
return lineInfo; return lineInfo;
} }

View File

@ -197,7 +197,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:unused)
case RCTPointerEventsBoxNone: case RCTPointerEventsBoxNone:
return hitSubview; return hitSubview;
default: default:
RCTLogError(@"Invalid pointer-events specified %zd on %@", _pointerEvents, self); RCTLogError(@"Invalid pointer-events specified %lld on %@", (long long)_pointerEvents, self);
return hitSubview ?: hitView; return hitSubview ?: hitView;
} }
} }

View File

@ -153,7 +153,7 @@ RCT_EXPORT_METHOD(startLoadWithResult:(BOOL)result lockIdentifier:(NSInteger)loc
[_shouldStartLoadLock unlockWithCondition:0]; [_shouldStartLoadLock unlockWithCondition:0];
} else { } else {
RCTLogWarn(@"startLoadWithResult invoked with invalid lockIdentifier: " RCTLogWarn(@"startLoadWithResult invoked with invalid lockIdentifier: "
"got %zd, expected %zd", lockIdentifier, _shouldStartLoadLock.condition); "got %lld, expected %lld", (long long)lockIdentifier, (long long)_shouldStartLoadLock.condition);
} }
} }