Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove 64 bits warnings #137

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions OAuth2Client.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0460;
LastUpgradeCheck = 0600;
ORGANIZATIONNAME = nxtbgthng;
TargetAttributes = {
94B6CE6519C1D0A200AA859B = {
Expand Down Expand Up @@ -551,7 +551,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
DSTROOT = /tmp/OAuth2Client.dst;
Expand All @@ -574,7 +573,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
DSTROOT = /tmp/OAuth2Client.dst;
GCC_MODEL_TUNING = G5;
Expand All @@ -593,7 +591,6 @@
1DEB922308733DC00010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
Expand All @@ -607,7 +604,6 @@
1DEB922408733DC00010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
Expand All @@ -621,7 +617,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
Expand Down Expand Up @@ -651,7 +646,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
Expand Down
16 changes: 8 additions & 8 deletions Sources/OAuth2Client/NXOAuth2AccessToken.m
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ + (id)tokenFromDefaultKeychainWithServiceProviderName:(NSString *)provider;
result = (__bridge_transfer NSDictionary *)cfResult;

if (status != noErr) {
NSAssert1(status == errSecItemNotFound, @"unexpected error while fetching token from keychain: %d", (int)status);
NSAssert1(status == errSecItemNotFound, @"unexpected error while fetching token from keychain: %@", @(status));
return nil;
}

Expand All @@ -257,7 +257,7 @@ - (void)storeInDefaultKeychainWithServiceProviderName:(NSString *)provider;
nil];
[self removeFromDefaultKeychainWithServiceProviderName:provider];
OSStatus __attribute__((unused)) err = SecItemAdd((__bridge CFDictionaryRef)query, NULL);
NSAssert1(err == noErr, @"error while adding token to keychain: %d", (int)err);
NSAssert1(err == noErr, @"error while adding token to keychain: %@", @(err));
}

- (void)removeFromDefaultKeychainWithServiceProviderName:(NSString *)provider;
Expand All @@ -268,7 +268,7 @@ - (void)removeFromDefaultKeychainWithServiceProviderName:(NSString *)provider;
serviceName, kSecAttrService,
nil];
OSStatus __attribute__((unused)) err = SecItemDelete((__bridge CFDictionaryRef)query);
NSAssert1((err == noErr || err == errSecItemNotFound), @"error while deleting token from keychain: %d", (int)err);
NSAssert1((err == noErr || err == errSecItemNotFound), @"error while deleting token from keychain: %@", @(err));
}

#else
Expand All @@ -287,7 +287,7 @@ + (id)tokenFromDefaultKeychainWithServiceProviderName:(NSString *)provider;
NULL,
&item);
if (err != noErr) {
NSAssert1(err == errSecItemNotFound, @"unexpected error while fetching token from keychain: %d", err);
NSAssert1(err == errSecItemNotFound, @"unexpected error while fetching token from keychain: %@", @(err));
return nil;
}

Expand All @@ -314,7 +314,7 @@ + (id)tokenFromDefaultKeychainWithServiceProviderName:(NSString *)provider;
SecKeychainItemFreeContent(&list, password);
} else {
// TODO find out why this always works in i386 and always fails on ppc
NSLog(@"Error from SecKeychainItemCopyContent: %d", err);
NSLog(@"Error from SecKeychainItemCopyContent: %@", @(err));
return nil;
}
CFRelease(item);
Expand All @@ -336,7 +336,7 @@ OSStatus __attribute__((unused))err = SecKeychainAddGenericPassword(NULL,
[data bytes],
NULL);

NSAssert1(err == noErr, @"error while adding token to keychain: %d", err);
NSAssert1(err == noErr, @"error while adding token to keychain: %@", @(err));
}

- (void)removeFromDefaultKeychainWithServiceProviderName:(NSString *)provider;
Expand All @@ -351,14 +351,14 @@ - (void)removeFromDefaultKeychainWithServiceProviderName:(NSString *)provider;
NULL,
NULL,
&item);
NSAssert1((err == noErr || err == errSecItemNotFound), @"error while deleting token from keychain: %d", err);
NSAssert1((err == noErr || err == errSecItemNotFound), @"error while deleting token from keychain: %@", @(err));
if (err == noErr) {
err = SecKeychainItemDelete(item);
}
if (item) {
CFRelease(item);
}
NSAssert1((err == noErr || err == errSecItemNotFound), @"error while deleting token from keychain: %d", err);
NSAssert1((err == noErr || err == errSecItemNotFound), @"error while deleting token from keychain: %@", @(err));
}

#endif
Expand Down
12 changes: 6 additions & 6 deletions Sources/OAuth2Client/NXOAuth2AccountStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ + (void)removeFromDefaultKeychain;
serviceName, kSecAttrService,
nil];
OSStatus __attribute__((unused)) err = SecItemDelete((__bridge CFDictionaryRef)query);
NSAssert1((err == noErr || err == errSecItemNotFound), @"Error while deleting token from keychain: %zd", err);
NSAssert1((err == noErr || err == errSecItemNotFound), @"Error while deleting token from keychain: %zd", @(err));

}

Expand All @@ -663,7 +663,7 @@ + (NSDictionary *)accountsFromDefaultKeychain;
NULL,
&item);
if (err != noErr) {
NSAssert1(err == errSecItemNotFound, @"Unexpected error while fetching accounts from keychain: %d", err);
NSAssert1(err == errSecItemNotFound, @"Unexpected error while fetching accounts from keychain: %@", @(err));
return nil;
}

