Stage 1 of clang compiler warning patches.

This commit is contained in:
Euan Thoms
2015-10-31 14:10:03 +08:00
parent 0b490a00c6
commit 3c62cc744e
85 changed files with 185 additions and 165 deletions
+1 -1
View File
@@ -344,7 +344,7 @@ size_t curl_body_function_freebusy(void *ptr, size_t size, size_t nmemb, void *i
NSMutableString *s;
s = [NSMutableString stringWithCapacity: 64];
[s appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])];
[s appendFormat:@"<0x%08X[%@]:", (unsigned int)self, NSStringFromClass([self class])];
if (freeBusyViewType)
[s appendFormat:@" freeBusyViewType='%@'", freeBusyViewType];
if (mergedFreeBusy)
@@ -84,7 +84,7 @@
#import "SOGoAppointmentFolders.h"
#import "SOGoFreeBusyObject.h"
#import "SOGoTaskObject.h"
#import "SOGoWebAppointmentFolder.h";
#import "SOGoWebAppointmentFolder.h"
#import "SOGoAppointmentFolder.h"
@@ -2337,7 +2337,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
request = [context request];
if (!([request isIPhone] || [request isICal4]))
{
gdRT = [self groupDavResourceType];
gdRT = (NSArray *) [self groupDavResourceType];
gdVEventCol = [NSArray arrayWithObjects: [gdRT objectAtIndex: 0],
XMLNS_GROUPDAV, nil];
[colType addObject: gdVEventCol];
@@ -1992,7 +1992,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
if ([container resourceNameForEventUID: eventUID])
{
return [NSException exceptionWithHTTPStatus: 403
reason: [NSString stringWithFormat: @"Event UID already in use. (%s)", eventUID]];
reason: [NSString stringWithFormat: @"Event UID already in use. (%@)", eventUID]];
}
//
@@ -171,7 +171,7 @@
- (Class *) parsingClass
{
return [iCalCalendar class];
return (Class *)[iCalCalendar class];
}
- (NSString *) davContentType
+2 -2
View File
@@ -102,9 +102,9 @@
}
if ([reminderReference caseInsensitiveCompare: @"BEFORE"] == NSOrderedSame)
aValue = [NSString stringWithString: @"-P"];
aValue = (NSString *) @"-P";
else
aValue = [NSString stringWithString: @"P"];
aValue = (NSString *) @"P";
if ([reminderUnit caseInsensitiveCompare: @"MINUTES"] == NSOrderedSame ||
[reminderUnit caseInsensitiveCompare: @"HOURS"] == NSOrderedSame)
+1 -1
View File
@@ -267,7 +267,7 @@
- (NSTimeInterval) occurenceInterval
{
return [[self endDate] timeIntervalSinceDate: [self startDate]];
return (NSTimeInterval) [[self endDate] timeIntervalSinceDate: [self startDate]];
}
/**
@@ -162,7 +162,7 @@
rule = [iCalRecurrenceRule new];
[rule setInterval: @"1"];
frequency = NSNotFound;
frequency = (int)NSNotFound;
o = [repeat objectForKey: @"frequency"];
if ([o isKindOfClass: [NSString class]])
{
+1 -1
View File
@@ -214,7 +214,7 @@
{
percent = [o intValue];
if (percent >= 0 && percent <= 100)
[self setPercentComplete: [NSString stringWithFormat: @"%i", percent]];
[self setPercentComplete: [NSString stringWithFormat: @"%i", (int)percent]];
}
else
[self setPercentComplete: @""];
+4 -4
View File
@@ -327,7 +327,7 @@ convention:
if (year && month && day)
[self setBday: [NSString stringWithFormat: @"%.4d-%.2d-%.2d",
year, month, day]];
(int)year, (int)month, (int)day]];
else
[self setBday: @""];
@@ -644,11 +644,11 @@ convention:
birthDay = [[self bday] asCalendarDate];
if (birthDay)
{
stringValue = [NSString stringWithFormat: @"%.4d", [birthDay yearOfCommonEra]];
stringValue = [NSString stringWithFormat: @"%.4d", (int)[birthDay yearOfCommonEra]];
[self _setValue: @"birthyear" to: stringValue inLDIFRecord: ldifRecord];
stringValue = [NSString stringWithFormat: @"%.2d", [birthDay monthOfYear]];
stringValue = [NSString stringWithFormat: @"%.2d", (int)[birthDay monthOfYear]];
[self _setValue: @"birthmonth" to: stringValue inLDIFRecord: ldifRecord];
stringValue = [NSString stringWithFormat: @"%.2d", [birthDay dayOfMonth]];
stringValue = [NSString stringWithFormat: @"%.2d", (int)[birthDay dayOfMonth]];
[self _setValue: @"birthday" to: stringValue inLDIFRecord: ldifRecord];
}
[self _setValue: @"description" to: [self note] inLDIFRecord: ldifRecord];
+1 -1
View File
@@ -59,7 +59,7 @@
[response setHeader: [self davContentType] forKey: @"content-type"];
[response setHeader: [NSString stringWithFormat:@" %d",
[data length]]
(int)[data length]]
forKey: @"content-length"];
[response setContent: data];
}
+3 -3
View File
@@ -268,9 +268,9 @@ Class SOGoContactSourceFolderK;
SOGoUser *currentUser;
id <SOGoSource> source;
if ([sourceID isEqualToString: @"personal"])
result = [NSException exceptionWithHTTPStatus: 403
reason: (@"folder '%@' cannot be deleted", sourceID)];
if ([sourceID isEqualToString: @"personal"]){
result = [NSException exceptionWithHTTPStatus: 403 reason: [NSString stringWithFormat: (@"folder '%@' cannot be deleted"), sourceID]];
}
else
{
result = nil;
+1 -1
View File
@@ -50,7 +50,7 @@
- (Class *) parsingClass
{
return [NGVCard class];
return (Class *)[NGVCard class];
}
/* content */
+1 -1
View File
@@ -45,7 +45,7 @@
- (Class *) parsingClass
{
return [NGVList class];
return (Class *)[NGVList class];
}
+1 -1
View File
@@ -94,7 +94,7 @@
{
if (![newDisplayName length])
newDisplayName = newName;
ASSIGN (displayName, newDisplayName);
ASSIGN (displayName, [newDisplayName mutableCopy]);
}
return self;
+1 -1
View File
@@ -533,7 +533,7 @@
messageID = [NSMutableString string];
[messageID appendFormat: @"<%@", [SOGoObject globallyUniqueObjectId]];
pGUID = [[NSProcessInfo processInfo] globallyUniqueString];
[messageID appendFormat: @"@%u>", [pGUID hash]];
[messageID appendFormat: @"@%u>", (unsigned int)[pGUID hash]];
return [messageID lowercaseString];
}
+1 -1
View File
@@ -396,7 +396,7 @@ static BOOL debugOn = NO;
mimeType = @"application/octet-stream";
[response setHeader: mimeType forKey: @"content-type"];
[response setHeader: [NSString stringWithFormat:@"%d", [data length]]
[response setHeader: [NSString stringWithFormat:@"%d", (int)[data length]]
forKey: @"content-length"];
if (asAttachment)
+1 -1
View File
@@ -1674,7 +1674,7 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
sortOrderings = [NSMutableArray array];
if ([self _sortElementIsAscending: sortElement])
if ([self _sortElementIsAscending: (NGDOMNodeWithChildren <DOMElement> *)sortElement])
sortOrderingOrder = EOCompareAscending;
else
sortOrderingOrder = EOCompareDescending;
+2 -2
View File
@@ -73,10 +73,10 @@
- (NSString *) newLine
{
NSString *rc = [NSString stringWithString: @" "];
NSString *rc = @" ";
if (htmlComposition)
rc = [NSString stringWithString: @"<br/>"];
rc = @"<br/>";
return rc;
}
+1 -1
View File
@@ -74,7 +74,7 @@
int i;
allLabels = [NSMutableArray array];
allKeys = [[theDefaults allKeys] sortedArrayUsingSelector: @selector (caseInsensitiveCompare:)];
allKeys = [[[theDefaults allKeys] sortedArrayUsingSelector: @selector (caseInsensitiveCompare:)] mutableCopy];
for (i = 0; i < [allKeys count]; i++)
{
+10 -5
View File
@@ -779,9 +779,14 @@ static BOOL debugSoParts = NO;
[mimeType hasPrefix: @"audio/"] ||
[mimeType hasPrefix: @"image/"] ||
[mimeType hasPrefix: @"video/"])
{
filename = [NSString stringWithFormat: @"unknown_%@", path];
else if ([mimeType isEqualToString: @"message/rfc822"])
filename = [NSString stringWithFormat: @"email_%@.eml", path];
}
else
{
if ([mimeType isEqualToString: @"message/rfc822"])
filename = [NSString stringWithFormat: @"email_%@.eml", path];
}
}
if (filename)
@@ -825,13 +830,13 @@ static BOOL debugSoParts = NO;
{
currentPart = [subparts objectAtIndex: i-1];
if (path)
newPath = [NSString stringWithFormat: @"%@.%d", path, i];
newPath = [NSString stringWithFormat: @"%@.%d", path, (int)i];
else
newPath = [NSString stringWithFormat: @"%d", i];
newPath = [NSString stringWithFormat: @"%d", (int)i];
[self _fetchFileAttachmentKeysInPart: currentPart
intoArray: keys
withPath: newPath
andPrefix: [NSString stringWithFormat: @"%@/%i", prefix, i]];
andPrefix: [NSString stringWithFormat: @"%@/%i", prefix, (int)i]];
}
}
else
+2 -2
View File
@@ -310,7 +310,7 @@ static NSDictionary *BSONTypes()
case 'q': return 0x12;
default:
[NSException raise: NSInvalidArgumentException format: @"%@::%s - invalid encoding type '%c'", [self class], _cmd, encoding];
[NSException raise: NSInvalidArgumentException format: @"%@::%@ - invalid encoding type '%c'", [self class], NSStringFromSelector(_cmd), encoding];
}
return 0;
}
@@ -385,7 +385,7 @@ static NSDictionary *BSONTypes()
}
[NSException raise: NSInvalidArgumentException format: @"%@::%s - invalid encoding type '%c'", [self class], _cmd, encoding];
[NSException raise: NSInvalidArgumentException format: @"%@::%@ - invalid encoding type '%c'", [self class], NSStringFromSelector(_cmd), encoding];
return nil;
}
+1 -1
View File
@@ -1703,7 +1703,7 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection,
hostname: hostname
port: [NSString stringWithFormat: @"%d", port]
encryption: encryption
bindAsCurrentUser: NO];
bindAsCurrentUser: [NSString stringWithFormat: @"%d", NO]];
[ab setBaseDN: [entry dn]
IDField: @"cn"
CNField: @"displayName"
+6 -6
View File
@@ -90,9 +90,9 @@ static NSString *rfc822Months[] = {@"", @"Jan", @"Feb", @"Mar", @"Apr",
NSString *str;
str = [NSString stringWithFormat: @"%.4d%.2d%.2d",
[self yearOfCommonEra],
[self monthOfYear],
[self dayOfMonth]];
(int)[self yearOfCommonEra],
(int)[self monthOfYear],
(int)[self dayOfMonth]];
return str;
}
@@ -109,9 +109,9 @@ static NSString *rfc822Months[] = {@"", @"Jan", @"Feb", @"Mar", @"Apr",
return
[NSString stringWithFormat: @"%@, %.2d %@ %d %.2d:%.2d:%.2d %+.4d",
rfc822Days[[self dayOfWeek]], [self dayOfMonth],
rfc822Months[[self monthOfYear]], [self yearOfCommonEra],
[self hourOfDay], [self minuteOfHour], [self secondOfMinute],
rfc822Days[[self dayOfWeek]], (int)[self dayOfMonth],
rfc822Months[[self monthOfYear]], (int)[self yearOfCommonEra],
(int)[self hourOfDay], (int)[self minuteOfHour], (int)[self secondOfMinute],
timeZoneShift];
}
+1 -1
View File
@@ -46,7 +46,7 @@
{
NSString *newTag;
newTag = [NSString stringWithFormat: @"n%d", [namespaces count]];
newTag = [NSString stringWithFormat: @"n%d", (int)[namespaces count]];
[namespaces setObject: newTag forKey: newNS];
return newTag;
+1 -1
View File
@@ -309,7 +309,7 @@ static int cssEscapingCount;
c == 0xD ||
(c >= 0x20 && c <= 0xD7FF) ||
(c >= 0xE000 && c <= 0xFFFD) ||
(c >= 0x10000 && c <= 0x10FFFF))
(c >= (unichar)0x10000 && c <= (unichar)0x10FFFF))
{
*(start+j) = c;
j++;
+7 -9
View File
@@ -87,7 +87,7 @@ static EOAttribute *textColumn = nil;
{
tableUrl = nil;
initialized = NO;
objectType = -1;
objectType = (SOGoCacheObjectType) -1;
deleted = NO;
version = 0;
}
@@ -394,7 +394,7 @@ static EOAttribute *textColumn = nil;
@"SELECT * FROM %@ WHERE c_path = %@",
tableName, pathValue];
if (startVersion > -1)
[sql appendFormat: @" AND c_version > %d", startVersion];
[sql appendFormat: @" AND c_version > %d", (int)startVersion];
/* execution */
records = [self performSQLQuery: sql];
@@ -422,18 +422,16 @@ static EOAttribute *textColumn = nil;
tableName = [self tableName];
adaptor = [self tableChannelAdaptor];
pathValue = [adaptor formatValue: [NSString stringWithFormat: @"/%@", deviceId]
forAttribute: textColumn];
/* query */
sql = [NSMutableString stringWithFormat:
@"SELECT * FROM %@ WHERE c_type = %d AND c_deleted <> 1", tableName, objectType];
if (startVersion > -1)
[sql appendFormat: @" AND c_version > %d", startVersion];
[sql appendFormat: @" AND c_version > %d", (int)startVersion];
if (deviceId) {
pathValue = [adaptor formatValue: [NSString stringWithFormat: @"/%@%", deviceId]
pathValue = [adaptor formatValue: [NSString stringWithFormat: @"/%@", deviceId]
forAttribute: textColumn];
[sql appendFormat: @" AND c_path like %@", pathValue];
}
@@ -557,7 +555,7 @@ static EOAttribute *textColumn = nil;
lastModifiedValue = (NSInteger) [lastModified timeIntervalSince1970];
if (objectType == -1)
if (objectType == (SOGoCacheObjectType) -1)
[NSException raise: @"SOGoCacheIOException"
format: @"object type has not been set for object '%@'",
self];
@@ -587,7 +585,7 @@ static EOAttribute *textColumn = nil;
@")"),
tableName,
pathValue, parentPathValue, objectType,
creationDateValue, lastModifiedValue,
(int)creationDateValue, (int)lastModifiedValue,
propsValue];
isNew = NO;
}
@@ -601,7 +599,7 @@ static EOAttribute *textColumn = nil;
@" c_version = %d, c_content = %@"
@" WHERE c_path = %@"),
tableName,
lastModifiedValue, deletedValue, version, propsValue,
(int)lastModifiedValue, (int)deletedValue, (int)version, propsValue,
pathValue];
}
+6 -3
View File
@@ -94,7 +94,7 @@
{
[self subclassResponsibility: _cmd];
return nil;
return (Class *) nil;
}
- (void) _setRecord: (NSDictionary *) objectRecord
@@ -254,6 +254,9 @@
- (NSException *) moveToFolder: (SOGoGCSFolder *) newFolder
{
[self subclassResponsibility: _cmd];
// TODO: Add exception handling code and return it
return (NSException *) nil;
}
- (NSException *) delete
@@ -345,7 +348,7 @@
/* attempt a save */
error = [self saveComponent: [[self parsingClass] parseSingleFromSource: [rq contentAsString]]
error = [self saveComponent: [(id)[self parsingClass] parseSingleFromSource: [rq contentAsString]]
baseVersion: baseVersion];
if (error)
response = (WOResponse *) error;
@@ -410,7 +413,7 @@
else
length = 0;
return [NSString stringWithFormat: @"%u", length];
return [NSString stringWithFormat: @"%u", (unsigned int)length];
}
- (NSException *) davMoveToTargetObject: (id) _target
+1 -1
View File
@@ -107,7 +107,7 @@
- (void) setDisplayName: (NSString *) newDisplayName
{
ASSIGN (displayName, newDisplayName);
ASSIGN (displayName, [newDisplayName mutableCopy]);
}
- (NSString *) displayName
+4 -4
View File
@@ -376,12 +376,12 @@ static NSArray *childRecordFields = nil;
if (!displayName)
{
if (activeUserIsOwner)
displayName = [self _displayNameFromOwner];
displayName = [[self _displayNameFromOwner] mutableCopy];
else
{
displayName = [self _displayNameFromSubscriber];
displayName = [[self _displayNameFromSubscriber] mutableCopy];
if (!displayName)
displayName = [self _displayNameFromOwner];
displayName = [[self _displayNameFromOwner] mutableCopy];
}
[displayName retain];
}
@@ -829,7 +829,7 @@ static NSArray *childRecordFields = nil;
{
currentID = [ids objectAtIndex: count];
names = [[currentID componentsSeparatedByString: @"/"] objectEnumerator];
deleteObject = self;
deleteObject = (SOGoContentObject *)self;
while ((currentName = [names nextObject]))
{
deleteObject = [deleteObject lookupName: currentName
+2 -2
View File
@@ -135,7 +135,7 @@
{
NSArray *allSources;
NGLdapEntry *entry;
NSObject <SOGoSource> *source;
NSObject <SOGoSource, SOGoDNSource> *source;
id o;
NSEnumerator *gclasses;
NSString *gclass;
@@ -154,7 +154,7 @@
for (i = 0; i < [allSources count]; i++)
{
source = [[SOGoUserManager sharedUserManager] sourceWithID: [allSources objectAtIndex: i]];
source = (NSObject <SOGoSource, SOGoDNSource> *) [[SOGoUserManager sharedUserManager] sourceWithID: [allSources objectAtIndex: i]];
// Our different sources might not all implements groups support
if ([source respondsToSelector: theSelector])
+3 -3
View File
@@ -1066,7 +1066,7 @@
[_ms appendFormat:@" name=%@", nameInContainer];
if (container)
[_ms appendFormat:@" container=0x%08X/%@",
container, [container valueForKey:@"nameInContainer"]];
(unsigned int)container, [container valueForKey:@"nameInContainer"]];
}
- (NSString *) description
@@ -1074,7 +1074,7 @@
NSMutableString *ms;
ms = [NSMutableString stringWithCapacity:64];
[ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])];
[ms appendFormat:@"<0x%08X[%@]:", (unsigned int) self, NSStringFromClass([self class])];
[self appendAttributesToDescription:ms];
[ms appendString:@">"];
@@ -1084,7 +1084,7 @@
- (NSString *) loggingPrefix
{
return [NSString stringWithFormat:@"<0x%08X[%@]:%@>",
self, NSStringFromClass([self class]),
(unsigned int) self, NSStringFromClass([self class]),
[self nameInContainer]];
}