Skip to content

Commit

Permalink
Merge pull request #166 from ably/fix-warnings
Browse files Browse the repository at this point in the history
Fix compiler warnings.
  • Loading branch information
ricardopereira committed Jan 26, 2016
2 parents 2b3bcaf + 4a292ae commit b4b8b04
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ably-ios/ARTChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ART_ASSUME_NONNULL_BEGIN
- (void)publishMessage:(ARTMessage *)message callback:(art_nullable ARTErrorCallback)callback;
- (void)publishMessages:(__GENERIC(NSArray, ARTMessage *) *)messages callback:(art_nullable ARTErrorCallback)callback;

- (BOOL)history:(art_nullable ARTDataQuery *)query callback:(void(^)(__GENERIC(ARTPaginatedResult, ARTMessage *) *__art_nullable result, NSError *__art_nullable error))callback error:(NSError *__art_nullable *__art_nullable)errorPtr;
- (BOOL)history:(art_nullable ARTDataQuery *)query callback:(void(^)(__GENERIC(ARTPaginatedResult, ARTMessage *) *__art_nullable result, NSError *__art_nullable error))callback error:(NSError *__art_nullable *__art_nullable)errorPtr;

@end

Expand Down
2 changes: 1 addition & 1 deletion ably-ios/ARTLog.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ - (void)debug:(NSString *)format, ... {
- (void)debug:(const char *)fileName line:(NSUInteger)line message:(NSString *)message, ... {
va_list args;
va_start(args, message);
[self log:[[NSString alloc] initWithFormat:[NSString stringWithFormat:@"(%@:%d) %@", [[NSString stringWithUTF8String:fileName] lastPathComponent], line, message] arguments:args] level:ARTLogLevelDebug];
[self log:[[NSString alloc] initWithFormat:[NSString stringWithFormat:@"(%@:%lu) %@", [[NSString stringWithUTF8String:fileName] lastPathComponent], (unsigned long)line, message] arguments:args] level:ARTLogLevelDebug];
va_end(args);
}

Expand Down
2 changes: 1 addition & 1 deletion ably-ios/ARTPresenceMessage.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ - (NSString *)description {
NSMutableString *description = [[super description] mutableCopy];
[description deleteCharactersInRange:NSMakeRange(description.length - (description.length>2 ? 2:0), 2)];
[description appendFormat:@",\n"];
[description appendFormat:@" action: %d\n", self.action];
[description appendFormat:@" action: %lu\n", (unsigned long)self.action];
[description appendFormat:@"}"];
return description;
}
Expand Down
2 changes: 1 addition & 1 deletion ably-ios/ARTProtocolMessage.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ - (NSString *)description {
NSMutableString *description = [NSMutableString stringWithFormat:@"<%@: %p> {\n", self.class, self];
[description appendFormat:@" count: %d,\n", self.count];
[description appendFormat:@" id: %@,\n", self.id];
[description appendFormat:@" action: %d,\n", self.action];
[description appendFormat:@" action: %lu,\n", (unsigned long)self.action];
[description appendFormat:@" clientId: %@,\n", self.clientId];
[description appendFormat:@" channel: %@,\n", self.channel];
[description appendFormat:@" channelSerial: %@,\n", self.channelSerial];
Expand Down
8 changes: 4 additions & 4 deletions ably-ios/ARTRealtime.m
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ - (void)ack:(ARTProtocolMessage *)message {
NSArray *nackMessages = nil;
NSArray *ackMessages = nil;
[self.logger verbose:@"ARTRealtime ACK: msgSerial=%lld, count=%d", serial, count];
[self.logger verbose:@"ARTRealtime ACK (before processing): pendingMessageStartSerial=%lld, pendingMessages=%d", self.pendingMessageStartSerial, self.pendingMessages.count];
[self.logger verbose:@"ARTRealtime ACK (before processing): pendingMessageStartSerial=%lld, pendingMessages=%lu", self.pendingMessageStartSerial, (unsigned long)self.pendingMessages.count];

if (serial < self.pendingMessageStartSerial) {
// This is an error condition and shouldn't happen but
Expand Down Expand Up @@ -733,14 +733,14 @@ - (void)ack:(ARTProtocolMessage *)message {
msg.cb([ARTStatus state:ARTStateOk]);
}

[self.logger verbose:@"ARTRealtime ACK (after processing): pendingMessageStartSerial=%lld, pendingMessages=%d", self.pendingMessageStartSerial, self.pendingMessages.count];
[self.logger verbose:@"ARTRealtime ACK (after processing): pendingMessageStartSerial=%lld, pendingMessages=%lu", self.pendingMessageStartSerial, (unsigned long)self.pendingMessages.count];
}

- (void)nack:(ARTProtocolMessage *)message {
int64_t serial = message.msgSerial;
int count = message.count;
[self.logger verbose:@"ARTRealtime NACK: msgSerial=%lld, count=%d", serial, count];
[self.logger verbose:@"ARTRealtime NACK (before processing): pendingMessageStartSerial=%lld, pendingMessages=%d", self.pendingMessageStartSerial, self.pendingMessages.count];
[self.logger verbose:@"ARTRealtime NACK (before processing): pendingMessageStartSerial=%lld, pendingMessages=%lu", self.pendingMessageStartSerial, (unsigned long)self.pendingMessages.count];

if (serial != self.pendingMessageStartSerial) {
// This is an error condition and it shouldn't happen but
Expand Down Expand Up @@ -768,7 +768,7 @@ - (void)nack:(ARTProtocolMessage *)message {
msg.cb([ARTStatus state:ARTStateError info:message.error]);
}

[self.logger verbose:@"ARTRealtime NACK (after processing): pendingMessageStartSerial=%lld, pendingMessages=%d", self.pendingMessageStartSerial, self.pendingMessages.count];
[self.logger verbose:@"ARTRealtime NACK (after processing): pendingMessageStartSerial=%lld, pendingMessages=%lu", self.pendingMessageStartSerial, (unsigned long)self.pendingMessages.count];
}

- (CFRunLoopTimerRef)startTimer:(void(^)())onTimeout interval:(NSTimeInterval)interval {
Expand Down
2 changes: 1 addition & 1 deletion ably-ios/ARTRestChannel.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ - (ARTRestPresence *)presence {
return _restPresence;
}

- (BOOL)history:(ARTDataQuery *)query callback:(void(^)(ARTPaginatedResult *result, NSError *error))callback error:(NSError **)errorPtr {
- (BOOL)history:(ARTDataQuery *)query callback:(void(^)(__GENERIC(ARTPaginatedResult, ARTMessage *) *result, NSError *error))callback error:(NSError **)errorPtr {
if (query.limit > 1000) {
if (errorPtr) {
*errorPtr = [NSError errorWithDomain:ARTAblyErrorDomain
Expand Down
5 changes: 2 additions & 3 deletions ably-ios/ARTStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ FOUNDATION_EXPORT NSString *const ARTAblyErrorDomain;
@interface ARTErrorInfo : NSObject

@property (readonly, copy, nonatomic) NSString *message;
@property (readonly, assign, nonatomic) int statusCode;
@property (readonly, assign, nonatomic) int code;
@property (readonly, assign, nonatomic) NSInteger statusCode;
@property (readonly, assign, nonatomic) NSInteger code;

// FIXME: use NSInteger instead int (don't know what kind of processor architecture your code might run)
- (ARTErrorInfo *)setCode:(NSInteger) code message:(NSString *) message;
- (ARTErrorInfo *)setCode:(NSInteger) code status:(NSInteger) status message:(NSString *) message;

Expand Down
4 changes: 2 additions & 2 deletions ably-ios/ARTStatus.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ + (ARTErrorInfo *)createWithNSError:(NSError *)error {
}

- (NSString *)description {
return [NSString stringWithFormat:@"ARTErrorInfo with code %d, message: %@", self.statusCode, self.message];
return [NSString stringWithFormat:@"ARTErrorInfo with code %ld, message: %@", (long)self.statusCode, self.message];
}

@end
Expand Down Expand Up @@ -75,7 +75,7 @@ + (ARTStatus *)state:(ARTState)state info:(ARTErrorInfo *)info {
}

- (NSString *)description {
return [NSString stringWithFormat:@"ARTStatus: %d, Error info: %@", self.state, [self.errorInfo description]];
return [NSString stringWithFormat:@"ARTStatus: %lu, Error info: %@", (unsigned long)self.state, [self.errorInfo description]];
}


Expand Down
4 changes: 2 additions & 2 deletions ably-ios/ARTWebSocketTransport.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ - (void)dealloc {
}

- (void)send:(ARTProtocolMessage *)msg {
[self.logger debug:__FILE__ line:__LINE__ message:@"%p sending action %d with %@", self, msg.action, msg.messages];
[self.logger debug:__FILE__ line:__LINE__ message:@"%p sending action %lu with %@", self, (unsigned long)msg.action, msg.messages];
NSData *data = [self.encoder encodeProtocolMessage:msg];
[self.websocket sendWithData:data];
}
Expand Down Expand Up @@ -226,7 +226,7 @@ - (void)webSocketOpen {

- (void)webSocketClose:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean {
ARTWebSocketTransport * __weak weakSelf = self;
[self.logger debug:__FILE__ line:__LINE__ message:@"%p websocket did disconnect (code %d) %@", self, code, reason];
[self.logger debug:__FILE__ line:__LINE__ message:@"%p websocket did disconnect (code %ld) %@", self, (long)code, reason];

CFRunLoopPerformBlock(self.rl, kCFRunLoopDefaultMode, ^{
ARTWebSocketTransport *s = weakSelf;
Expand Down

0 comments on commit b4b8b04

Please sign in to comment.