Expand All @@ -690,7 +690,7 @@ + (NSDictionary *)accountsFromDefaultKeychain;
SecKeychainItemFreeContent(&list, password);
} else {
// TODO find out why this always works in i386 and always fails on ppc
NSLog(@"Error from SecKeychainItemCopyContent: %d", err);
NSLog(@"Error from SecKeychainItemCopyContent: %@", @(err));
return nil;
}
CFRelease(item);
Expand All @@ -714,7 +714,7 @@ OSStatus __attribute__((unused))err = SecKeychainAddGenericPassword(NULL,
[data bytes],
NULL);

NSAssert1(err == noErr, @"Error while storing accounts in keychain: %d", err);
NSAssert1(err == noErr, @"Error while storing accounts in keychain: %@", @(err));
}

+ (void)removeFromDefaultKeychain;
Expand All @@ -730,14 +730,14 @@ + (void)removeFromDefaultKeychain;
NULL,
NULL,
&item);
NSAssert1((err == noErr || err == errSecItemNotFound), @"Error while deleting accounts from keychain: %d", err);
NSAssert1((err == noErr || err == errSecItemNotFound), @"Error while deleting accounts from keychain: %@", @(err));
if (err == noErr) {
err = SecKeychainItemDelete(item);
}
if (item) {
CFRelease(item);
}
NSAssert1((err == noErr || err == errSecItemNotFound), @"Error while deleting accounts from keychain: %d", err);
NSAssert1((err == noErr || err == errSecItemNotFound), @"Error while deleting accounts from keychain: %@", @(err));
}

#endif
Expand Down
4 changes: 2 additions & 2 deletions Sources/OAuth2Client/NXOAuth2Connection.m
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ - (void)applyParameters:(NSDictionary *)parameters onRequest:(NSMutableURLReques
NSInputStream *postBodyStream = [[NXOAuth2PostBodyStream alloc] initWithParameters:parameters];

contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",[(NXOAuth2PostBodyStream *)postBodyStream boundary]];
NSString *contentLength = [NSString stringWithFormat:@"%lld", [(NXOAuth2PostBodyStream *)postBodyStream length]];
NSString *contentLength = [@([(NXOAuth2PostBodyStream *)postBodyStream length]) stringValue];
[aRequest setValue:contentType forHTTPHeaderField:@"Content-Type"];
[aRequest setValue:contentLength forHTTPHeaderField:@"Content-Length"];

Expand Down Expand Up @@ -474,7 +474,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection;
}
}

NSString *localizedError = [NSString stringWithFormat:NSLocalizedString(@"HTTP Error: %d", @"NXOAuth2HTTPErrorDomain description"), self.statusCode];
NSString *localizedError = [NSString stringWithFormat:NSLocalizedString(@"HTTP Error: %@", @"NXOAuth2HTTPErrorDomain description"), self.statusCode];
NSDictionary *errorUserInfo = [NSDictionary dictionaryWithObject:localizedError forKey:NSLocalizedDescriptionKey];
NSError *error = [NSError errorWithDomain:NXOAuth2HTTPErrorDomain
code:self.statusCode
Expand Down
7 changes: 3 additions & 4 deletions Sources/OAuth2Client/NXOAuth2PostBodyStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ - (id)initWithParameters:(NSDictionary *)postParameters;
{
self = [self init];
if (self) {
srandom(time(NULL));
boundary = [[NSString alloc] initWithFormat:@"------------nx-oauth2%d", rand()];
boundary = [[NSString alloc] initWithFormat:@"------------nx-oauth2%@", @(arc4random())];
numBytesTotal = 0;
streamIndex = 0;

Expand Down Expand Up @@ -88,7 +87,7 @@ - (NSArray *)streamsForParameters:(NSDictionary *)parameters contentLength:(unsi
NSData *delimiterData = [delimiter dataUsingEncoding:NSUTF8StringEncoding];
NSData *contentHeaderData = [[part contentHeaders] dataUsingEncoding:NSUTF8StringEncoding];

int dataLength = delimiterData.length + contentHeaderData.length;
NSUInteger dataLength = delimiterData.length + contentHeaderData.length;
NSMutableData *headerData = [NSMutableData dataWithCapacity: dataLength];
[headerData appendData:delimiterData];
[headerData appendData:contentHeaderData];
Expand Down Expand Up @@ -146,7 +145,7 @@ - (NSInteger)read:(uint8_t *)buffer maxLength:(NSUInteger)len;
if (currentStream == nil)
return 0;

int result = [currentStream read:buffer maxLength:len];
NSInteger result = [currentStream read:buffer maxLength:len];

if (result == 0) {
if (streamIndex < contentStreams.count - 1) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/OAuth2Client/NXOAuth2Request.m
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ - (void)applyParameters:(NSDictionary *)someParameters onRequest:(NSMutableURLRe
NSInputStream *postBodyStream = [[NXOAuth2PostBodyStream alloc] initWithParameters:parameters];

NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", [(NXOAuth2PostBodyStream *)postBodyStream boundary]];
NSString *contentLength = [NSString stringWithFormat:@"%llu", [(NXOAuth2PostBodyStream *)postBodyStream length]];
NSString *contentLength = [@([(NXOAuth2PostBodyStream *)postBodyStream length]) stringValue];
[aRequest setValue:contentType forHTTPHeaderField:@"Content-Type"];
[aRequest setValue:contentLength forHTTPHeaderField:@"Content-Length"];

Expand Down