Changes for arm64 and Clang redefined-types

This commit is contained in:
Frederic Jacobs 2014-07-17 02:02:09 +02:00
parent 675956f792
commit 44bd921db2
26 changed files with 51 additions and 52 deletions

View File

@ -598,7 +598,7 @@ int64_t decodeZigZag64(int64_t n) {
bufferPos = 0;
bufferSize = 0;
if (input != nil) {
bufferSize = [input read:buffer.mutableBytes maxLength:buffer.length];
bufferSize = (int32_t)[input read:buffer.mutableBytes maxLength:buffer.length];
}
if (bufferSize <= 0) {
@ -610,7 +610,7 @@ int64_t decodeZigZag64(int64_t n) {
}
} else {
[self recomputeBufferSizeAfterLimit];
int32_t totalBytesRead = totalBytesRetired + bufferSize + bufferSizeAfterLimit;
NSInteger totalBytesRead = totalBytesRetired + bufferSize + bufferSizeAfterLimit;
if (totalBytesRead > sizeLimit || totalBytesRead < 0) {
@throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"sizeLimitExceeded" userInfo:nil];
}
@ -713,7 +713,7 @@ int64_t decodeZigZag64(int64_t n) {
while (pos < (int32_t)chunk.length) {
int32_t n = 0;
if (input != nil) {
n = [input read:(((uint8_t*) chunk.mutableBytes) + pos) maxLength:chunk.length - (NSUInteger)pos];
n = (int32_t)[input read:(((uint8_t*) chunk.mutableBytes) + pos) maxLength:chunk.length - (NSUInteger)pos];
}
if (n <= 0) {
@throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"truncatedMessage" userInfo:nil];

View File

@ -86,7 +86,7 @@ BOOL isHex(unichar c) {
if (isSigned) {
result = strtol(in_string, &out_string, 0);
} else {
result = convertUInt32ToInt32(strtoul(in_string, &out_string, 0));
result = convertUInt32ToInt32((unsigned int)strtoul(in_string, &out_string, 0));
}
}

View File

@ -8,7 +8,7 @@
AudioBufferList* audioBufferList = malloc(sizeof(AudioBufferList));
audioBufferList->mNumberBuffers = 1;
audioBufferList->mBuffers[0].mNumberChannels = 1;
audioBufferList->mBuffers[0].mDataByteSize = bufferSize;
audioBufferList->mBuffers[0].mDataByteSize = (UInt32)bufferSize;
audioBufferList->mBuffers[0].mData = malloc(bufferSize);
RemoteIOBufferListWrapper* w = [RemoteIOBufferListWrapper new];

View File

@ -22,7 +22,7 @@
checkOperationDescribe(time_scale_rate(&timeScaleState, (float)stretchFactor) == 0, @"Changing time scaling");
int inputSampleCount = [audioData length]/sizeof(int16_t);
int inputSampleCount = (unsigned int)[audioData length]/sizeof(int16_t);
int maxOutputSampleCount = [self getSafeMaxOutputSampleCountFromInputSampleCount:inputSampleCount];
int16_t* input = (int16_t*)[audioData bytes];

View File

@ -375,7 +375,7 @@ void onAddressBookChanged(ABAddressBookRef notifyAddressBook, CFDictionaryRef in
-(NSArray*) contactsForContactIds:(NSArray *)contactIds {
NSMutableArray *contacts = [NSMutableArray array];
for (NSNumber *favouriteId in contactIds) {
Contact *contact = [self latestContactWithRecordId:[favouriteId integerValue]];
Contact *contact = [self latestContactWithRecordId:[favouriteId intValue]];
if (contact) {
[contacts addObject:contact];
@ -427,7 +427,7 @@ void onAddressBookChanged(ABAddressBookRef notifyAddressBook, CFDictionaryRef in
#pragma mark - Whisper User Management
-(unsigned int) checkForNewWhisperUsers {
-(NSUInteger) checkForNewWhisperUsers {
NSArray *currentUsers = [self getWhisperUsersFromContactsArray:[latestContactsById allValues]];
NSArray *newUsers = [self getNewItemsFrom:currentUsers comparedTo:[latestWhisperUsersById allValues]];

View File

@ -112,7 +112,7 @@
NSData *data = [self dataForKey:key];
if ([data length] != length) {
DDLogError(@"Length of data not matching. Got %lu, expected %u", [data length], length);
DDLogError(@"Length of data not matching. Got %lu, expected %u", (unsigned long)[data length], length);
}
return data;

View File

@ -67,8 +67,8 @@ void handleDnsCompleted(CFHostRef hostRef, CFHostInfoType typeInfo, const CFStre
Boolean startedSuccess = CFHostStartInfoResolution(hostRef, kCFHostAddresses, &d->error);
CFRelease(hostRef);
if (!startedSuccess) {
[d->futureResultSource trySetFailure:[OperationFailed new:[NSString stringWithFormat:@"DNS query failed to start. Error code: %ld",
d->error.error]]];
[d->futureResultSource trySetFailure:[OperationFailed new:[NSString stringWithFormat:@"DNS query failed to start. Error code: %d",
(int)d->error.error]]];
}
[unlessCancelledToken whenCancelledTryCancel:d->futureResultSource];

View File

@ -36,7 +36,7 @@
NSMutableDictionary* headers = [NSMutableDictionary dictionary];
if (optionalBody != nil) {
[headers setObject:[[NSNumber numberWithLongLong:[optionalBody length]] stringValue] forKey:@"Content-Length"];
[headers setObject:[[NSNumber numberWithUnsignedInteger:[optionalBody length]] stringValue] forKey:@"Content-Length"];
}
HttpRequest* s = [HttpRequest new];
@ -58,7 +58,7 @@
NSMutableDictionary* headers = [NSMutableDictionary dictionary];
if (optionalBody != nil) {
[headers setObject:[[NSNumber numberWithLongLong:[optionalBody length]] stringValue] forKey:@"Content-Length"];
[headers setObject:[[NSNumber numberWithUnsignedInteger:[optionalBody length]] stringValue] forKey:@"Content-Length"];
}
[headers setObject:[HttpRequest computeBasicAuthorizationTokenForLocalNumber:localNumber andPassword:password] forKey:@"Authorization"];
@ -81,7 +81,7 @@
NSMutableDictionary* headers = [NSMutableDictionary dictionary];
if (optionalBody != nil) {
[headers setObject:[[NSNumber numberWithLongLong:[optionalBody length]] stringValue] forKey:@"Content-Length"];
[headers setObject:[[NSNumber numberWithUnsignedInteger:[optionalBody length]] stringValue] forKey:@"Content-Length"];
}
[headers setObject:[HttpRequest computeOtpAuthorizationTokenForLocalNumber:localNumber andCounterValue:counter andPassword:password] forKey:@"Authorization"];

View File

@ -106,7 +106,7 @@
NSString* body = [self getOptionalBodyText];
if (body != nil) {
[r addObject:@"Content-Length: "];
[r addObject:[[NSNumber numberWithLongLong:[body length]] stringValue]];
[r addObject:[[NSNumber numberWithUnsignedInteger:[body length]] stringValue]];
[r addObject:@"\r\n"];
[r addObject:body];
} else {
@ -120,8 +120,8 @@
}
-(NSString*) description {
return [NSString stringWithFormat:@"%d %@%@",
statusCode,
return [NSString stringWithFormat:@"%lu %@%@",
(unsigned long)statusCode,
statusText,
![self hasBody] ? @""
: [self hasEmptyBody] ? @" [empty body]"

View File

@ -266,7 +266,7 @@ andSynchronizationSourceIdentifier:(uint32_t)synchronizedSourceIdentifier
}
-(NSData*) generateCcrcData {
return [[contributingSourceIdentifiers map:^id(NSNumber* ccsrc) {
return [NSData dataWithBigEndianBytesOfUInt32:[ccsrc unsignedLongValue]];
return [NSData dataWithBigEndianBytesOfUInt32:[ccsrc unsignedIntValue]];
}] concatDatas];
}
-(NSData*) generateExtensionHeaderData {

View File

@ -49,8 +49,8 @@
CFRelease(anchorCerts);
checkOperationDescribe(setAnchorResult == 0,
([NSString stringWithFormat:@"SecTrustSetAnchorCertificates failed with error code: %ld",
setAnchorResult]));
([NSString stringWithFormat:@"SecTrustSetAnchorCertificates failed with error code: %d",
(int)setAnchorResult]));
}
-(NSString *)description {

View File

@ -74,7 +74,6 @@
NSStreamStatus status = [outputStream streamStatus];
if (status < NSStreamStatusOpen) return;
if (status >= NSStreamStatusAtEnd) {
DDLogError(@"Status of the stream: %lu", status);
[rawDataHandler handleError:@"Wrote to ended/closed/errored stream."
relatedInfo:nil
causedTermination:false];
@ -83,15 +82,16 @@
while ([writeBuffer enqueuedLength] > 0 && [outputStream hasSpaceAvailable]) {
NSData* data = [writeBuffer peekVolatileHeadOfData];
int d = [outputStream write:[data bytes] maxLength:[data length]];
NSInteger d = [outputStream write:[data bytes] maxLength:[data length]];
// reached destination buffer capacity?
if (d == 0) break;
// error?
if (d < 0) {
id error = [outputStream streamError];
if (error == nil) error = @"Unknown error when writing to stream.";
if (error == nil){
error = @"Unknown error when writing to stream.";
}
[rawDataHandler handleError:error relatedInfo:nil causedTermination:false];
return;
}
@ -167,7 +167,7 @@
if ([inputStream streamError]) {
error = [inputStream streamError];
DDLogError(@"Error on incoming stream : %@");
DDLogError(@"Error on incoming stream : %@", error);
} else if ([outputStream streamError]){
error = [outputStream streamError];
DDLogError(@"Error on outgoing stream: %@", error);
@ -184,7 +184,7 @@
if (![[futureConnectedAndWritableSource forceGetResult] isEqual:@YES]) return;
while ([inputStream hasBytesAvailable]) {
int numRead = [inputStream read:[readBuffer mutableBytes] maxLength:[readBuffer length]];
NSInteger numRead = [inputStream read:[readBuffer mutableBytes] maxLength:[readBuffer length]];
if (numRead < 0) [self onErrorOccurred:@"Read Error"];
if (numRead <= 0) break;
@ -230,9 +230,9 @@
break;
default:
[self onErrorOccurred:[NSString stringWithFormat:@"Unexpected %@ stream event: %d.",
[self onErrorOccurred:[NSString stringWithFormat:@"Unexpected %@ stream event: %lu.",
isInputStream ? @"input" : @"output",
event]];
(unsigned long)event]];
}
}
}

View File

@ -69,7 +69,7 @@
SecTrustResultType trustResult = kSecTrustResultInvalid;
OSStatus evalResult = SecTrustEvaluate(trust, &trustResult);
checkSecurityOperation(evalResult == 0,
([NSString stringWithFormat:@"NetworkStream: SecTrustEvaluate failed with error code: %ld", evalResult]));
([NSString stringWithFormat:@"NetworkStream: SecTrustEvaluate failed with error code: %d", (int)evalResult]));
checkSecurityOperation(trustResult != kSecTrustResultProceed,
@"Unexpected: User approved certificate somehow? Failing safe.");
checkSecurityOperation(trustResult == kSecTrustResultUnspecified,

View File

@ -126,8 +126,7 @@
Future* futureEndPoint = [futureDnsResult then:^(NSArray* ipAddresses) {
require([ipAddresses count] > 0);
// @todo: is this the correct way to pick an address (random)? What about low latency? Different each time? dns beforehand?
IpAddress* address = [ipAddresses objectAtIndex:arc4random_uniform([ipAddresses count])];
IpAddress* address = [ipAddresses objectAtIndex:arc4random_uniform((unsigned int)[ipAddresses count])];
return [IpEndPoint ipEndPointAtAddress:address
onPort:sessionDescriptor.relayUdpPort];
}];

View File

@ -40,7 +40,7 @@
NSString* hashCountHeader = [[response getHeaders] objectForKey:HASH_COUNT_HEADER_KEY];
checkOperation(hashCountHeader != nil);
int hashCountValue = [hashCountHeader integerValue];
int hashCountValue = [hashCountHeader intValue];
checkOperation(hashCountValue > 0);
NSData* responseBody = [response getOptionalBodyData];

View File

@ -60,7 +60,7 @@
[self log:@"JitterQueue arrival" details:[NSString stringWithFormat:@"sequence: %d", sequenceNumber]];
}
-(void) notifyDequeue:(uint16_t)sequenceNumber withRemainingEnqueuedItemCount:(NSUInteger)remainingCount {
[self log:@"JitterQueue dequeue" details:[NSString stringWithFormat:@"sequence: %d, remaining: %d", sequenceNumber, remainingCount]];
[self log:@"JitterQueue dequeue" details:[NSString stringWithFormat:@"sequence: %d, remaining: %lu", sequenceNumber, (unsigned long)remainingCount]];
}
-(void) notifyBadArrival:(uint16_t)sequenceNumber ofType:(enum JitterBadArrivalType)arrivalType {
[self log:@"JitterQueue bad arrival" details:[NSString stringWithFormat:@"sequence: %d, arrival type: %d", sequenceNumber, arrivalType]];

View File

@ -31,7 +31,7 @@ void generateCRC32Table(uint32_t *pTable, uint32_t poly) {
uint32_t crc = seed;
uint8_t *pBytes = (uint8_t *)[self bytes];
uint32_t length = [self length];
NSUInteger length = [self length];
while (length--) {
crc = (crc>>8) ^ pTable[(crc & 0xFF) ^ *pBytes++];

View File

@ -2,7 +2,7 @@
#import "Constraints.h"
#import "Util.h"
#define INITIAL_CAPACITY 100
#define INITIAL_CAPACITY 100 // The buffer size can not be longer than an unsigned int.
@implementation CyclicalBuffer
@ -55,7 +55,7 @@
-(void) discard:(NSUInteger)length {
require(length <= count);
count -= length;
readOffset = (readOffset + length)%[buffer length];
readOffset = (readOffset + length)%(unsigned int)[buffer length];
}
-(NSData*) peekDataWithLength:(NSUInteger)length{

View File

@ -119,7 +119,7 @@ static NSInteger connectingFlashCounter = 0;
- (void)rotateConnectingIndicator {
[_connectingIndicatorImageView setImage:[UIImage imageNamed:SPINNER_RINGING_IMAGE_NAME]];
[UIView animateWithDuration:RINGING_ROTATION_DURATION delay:0.0 options:UIViewAnimationOptionCurveLinear animations:^{
_connectingIndicatorImageView.transform = CGAffineTransformRotate(_connectingIndicatorImageView.transform, M_PI_2);
_connectingIndicatorImageView.transform = CGAffineTransformRotate(_connectingIndicatorImageView.transform, (float)M_PI_2);
} completion:nil];
}

View File

@ -173,7 +173,7 @@
CGRectGetMinY(_tabBarInboxButton.frame),
CGRectGetWidth(_tabBarInboxButton.frame),
CGRectGetHeight(_tabBarInboxButton.frame) - CGRectGetHeight(_missedCallCountLabel.frame));
_missedCallCountLabel.text = [NSString stringWithFormat:@"%d",missedCallCount];
_missedCallCountLabel.text = [NSString stringWithFormat:@"%lu",(unsigned long)missedCallCount];
_missedCallCountLabel.hidden = NO;
} else {
_tabBarInboxButton.frame = CGRectMake(CGRectGetMinX(_tabBarInboxButton.frame),

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5056" systemVersion="13D65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
</dependencies>
@ -40,7 +40,7 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" hidesWhenStopped="YES" style="gray" id="ZuN-a5-tVs" userLabel="Register Activity Indicator">
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" hidesWhenStopped="YES" style="gray" id="ZuN-a5-tVs" userLabel="Register Activity Indicator">
<rect key="frame" x="281" y="338" width="20" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>

View File

@ -67,12 +67,12 @@
_deleteImageView.bounds.size.height);
} else {
float ratio = _scrollView.contentOffset.x / CGRectGetWidth(_deleteView.frame);
float newWidth = DELETE_IMAGE_VIEW_WIDTH/2 + (DELETE_IMAGE_VIEW_WIDTH * ratio)/2.0f;
double ratio = _scrollView.contentOffset.x / CGRectGetWidth(_deleteView.frame);
double newWidth = DELETE_IMAGE_VIEW_WIDTH/2 + (DELETE_IMAGE_VIEW_WIDTH * ratio)/2.0f;
_deleteImageView.bounds = CGRectMake(_deleteImageView.bounds.origin.x,
_deleteImageView.bounds.origin.y,
newWidth,
(CGFloat)newWidth,
_deleteImageView.bounds.size.height);
_deleteImageView.tintColor = [UIColor whiteColor];
}

View File

@ -40,7 +40,7 @@
- (void)configureWithNotes:(NSString *)notes {
_infoDisplayLabel.frame = CGRectMake(_infoDisplayLabel.frame.origin.x,
_infoDisplayLabel.frame.origin.y,
fabs(_infoDisplayLabel.frame.origin.x - CGRectGetWidth(self.frame)),
(CGFloat)(fabs(_infoDisplayLabel.frame.origin.x - CGRectGetWidth(self.frame))),
CGRectGetHeight(_infoDisplayLabel.frame));
_infoDisplayLabel.text = notes;
_infoTypeLabel.text = CONTACT_DETAIL_COMM_TYPE_NOTES;

View File

@ -15,7 +15,7 @@
_inboxMessageLabelFirst.text = HOME_FOOTER_FIRST_MESSAGE_CALLS_NIL;
_inboxMessageLabelSecond.text = HOME_FOOTER_SECOND_MESSAGE_CALLS_NIL;
} else {
_inboxCountLabel.text = [NSString stringWithFormat:@"%d", inboxCount];
_inboxCountLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)inboxCount];
_inboxMessageLabelFirst.text = HOME_FOOTER_FIRST_MESSAGE_CALLS_UNSORTED;
_inboxMessageLabelSecond.text = inboxCount == 1 ? HOME_FOOTER_SECOND_MESSAGE_CALL_UNSORTED : HOME_FOOTER_SECOND_MESSAGE_CALLS_UNSORTED;
}

View File

@ -109,11 +109,11 @@
_archiveImageView.bounds.size.height);
} else {
float ratio = (_archiveView.frame.size.width/2.0f - _scrollView.contentOffset.x) / (_archiveView.frame.size.width/2.0f);
float newWidth = ARCHIVE_IMAGE_VIEW_WIDTH/2 + (ARCHIVE_IMAGE_VIEW_WIDTH * ratio)/2.0f;
double ratio = (_archiveView.frame.size.width/2.0f - _scrollView.contentOffset.x) / (_archiveView.frame.size.width/2.0f);
double newWidth = ARCHIVE_IMAGE_VIEW_WIDTH/2 + (ARCHIVE_IMAGE_VIEW_WIDTH * ratio)/2.0f;
_archiveImageView.bounds = CGRectMake(_archiveImageView.bounds.origin.x,
_archiveImageView.bounds.origin.y,
newWidth,
(CGFloat)newWidth,
_archiveImageView.bounds.size.height);
_archiveImageView.tintColor = [UIColor whiteColor];
@ -127,12 +127,12 @@
_deleteImageView.bounds.size.height);
} else {
float ratio = _scrollView.contentOffset.x / (CGRectGetWidth(_deleteView.frame)*2);
float newWidth = DELETE_IMAGE_VIEW_WIDTH/2 + (DELETE_IMAGE_VIEW_WIDTH * ratio)/2.0f;
double ratio = _scrollView.contentOffset.x / (CGRectGetWidth(_deleteView.frame)*2);
double newWidth = DELETE_IMAGE_VIEW_WIDTH/2 + (DELETE_IMAGE_VIEW_WIDTH * ratio)/2.0f;
_deleteImageView.bounds = CGRectMake(_deleteImageView.bounds.origin.x,
_deleteImageView.bounds.origin.y,
newWidth,
(CGFloat)newWidth,
_deleteImageView.bounds.size.height);
_deleteImageView.tintColor = [UIColor whiteColor];
}

View File

@ -9,7 +9,7 @@
if (isExpanded) {
_columnStateImageView.transform = CGAffineTransformMakeRotation(0 * M_PI/180);
} else {
_columnStateImageView.transform = CGAffineTransformMakeRotation(270 * M_PI/180);
_columnStateImageView.transform = CGAffineTransformMakeRotation( 270 * (float)M_PI/180);
}
}];
}