+2006-07-04 Helge Hess <helge.hess@opengroupware.org>
+
+ * use %p for pointer formats, fixed gcc 4.1 warnings, use -isNotEmpty
+ when appropriate (v4.5.241)
+
2006-02-22 Helge Hess <helge.hess@opengroupware.org>
* NGMime: hardcoded CET/UTC in tzname parsing (v4.5.240)
NSString *lkey;
lkey = [self key];
- if ([lkey length] == 0)
+ if (![lkey isNotEmpty])
return nil;
/* check whether key is a valid sort string */
if (i > 0) [sortStr appendString:@" "];
[sortStr appendString:s];
}
- return [sortStr length] > 0 ? sortStr : nil;
+ return [sortStr isNotEmpty] ? sortStr : (NSMutableString *)nil;
}
@end /* NSArray(IMAPAdditions) */
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;
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;
}
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;
? @"REFERENCES"
: @"ORDEREDSUBJECT";
- if ([_charSet length] == 0)
+ if (![_charSet isNotEmpty])
_charSet = @"UTF-8";
threadStr = [NSString stringWithFormat:@"UID THREAD %@ %@ ALL",
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";
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];
array = [_folder pathComponents];
- if ([array count] > 0) {
+ if ([array isNotEmpty]) {
NSString *o;
o = [array objectAtIndex:0];
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)":""];
imap4Separator =
[[ud stringForKey:@"NGImap4ConnectionStringSeparator"] copy];
- if ([imap4Separator length] == 0)
+ if (![imap4Separator isNotEmpty])
imap4Separator = @"/";
NSLog(@"Note(NGImap4Connection): using '%@' as the IMAP4 folder separator.",
imap4Separator);
/* 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 {
return nil;
folderName = [_url path];
- if ([folderName length] == 0)
+ if (![folderName isNotEmpty])
return nil;
if ([folderName characterAtIndex:0] == '/')
folderName = [folderName substringFromIndex:1];
newFolder = [_url isKindOfClass:[NSURL class]]
? [self imap4FolderNameForURL:_url]
- : _url;
+ : (NSString *)_url;
if (!alwaysSelect) {
if ([[[self client] selectedFolderName] isEqualToString:newFolder])
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 .."];
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]];
}
}
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 */
if (_uids == nil)
return nil;
- if ([_uids count] == 0)
+ if (![_uids isNotEmpty])
return nil; // TODO: might break empty folders?! return a dict!
/* select folder */
/* 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;
}
}
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 */
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];
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 */
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 {
[result addObjectsFromArray:array];
}
}
- return self->lastException ? nil : result;
+ return self->lastException ? (NSMutableArray *)nil : result;
}
- (BOOL)hasNewMessages {
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;
{
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);
}
_email = [_email stringValue];
- if ([_email length] == 0)
+ if (![_email isNotEmpty])
return nil;
return [[NGImap4EnvelopeAddress alloc] initWithString:_email];
}
/* 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 */
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];
- (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:@"@"];
- (NSString *)email {
NSString *t;
- if ([self->personalName length] == 0)
+ if (![self->personalName isNotEmpty])
return [self baseEMail];
if ((t = [self baseEMail]) == nil)
return self->personalName;
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];
[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;
- (BOOL)changeCurrentDirectoryPath:(NSString *)_path {
id<NGImap4Folder> 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;
//NSLog(@"qualifier: %@", q);
msgs = [folder messagesForQualifier:q maxCount:2];
- if ([msgs count] == 0) {
+ if (![msgs isNotEmpty]) {
/* no such message .. */
return nil;
}
q = [self _qualifierForFileName:fileName];
msgs = [folder messagesForQualifier:q maxCount:2];
- if ([msgs count] > 0)
+ if ([msgs isNotEmpty])
return YES;
}
}
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]))
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;
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;
msn = [[dict objectForKey:@"search"] mutableCopy];
- if ((msn == nil) || ([msn count] == 0)) {
+ if ((msn == nil) || ![msn isNotEmpty]) {
mes = [NSArray array];
}
else {
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];
if (uids == nil) {
EOQualifier *qual;
- if (![_so count]) {
+ if (![_so isNotEmpty]) {
static NSArray *ArrivalSO = nil;
if (ArrivalSO == nil) {
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];
}
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
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;
pool = [[NSAutoreleasePool alloc] init];
- if (![_so count]) {
+ if (![_so isNotEmpty])
return [self messages];
- }
if (!(uids = [self _messageIds:_so onlyUnseen:NO]))
return [self messages];
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;
[messageMapping setObject:message forKey:number];
}
}
- if ([messageMapping count] > 0) {
+ if ([messageMapping isNotEmpty]) {
static NSArray *sortKeys = nil;
uids = [messageMapping allKeys];
NSString *n;
n = [self absoluteName];
- if ([n length] > 0)
+ if ([n isNotEmpty])
[self _postResetSubfolderNotification];
else
[self _resetSubFolder];
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];
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];
}
}
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];
[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
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;
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];
}
}
[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];
}
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"];
[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;
orgH = [self headers];
- if ([[orgH objectForKey:@"encoding"] length] != 0)
+ if ([[orgH objectForKey:@"encoding"] isNotEmpty])
return;
h = [[self headers] mutableCopy];
bStruct =
[(NSDictionary *)[fetchResponses lastObject] objectForKey:@"body"];
}
- else if ([fetchResponses count] == 0) {
+ else if (![fetchResponses isNotEmpty]) {
/* no results */
bStruct = nil;
}
}
/* set encoding */
- if ([[bStruct objectForKey:@"encoding"] length] > 0)
+ if ([[bStruct objectForKey:@"encoding"] isNotEmpty])
[self _processBodyStructureEncoding:bStruct];
self->bodyStructure = [[NGMimeMessage alloc] initWithHeader:[self headers]];
qRoot = [quotaRoot objectForKey:obj];
- if (![qRoot length]) {
+ if (![qRoot isNotEmpty]) {
if (LogImapEnabled) {
[self logWithFormat:@"%s: missing quotaroot for %@",
__PRETTY_FUNCTION__, obj];
enumerator = [_flags objectEnumerator];
cnt = 0;
while ((obj = [enumerator nextObject])) {
- if ([obj length] == 0)
+ if (![obj isNotEmpty])
continue;
if (![[obj substringToIndex:1] isEqualToString:@"\\"])
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];
_consume(self, 1);
folderRoot = nil;
}
- if ([folderName length] && [folderRoot length]) {
+ if ([folderName isNotEmpty] && [folderRoot isNotEmpty])
[dict setObject:folderRoot forKey:folderName];
- }
+
return YES;
}
if ((data = [self _parseData]) == nil)
return nil;
- if ([data length] == 0)
+ if (![data isNotEmpty])
return @"";
s = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
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;
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;
_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;
_consume(self, 1);
value = _parseUntil(self, '\n');
- if ([value length] > 0) {
+ if ([value isNotEmpty]) {
obj = [[NSDictionary alloc]
initWithObjects:&value forKeys:&key count: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];
[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."];
}
- (BOOL)isValidScriptName:(NSString *)_name {
- return ([_name length] == 0) ? NO : YES;
+ return [_name isNotEmpty];
}
- (NSDictionary *)putScript:(NSString *)_name script:(NSString *)_script {
[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;
}
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]];
/* 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"];
}
}
while (result);
- return !isPhrase ? nil : yesNum;
+ return !isPhrase ? (NSNumber *)nil : yesNum;
}
- (id)parsePhrase:(BOOL)_guessMode {
/* description */
- (NSString *)description {
- return [StrClass stringWithFormat:@"<%@[0x%08X]>",
+ return [StrClass stringWithFormat:@"<%@[0x%p]>",
NSStringFromClass([self class]),
(unsigned)self];
}
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];
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;
}
// description
- (NSString *)description {
- return [NSString stringWithFormat:@"<POP3Client[0x%08X]: socket=%@>",
+ return [NSString stringWithFormat:@"<POP3Client[0x%p]: socket=%@>",
(unsigned)self, [self socket]];
}
/* description */
- (NSString *)description {
- return [NSString stringWithFormat:@"<Pop3Reply[0x%08X]: positive=%s line=%@>",
+ return [NSString stringWithFormat:@"<Pop3Reply[0x%p]: positive=%s line=%@>",
(unsigned)self,
[self isPositive] ? "YES" : "NO",
[self line]];
/* description */
- (NSString *)description {
- return [NSString stringWithFormat:@"<Pop3MsgInfo[0x%08X]: number=%i size=%i>",
+ return [NSString stringWithFormat:@"<Pop3MsgInfo[0x%p]: number=%i size=%i>",
(unsigned)self, [self messageNumber], [self size]];
}
- (NSMutableString *)buildSendMailCommandLineWithSender:(NSString *)_sender {
NSMutableString *sendmail;
- if ([[self executablePath] length] == 0)
+ if (![[self executablePath] isNotEmpty])
return nil;
sendmail = [NSMutableString stringWithCapacity:256];
- (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],
// description
- (NSString *)description {
- return [NSString stringWithFormat:@"<SMTP-Client[0x%08X]: socket=%@>",
+ return [NSString stringWithFormat:@"<SMTP-Client[0x%p]: socket=%@>",
(unsigned)self, [self socket]];
}
}
else
len = 0;
- return (len > 0) ? [NSString stringWithCString:(cstr + 1)] : [self text];
+ return (len > 0) ? [NSString stringWithCString:(cstr + 1)] : (id)[self text];
}
- (BOOL)isPositive {
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
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))
[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:@"=\""];
[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;
if (![type isKindOfClass:[NGMimeType class]])
type = [NGMimeType mimeType:[type stringValue]];
- return (type != nil ? type : defaultType);
+ return (type != nil ? type : (id)defaultType);
}
- (NSString *)contentId {
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])];
- (NSString *)description {
return [NSString stringWithFormat:
- @"<MimeContentLengthHeaderFieldParser: object=0x%08X>",
+ @"<MimeContentLengthHeaderFieldParser: object=0x%p>",
(unsigned)self];
}
- (NSString *)description {
return [NSString stringWithFormat:
- @"<MimeContentTypeHeaderFieldParser: object=0x%08X>",
+ @"<MimeContentTypeHeaderFieldParser: object=0x%p>",
(unsigned)self];
}
/* description */
- (NSString *)description {
- return [NSString stringWithFormat:@"<0x%08X[%@]: path=%@>",
+ return [NSString stringWithFormat:@"<0x%p[%@]: path=%@>",
self, NSStringFromClass([self class]), self->path];
}
- (NSString *)description {
return [NSString stringWithFormat:
- @"<HeaderFieldParserSet: id=0x%08X map=%@ default=%@>",
+ @"<HeaderFieldParserSet: id=0x%p map=%@ default=%@>",
(unsigned)self, self->fieldNameToParser,
[self defaultParser]];
}
d = [[NSMutableString alloc] init];
- [d appendFormat:@"<%@[0x%08X]: type=%@",
+ [d appendFormat:@"<%@[0x%p]: type=%@",
NSStringFromClass([self class]), self, self->type];
if (self->parameters)
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:@">"];
- (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];
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]];
}
// 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];
- (NSString *)description {
return [NSString stringWithFormat:
- @"<MimeStringHeaderFieldParser: id=0x%08X"
+ @"<MimeStringHeaderFieldParser: id=0x%p"
@" removesComments=%s>",
(unsigned)self, self->removeComments ? "YES" : "NO"];
}
}
// parse parameters
*parameters = parseParameters(self, _str, cstr);
- if (![*parameters count])
+ if (![*parameters isNotEmpty])
*parameters = nil;
-
+
return YES;
}
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
}
[self indent];
- printf("<part ptr='0x%08X'", (unsigned int)_part);
+ printf("<part ptr='0x%p'", (unsigned int)_part);
if ([_part conformsToProtocol:@protocol(NGMimePart)]) {
if ((tmp = [_part contentType]))