Permalink
Browse files

Fixing several compiler warnings

  • Loading branch information...
1 parent fa46160 commit 2e9fa9060adf2376e738d209f3a72c487ddcb7f7 @robbiehanson committed Jul 3, 2012
@@ -183,14 +183,13 @@ +(NSXMLElement *)valueElementFromDate:(NSDate *)date {
kCFCalendarUnitMinute |
kCFCalendarUnitSecond;
NSDateComponents *dateComponents = [[NSCalendar currentCalendar] components:calendarComponents fromDate:date];
- NSString *dateString = [NSString stringWithFormat: @"%.4d%.2d%.2dT%.2d:%.2d:%.2d",
- [dateComponents year],
- [dateComponents month],
- [dateComponents day],
- [dateComponents hour],
- [dateComponents minute],
- [dateComponents second],
- nil];
+ NSString *dateString = [NSString stringWithFormat: @"%.4ld%.2ld%.2ldT%.2ld:%.2ld:%.2ld",
+ (long)[dateComponents year],
+ (long)[dateComponents month],
+ (long)[dateComponents day],
+ (long)[dateComponents hour],
+ (long)[dateComponents minute],
+ (long)[dateComponents second], nil];
return [self valueElementFromElementWithName:@"dateTime.iso8601" value: dateString];
}
@@ -377,7 +377,8 @@ - (void)setTimeZone:(NSTimeZone *)tz {
if (tz != nil) {
NSInteger offset = [tz secondsFromGMT];
- [elem setStringValue:[NSString stringWithFormat:@"%02d:%02d", offset / 3600, (offset % 3600) / 60]];
+ [elem setStringValue:[NSString stringWithFormat:@"%02ld:%02ld",
+ (long)(offset / 3600), (long)((offset % 3600) / 60)]];
} else if (elem != nil) {
[self removeChildAtIndex:[[self children] indexOfObject:elem]];
}
@@ -434,7 +434,21 @@ static NSInteger sortForms(NSXMLElement *form1, NSXMLElement *form2, void *conte
// The formTypeValue variable is guaranteed to be properly encoded.
- return [formTypeValue1 compare:formTypeValue2 options:NSLiteralSearch];
+ if (formTypeValue1)
+ {
+ if (formTypeValue2)
+ return [formTypeValue1 compare:formTypeValue2 options:NSLiteralSearch];
+ else
+ return NSOrderedAscending;
+ }
+ else if (formTypeValue2)
+ {
+ return NSOrderedDescending;
+ }
+ else
+ {
+ return NSOrderedSame;
+ }
}
static NSInteger sortFormFields(NSXMLElement *field1, NSXMLElement *field2, void *context)
@@ -73,7 +73,7 @@ - (void)nextRequest
XMPPJID *jid = [jids objectAtIndex:jidIndex];
[jidField setStringValue:[jid bare]];
- [xofyField setStringValue:[NSString stringWithFormat:@"%i of %i", (jidIndex+1), [jids count]]];
+ [xofyField setStringValue:[NSString stringWithFormat:@"%i of %i", (jidIndex+1), (int)[jids count]]];
}
else
{
@@ -107,7 +107,7 @@ - (void)xmppRoster:(XMPPRoster *)sender didReceiveBuddyRequest:(XMPPPresence *)p
}
else
{
- [xofyField setStringValue:[NSString stringWithFormat:@"%i of %i", (jidIndex+1), [jids count]]];
+ [xofyField setStringValue:[NSString stringWithFormat:@"%i of %i", (jidIndex+1), (int)[jids count]]];
[xofyField setHidden:NO];
}
}

0 comments on commit 2e9fa90

Please sign in to comment.