From f96af443d6f95a2461da7b3ff924a5200fcf4766 Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 3 Jul 2006 22:21:54 +0000 Subject: [PATCH] use %p for pointer formats gcc 4.1 fixes minor code improvs git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1290 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-mime/ChangeLog | 5 +++ .../NGImap4/EOSortOrdering+IMAPAdditions.m | 4 +- sope-mime/NGImap4/NGImap4Client.m | 20 ++++----- sope-mime/NGImap4/NGImap4Connection.m | 41 ++++++++++--------- sope-mime/NGImap4/NGImap4Context.m | 12 +++--- sope-mime/NGImap4/NGImap4DataSource.m | 3 +- sope-mime/NGImap4/NGImap4Envelope.m | 10 ++--- sope-mime/NGImap4/NGImap4EnvelopeAddress.m | 8 ++-- sope-mime/NGImap4/NGImap4FileManager.m | 26 ++++++------ sope-mime/NGImap4/NGImap4Folder.m | 31 +++++++------- sope-mime/NGImap4/NGImap4FolderMailRegistry.m | 6 +-- sope-mime/NGImap4/NGImap4MailboxInfo.m | 2 +- .../NGImap4/NGImap4Message+BodyStructure.h | 40 ++++++++++-------- sope-mime/NGImap4/NGImap4Message.m | 25 ++++++----- sope-mime/NGImap4/NGImap4ResponseNormalizer.m | 4 +- sope-mime/NGImap4/NGImap4ResponseParser.m | 20 ++++----- sope-mime/NGImap4/NGImap4ServerRoot.m | 2 +- sope-mime/NGImap4/NGSieveClient.m | 8 ++-- sope-mime/NGMail/NGMBoxReader.m | 2 +- sope-mime/NGMail/NGMailAddressParser.m | 4 +- sope-mime/NGMail/NGMimeMessage.m | 2 +- sope-mime/NGMail/NGMimeMessageGenerator.m | 2 +- sope-mime/NGMail/NGPop3Client.m | 2 +- sope-mime/NGMail/NGPop3Support.m | 4 +- sope-mime/NGMail/NGSendMail.m | 4 +- sope-mime/NGMail/NGSmtpClient.m | 2 +- sope-mime/NGMail/NGSmtpSupport.m | 2 +- sope-mime/NGMime/NGConcreteMimeType.m | 37 +++++++++-------- sope-mime/NGMime/NGMimeBodyPart.m | 4 +- .../NGMimeContentLengthHeaderFieldParser.m | 2 +- .../NGMimeContentTypeHeaderFieldParser.m | 2 +- sope-mime/NGMime/NGMimeFileData.m | 2 +- sope-mime/NGMime/NGMimeHeaderFieldParserSet.m | 2 +- sope-mime/NGMime/NGMimeHeaderFields.m | 2 +- sope-mime/NGMime/NGMimeJoinedData.m | 2 +- sope-mime/NGMime/NGMimeMultipartBody.m | 2 +- sope-mime/NGMime/NGMimePartGenerator.m | 6 +-- .../NGMime/NGMimeStringHeaderFieldParser.m | 9 ++-- sope-mime/NGMime/NGMimeType.m | 4 +- sope-mime/Version | 2 +- sope-mime/samples/Mime2XmlTool.m | 2 +- 41 files changed, 195 insertions(+), 174 deletions(-) diff --git a/sope-mime/ChangeLog b/sope-mime/ChangeLog index 18a8f28d..ed50135c 100644 --- a/sope-mime/ChangeLog +++ b/sope-mime/ChangeLog @@ -1,3 +1,8 @@ +2006-07-04 Helge Hess + + * use %p for pointer formats, fixed gcc 4.1 warnings, use -isNotEmpty + when appropriate (v4.5.241) + 2006-02-22 Helge Hess * NGMime: hardcoded CET/UTC in tzname parsing (v4.5.240) diff --git a/sope-mime/NGImap4/EOSortOrdering+IMAPAdditions.m b/sope-mime/NGImap4/EOSortOrdering+IMAPAdditions.m index 59d1e501..203a36bd 100644 --- a/sope-mime/NGImap4/EOSortOrdering+IMAPAdditions.m +++ b/sope-mime/NGImap4/EOSortOrdering+IMAPAdditions.m @@ -52,7 +52,7 @@ static NSArray *AllowedSortKeys = nil; NSString *lkey; lkey = [self key]; - if ([lkey length] == 0) + if (![lkey isNotEmpty]) return nil; /* check whether key is a valid sort string */ @@ -109,7 +109,7 @@ static NSArray *AllowedSortKeys = nil; if (i > 0) [sortStr appendString:@" "]; [sortStr appendString:s]; } - return [sortStr length] > 0 ? sortStr : nil; + return [sortStr isNotEmpty] ? sortStr : (NSMutableString *)nil; } @end /* NSArray(IMAPAdditions) */ diff --git a/sope-mime/NGImap4/NGImap4Client.m b/sope-mime/NGImap4/NGImap4Client.m index 40822627..666e23f7 100644 --- a/sope-mime/NGImap4/NGImap4Client.m +++ b/sope-mime/NGImap4/NGImap4Client.m @@ -533,13 +533,13 @@ static BOOL ImapDebugEnabled = NO; if (_folder == nil) _folder = @""; if (_pattern == nil) _pattern = @""; - if ([_folder length] > 0) { + if ([_folder isNotEmpty]) { if ((_folder = [self _folder2ImapFolder:_folder]) == nil) return nil; } - if ([_pattern length] > 0) + if ([_pattern isNotEmpty]) if (!(_pattern = [self _folder2ImapFolder:_pattern])) return nil; @@ -575,14 +575,14 @@ static BOOL ImapDebugEnabled = NO; if (_folder == nil) _folder = @""; - if ([_folder length] > 0) { + if ([_folder isNotEmpty]) { if ((_folder = [self _folder2ImapFolder:_folder]) == nil) return nil; } if (_pattern == nil) _pattern = @""; - if ([_pattern length] > 0) { + if ([_pattern isNotEmpty]) { if ((_pattern = [self _folder2ImapFolder:_pattern]) == nil) return nil; } @@ -618,7 +618,7 @@ static BOOL ImapDebugEnabled = NO; tmp = self->selectedFolder; // remember ptr to old folder name - if ([_folder length] == 0) + if (![_folder isNotEmpty]) return nil; if ((_folder = [self _folder2ImapFolder:_folder]) == nil) return nil; @@ -1013,7 +1013,7 @@ static BOOL ImapDebugEnabled = NO; ? @"REFERENCES" : @"ORDEREDSUBJECT"; - if ([_charSet length] == 0) + if (![_charSet isNotEmpty]) _charSet = @"UTF-8"; threadStr = [NSString stringWithFormat:@"UID THREAD %@ %@ ALL", @@ -1097,7 +1097,7 @@ static BOOL ImapDebugEnabled = NO; else tmp = [_sortSpec stringValue]; - if ([tmp length] == 0) { /* found no valid key use date sorting */ + if (![tmp isNotEmpty]) { /* found no valid key use date sorting */ [self logWithFormat:@"Note: no key found for sorting, using 'DATE': %@", _sortSpec]; tmp = @"DATE"; @@ -1119,7 +1119,7 @@ static BOOL ImapDebugEnabled = NO; NSString *s; s = [self _searchExprForQual:_qualifier]; - if ([s length] == 0) { + if (![s isNotEmpty]) { // TODO: should set last-exception? [self logWithFormat:@"ERROR(%s): could not process search qualifier: %@", __PRETTY_FUNCTION__, _qualifier]; @@ -1407,7 +1407,7 @@ static inline NSArray *_flags2ImapFlags(NGImap4Client *self, NSArray *_flags) { array = [_folder pathComponents]; - if ([array count] > 0) { + if ([array isNotEmpty]) { NSString *o; o = [array objectAtIndex:0]; @@ -1486,7 +1486,7 @@ static inline NSArray *_flags2ImapFlags(NGImap4Client *self, NSArray *_flags) { id tmp; ms = [NSMutableString stringWithCapacity:128]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; if (self->login != nil) [ms appendFormat:@" login=%@%s", self->login, self->password?"(pwd)":""]; diff --git a/sope-mime/NGImap4/NGImap4Connection.m b/sope-mime/NGImap4/NGImap4Connection.m index 5fb802e7..239ec35d 100644 --- a/sope-mime/NGImap4/NGImap4Connection.m +++ b/sope-mime/NGImap4/NGImap4Connection.m @@ -47,7 +47,7 @@ static NSString *imap4Separator = nil; imap4Separator = [[ud stringForKey:@"NGImap4ConnectionStringSeparator"] copy]; - if ([imap4Separator length] == 0) + if (![imap4Separator isNotEmpty]) imap4Separator = @"/"; NSLog(@"Note(NGImap4Connection): using '%@' as the IMAP4 folder separator.", imap4Separator); @@ -156,21 +156,24 @@ static NSString *imap4Separator = nil; /* errors */ - (NSException *)errorCouldNotSelectURL:(NSURL *)_url { + NSException *e; NSDictionary *ui; NSString *r; r = [_url isNotNull] ? [@"Could not select IMAP4 folder: " stringByAppendingString: [_url absoluteString]] - : @"Could not select IMAP4 folder!"; + : (NSString *)@"Could not select IMAP4 folder!"; - ui = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithInt:404], @"http-status", - _url, @"url", - nil]; + ui = [[NSDictionary alloc] initWithObjectsAndKeys: + [NSNumber numberWithInt:404], @"http-status", + _url, @"url", + nil]; - return [NSException exceptionWithName:@"NGImap4Exception" - reason:r userInfo:ui]; + e = [NSException exceptionWithName:@"NGImap4Exception" + reason:r userInfo:ui]; + [ui release]; ui = nil; + return e; } - (NSException *)errorForResult:(NSDictionary *)_result text:(NSString *)_txt { @@ -298,7 +301,7 @@ NSArray *SOGoMailGetDirectChildren(NSArray *_array, NSString *_fn) { return nil; folderName = [_url path]; - if ([folderName length] == 0) + if (![folderName isNotEmpty]) return nil; if ([folderName characterAtIndex:0] == '/') folderName = [folderName substringFromIndex:1]; @@ -328,7 +331,7 @@ NSArray *SOGoMailGetDirectChildren(NSArray *_array, NSString *_fn) { newFolder = [_url isKindOfClass:[NSURL class]] ? [self imap4FolderNameForURL:_url] - : _url; + : (NSString *)_url; if (!alwaysSelect) { if ([[[self client] selectedFolderName] isEqualToString:newFolder]) @@ -358,7 +361,7 @@ NSArray *SOGoMailGetDirectChildren(NSArray *_array, NSString *_fn) { NSDictionary *result; if ((result = [self cachedHierarchyResults]) != nil) - return [result isNotNull] ? result : nil; + return [result isNotNull] ? result : (NSDictionary *)nil; if (debugCache) [self logWithFormat:@" no folders cached yet .."]; @@ -374,7 +377,7 @@ NSArray *SOGoMailGetDirectChildren(NSArray *_array, NSString *_fn) { if ([result isNotNull]) { [self cacheHierarchyResults:result]; if (debugCache) { - [self logWithFormat:@"cached results: 0x%08X(%d)", + [self logWithFormat:@"cached results: 0x%p(%d)", result, [result count]]; } } @@ -423,7 +426,7 @@ NSArray *SOGoMailGetDirectChildren(NSArray *_array, NSString *_fn) { uids = [self cachedUIDsForURL:_url qualifier:_qualifier sortOrdering:_so]; if (uids != nil) { if (debugCache) [self logWithFormat:@"reusing uid cache!"]; - return [uids isNotNull] ? uids : nil; + return [uids isNotNull] ? uids : (NSArray *)nil; } /* select folder and fetch */ @@ -471,7 +474,7 @@ NSArray *SOGoMailGetDirectChildren(NSArray *_array, NSString *_fn) { if (_uids == nil) return nil; - if ([_uids count] == 0) + if (![_uids isNotEmpty]) return nil; // TODO: might break empty folders?! return a dict! /* select folder */ @@ -541,7 +544,7 @@ NSArray *SOGoMailGetDirectChildren(NSArray *_array, NSString *_fn) { /* process results */ result = [(NSDictionary *)result objectForKey:@"fetch"]; - if ([result count] == 0) { /* did not find part */ + if (![result isNotEmpty]) { /* did not find part */ [self errorWithFormat:@"did not find part: %@", _partId]; return nil; } @@ -622,7 +625,7 @@ NSArray *SOGoMailGetDirectChildren(NSArray *_array, NSString *_fn) { } result = [result valueForKey:@"search"]; - if ([result count] == 0) /* no messages in there, nothin' to be done */ + if (![result isNotEmpty]) /* no messages in there, nothin' to be done */ return nil; /* store flags */ @@ -872,10 +875,10 @@ NSArray *SOGoMailGetDirectChildren(NSArray *_array, NSString *_fn) { NSMutableString *ms; ms = [NSMutableString stringWithCapacity:128]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; - [ms appendFormat:@" client=0x%08X", self->client]; - if ([self->password length] > 0) + [ms appendFormat:@" client=0x%p", self->client]; + if ([self->password isNotEmpty]) [ms appendString:@" pwd"]; [ms appendFormat:@" created=%@", self->creationTime]; diff --git a/sope-mime/NGImap4/NGImap4Context.m b/sope-mime/NGImap4/NGImap4Context.m index 81e1deb5..4aba5959 100644 --- a/sope-mime/NGImap4/NGImap4Context.m +++ b/sope-mime/NGImap4/NGImap4Context.m @@ -486,7 +486,7 @@ static int ImapLogEnabled = -1; list = [res objectForKey:@"list"]; - if ([list count]) { /* folder exist but is not subscribed */ + if ([list isNotEmpty]) { /* folder exist but is not subscribed */ [self->client subscribe:_name]; } else { /* try to create folder */ @@ -637,11 +637,11 @@ static int ImapLogEnabled = -1; enumerator = [[_name componentsSeparatedByString:@"/"] objectEnumerator]; f = [self serverRoot]; - while ((obj = [enumerator nextObject])) { - if ([obj length] > 0) + while ((obj = [enumerator nextObject]) != nil) { + if ([obj isNotEmpty]) f = [f subFolderWithName:obj caseInsensitive:_caseIn]; } - return self->lastException ? nil : f; + return self->lastException ? (NGImap4Folder *)nil : f; } - (BOOL)createFolderWithPath:(NSString *)_name { @@ -707,7 +707,7 @@ static int ImapLogEnabled = -1; [result addObjectsFromArray:array]; } } - return self->lastException ? nil : result; + return self->lastException ? (NSMutableArray *)nil : result; } - (BOOL)hasNewMessages { @@ -955,7 +955,7 @@ static int ImapLogEnabled = -1; NSMutableString *ms; ms = [NSMutableString stringWithCapacity:64]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; [self appendAttributesToDescription:ms]; [ms appendString:@">"]; return ms; diff --git a/sope-mime/NGImap4/NGImap4DataSource.m b/sope-mime/NGImap4/NGImap4DataSource.m index 8c4a710e..ab024ff6 100644 --- a/sope-mime/NGImap4/NGImap4DataSource.m +++ b/sope-mime/NGImap4/NGImap4DataSource.m @@ -115,7 +115,8 @@ static BOOL profileDS = NO; { if (profileDS) [self logWithFormat:@"fetchObjects: fetch ..."]; - tmp = (self->folder) ? [self fetchMessages] : [NSArray array]; + tmp = (self->folder != nil) + ? [self fetchMessages] : (NSArray *)[NSArray array]; if (profileDS) [self logWithFormat:@"fetchObjects: done ..."]; ASSIGN(self->messages, tmp); diff --git a/sope-mime/NGImap4/NGImap4Envelope.m b/sope-mime/NGImap4/NGImap4Envelope.m index 2590d1df..aa8676af 100644 --- a/sope-mime/NGImap4/NGImap4Envelope.m +++ b/sope-mime/NGImap4/NGImap4Envelope.m @@ -48,7 +48,7 @@ static NGMimeRFC822DateHeaderFieldParser *dateParser = nil; } _email = [_email stringValue]; - if ([_email length] == 0) + if (![_email isNotEmpty]) return nil; return [[NGImap4EnvelopeAddress alloc] initWithString:_email]; } @@ -173,13 +173,13 @@ static NGMimeRFC822DateHeaderFieldParser *dateParser = nil; /* derived accessors */ - (BOOL)hasTo { - return [self->to count] > 0 ? YES : NO; + return [self->to isNotEmpty] ? YES : NO; } - (BOOL)hasCC { - return [self->cc count] > 0 ? YES : NO; + return [self->cc isNotEmpty] ? YES : NO; } - (BOOL)hasBCC { - return [self->bcc count] > 0 ? YES : NO; + return [self->bcc isNotEmpty] ? YES : NO; } /* description */ @@ -188,7 +188,7 @@ static NGMimeRFC822DateHeaderFieldParser *dateParser = nil; NSMutableString *ms; ms = [NSMutableString stringWithCapacity:128]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; if (self->date) [ms appendFormat:@" date='%@'", self->date]; if (self->subject) [ms appendFormat:@" subject='%@'", self->subject]; diff --git a/sope-mime/NGImap4/NGImap4EnvelopeAddress.m b/sope-mime/NGImap4/NGImap4EnvelopeAddress.m index 98d87a16..9e8b9b6e 100644 --- a/sope-mime/NGImap4/NGImap4EnvelopeAddress.m +++ b/sope-mime/NGImap4/NGImap4EnvelopeAddress.m @@ -98,9 +98,9 @@ - (NSString *)baseEMail { NSString *t; - if ([self->mailbox length] == 0) + if (![self->mailbox isNotEmpty]) return nil; - if ([self->host length] == 0) + if (![self->host isNotEmpty]) return self->mailbox; t = [self->mailbox stringByAppendingString:@"@"]; @@ -109,7 +109,7 @@ - (NSString *)email { NSString *t; - if ([self->personalName length] == 0) + if (![self->personalName isNotEmpty]) return [self baseEMail]; if ((t = [self baseEMail]) == nil) return self->personalName; @@ -125,7 +125,7 @@ NSMutableString *ms; ms = [NSMutableString stringWithCapacity:128]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; if (self->personalName) [ms appendFormat:@" name='%@'", self->personalName]; if (self->sourceRoute) [ms appendFormat:@" source='%@'", self->sourceRoute]; diff --git a/sope-mime/NGImap4/NGImap4FileManager.m b/sope-mime/NGImap4/NGImap4FileManager.m index 6377ef9b..3465d62b 100644 --- a/sope-mime/NGImap4/NGImap4FileManager.m +++ b/sope-mime/NGImap4/NGImap4FileManager.m @@ -144,9 +144,9 @@ static BOOL debugOn = NO; [self->currentFolder release]; self->currentFolder = nil; conDict = [NSDictionary dictionaryWithObjectsAndKeys: - _user ? _user : @"anonymous", @"login", - _pwd ? _pwd : @"", @"passwd", - _host ? _host : @"localhost", @"host", + _user ? _user : (NSString *)@"anonymous", @"login", + _pwd ? _pwd : (NSString *)@"", @"passwd", + _host ? _host : (NSString *)@"localhost", @"host", nil]; loginException = nil; @@ -226,13 +226,12 @@ static BOOL debugOn = NO; - (BOOL)changeCurrentDirectoryPath:(NSString *)_path { id folder; - if ([_path length] == 0) + if (![_path isNotEmpty]) return NO; - if (![_path isAbsolutePath]) { + if (![_path isAbsolutePath]) _path = [[self currentDirectoryPath] stringByAppendingPathComponent:_path]; - } - + if ((folder = [self _lookupFolderAtPathString:_path]) == nil) return NO; @@ -329,7 +328,7 @@ static BOOL debugOn = NO; //NSLog(@"qualifier: %@", q); msgs = [folder messagesForQualifier:q maxCount:2]; - if ([msgs count] == 0) { + if (![msgs isNotEmpty]) { /* no such message .. */ return nil; } @@ -422,7 +421,7 @@ static BOOL debugOn = NO; q = [self _qualifierForFileName:fileName]; msgs = [folder messagesForQualifier:q maxCount:2]; - if ([msgs count] > 0) + if ([msgs isNotEmpty]) return YES; } @@ -506,9 +505,10 @@ static BOOL debugOn = NO; } if (date == nil) - NSLog(@"couldn't parse date: %@", tmp); + NSLog(@"could not parse date: %@", tmp); - [attrs setObject:date ? date : tmp forKey:NSFileModificationDate]; + [attrs setObject:(date != nil ? date : (NSCalendarDate *)tmp) + forKey:NSFileModificationDate]; } if ((tmp = [headers objectForKey:Fields->from])) @@ -576,7 +576,7 @@ static BOOL debugOn = NO; q = [self _qualifierForFileName:fileName]; msgs = [folder messagesForQualifier:q maxCount:2]; - if ([msgs count] == 0) { + if (![msgs isNotEmpty]) { /* msg does not exist */ //NSLog(@"did not find msg for qualifier %@ in folder %@", q, folder); return nil; @@ -662,7 +662,7 @@ static BOOL debugOn = NO; ms = [NSMutableString stringWithCapacity:64]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; [self appendAttributesToDescription:ms]; [ms appendString:@">"]; return ms; diff --git a/sope-mime/NGImap4/NGImap4Folder.m b/sope-mime/NGImap4/NGImap4Folder.m index b0966d20..ea305ec9 100644 --- a/sope-mime/NGImap4/NGImap4Folder.m +++ b/sope-mime/NGImap4/NGImap4Folder.m @@ -299,7 +299,7 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; msn = [[dict objectForKey:@"search"] mutableCopy]; - if ((msn == nil) || ([msn count] == 0)) { + if ((msn == nil) || ![msn isNotEmpty]) { mes = [NSArray array]; } else { @@ -529,7 +529,7 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; n = [self absoluteName]; // TODO: fix that junk! - if ([n length] > 0) { + if ([n isNotEmpty]) { [nc addObserver:self selector:@selector(_resetFolder) name:[self resetFolderNotificationName] object:nil]; @@ -748,7 +748,7 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; if (uids == nil) { EOQualifier *qual; - if (![_so count]) { + if (![_so isNotEmpty]) { static NSArray *ArrivalSO = nil; if (ArrivalSO == nil) { @@ -793,7 +793,8 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; if (![self->context registerAsSelectedFolder:self]) return nil; - bodyKey = [NSString stringWithFormat:@"body[%@]", _part?_part:@""]; + bodyKey = [NSString stringWithFormat: + @"body[%@]", _part ? _part : (NSString *)@""]; uids = [NSArray arrayWithObject:[NSNumber numberWithUnsignedInt:_mUid]]; parts = [NSArray arrayWithObject:bodyKey]; @@ -809,7 +810,7 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; } fetchResults = [result objectForKey:@"fetch"]; - if ([fetchResults count] == 0) + if (![fetchResults isNotEmpty]) [self debugWithFormat:@"found no fetch result"]; // TODO: using 'lastObject' is certainly wrong? need to search for body @@ -835,7 +836,9 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; uid = [NSNumber numberWithUnsignedInt:_mUid]; allSortUids = [self _messageIds:_so onlyUnseen:NO]; - uids = _unread ? [self _messageIds:_so onlyUnseen:_unread] : nil; + + uids = _unread ? [self _messageIds:_so onlyUnseen:_unread] : (NSArray *)nil; + enumerator = [allSortUids objectEnumerator]; lastUid = nil; @@ -896,9 +899,8 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; pool = [[NSAutoreleasePool alloc] init]; - if (![_so count]) { + if (![_so isNotEmpty]) return [self messages]; - } if (!(uids = [self _messageIds:_so onlyUnseen:NO])) return [self messages]; @@ -970,12 +972,13 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; enumerator = [messages objectEnumerator]; messageMapping = [NSMutableDictionary dictionaryWithCapacity: [messages count]]; - while ((message = [enumerator nextObject])) { - if (![message isComplete]) + while ((message = [enumerator nextObject]) != nil) { + if (![message isComplete]) { [messageMapping setObject:message forKey:[NSNumber numberWithUnsignedInt:[message uid]]]; + } } - if ([ unreadUids count]) { + if ([unreadUids isNotEmpty]) { enumerator = [_array objectEnumerator]; while ((message = [enumerator nextObject])) { NSNumber *number; @@ -986,7 +989,7 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; [messageMapping setObject:message forKey:number]; } } - if ([messageMapping count] > 0) { + if ([messageMapping isNotEmpty]) { static NSArray *sortKeys = nil; uids = [messageMapping allKeys]; @@ -1316,7 +1319,7 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; NSString *n; n = [self absoluteName]; - if ([n length] > 0) + if ([n isNotEmpty]) [self _postResetSubfolderNotification]; else [self _resetSubFolder]; @@ -2006,7 +2009,7 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; ms = [NSMutableString stringWithCapacity:64]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; if ((tmp = [self name])) [ms appendFormat:@" name=%@", tmp]; diff --git a/sope-mime/NGImap4/NGImap4FolderMailRegistry.m b/sope-mime/NGImap4/NGImap4FolderMailRegistry.m index cc35acf1..cf8ce230 100644 --- a/sope-mime/NGImap4/NGImap4FolderMailRegistry.m +++ b/sope-mime/NGImap4/NGImap4FolderMailRegistry.m @@ -162,7 +162,7 @@ static NSString *keys[2] = { @"flag", nil }; if (_msg == nil) return; if (logFlagPostings) { - [self logWithFormat:@"%s flag '%@' msg %d (0x%08X)", + [self logWithFormat:@"%s flag '%@' msg %d (0x%p)", (_op == NGImap4_FlagAdd ? "add" : "del"), _flag, [_msg uid], _msg]; } @@ -203,7 +203,7 @@ static NSString *keys[2] = { @"flag", nil }; } if (logFlagPostings) - [self logWithFormat:@" post to 0x%08X ...", self->observers[i]]; + [self logWithFormat:@" post to 0x%p ...", self->observers[i]]; if (_op == NGImap4_FlagAdd) [self->observers[i] _addFlag:notification]; @@ -211,7 +211,7 @@ static NSString *keys[2] = { @"flag", nil }; [self->observers[i] _removeFlag:notification]; if (logFlagPostings) - [self logWithFormat:@" done post to 0x%08X.", self->observers[i]]; + [self logWithFormat:@" done post to 0x%p.", self->observers[i]]; } #if LIB_FOUNDATION_LIBRARY diff --git a/sope-mime/NGImap4/NGImap4MailboxInfo.m b/sope-mime/NGImap4/NGImap4MailboxInfo.m index 6159c736..37a7eff0 100644 --- a/sope-mime/NGImap4/NGImap4MailboxInfo.m +++ b/sope-mime/NGImap4/NGImap4MailboxInfo.m @@ -92,7 +92,7 @@ NSMutableString *ms; ms = [NSMutableString stringWithCapacity:64]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; [self appendAttributesToDescription:ms]; [ms appendString:@">"]; return ms; diff --git a/sope-mime/NGImap4/NGImap4Message+BodyStructure.h b/sope-mime/NGImap4/NGImap4Message+BodyStructure.h index 3fe0874a..b044fbeb 100644 --- a/sope-mime/NGImap4/NGImap4Message+BodyStructure.h +++ b/sope-mime/NGImap4/NGImap4Message+BodyStructure.h @@ -127,27 +127,34 @@ static id _buildMessage(id self, NSURL *_baseUrl, NSDictionary *_dict) { addrEnum = [addrs objectEnumerator]; str = nil; - while ((addr = [addrEnum nextObject])) { + while ((addr = [addrEnum nextObject]) != nil) { NSString *personalName, *mailboxName, *hostName; - if (!str) { + + if (str == nil) str = [NSMutableString stringWithCapacity:32]; - } - else { + else [str appendString:@", "]; - } + personalName = [addr objectForKey:@"personalName"]; mailboxName = [addr objectForKey:@"mailboxName"]; hostName = [addr objectForKey:@"hostName"]; - if ([personalName length]) { - [str appendFormat:@"\"%@\" <%@@%@>", personalName, - mailboxName, hostName]; + if ([personalName isNotEmpty]) { + [str appendString:@"\""]; + [str appendString:personalName]; + [str appendString:@"\" <"]; + [str appendString:mailboxName]; + [str appendString:@"@"]; + [str appendString:hostName]; + [str appendString:@">"]; } else { - [str appendFormat:@"%@@%@", mailboxName, hostName]; - } + [str appendString:mailboxName]; + [str appendString:@"@"]; + [str appendString:hostName]; + } } - if (str) + if (str != nil) [map setObject:str forKey:obj]; } } @@ -234,14 +241,13 @@ static id _buildMimeBodyPart(id self, NSDictionary *_dict) [dict setObject:type forKey:Fields->contentType]; - if (([value = [_dict objectForKey:@"bodyId"] length])) { + if ([(value = [_dict objectForKey:@"bodyId"]) isNotEmpty]) [dict setObject:value forKey:Fields->messageID]; - } - - if (([value = [_dict objectForKey:@"size"] length])) { + + if ([(value = [_dict objectForKey:@"size"]) isNotEmpty]) [dict setObject:value forKey:Fields->contentLength]; - } - if (([value = [_dict objectForKey:@"encoding"] length])) { + + if ([(value = [_dict objectForKey:@"encoding"]) isNotEmpty]) { [dict setObject:[value lowercaseString] forKey:Fields->contentTransferEncoding]; } diff --git a/sope-mime/NGImap4/NGImap4Message.m b/sope-mime/NGImap4/NGImap4Message.m index 40b2ef78..72a3681a 100644 --- a/sope-mime/NGImap4/NGImap4Message.m +++ b/sope-mime/NGImap4/NGImap4Message.m @@ -438,12 +438,12 @@ static BOOL ImapDebugEnabled = NO; id tmp; ms = [NSMutableString stringWithCapacity:128]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; [ms appendFormat:@" uid=%d size=%d", self->uid, self->size]; - if (self->headers) { + if (self->headers != nil) { tmp = [[self headers] objectForKey:@"subject"]; - if ([tmp length] > 0) + if ([tmp isNotEmpty]) [ms appendFormat:@" subject='%@'", tmp]; else [ms appendString:@" no-subject"]; @@ -456,16 +456,15 @@ static BOOL ImapDebugEnabled = NO; [ms appendFormat:@" folder='%@'", tmp]; if (self->flags) { - tmp = [self flags]; + tmp = [self flags]; - if ([tmp count] > 0) - [ms appendFormat:@"flags: (%@)", [tmp componentsJoinedByString:@", "]]; - else - [ms appendString:@"no-flags"]; + if ([tmp isNotEmpty]) + [ms appendFormat:@"flags: (%@)", [tmp componentsJoinedByString:@", "]]; + else + [ms appendString:@"no-flags"]; } - else { + else [ms appendString:@" [flags not fetched]"]; - } [ms appendString:@">"]; return ms; @@ -579,7 +578,7 @@ static BOOL ImapDebugEnabled = NO; orgH = [self headers]; - if ([[orgH objectForKey:@"encoding"] length] != 0) + if ([[orgH objectForKey:@"encoding"] isNotEmpty]) return; h = [[self headers] mutableCopy]; @@ -626,7 +625,7 @@ static BOOL ImapDebugEnabled = NO; bStruct = [(NSDictionary *)[fetchResponses lastObject] objectForKey:@"body"]; } - else if ([fetchResponses count] == 0) { + else if (![fetchResponses isNotEmpty]) { /* no results */ bStruct = nil; } @@ -657,7 +656,7 @@ static BOOL ImapDebugEnabled = NO; } /* set encoding */ - if ([[bStruct objectForKey:@"encoding"] length] > 0) + if ([[bStruct objectForKey:@"encoding"] isNotEmpty]) [self _processBodyStructureEncoding:bStruct]; self->bodyStructure = [[NGMimeMessage alloc] initWithHeader:[self headers]]; diff --git a/sope-mime/NGImap4/NGImap4ResponseNormalizer.m b/sope-mime/NGImap4/NGImap4ResponseNormalizer.m index ffff8b1b..7ca2d153 100644 --- a/sope-mime/NGImap4/NGImap4ResponseNormalizer.m +++ b/sope-mime/NGImap4/NGImap4ResponseNormalizer.m @@ -479,7 +479,7 @@ static int LogImapEnabled = -1; qRoot = [quotaRoot objectForKey:obj]; - if (![qRoot length]) { + if (![qRoot isNotEmpty]) { if (LogImapEnabled) { [self logWithFormat:@"%s: missing quotaroot for %@", __PRETTY_FUNCTION__, obj]; @@ -628,7 +628,7 @@ _imapFlags2Flags(NGImap4ResponseNormalizer *self, NSArray *_flags) enumerator = [_flags objectEnumerator]; cnt = 0; while ((obj = [enumerator nextObject])) { - if ([obj length] == 0) + if (![obj isNotEmpty]) continue; if (![[obj substringToIndex:1] isEqualToString:@"\\"]) diff --git a/sope-mime/NGImap4/NGImap4ResponseParser.m b/sope-mime/NGImap4/NGImap4ResponseParser.m index fb89b618..024211d8 100644 --- a/sope-mime/NGImap4/NGImap4ResponseParser.m +++ b/sope-mime/NGImap4/NGImap4ResponseParser.m @@ -747,7 +747,7 @@ static void _parseUntaggedResponse(NGImap4ResponseParser *self, while ((obj = [enumerator nextObject]) != nil) { [uids addObject:obj]; obj = [enumerator nextObject]; - [rights addObject:(obj ? obj : @"")]; + [rights addObject:(obj != nil ? obj : (id)@"")]; } result = [[NSDictionary alloc] initWithObjects:rights forKeys:uids]; @@ -942,9 +942,9 @@ static void _parseUntaggedResponse(NGImap4ResponseParser *self, _consume(self, 1); folderRoot = nil; } - if ([folderName length] && [folderRoot length]) { + if ([folderName isNotEmpty] && [folderRoot isNotEmpty]) [dict setObject:folderRoot forKey:folderName]; - } + return YES; } @@ -1081,7 +1081,7 @@ static BOOL _parseThreadResponse(NGImap4ResponseParser *self, if ((data = [self _parseData]) == nil) return nil; - if ([data length] == 0) + if (![data isNotEmpty]) return @""; s = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; @@ -1646,9 +1646,9 @@ static NSDictionary *_parseBodyParameterList(NGImap4ResponseParser *self) NSString *str; str = _parseBodyString(self, YES); - if ([str length] > 0) { + if ([str isNotEmpty]) NSLog(@"%s: got unexpected string %@", __PRETTY_FUNCTION__, str); - } + list = (id)[NSDictionary dictionary]; } return list; @@ -1688,9 +1688,9 @@ static NSArray *_parseParenthesizedAddressList(NGImap4ResponseParser *self) { NSString *str; str = _parseBodyString(self, YES); - if ([str length] > 0) { + if ([str isNotEmpty]) NSLog(@"%s: got unexpected string %@", __PRETTY_FUNCTION__, str); - } + result = (id)[NSArray array]; } return result; @@ -1831,7 +1831,7 @@ static NSArray *_parseFlagArray(NGImap4ResponseParser *self) { _consumeIfMatch(self, '('); flags = _parseUntil(self, ')'); - if ([flags length] == 0) { + if (![flags isNotEmpty]) { static NSArray *emptyArray = nil; if (emptyArray == nil) emptyArray = [[NSArray alloc] init]; return emptyArray; @@ -1896,7 +1896,7 @@ static BOOL _parseNoOrOkArguments(NGImap4ResponseParser *self, _consume(self, 1); value = _parseUntil(self, '\n'); - if ([value length] > 0) { + if ([value isNotEmpty]) { obj = [[NSDictionary alloc] initWithObjects:&value forKeys:&key count:1]; } diff --git a/sope-mime/NGImap4/NGImap4ServerRoot.m b/sope-mime/NGImap4/NGImap4ServerRoot.m index 4b58acef..2454c011 100644 --- a/sope-mime/NGImap4/NGImap4ServerRoot.m +++ b/sope-mime/NGImap4/NGImap4ServerRoot.m @@ -418,7 +418,7 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; ms = [NSMutableString stringWithCapacity:64]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; if ((tmp = [self name])) [ms appendFormat:@" name=%@", tmp]; diff --git a/sope-mime/NGImap4/NGSieveClient.m b/sope-mime/NGImap4/NGSieveClient.m index 94baaca4..51128459 100644 --- a/sope-mime/NGImap4/NGSieveClient.m +++ b/sope-mime/NGImap4/NGSieveClient.m @@ -382,7 +382,7 @@ static BOOL debugImap4 = NO; [self logWithFormat:@"ERROR: could not parse status line."]; return nil; } - if ([s length] == 0) { // remainder of previous string + if (![s isNotEmpty]) { // remainder of previous string [s release]; if ((s = [self readStringToCRLF]) == nil) { [self logWithFormat:@"ERROR: could not parse status line."]; @@ -401,7 +401,7 @@ static BOOL debugImap4 = NO; } - (BOOL)isValidScriptName:(NSString *)_name { - return ([_name length] == 0) ? NO : YES; + return [_name isNotEmpty]; } - (NSDictionary *)putScript:(NSString *)_name script:(NSString *)_script { @@ -413,7 +413,7 @@ static BOOL debugImap4 = NO; [self logWithFormat:@"%s: missing script-name", __PRETTY_FUNCTION__]; return nil; } - if ([_script length] == 0) { + if (![_script isNotEmpty]) { [self logWithFormat:@"%s: missing script", __PRETTY_FUNCTION__]; return nil; } @@ -855,7 +855,7 @@ static BOOL debugImap4 = NO; NSMutableString *ms; ms = [NSMutableString stringWithCapacity:128]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; if (self->socket != nil) [ms appendFormat:@" socket=%@", [self socket]]; diff --git a/sope-mime/NGMail/NGMBoxReader.m b/sope-mime/NGMail/NGMBoxReader.m index 57368076..9ac60c8a 100644 --- a/sope-mime/NGMail/NGMBoxReader.m +++ b/sope-mime/NGMail/NGMBoxReader.m @@ -223,7 +223,7 @@ __appendByte(NGMBoxReader *self, NSMutableData *_data, IMP _readBytes, int _c); /* description */ - (NSString *)description { - return [NSString stringWithFormat:@"<%@[0x%08X] source=%@ endOfStream=%@", + return [NSString stringWithFormat:@"<%@[0x%p] source=%@ endOfStream=%@", NSStringFromClass([self class]), (unsigned)self, self->source, self->isEndOfStream ? @"YES" : @"NO"]; } diff --git a/sope-mime/NGMail/NGMailAddressParser.m b/sope-mime/NGMail/NGMailAddressParser.m index 86dd4f4e..80968dda 100644 --- a/sope-mime/NGMail/NGMailAddressParser.m +++ b/sope-mime/NGMail/NGMailAddressParser.m @@ -450,7 +450,7 @@ static inline id parseDomainLiteral(NGMailAddressParser *self, BOOL _guessMode) } while (result); - return !isPhrase ? nil : yesNum; + return !isPhrase ? (NSNumber *)nil : yesNum; } - (id)parsePhrase:(BOOL)_guessMode { @@ -1000,7 +1000,7 @@ static inline id parseDomainLiteral(NGMailAddressParser *self, BOOL _guessMode) /* description */ - (NSString *)description { - return [StrClass stringWithFormat:@"<%@[0x%08X]>", + return [StrClass stringWithFormat:@"<%@[0x%p]>", NSStringFromClass([self class]), (unsigned)self]; } diff --git a/sope-mime/NGMail/NGMimeMessage.m b/sope-mime/NGMail/NGMimeMessage.m index 0664546e..f6868ff5 100644 --- a/sope-mime/NGMail/NGMimeMessage.m +++ b/sope-mime/NGMail/NGMimeMessage.m @@ -214,7 +214,7 @@ static NGMimeType *defaultDataType = nil; id b; d = [NSMutableString stringWithCapacity:64]; - [d appendFormat:@"<%@[0x%08X]: header=%@", + [d appendFormat:@"<%@[0x%p]: header=%@", NSStringFromClass([self class]), self, self->header]; b = [self body]; diff --git a/sope-mime/NGMail/NGMimeMessageGenerator.m b/sope-mime/NGMail/NGMimeMessageGenerator.m index 4f1b7a03..b7a95bcf 100644 --- a/sope-mime/NGMail/NGMimeMessageGenerator.m +++ b/sope-mime/NGMail/NGMimeMessageGenerator.m @@ -185,7 +185,7 @@ static BOOL debugOn = NO; contentType = [self defaultContentTypeForPart:_part]; if (contentType == nil) { - [self logWithFormat:@"WARNING(%s): missing content-type in part 0x%08X.", + [self logWithFormat:@"WARNING(%s): missing content-type in part 0x%p.", __PRETTY_FUNCTION__, _part]; return nil; } diff --git a/sope-mime/NGMail/NGPop3Client.m b/sope-mime/NGMail/NGPop3Client.m index 1d4dd9d0..1890355f 100644 --- a/sope-mime/NGMail/NGPop3Client.m +++ b/sope-mime/NGMail/NGPop3Client.m @@ -620,7 +620,7 @@ // description - (NSString *)description { - return [NSString stringWithFormat:@"", + return [NSString stringWithFormat:@"", (unsigned)self, [self socket]]; } diff --git a/sope-mime/NGMail/NGPop3Support.m b/sope-mime/NGMail/NGPop3Support.m index 92fb8f50..4cb9d4d8 100644 --- a/sope-mime/NGMail/NGPop3Support.m +++ b/sope-mime/NGMail/NGPop3Support.m @@ -57,7 +57,7 @@ /* description */ - (NSString *)description { - return [NSString stringWithFormat:@"", + return [NSString stringWithFormat:@"", (unsigned)self, [self isPositive] ? "YES" : "NO", [self line]]; @@ -106,7 +106,7 @@ /* description */ - (NSString *)description { - return [NSString stringWithFormat:@"", + return [NSString stringWithFormat:@"", (unsigned)self, [self messageNumber], [self size]]; } diff --git a/sope-mime/NGMail/NGSendMail.m b/sope-mime/NGMail/NGSendMail.m index 6583c63c..ef4c9900 100644 --- a/sope-mime/NGMail/NGSendMail.m +++ b/sope-mime/NGMail/NGSendMail.m @@ -234,7 +234,7 @@ - (NSMutableString *)buildSendMailCommandLineWithSender:(NSString *)_sender { NSMutableString *sendmail; - if ([[self executablePath] length] == 0) + if (![[self executablePath] isNotEmpty]) return nil; sendmail = [NSMutableString stringWithCapacity:256]; @@ -331,7 +331,7 @@ - (BOOL)_appendData:(NSData *)_data to:(FILE *)_fd { int written; - if ([_data length] == 0) + if (![_data isNotEmpty]) return YES; written = fwrite((char *)[_data bytes], [_data length], diff --git a/sope-mime/NGMail/NGSmtpClient.m b/sope-mime/NGMail/NGSmtpClient.m index 5727683b..80f364b5 100644 --- a/sope-mime/NGMail/NGSmtpClient.m +++ b/sope-mime/NGMail/NGSmtpClient.m @@ -462,7 +462,7 @@ // description - (NSString *)description { - return [NSString stringWithFormat:@"", + return [NSString stringWithFormat:@"", (unsigned)self, [self socket]]; } diff --git a/sope-mime/NGMail/NGSmtpSupport.m b/sope-mime/NGMail/NGSmtpSupport.m index 3b3d912a..b26cbea6 100644 --- a/sope-mime/NGMail/NGSmtpSupport.m +++ b/sope-mime/NGMail/NGSmtpSupport.m @@ -173,7 +173,7 @@ NSString *NGSmtpDescriptionForReplyCode(NGSmtpReplyCode _code) { } else len = 0; - return (len > 0) ? [NSString stringWithCString:(cstr + 1)] : [self text]; + return (len > 0) ? [NSString stringWithCString:(cstr + 1)] : (id)[self text]; } - (BOOL)isPositive { diff --git a/sope-mime/NGMime/NGConcreteMimeType.m b/sope-mime/NGMime/NGConcreteMimeType.m index 7524a9aa..e183555a 100644 --- a/sope-mime/NGMime/NGConcreteMimeType.m +++ b/sope-mime/NGMime/NGConcreteMimeType.m @@ -498,39 +498,41 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; if (self->padding) [array addObject:@"padding"]; if (self->conversions) [array addObject:@"conversions"]; if (self->name) [array addObject:@"name"]; - return ([array count] > 0) ? [array objectEnumerator] : nil; + return [array isNotEmpty] ? [array objectEnumerator] : (NSEnumerator *)nil; } - (id)valueOfParameter:(NSString *)_parameterName { if ([_parameterName isEqualToString:@"type"]) return self->type; - else if ([_parameterName isEqualToString:@"padding"]) + if ([_parameterName isEqualToString:@"padding"]) return [NSNumber numberWithUnsignedInt:self->padding]; - else if ([_parameterName isEqualToString:@"conversions"]) + if ([_parameterName isEqualToString:@"conversions"]) return self->conversions; - else if ([_parameterName isEqualToString:@"name"]) + if ([_parameterName isEqualToString:@"name"]) return self->name; - else - return nil; + + return nil; } - (NSString *)stringValue { - NSMutableString *str = [NSMutableString stringWithCapacity:20]; + NSMutableString *str; NSString *paras; + str = [NSMutableString stringWithCapacity:20]; [str appendString:NGMimeTypeApplication]; [str appendString:@"/"]; [str appendString:@"octet"]; paras = [self parametersAsString]; - if (paras) [str appendString:paras]; + if (paras != nil) [str appendString:paras]; return str; } @end /* NGConcreteAppOctetMimeType */ -// other types + +/* other types */ @implementation NGConcreteImageMimeType @@ -643,7 +645,7 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; if ((p == nil) && (self->parameters == nil)) return YES; - if (([p count] == 0) && ([self->parameters count] == 0)) + if (![p isNotEmpty] && ![self->parameters isNotEmpty]) return YES; if ((p == nil) || (self->parameters == nil)) @@ -707,11 +709,12 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; [str appendString:@"/"]; [str appendString:self->subType]; - if ([self->parameters count] > 0) { - NSEnumerator *keys = [self->parameters keyEnumerator]; - id key = nil; + if ([self->parameters isNotEmpty]) { + NSEnumerator *keys; + id key; - while ((key = [keys nextObject])) { + keys = [self->parameters keyEnumerator]; + while ((key = [keys nextObject]) != nil) { [str appendString:@"; "]; [str appendString:key]; [str appendString:@"=\""]; @@ -742,13 +745,13 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; [super dealloc]; } -// accessors +/* accessors */ - (NSString *)type { - return self->type ? self->type : @"*"; + return self->type != nil ? self->type : (NSString *)@"*"; } - (NSString *)subType { - return self->subType ? self->subType : @"*"; + return self->subType != nil ? self->subType : (NSString *)@"*"; } - (BOOL)isCompositeType { return NO; diff --git a/sope-mime/NGMime/NGMimeBodyPart.m b/sope-mime/NGMime/NGMimeBodyPart.m index 6c0d6fbb..75e60623 100644 --- a/sope-mime/NGMime/NGMimeBodyPart.m +++ b/sope-mime/NGMime/NGMimeBodyPart.m @@ -162,7 +162,7 @@ static NGMimeType *defaultType = nil; if (![type isKindOfClass:[NGMimeType class]]) type = [NGMimeType mimeType:[type stringValue]]; - return (type != nil ? type : defaultType); + return (type != nil ? type : (id)defaultType); } - (NSString *)contentId { @@ -200,7 +200,7 @@ static NGMimeType *defaultType = nil; d = [NSMutableString stringWithCapacity:128]; - [d appendFormat:@"<%@[0x%08X]: header=%@", + [d appendFormat:@"<%@[0x%p]: header=%@", NSStringFromClass([self class]), self, self->header]; if (b) [d appendFormat:@" bodyClass=%@", NSStringFromClass([b class])]; diff --git a/sope-mime/NGMime/NGMimeContentLengthHeaderFieldParser.m b/sope-mime/NGMime/NGMimeContentLengthHeaderFieldParser.m index e6a0c039..eaf85e82 100644 --- a/sope-mime/NGMime/NGMimeContentLengthHeaderFieldParser.m +++ b/sope-mime/NGMime/NGMimeContentLengthHeaderFieldParser.m @@ -52,7 +52,7 @@ - (NSString *)description { return [NSString stringWithFormat: - @"", + @"", (unsigned)self]; } diff --git a/sope-mime/NGMime/NGMimeContentTypeHeaderFieldParser.m b/sope-mime/NGMime/NGMimeContentTypeHeaderFieldParser.m index 9c95ab52..79112db3 100644 --- a/sope-mime/NGMime/NGMimeContentTypeHeaderFieldParser.m +++ b/sope-mime/NGMime/NGMimeContentTypeHeaderFieldParser.m @@ -79,7 +79,7 @@ static BOOL MimeLogEnabled = NO; - (NSString *)description { return [NSString stringWithFormat: - @"", + @"", (unsigned)self]; } diff --git a/sope-mime/NGMime/NGMimeFileData.m b/sope-mime/NGMime/NGMimeFileData.m index a2320321..ffe1e4c1 100644 --- a/sope-mime/NGMime/NGMimeFileData.m +++ b/sope-mime/NGMime/NGMimeFileData.m @@ -175,7 +175,7 @@ static unsigned tmpmask = 0600; /* description */ - (NSString *)description { - return [NSString stringWithFormat:@"<0x%08X[%@]: path=%@>", + return [NSString stringWithFormat:@"<0x%p[%@]: path=%@>", self, NSStringFromClass([self class]), self->path]; } diff --git a/sope-mime/NGMime/NGMimeHeaderFieldParserSet.m b/sope-mime/NGMime/NGMimeHeaderFieldParserSet.m index a0404adb..101a11ca 100644 --- a/sope-mime/NGMime/NGMimeHeaderFieldParserSet.m +++ b/sope-mime/NGMime/NGMimeHeaderFieldParserSet.m @@ -166,7 +166,7 @@ static NGMimeHeaderFieldParserSet *rfc822set = nil; - (NSString *)description { return [NSString stringWithFormat: - @"", + @"", (unsigned)self, self->fieldNameToParser, [self defaultParser]]; } diff --git a/sope-mime/NGMime/NGMimeHeaderFields.m b/sope-mime/NGMime/NGMimeHeaderFields.m index 07977cee..48b06779 100644 --- a/sope-mime/NGMime/NGMimeHeaderFields.m +++ b/sope-mime/NGMime/NGMimeHeaderFields.m @@ -205,7 +205,7 @@ static int MimeLogEnabled = -1; d = [[NSMutableString alloc] init]; - [d appendFormat:@"<%@[0x%08X]: type=%@", + [d appendFormat:@"<%@[0x%p]: type=%@", NSStringFromClass([self class]), self, self->type]; if (self->parameters) diff --git a/sope-mime/NGMime/NGMimeJoinedData.m b/sope-mime/NGMime/NGMimeJoinedData.m index a89820ad..a2cc1eff 100644 --- a/sope-mime/NGMime/NGMimeJoinedData.m +++ b/sope-mime/NGMime/NGMimeJoinedData.m @@ -161,7 +161,7 @@ NSMutableString *ms; ms = [NSMutableString stringWithCapacity:128]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; [ms appendFormat:@" joinedDataObjects=%d>", [self->joinedDataObjects count]]; [ms appendString:@">"]; diff --git a/sope-mime/NGMime/NGMimeMultipartBody.m b/sope-mime/NGMime/NGMimeMultipartBody.m index adef852e..5e1889a6 100644 --- a/sope-mime/NGMime/NGMimeMultipartBody.m +++ b/sope-mime/NGMime/NGMimeMultipartBody.m @@ -143,7 +143,7 @@ static inline void _checkArray(NGMimeMultipartBody *self) { - (NSString *)description { NSMutableString *d = [NSMutableString stringWithCapacity:64]; - [d appendFormat:@"<%@[0x%08X]:", NSStringFromClass([self class]), self]; + [d appendFormat:@"<%@[0x%p]:", NSStringFromClass([self class]), self]; if (self->flags.isParsed) { if (self->prefix) [d appendFormat:@" prefix=%@", self->prefix]; diff --git a/sope-mime/NGMime/NGMimePartGenerator.m b/sope-mime/NGMime/NGMimePartGenerator.m index ed61eef4..cd8850df 100644 --- a/sope-mime/NGMime/NGMimePartGenerator.m +++ b/sope-mime/NGMime/NGMimePartGenerator.m @@ -344,19 +344,19 @@ static BOOL debugOn = NO; additionalHeaders = [[NGMutableHashMap alloc] initWithCapacity:16]; if (debugOn) { - [self debugWithFormat:@"generate part: 0x%08X<%@>", + [self debugWithFormat:@"generate part: 0x%p<%@>", self->part, NSStringFromClass([self->part class])]; } bodyData = [self generateBodyData:additionalHeaders]; if (debugOn) { - [self debugWithFormat:@" => body 0x%08X<%@> length=%d", + [self debugWithFormat:@" => body 0x%p<%@> length=%d", bodyData, NSStringFromClass([bodyData class]), [bodyData length]]; } headerData = [self generateHeaderData:additionalHeaders]; if (debugOn) { - [self debugWithFormat:@" => header 0x%08X<%@> length=%d", + [self debugWithFormat:@" => header 0x%p<%@> length=%d", headerData, NSStringFromClass([headerData class]), [headerData length]]; } diff --git a/sope-mime/NGMime/NGMimeStringHeaderFieldParser.m b/sope-mime/NGMime/NGMimeStringHeaderFieldParser.m index ee23c464..7749fbe7 100644 --- a/sope-mime/NGMime/NGMimeStringHeaderFieldParser.m +++ b/sope-mime/NGMime/NGMimeStringHeaderFieldParser.m @@ -51,16 +51,17 @@ static BOOL StripLeadingSpaces = NO; // TODO: fixup unsigned len = [_value length]; unsigned cnt; - unichar src[len+1]; + unichar src[len + 1]; NSString *res; - + if (_value == nil) return nil; if (len == 0) return @""; - res = self->removeComments ? [self removeCommentsFromValue:_value] : _value; + res = self->removeComments + ? [self removeCommentsFromValue:_value] : (NSString *)_value; if (StripLeadingSpaces) { /* currently be done during header field parsing */ [res getCharacters:src]; @@ -82,7 +83,7 @@ static BOOL StripLeadingSpaces = NO; - (NSString *)description { return [NSString stringWithFormat: - @"", (unsigned)self, self->removeComments ? "YES" : "NO"]; } diff --git a/sope-mime/NGMime/NGMimeType.m b/sope-mime/NGMime/NGMimeType.m index f36d9635..460a7013 100644 --- a/sope-mime/NGMime/NGMimeType.m +++ b/sope-mime/NGMime/NGMimeType.m @@ -696,8 +696,8 @@ static BOOL _parseMimeType(id self, NSString *_str, NSString **type, } // parse parameters *parameters = parseParameters(self, _str, cstr); - if (![*parameters count]) + if (![*parameters isNotEmpty]) *parameters = nil; - + return YES; } diff --git a/sope-mime/Version b/sope-mime/Version index 33ace709..e00f09c7 100644 --- a/sope-mime/Version +++ b/sope-mime/Version @@ -2,7 +2,7 @@ MAJOR_VERSION:=4 MINOR_VERSION:=5 -SUBMINOR_VERSION:=240 +SUBMINOR_VERSION:=241 # v4.5.214 requires libNGExtensions v4.5.146 # v4.2.149 requires libNGStreams v4.2.34 diff --git a/sope-mime/samples/Mime2XmlTool.m b/sope-mime/samples/Mime2XmlTool.m index 4369c5d0..ba0cfb3b 100644 --- a/sope-mime/samples/Mime2XmlTool.m +++ b/sope-mime/samples/Mime2XmlTool.m @@ -135,7 +135,7 @@ } [self indent]; - printf("