From: helge Date: Mon, 3 Jul 2006 22:41:37 +0000 (+0000) Subject: use %p for pointer formats X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=291da854a0d0fa2df1f4e5306590a72383e71e77;p=sope use %p for pointer formats 64bit preparations gcc 4.1 warnings some code cleanups git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1294 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-ldap/NGLdap/ChangeLog b/sope-ldap/NGLdap/ChangeLog index 26c8eb28..fe350a0a 100644 --- a/sope-ldap/NGLdap/ChangeLog +++ b/sope-ldap/NGLdap/ChangeLog @@ -1,3 +1,8 @@ +2006-07-04 Helge Hess + + * use %p for pointer formats, fixed gcc 4.1 warnings, minor code + cleanups (v4.5.30) + 2006-05-16 Marcus Mueller * EOQualifier+LDAP.h: changed EOControl related includes into imports diff --git a/sope-ldap/NGLdap/NGLdapAttribute.m b/sope-ldap/NGLdap/NGLdapAttribute.m index 2fa4cf12..58efa61b 100644 --- a/sope-ldap/NGLdap/NGLdapAttribute.m +++ b/sope-ldap/NGLdap/NGLdapAttribute.m @@ -63,7 +63,7 @@ return [parts count] > 1 ? [parts subarrayWithRange:NSMakeRange(1, [parts count] - 1)] - : [NSArray array]; + : (NSArray *)[NSArray array]; } - (NSArray *)subtypes { @@ -204,7 +204,8 @@ objs[i] = [[NSString alloc] initWithString:@""]; } else { - objs[i] = (![data isNotNull]) ? (id)@"" : [self stringFromData:data]; + objs[i] = [data isNotNull] + ? [self stringFromData:data] : (NSString *)@""; } } @@ -257,7 +258,7 @@ NSMutableString *s; s = [NSMutableString stringWithCapacity:100]; - [s appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [s appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; [s appendFormat:@" name='%@'", [self attributeName]]; [s appendString:@" values="]; diff --git a/sope-ldap/NGLdap/NGLdapConnection.m b/sope-ldap/NGLdap/NGLdapConnection.m index b791632f..1bde62d7 100644 --- a/sope-ldap/NGLdap/NGLdapConnection.m +++ b/sope-ldap/NGLdap/NGLdapConnection.m @@ -236,6 +236,9 @@ static void freeMods(LDAPMod **mods) { - (BOOL)bindWithMethod:(NSString *)_method binddn:(NSString *)_login credentials:(NSString *)_cred { + static NSString *loginKey = @"login"; + NSDictionary *ui; + NSException *e; int method, err; const char *l, *p; @@ -269,11 +272,15 @@ static void freeMods(LDAPMod **mods) { return YES; } - [[self _exceptionForErrorCode:err - operation:@"bind" - userInfo:[NSDictionary dictionaryWithObject:_login ? _login : @"" - forKey:@"login"]] - raise]; + /* exceptions */ + + if (_login == nil) _login = @""; + ui = [[NSDictionary alloc] + initWithObjects:&_login forKeys:&loginKey count:1]; + e = [self _exceptionForErrorCode:err operation:@"bind" userInfo:ui]; + [ui release]; ui = nil; + + [e raise]; return NO; } @@ -789,7 +796,7 @@ static void freeMods(LDAPMod **mods) { NSMutableString *s; s = [NSMutableString stringWithCapacity:100]; - [s appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [s appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; if ([self isBound]) [s appendString:@" bound"]; @@ -972,7 +979,7 @@ static void freeMods(LDAPMod **mods) { if (LDAPDebugEnabled) [self logWithFormat:@"check pwd of login '%@' on %@", _login, _baseDN]; - if ([_pwd length] == 0) { + if (![_pwd isNotEmpty]) { if (LDAPDebugEnabled) [self logWithFormat:@" no password provided."]; return NO; } @@ -984,7 +991,7 @@ static void freeMods(LDAPMod **mods) { } strDN = [self dnForLogin:_login baseDN:_baseDN]; - if ([strDN length] == 0) { + if (![strDN isNotEmpty]) { if (LDAPDebugEnabled) { [self logWithFormat:@" missing dn for login %@ atBaseDN %@", _login, _baseDN]; @@ -995,7 +1002,7 @@ static void freeMods(LDAPMod **mods) { if (LDAPDebugEnabled) { [self logWithFormat:@" attempting to bind login %@ DN: %@ %s!", _login, strDN, - [_pwd length] > 0 ? "(with password) " : "(empty password) "]; + [_pwd isNotEmpty] ? "(with password) " : "(empty password) "]; } /* @@ -1036,7 +1043,7 @@ static void freeMods(LDAPMod **mods) { NSLog(@"LDAP: check pwd of login '%@' on %@,%i,%@ ...", _login, _hostName, _port, _baseDN); } - if ([_pwd length] == 0) { + if (![_pwd isNotEmpty]) { if (LDAPDebugEnabled) [self logWithFormat:@" no password provided."]; return NO; } diff --git a/sope-ldap/NGLdap/NGLdapEntry.m b/sope-ldap/NGLdap/NGLdapEntry.m index dd478464..01d679d7 100644 --- a/sope-ldap/NGLdap/NGLdapEntry.m +++ b/sope-ldap/NGLdap/NGLdapEntry.m @@ -204,7 +204,7 @@ NSMutableString *s; s = [NSMutableString stringWithCapacity:100]; - [s appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [s appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; [s appendFormat:@" dn='%@'", [self dn]]; diff --git a/sope-ldap/NGLdap/NGLdapFileManager.m b/sope-ldap/NGLdap/NGLdapFileManager.m index 90fec366..943d2db2 100644 --- a/sope-ldap/NGLdap/NGLdapFileManager.m +++ b/sope-ldap/NGLdap/NGLdapFileManager.m @@ -101,7 +101,7 @@ static NSArray *fileInfoAttrs = nil; if ((nctxs = [self->connection namingContexts])) { if ([nctxs count] > 1) NSLog(@"WARNING: more than one naming context handled by server !"); - if ([nctxs count] > 0) + if ([nctxs isNotEmpty]) _rootDN = [[nctxs objectAtIndex:0] lowercaseString]; } } @@ -190,7 +190,7 @@ static NSArray *fileInfoAttrs = nil; if (![_path isAbsolutePath]) _path = [[self currentDirectoryPath] stringByAppendingPathComponent:_path]; - if ([_path length] == 0) return nil; + if (![_path isNotEmpty]) return nil; NSAssert1([_path isAbsolutePath], @"path %@ is not an absolute path (after append to cwd) !", _path); @@ -205,7 +205,7 @@ static NSArray *fileInfoAttrs = nil; if ([pathComponent isEqualToString:@"."]) continue; - if ([pathComponent length] == 0) + if (![pathComponent isNotEmpty]) continue; if ([pathComponent isEqualToString:@"/"]) { @@ -231,7 +231,7 @@ static NSArray *fileInfoAttrs = nil; NSString *dn; NSString *path; - if ([_path length] == 0) + if (![_path isNotEmpty]) return NO; if ((dn = [self dnForPath:_path]) == nil) @@ -644,7 +644,7 @@ static NSArray *fileInfoAttrs = nil; NSMutableString *ms; ms = [NSMutableString stringWithCapacity:64]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; if (self->rootDN) [ms appendFormat:@" root=%@", self->rootDN]; diff --git a/sope-ldap/NGLdap/NGLdapGlobalID.m b/sope-ldap/NGLdap/NGLdapGlobalID.m index b6111bfd..1a7d14f8 100644 --- a/sope-ldap/NGLdap/NGLdapGlobalID.m +++ b/sope-ldap/NGLdap/NGLdapGlobalID.m @@ -92,7 +92,7 @@ NSString *d; s = [[NSMutableString alloc] init]; - [s appendFormat:@"<0x%08X[%@]: ", self, NSStringFromClass([self class])]; + [s appendFormat:@"<0x%p[%@]: ", self, NSStringFromClass([self class])]; [s appendFormat:@" host=%@", self->host]; [s appendFormat:@" port=%i", self->port]; [s appendFormat:@" dn=%@", self->dn]; diff --git a/sope-ldap/NGLdap/NGLdapSearchResultEnumerator.m b/sope-ldap/NGLdap/NGLdapSearchResultEnumerator.m index 68e3d00c..617ebee0 100644 --- a/sope-ldap/NGLdap/NGLdapSearchResultEnumerator.m +++ b/sope-ldap/NGLdap/NGLdapSearchResultEnumerator.m @@ -321,7 +321,7 @@ NSMutableString *s; s = [NSMutableString stringWithCapacity:100]; - [s appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [s appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; [s appendFormat:@" msgid=%i", [self messageID]]; [s appendFormat:@" duration=%.2fs", [self duration]]; diff --git a/sope-ldap/NGLdap/NGLdapURL.m b/sope-ldap/NGLdap/NGLdapURL.m index bc745d65..08e0d740 100644 --- a/sope-ldap/NGLdap/NGLdapURL.m +++ b/sope-ldap/NGLdap/NGLdapURL.m @@ -311,7 +311,7 @@ static NSString *NGEscapeUrlString(NSString *_source) { s = [[NSMutableString alloc] initWithCapacity:200]; [s appendString:@"ldap://"]; - [s appendString:self->host ? self->host : @"localhost"]; + [s appendString:self->host != nil ? self->host : (NSString *)@"localhost"]; if (self->port > 0) [s appendFormat:@":%i", self->port]; [s appendString:@"/"]; diff --git a/sope-ldap/NGLdap/NSString+DN.m b/sope-ldap/NGLdap/NSString+DN.m index a1607daf..4f4816fd 100644 --- a/sope-ldap/NGLdap/NSString+DN.m +++ b/sope-ldap/NGLdap/NSString+DN.m @@ -95,7 +95,7 @@ static NSArray *cleanDNComponents(NSArray *_components) { NSString *s; s = _stripSpaces(self); - if ([s length] == 0) + if (![s isNotEmpty]) return _component; s = [dnSeparator stringByAppendingString:self]; diff --git a/sope-ldap/NGLdap/Version b/sope-ldap/NGLdap/Version index 2aec4a55..03086536 100644 --- a/sope-ldap/NGLdap/Version +++ b/sope-ldap/NGLdap/Version @@ -2,4 +2,4 @@ MAJOR_VERSION=4 MINOR_VERSION=5 -SUBMINOR_VERSION:=29 +SUBMINOR_VERSION:=30