Skip to content

Commit 88025e5

Browse files
author
Damien Rambout
committed
Remove 64 bit conversion with precision loss warnings
1 parent 38192c6 commit 88025e5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Sources/OAuth2Client/NXOAuth2PostBodyStream.m

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ - (id)initWithParameters:(NSDictionary *)postParameters;
3030
{
3131
self = [self init];
3232
if (self) {
33-
srandom(time(NULL));
34-
boundary = [[NSString alloc] initWithFormat:@"------------nx-oauth2%d", rand()];
33+
boundary = [[NSString alloc] initWithFormat:@"------------nx-oauth2%@", @(arc4random())];
3534
numBytesTotal = 0;
3635
streamIndex = 0;
3736

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

91-
int dataLength = delimiterData.length + contentHeaderData.length;
90+
NSUInteger dataLength = delimiterData.length + contentHeaderData.length;
9291
NSMutableData *headerData = [NSMutableData dataWithCapacity: dataLength];
9392
[headerData appendData:delimiterData];
9493
[headerData appendData:contentHeaderData];
@@ -146,7 +145,7 @@ - (NSInteger)read:(uint8_t *)buffer maxLength:(NSUInteger)len;
146145
if (currentStream == nil)
147146
return 0;
148147

149-
int result = [currentStream read:buffer maxLength:len];
148+
NSInteger result = [currentStream read:buffer maxLength:len];
150149

151150
if (result == 0) {
152151
if (streamIndex < contentStreams.count - 1) {

0 commit comments

Comments
 (0)