From e7f7d18905f5d26a354295fabfa0309c0abea6be Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 3 Jul 2006 19:34:05 +0000 Subject: [PATCH] fixed gcc 4.1 warnings use %p for pointer formats install/lookup in lib64 on 64bit systems various minor cleanups git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1282 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-core/EOControl/ChangeLog | 8 ++ sope-core/EOControl/EOAndQualifier.m | 2 +- sope-core/EOControl/EOClassDescription.m | 2 +- sope-core/EOControl/EOFetchSpecification.m | 2 +- sope-core/EOControl/EOGenericRecord.m | 2 +- sope-core/EOControl/EOKeyGlobalID.m | 2 +- sope-core/EOControl/EOKeyValueArchiver.m | 2 +- sope-core/EOControl/EOKeyValueCoding.m | 22 +++-- sope-core/EOControl/EOKeyValueQualifier.m | 2 +- sope-core/EOControl/EOOrQualifier.m | 2 +- sope-core/EOControl/EOQualifierParser.m | 9 +- sope-core/EOControl/EOQualifierVariable.m | 2 +- sope-core/EOControl/EOSortOrdering.m | 2 +- sope-core/EOControl/Version | 2 +- sope-core/EOCoreData/EOCoreDataSource.m | 2 +- sope-core/EOCoreData/EOQualifier+CoreData.m | 2 +- sope-core/NGExtensions/ChangeLog | 10 +++ .../EOExt.subproj/EOCacheDataSource.m | 2 +- .../EOExt.subproj/EOFilterDataSource.m | 2 +- .../EOExt.subproj/EOKeyMapDataSource.m | 2 +- .../FdExt.subproj/NGPropertyListParser.m | 2 +- .../FdExt.subproj/NSAutoreleasePool+misc.m | 2 +- .../FdExt.subproj/NSException+misc.m | 6 +- .../FdExt.subproj/NSFileManager+Extensions.m | 2 +- .../FdExt.subproj/NSObject+Logs.m | 2 +- .../FdExt.subproj/NSProcessInfo+misc.m | 4 +- .../FdExt.subproj/NSSet+enumerator.m | 82 ++++++++++--------- .../NGExtensions/FdExt.subproj/NSString+Ext.m | 4 +- .../FdExt.subproj/NSString+misc.m | 2 +- sope-core/NGExtensions/GNUmakefile.preamble | 4 + sope-core/NGExtensions/NGBitSet.m | 2 +- sope-core/NGExtensions/NGBundleManager.m | 6 +- .../NGExtensions/NGDirectoryEnumerator.m | 2 +- sope-core/NGExtensions/NGHashMap.m | 63 +++++++------- .../NGLogging.subproj/NGLogEvent.m | 2 +- .../NGExtensions/NGLogging.subproj/NGLogger.m | 2 +- .../NGLogging.subproj/NGLoggerManager.m | 4 +- sope-core/NGExtensions/NGObjCRuntime.m | 2 +- sope-core/NGExtensions/NGResourceLocator.m | 26 +++--- .../NGRuleEngine.subproj/NGRuleAssignment.m | 24 ++++-- .../NGRuleEngine.subproj/NGRuleContext.m | 4 +- sope-core/NGExtensions/NGStack.m | 2 +- sope-core/NGExtensions/Version | 2 +- sope-core/NGStreams/ChangeLog | 4 + sope-core/NGStreams/GNUmakefile.preamble | 4 + sope-core/NGStreams/NGActiveSocket.m | 4 +- sope-core/NGStreams/NGByteBuffer.m | 2 +- sope-core/NGStreams/NGCTextStream.m | 2 +- sope-core/NGStreams/NGCharBuffer.m | 2 +- sope-core/NGStreams/NGDatagramPacket.m | 2 +- sope-core/NGStreams/NGDescriptorFunctions.m | 4 +- sope-core/NGStreams/NGFileStream.m | 7 +- sope-core/NGStreams/NGFilterStream.m | 2 +- sope-core/NGStreams/NGInternetSocketAddress.m | 2 +- sope-core/NGStreams/NGInternetSocketDomain.m | 2 +- sope-core/NGStreams/NGLocalSocketAddress.m | 19 +++-- sope-core/NGStreams/NGLocalSocketDomain.m | 2 +- sope-core/NGStreams/NGSocket.m | 2 +- sope-core/NGStreams/NGSocketExceptions.m | 13 +-- sope-core/NGStreams/NGStream.m | 2 +- sope-core/NGStreams/NGStreamCoder.m | 4 +- sope-core/NGStreams/NGStreamPipe.m | 2 +- sope-core/NGStreams/NGTaskStream.m | 2 +- sope-core/NGStreams/NGTerminalSupport.m | 13 +-- sope-core/NGStreams/Version | 2 +- sope-core/NGStreams/fhs.make | 7 +- sope-core/samples/subclassing.m | 4 +- 67 files changed, 255 insertions(+), 186 deletions(-) diff --git a/sope-core/EOControl/ChangeLog b/sope-core/EOControl/ChangeLog index deffe6d5..bb7a9ec7 100644 --- a/sope-core/EOControl/ChangeLog +++ b/sope-core/EOControl/ChangeLog @@ -1,3 +1,11 @@ +2006-07-03 Helge Hess + + * v4.5.65 + + * EOKeyValueCoding.m: reduced autorelease usage in KVC key creation + + * use %p for pointer formats, fixed gcc 4.1 warnings + 2006-05-02 Marcus Mueller * EOSortOrdering.m: use keyPaths instead of just keys in diff --git a/sope-core/EOControl/EOAndQualifier.m b/sope-core/EOControl/EOAndQualifier.m index 558b5cf0..7e27315c 100644 --- a/sope-core/EOControl/EOAndQualifier.m +++ b/sope-core/EOControl/EOAndQualifier.m @@ -129,7 +129,7 @@ static BOOL debugTransform = NO; } } - return keys ? [keys allObjects] : [NSArray array]; + return keys ? [keys allObjects] : (NSArray *)[NSArray array]; } /* keys */ diff --git a/sope-core/EOControl/EOClassDescription.m b/sope-core/EOControl/EOClassDescription.m index 2947cafb..7f68fb43 100644 --- a/sope-core/EOControl/EOClassDescription.m +++ b/sope-core/EOControl/EOClassDescription.m @@ -149,7 +149,7 @@ static NSMapTable *classToDesc = NULL; /* description */ - (NSString *)description { - return [NSString stringWithFormat:@"<%@[0x%08X]: entity=%@>", + return [NSString stringWithFormat:@"<%@[0x%p]: entity=%@>", NSStringFromClass([self class]), self, [self entityName]]; } diff --git a/sope-core/EOControl/EOFetchSpecification.m b/sope-core/EOControl/EOFetchSpecification.m index 78614c1f..37fa0b41 100644 --- a/sope-core/EOControl/EOFetchSpecification.m +++ b/sope-core/EOControl/EOFetchSpecification.m @@ -374,7 +374,7 @@ id tmp; ms = [NSMutableString stringWithCapacity:128]; - [ms appendFormat:@"<%@[0x%08X]:", NSStringFromClass([self class]), self]; + [ms appendFormat:@"<%@[0x%p]:", NSStringFromClass([self class]), self]; if ((tmp = [self entityName])) [ms appendFormat:@" entity=%@", tmp]; diff --git a/sope-core/EOControl/EOGenericRecord.m b/sope-core/EOControl/EOGenericRecord.m index d1343c05..f4ab5d69 100644 --- a/sope-core/EOControl/EOGenericRecord.m +++ b/sope-core/EOControl/EOGenericRecord.m @@ -155,7 +155,7 @@ static inline void _willChange(EOGenericRecord *self) { if (_value == nil) _value = null; #if DEBUG - NSAssert1(_key, @"called -takeValue:0x%08X forKey:nil !", _value); + NSAssert1(_key, @"called -takeValue:0x%p forKey:nil !", _value); #endif value = eoGet(self, _key); diff --git a/sope-core/EOControl/EOKeyGlobalID.m b/sope-core/EOControl/EOKeyGlobalID.m index 4b6e9af8..c11e3db6 100644 --- a/sope-core/EOControl/EOKeyGlobalID.m +++ b/sope-core/EOControl/EOKeyGlobalID.m @@ -142,7 +142,7 @@ unsigned int i; s = [[NSMutableString alloc] init]; - [s appendFormat:@"<0x%08X[%@]: %@", + [s appendFormat:@"<0x%p[%@]: %@", self, NSStringFromClass([self class]), [self entityName]]; diff --git a/sope-core/EOControl/EOKeyValueArchiver.m b/sope-core/EOControl/EOKeyValueArchiver.m index 8649be35..636e17b7 100644 --- a/sope-core/EOControl/EOKeyValueArchiver.m +++ b/sope-core/EOControl/EOKeyValueArchiver.m @@ -256,7 +256,7 @@ static BOOL isPListObject(id _obj) { self->plist = self->parent; self->parent = lastParent; - return obj ? obj : [NSNull null]; + return obj != nil ? obj : (id)[NSNull null]; } - (id)decodeObjectForKey:(NSString *)_key { diff --git a/sope-core/EOControl/EOKeyValueCoding.m b/sope-core/EOControl/EOKeyValueCoding.m index ff694c64..2c46503e 100644 --- a/sope-core/EOControl/EOKeyValueCoding.m +++ b/sope-core/EOControl/EOKeyValueCoding.m @@ -818,11 +818,14 @@ static inline BOOL setValue(NSString* key, id instance, id value) NSString *key; key = (start < i) - ? [StringClass stringWithCString:(const char *) - &(buf[start]) length:(i - start)] - : @""; + ? [[StringClass alloc] initWithCString:(const char *)&(buf[start]) + length:(i - start)] + : (NSString *)@""; - if ((value = [value valueForKey:key]) == nil) + value = [value valueForKey:key]; + [key release]; key = nil; + + if (value == nil) return nil; start = (i + 1); /* next part is after the pt */ @@ -831,12 +834,15 @@ static inline BOOL setValue(NSString* key, id instance, id value) /* check last part */ { NSString *key; + id v; key = (start < i) - ? [StringClass stringWithCString:(const char *) - &(buf[start]) length:(i - start)] - : @""; - return [value valueForKey:key]; + ? [[StringClass alloc] initWithCString:(const char *)&(buf[start]) + length:(i - start)] + : (id)@""; + v = [value valueForKey:key]; + [key release]; key = nil; + return v; } #else /* naive implementation */ diff --git a/sope-core/EOControl/EOKeyValueQualifier.m b/sope-core/EOControl/EOKeyValueQualifier.m index 4e97e595..9c941fc2 100644 --- a/sope-core/EOControl/EOKeyValueQualifier.m +++ b/sope-core/EOControl/EOKeyValueQualifier.m @@ -175,7 +175,7 @@ static EONull *null = nil; [(NSMutableDictionary *)_ctx setObject:lv forKey:self->key]; } - rv = self->value ? self->value : null; + rv = self->value != nil ? self->value : (id)null; if (debugEval) { NSLog(@"Eval: EOKeyValueQualifier:(%@ %@)\n" diff --git a/sope-core/EOControl/EOOrQualifier.m b/sope-core/EOControl/EOOrQualifier.m index 8cb1b70c..c448ebb7 100644 --- a/sope-core/EOControl/EOOrQualifier.m +++ b/sope-core/EOControl/EOOrQualifier.m @@ -127,7 +127,7 @@ static BOOL debugTransform = NO; } } - return keys ? [keys allObjects] : [NSArray array]; + return keys ? [keys allObjects] : (NSArray *)[NSArray array]; } /* keys */ diff --git a/sope-core/EOControl/EOQualifierParser.m b/sope-core/EOControl/EOQualifierParser.m index 1860bc8d..52321db4 100644 --- a/sope-core/EOControl/EOQualifierParser.m +++ b/sope-core/EOControl/EOQualifierParser.m @@ -1081,18 +1081,19 @@ static id _parseValue(id _ctx, const char *_buf, unsigned _bufLen, if (qDebug) { NSLog(@"%s: return <%@> for <%s> ", __PRETTY_FUNCTION__, - obj?obj:@"", _buf); + obj != nil ? obj : (id)@"", _buf); } if (obj != nil) { + NSDictionary *d; id keys[2], values[2]; keys[0] = @"length"; values[0] = [NSNumber numberWithUnsignedInt:pos]; keys[1] = @"object"; values[1] = obj; - [_ctx setResult: - [NSDictionary dictionaryWithObjects:values forKeys:keys count:2] - forFunction:@"parseValue" atPos:(unsigned)_buf]; + d = [[NSDictionary alloc] initWithObjects:values forKeys:keys count:2]; + [_ctx setResult:d forFunction:@"parseValue" atPos:(unsigned)_buf]; + [d release]; *_keyLen = pos; } return obj; diff --git a/sope-core/EOControl/EOQualifierVariable.m b/sope-core/EOControl/EOQualifierVariable.m index fe5a69d5..b8b942d8 100644 --- a/sope-core/EOControl/EOQualifierVariable.m +++ b/sope-core/EOControl/EOQualifierVariable.m @@ -89,7 +89,7 @@ } - (NSString *)description { - return [NSString stringWithFormat:@"<%@[0x%08X]: variable=%@>", + return [NSString stringWithFormat:@"<%@[0x%p]: variable=%@>", NSStringFromClass([self class]), self, [self key]]; } diff --git a/sope-core/EOControl/EOSortOrdering.m b/sope-core/EOControl/EOSortOrdering.m index 586ad1a8..7d3ac07d 100644 --- a/sope-core/EOControl/EOSortOrdering.m +++ b/sope-core/EOControl/EOSortOrdering.m @@ -144,7 +144,7 @@ EOControl_DECLARE SEL EOCompareCaseInsensitiveDescending = - (NSString *)description { return [NSString stringWithFormat: - @"<0x%08X[%@]: key=%@ selector=%@>", + @"<0x%p[%@]: key=%@ selector=%@>", self, NSStringFromClass([self class]), [self key], NSStringFromSelector([self selector])]; } diff --git a/sope-core/EOControl/Version b/sope-core/EOControl/Version index c41a410a..81e751c7 100644 --- a/sope-core/EOControl/Version +++ b/sope-core/EOControl/Version @@ -1,3 +1,3 @@ # version file -SUBMINOR_VERSION:=64 +SUBMINOR_VERSION:=65 diff --git a/sope-core/EOCoreData/EOCoreDataSource.m b/sope-core/EOCoreData/EOCoreDataSource.m index d569d1bd..eac404e1 100644 --- a/sope-core/EOCoreData/EOCoreDataSource.m +++ b/sope-core/EOCoreData/EOCoreDataSource.m @@ -408,7 +408,7 @@ static BOOL debugOn = NO; NSMutableString *ms; ms = [NSMutableString stringWithCapacity:64]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; if (self->fetchSpecification != nil) [ms appendFormat:@" fs=%@", self->fetchSpecification]; diff --git a/sope-core/EOCoreData/EOQualifier+CoreData.m b/sope-core/EOCoreData/EOQualifier+CoreData.m index f39d5ac9..0e5babd0 100644 --- a/sope-core/EOCoreData/EOQualifier+CoreData.m +++ b/sope-core/EOCoreData/EOQualifier+CoreData.m @@ -148,7 +148,7 @@ unsigned popts; if (_selector == NULL) { - NSLog(@"ERROR(0x%08X/%@): missing selector for predicate construction: %@", + NSLog(@"ERROR(0x%p/%@): missing selector for predicate construction: %@", self, NSStringFromClass([self class]), self); return nil; } diff --git a/sope-core/NGExtensions/ChangeLog b/sope-core/NGExtensions/ChangeLog index d952a4b6..c947cc9a 100644 --- a/sope-core/NGExtensions/ChangeLog +++ b/sope-core/NGExtensions/ChangeLog @@ -1,3 +1,13 @@ +2006-07-03 Helge Hess + + * v4.5.184 + + * NGHashMap.m: improved memory management with exceptions + + * FdExt.subproj/NSSet+enumerator.m: code cleanups + + * use %p for pointer formats, fixed gcc 4.1 warnings + 2006-05-16 Marcus Mueller * *.h, *m: changed EOControl related includes into imports diff --git a/sope-core/NGExtensions/EOExt.subproj/EOCacheDataSource.m b/sope-core/NGExtensions/EOExt.subproj/EOCacheDataSource.m index 989b2d44..0364ee0b 100644 --- a/sope-core/NGExtensions/EOExt.subproj/EOCacheDataSource.m +++ b/sope-core/NGExtensions/EOExt.subproj/EOCacheDataSource.m @@ -158,7 +158,7 @@ - (NSString *)description { NSString *fmt; - fmt = [NSString stringWithFormat:@"<%@[0x%08X]: source=%@>", + fmt = [NSString stringWithFormat:@"<%@[0x%p]: source=%@>", NSStringFromClass([self class]), self, self->source]; return fmt; diff --git a/sope-core/NGExtensions/EOExt.subproj/EOFilterDataSource.m b/sope-core/NGExtensions/EOExt.subproj/EOFilterDataSource.m index f4d29381..8173849f 100644 --- a/sope-core/NGExtensions/EOExt.subproj/EOFilterDataSource.m +++ b/sope-core/NGExtensions/EOExt.subproj/EOFilterDataSource.m @@ -200,7 +200,7 @@ NSMutableString *ms; ms = [NSMutableString stringWithCapacity:64]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; if (self->source != nil) [ms appendFormat:@" source=%@", self->source]; diff --git a/sope-core/NGExtensions/EOExt.subproj/EOKeyMapDataSource.m b/sope-core/NGExtensions/EOExt.subproj/EOKeyMapDataSource.m index 700fd609..f2e58d65 100644 --- a/sope-core/NGExtensions/EOExt.subproj/EOKeyMapDataSource.m +++ b/sope-core/NGExtensions/EOExt.subproj/EOKeyMapDataSource.m @@ -298,7 +298,7 @@ - (NSString *)description { NSString *fmt; - fmt = [NSString stringWithFormat:@"<%@[0x%08X]: source=%@ map=%@>", + fmt = [NSString stringWithFormat:@"<%@[0x%p]: source=%@ map=%@>", NSStringFromClass([self class]), self, self->source, self->map]; return fmt; diff --git a/sope-core/NGExtensions/FdExt.subproj/NGPropertyListParser.m b/sope-core/NGExtensions/FdExt.subproj/NGPropertyListParser.m index f5c7e76e..8e9fb4cc 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NGPropertyListParser.m +++ b/sope-core/NGExtensions/FdExt.subproj/NGPropertyListParser.m @@ -484,7 +484,7 @@ static NSException *_makeException(NSException *_exception, } } else - NSLog(@"startPos=0x%08X endPos=0x%08X", startPos, endPos); + NSLog(@"startPos=0x%p endPos=0x%p", startPos, endPos); } [exception setUserInfo:ui]; diff --git a/sope-core/NGExtensions/FdExt.subproj/NSAutoreleasePool+misc.m b/sope-core/NGExtensions/FdExt.subproj/NSAutoreleasePool+misc.m index 75547e36..c578bc4a 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSAutoreleasePool+misc.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSAutoreleasePool+misc.m @@ -107,7 +107,7 @@ BOOL __autoreleaseEnableRetainRemove = NO; if (__autoreleaseEnableCheck) { unsigned int toCome = [NSAutoreleasePool autoreleaseCountForObject:self]; if (toCome+1 > [self retainCount]) { - NSLog(@"Release[0x%08X<%@>] release check for object %@ " + NSLog(@"Release[0x%p<%@>] release check for object %@ " @"has %d references " @"and %d pending calls to release in autorelease pools\n", (unsigned)self, NSStringFromClass([self class]), diff --git a/sope-core/NGExtensions/FdExt.subproj/NSException+misc.m b/sope-core/NGExtensions/FdExt.subproj/NSException+misc.m index c06ff880..254490be 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSException+misc.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSException+misc.m @@ -71,9 +71,9 @@ NSLog(@"ERROR(%s): missing format!", __PRETTY_FUNCTION__); va_start(ap, _format); - tmp = [[NSString allocWithZone:[self zone]] - initWithFormat:_format ? _format : @"Exception" - arguments:ap]; + tmp = [[NSString alloc] initWithFormat: + _format ? _format : (NSString *)@"Exception" + arguments:ap]; va_end(ap); self = [self initWithReason:tmp userInfo:nil]; diff --git a/sope-core/NGExtensions/FdExt.subproj/NSFileManager+Extensions.m b/sope-core/NGExtensions/FdExt.subproj/NSFileManager+Extensions.m index 9e95d8f0..aa142299 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSFileManager+Extensions.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSFileManager+Extensions.m @@ -181,7 +181,7 @@ - (NSString *)description { NSMutableString *ms = [NSMutableString stringWithCapacity:32]; - [ms appendFormat:@"<0x%08X[%@]", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]", self, NSStringFromClass([self class])]; [ms appendFormat:@" path=%@", self->path]; [ms appendString:@">"]; return ms; diff --git a/sope-core/NGExtensions/FdExt.subproj/NSObject+Logs.m b/sope-core/NGExtensions/FdExt.subproj/NSObject+Logs.m index 6f5ba65a..1f36818f 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSObject+Logs.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSObject+Logs.m @@ -67,7 +67,7 @@ static inline Class NSStringClass(void) { - (NSString *)loggingPrefix { /* improve perf ... */ - return [NSStringClass() stringWithFormat:@"<0x%08X[%@]>", + return [NSStringClass() stringWithFormat:@"<0x%p[%@]>", self, NSStringFromClass([self class])]; } diff --git a/sope-core/NGExtensions/FdExt.subproj/NSProcessInfo+misc.m b/sope-core/NGExtensions/FdExt.subproj/NSProcessInfo+misc.m index 0c7bc1bb..537293bb 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSProcessInfo+misc.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSProcessInfo+misc.m @@ -58,7 +58,7 @@ [ma addObject:arg]; } - return foundDefault ? (id)ma : a; + return foundDefault ? (NSArray *)ma : a; } /* create temp file name */ @@ -99,7 +99,7 @@ if (![[NSFileManager defaultManager] fileExistsAtPath:p isDirectory:&isDir]) return nil; - return isDir ? p : nil; + return isDir ? p : (NSString *)nil; } - (NSDictionary *)procStatusDictionary { diff --git a/sope-core/NGExtensions/FdExt.subproj/NSSet+enumerator.m b/sope-core/NGExtensions/FdExt.subproj/NSSet+enumerator.m index b0de3e55..49087ba7 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSSet+enumerator.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSSet+enumerator.m @@ -1,5 +1,6 @@ /* - Copyright (C) 2000-2005 SKYRIX Software AG + Copyright (C) 2000-2006 SKYRIX Software AG + Copyright (C) 2006 Helge Hess This file is part of SOPE. @@ -19,8 +20,8 @@ 02111-1307, USA. */ -#import "common.h" -#import "NSSet+enumerator.h" +#include "NSSet+enumerator.h" +#include "common.h" @implementation NSSet(enumerator) @@ -33,73 +34,76 @@ return self; } -// mapping +/* mapping */ - (NSArray *)mappedArrayUsingSelector:(SEL)_selector { - NSArray *array = nil; - NSSet *set = nil; - - set = [self mappedSetUsingSelector:_selector]; - if (set) { - array = [[NSArray allocWithZone:[self zone]] - initWithObjectsFromEnumerator:[set objectEnumerator]]; - } - set = nil; + NSArray *array; + NSSet *set; + + if ((set = [self mappedSetUsingSelector:_selector]) == nil) + return nil; + + array = [[NSArray alloc] + initWithObjectsFromEnumerator:[set objectEnumerator]]; return [array autorelease]; } - (NSArray *)mappedArrayUsingSelector:(SEL)_selector withObject:(id)_object { - NSArray *array = nil; - NSSet *set = nil; - - set = [self mappedSetUsingSelector:_selector withObject:_object]; - if (set) { - array = [[NSArray allocWithZone:[self zone]] - initWithObjectsFromEnumerator:[set objectEnumerator]]; - } - set = nil; + NSArray *array; + NSSet *set; + + if ((set = [self mappedSetUsingSelector:_selector withObject:_object])== nil) + return nil; + + array = [[NSArray allocWithZone:[self zone]] + initWithObjectsFromEnumerator:[set objectEnumerator]]; return [array autorelease]; } - (NSSet *)mappedSetUsingSelector:(SEL)_selector { - NSMutableSet *set = [NSMutableSet setWithCapacity:[self count]]; - NSEnumerator *e = [self objectEnumerator]; - id object = nil; + NSMutableSet *set; + NSEnumerator *e; + id object; - while ((object = [e nextObject])) { + set = [NSMutableSet setWithCapacity:[self count]]; + e = [self objectEnumerator]; + while ((object = [e nextObject]) != nil) { object = [object performSelector:_selector]; - - [set addObject:object ? object : [NSNull null]]; + + [set addObject:(object != nil ? object : (id)[NSNull null])]; } return set; } - (NSSet *)mappedSetUsingSelector:(SEL)_selector withObject:(id)_object { - NSMutableSet *set = [NSMutableSet setWithCapacity:[self count]]; - NSEnumerator *e = [self objectEnumerator]; - id object = nil; - - while ((object = [e nextObject])) { + NSMutableSet *set; + NSEnumerator *e; + id object; + + set = [NSMutableSet setWithCapacity:[self count]]; + e = [self objectEnumerator]; + while ((object = [e nextObject]) != nil) { object = [object performSelector:_selector withObject:_object]; - [set addObject:object ? object : [NSNull null]]; + [set addObject:(object != nil ? object : (id)[NSNull null])]; } return set; } -@end +@end /* NSSet(enumerator) */ + @implementation NSMutableSet(enumerator) - (id)initWithObjectsFromEnumerator:(NSEnumerator *)_enumerator { - if ((self = [self init])) { - id obj = nil; + if ((self = [self init]) != nil) { + id obj; - while ((obj = [_enumerator nextObject])) + while ((obj = [_enumerator nextObject]) != nil) [self addObject:obj]; } return self; } -@end +@end /* NSMutableSet(enumerator) */ void __link_NGExtensions_NSSetEnumerator() { __link_NGExtensions_NSSetEnumerator(); diff --git a/sope-core/NGExtensions/FdExt.subproj/NSString+Ext.m b/sope-core/NGExtensions/FdExt.subproj/NSString+Ext.m index 7d53d37a..fdf9f5d3 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSString+Ext.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSString+Ext.m @@ -29,14 +29,14 @@ { return ([self hasPrefix:_prefix]) ? [self substringFromIndex:[_prefix length]] - : [[self copy] autorelease]; + : (NSString *)[[self copy] autorelease]; } - (NSString *)stringWithoutSuffix:(NSString *)_suffix { return ([self hasSuffix:_suffix]) ? [self substringToIndex:([self length] - [_suffix length])] - : [[self copy] autorelease]; + : (NSString *)[[self copy] autorelease]; } - (NSString *)stringByReplacingString:(NSString *)_orignal diff --git a/sope-core/NGExtensions/FdExt.subproj/NSString+misc.m b/sope-core/NGExtensions/FdExt.subproj/NSString+misc.m index 0c1963cc..fcdb4faa 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSString+misc.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSString+misc.m @@ -202,7 +202,7 @@ if (r.length > 0) { return ([self length] > r.location) ? [self substringFromIndex:(r.location + r.length)] - : @""; + : (NSString *)@""; } return nil; } diff --git a/sope-core/NGExtensions/GNUmakefile.preamble b/sope-core/NGExtensions/GNUmakefile.preamble index ff4bc08c..7bb62f87 100644 --- a/sope-core/NGExtensions/GNUmakefile.preamble +++ b/sope-core/NGExtensions/GNUmakefile.preamble @@ -36,7 +36,11 @@ ADDITIONAL_LIB_DIRS += \ $(foreach dir,$(DEP_DIRS),-F$(GNUSTEP_BUILD_DIR)/$(dir)) endif +ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64) +SYSTEM_LIB_DIR += -L/usr/local/lib64 -L/usr/lib64 +else SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib +endif # Apple diff --git a/sope-core/NGExtensions/NGBitSet.m b/sope-core/NGExtensions/NGBitSet.m index 0bd83475..effd5729 100644 --- a/sope-core/NGExtensions/NGBitSet.m +++ b/sope-core/NGExtensions/NGBitSet.m @@ -318,7 +318,7 @@ - (NSString *)description { return [NSString stringWithFormat: - @"", + @"", (unsigned)self, self->universe, self->count, [[self toArray] description]]; } diff --git a/sope-core/NGExtensions/NGBundleManager.m b/sope-core/NGExtensions/NGBundleManager.m index 305e11af..f284ee95 100644 --- a/sope-core/NGExtensions/NGBundleManager.m +++ b/sope-core/NGExtensions/NGBundleManager.m @@ -568,7 +568,7 @@ static NSString *NGEnvVarPathSeparator = @":"; p = [bundle bundlePath]; if ([p hasSuffix:@"Libraries"]) { if (debugOn) { - fprintf(stderr, "%s: Dylib bundle: 0x%08X: %s\n", + fprintf(stderr, "%s: Dylib bundle: 0x%p: %s\n", __PRETTY_FUNCTION__, (unsigned int )bundle, [[bundle bundlePath] cString]); } @@ -576,7 +576,7 @@ static NSString *NGEnvVarPathSeparator = @":"; } else if ([p hasSuffix:@"Tools"]) { if (debugOn) { - fprintf(stderr, "%s: Tool bundle: 0x%08X: %s\n", + fprintf(stderr, "%s: Tool bundle: 0x%p: %s\n", __PRETTY_FUNCTION__, (unsigned int )bundle, [[bundle bundlePath] cString]); } @@ -1400,7 +1400,7 @@ static BOOL _doesInfoMatch(NSArray *keys, NSDictionary *dict, NSDictionary *info rnKeys = ([_resourceName respondsToSelector:@selector(objectForKey:)]) ? [_resourceName allKeys] - : nil; + : (NSArray *)nil; menum = NSEnumerateMapTable(self->pathToBundleInfo); while (NSNextMapEnumeratorPair(&menum, (void *)&path, (void *)&bundleInfo)) { diff --git a/sope-core/NGExtensions/NGDirectoryEnumerator.m b/sope-core/NGExtensions/NGDirectoryEnumerator.m index 5462cc9f..1be4ae3c 100644 --- a/sope-core/NGExtensions/NGDirectoryEnumerator.m +++ b/sope-core/NGExtensions/NGDirectoryEnumerator.m @@ -253,7 +253,7 @@ ms = [NSMutableString stringWithCapacity:128]; - [ms appendFormat:@"<%@[0x%08X]: ", NSStringFromClass([self class]), self]; + [ms appendFormat:@"<%@[0x%p]: ", NSStringFromClass([self class]), self]; [ms appendFormat:@" dir='%@'", self->topPath]; [ms appendFormat:@" cname='%@'", self->currentFileName]; diff --git a/sope-core/NGExtensions/NGHashMap.m b/sope-core/NGExtensions/NGHashMap.m index 9767611f..18a02b27 100644 --- a/sope-core/NGExtensions/NGHashMap.m +++ b/sope-core/NGExtensions/NGHashMap.m @@ -49,32 +49,33 @@ static inline void checkForAddErrorMessage(id _self, id _object, id _key) { NSString *r; if (_key == nil) { - r = [NSString stringWithFormat:@"nil key to be added in HashMap with object %@", - _object ? _object : @""]; - ui = [NSDictionary dictionaryWithObjectsAndKeys: - _self, @"map", - _key ? _key : @"", - @"key", - _object ? _object : @"", - @"object", - nil]; + r = [[NSString alloc] initWithFormat: + @"nil key to be added in HashMap with object %@", + (_object != nil ? _object : (id)@"")]; + ui = [[NSDictionary alloc] initWithObjectsAndKeys: + _self, @"map", + _key ? _key : (id)@"", @"key", + _object ? _object : (id)@"", @"object", + nil]; exc = [NSException exceptionWithName:NSInvalidArgumentException reason:r userInfo:ui]; + [r release]; r = nil; + [ui release]; ui = nil; [exc raise]; } if (_object == nil) { - r = [NSString stringWithFormat: - @"nil object to be added in HashMap for key %@", - _key ? _key : @""]; - ui = [NSDictionary dictionaryWithObjectsAndKeys: - _self, @"map", - _key ? _key : @"", - @"key", - _object ? _object : @"", - @"object", - nil]; + r = [[NSString alloc] initWithFormat: + @"nil object to be added in HashMap for key %@", + _key ? _key : (id)@""]; + ui = [[NSDictionary alloc] initWithObjectsAndKeys: + _self, @"map", + _key ? _key : (id)@"", @"key", + _object ? _object : (id)@"", @"object", + nil]; exc = [NSException exceptionWithName:NSInvalidArgumentException reason:r userInfo:ui]; + [r release]; r = nil; + [ui release]; ui = nil; [exc raise]; } } @@ -87,18 +88,18 @@ static inline void checkForRemoveErrorMessage(id _self, id _object, id _key) { if (_object != nil && _key != nil) return; - r = [NSString stringWithFormat: - @"nil object to be removed in HashMap for key %@", - _key ? _key : @""]; - ui = [NSDictionary dictionaryWithObjectsAndKeys: - _self, @"map", - _key ? _key : @"", - @"key", - _object ? _object : @"", - @"object", - nil]; + r = [[NSString alloc] initWithFormat: + @"nil object to be removed in HashMap for key %@", + _key ? _key : (id)@""]; + ui = [[NSDictionary alloc] initWithObjectsAndKeys: + _self, @"map", + _key ? _key : (id)@"", @"key", + _object ? _object : (id)@"", @"object", + nil]; exc = [NSException exceptionWithName:NSInvalidArgumentException reason:r userInfo:ui]; + [ui release]; ui = nil; + [r release]; r = nil; [exc raise]; } @@ -720,7 +721,7 @@ static inline unsigned __countObjectsForKey(NGHashMap *self, id _key) { if ((root = [self __structForKey:_key]) == NULL) { if (_index > 0) { [NSException raise:NSRangeException - format:@"index %d out of range in map 0x%08X", + format:@"index %d out of range in map 0x%p", _index, self]; return; } @@ -732,7 +733,7 @@ static inline unsigned __countObjectsForKey(NGHashMap *self, id _key) { else { if (!(_index < root->count)) { [NSException raise:NSRangeException - format:@"index %d out of range in map 0x%08X length %d", + format:@"index %d out of range in map 0x%p length %d", _index, self, root->count]; return; } diff --git a/sope-core/NGExtensions/NGLogging.subproj/NGLogEvent.m b/sope-core/NGExtensions/NGLogging.subproj/NGLogEvent.m index 1aa543e3..c095c190 100644 --- a/sope-core/NGExtensions/NGLogging.subproj/NGLogEvent.m +++ b/sope-core/NGExtensions/NGLogging.subproj/NGLogEvent.m @@ -80,7 +80,7 @@ static Class DateClass = Nil; case NGLogLevelFatal: lvl = @"FATAL"; break; default: lvl = @"ALL"; break; } - return [NSString stringWithFormat:@"<%@[0x%08X] date=%@ level=%@ msg:%@>", + return [NSString stringWithFormat:@"<%@[0x%p] date=%@ level=%@ msg:%@>", NSStringFromClass([self class]), self, [self date], lvl, self->msg]; } diff --git a/sope-core/NGExtensions/NGLogging.subproj/NGLogger.m b/sope-core/NGExtensions/NGLogging.subproj/NGLogger.m index 7dbb536a..d6c5fc2b 100644 --- a/sope-core/NGExtensions/NGLogging.subproj/NGLogger.m +++ b/sope-core/NGExtensions/NGLogging.subproj/NGLogger.m @@ -256,7 +256,7 @@ static NGLogLevel defaultLogLevel = NGLogLevelInfo; case NGLogLevelFatal: lvl = @"FATAL"; break; default: lvl = @"ALL"; break; } - return [NSString stringWithFormat:@"<%@[0x%08X] logLevel=%@ appenders:%@>", + return [NSString stringWithFormat:@"<%@[0x%p] logLevel=%@ appenders:%@>", NSStringFromClass([self class]), self, lvl, self->appenders]; } diff --git a/sope-core/NGExtensions/NGLogging.subproj/NGLoggerManager.m b/sope-core/NGExtensions/NGLogging.subproj/NGLoggerManager.m index e30ad268..57e52e5e 100644 --- a/sope-core/NGExtensions/NGLogging.subproj/NGLoggerManager.m +++ b/sope-core/NGExtensions/NGLogging.subproj/NGLoggerManager.m @@ -106,7 +106,7 @@ static BOOL debugAll = NO; - (NGLogger *)loggerForClass:(Class)_clazz { NSString *name; - name = _clazz != Nil ? NSStringFromClass(_clazz) : nil; + name = _clazz != Nil ? NSStringFromClass(_clazz) : (NSString *)nil; return [self loggerForFacilityNamed:name]; } @@ -122,7 +122,7 @@ static BOOL debugAll = NO; /* description */ - (NSString *)description { - return [NSString stringWithFormat:@"<%@[0x%08X] debugAll=%@ #loggers=%d>", + return [NSString stringWithFormat:@"<%@[0x%p] debugAll=%@ #loggers=%d>", NSStringFromClass([self class]), self, debugAll ? @"YES" : @"NO", [self->loggerMap count]]; } diff --git a/sope-core/NGExtensions/NGObjCRuntime.m b/sope-core/NGExtensions/NGObjCRuntime.m index 2f1174fa..b8aa29d7 100644 --- a/sope-core/NGExtensions/NGObjCRuntime.m +++ b/sope-core/NGExtensions/NGObjCRuntime.m @@ -134,7 +134,7 @@ fillMethodListWithSpecs(MethodList_t methods, SEL _selector, va_list *va) unsigned count; selector = _selector; - signature = selector ? va_arg(*va, NSString *) : nil; + signature = selector ? va_arg(*va, NSString *) : (NSString *)nil; imp = signature ? va_arg(*va, IMP) : NULL; count = 0; while ((selector != NULL) && (signature != nil) && (imp != NULL)) { diff --git a/sope-core/NGExtensions/NGResourceLocator.m b/sope-core/NGExtensions/NGResourceLocator.m index 303136d2..3d01d3ad 100644 --- a/sope-core/NGExtensions/NGResourceLocator.m +++ b/sope-core/NGExtensions/NGResourceLocator.m @@ -62,7 +62,7 @@ NSString *apath; if (pathes != nil) - return [pathes isNotNull] ? pathes : nil; + return [pathes isNotNull] ? pathes : (NSArray *)nil; env = [[NSProcessInfo processInfo] environment]; if ((apath = [env objectForKey:@"GNUSTEP_PATHPREFIX_LIST"]) == nil) @@ -90,8 +90,8 @@ e = ([self->gsSubPath length] > 0) ? [[self gsRootPathes] objectEnumerator] - : nil; - while ((p = [e nextObject])) { + : (NSEnumerator *)nil; + while ((p = [e nextObject]) != nil) { p = [p stringByAppendingPathComponent:self->gsSubPath]; if ([ma containsObject:p]) continue; @@ -104,8 +104,8 @@ e = ([self->fhsSubPath length] > 0) ? [[self fhsRootPathes] objectEnumerator] - : nil; - while ((p = [e nextObject])) { + : (NSEnumerator *)nil; + while ((p = [e nextObject]) != nil) { p = [p stringByAppendingPathComponent:self->fhsSubPath]; if ([ma containsObject:p]) continue; @@ -140,7 +140,8 @@ if (self->nameToPathCache == nil) self->nameToPathCache = [[NSMutableDictionary alloc] initWithCapacity:64]; - [self->nameToPathCache setObject:_path?_path:(id)[NSNull null] forKey:_name]; + [self->nameToPathCache setObject:(_path ? _path : (NSString *)[NSNull null]) + forKey:_name]; } /* operation */ @@ -151,8 +152,8 @@ if (![_name isNotNull] || [_name length] == 0) return nil; - if ((p = [self->nameToPathCache objectForKey:_name])) - return [p isNotNull] ? p : nil; + if ((p = [self->nameToPathCache objectForKey:_name]) != nil) + return [p isNotNull] ? p : (NSString *)nil; e = [[self searchPathes] objectEnumerator]; while ((p = [e nextObject]) != nil) { @@ -185,7 +186,10 @@ NSArray *lSearchPathes; unsigned i, count; - _ext = [_ext length] > 0 ? [@"." stringByAppendingString:_ext] :nil; + _ext = ([_ext length] > 0) + ? [@"." stringByAppendingString:_ext] + : (NSString *)nil; + uniquer = [NSMutableSet setWithCapacity:128]; pathes = _withPath ? [NSMutableArray arrayWithCapacity:64] : nil; lSearchPathes = [self searchPathes]; @@ -218,7 +222,7 @@ } } - return _withPath ? pathes : [uniquer allObjects]; + return _withPath ? (NSArray *)pathes : [uniquer allObjects]; } /* description */ @@ -227,7 +231,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:@" gs=%@ fhs=%@", self->gsSubPath, self->fhsSubPath]; diff --git a/sope-core/NGExtensions/NGRuleEngine.subproj/NGRuleAssignment.m b/sope-core/NGExtensions/NGRuleEngine.subproj/NGRuleAssignment.m index 13e54536..dde2554f 100644 --- a/sope-core/NGExtensions/NGRuleEngine.subproj/NGRuleAssignment.m +++ b/sope-core/NGExtensions/NGRuleEngine.subproj/NGRuleAssignment.m @@ -88,15 +88,26 @@ /* description */ - (NSString *)valueStringValue { - return [self->value isKindOfClass:[NSNumber class]] - ? [self->value stringValue] - : [NSString stringWithFormat:@"\"%@\"", self->value]; + NSMutableString *ms; + + if ([self->value isKindOfClass:[NSNumber class]]) + return [self->value stringValue]; + + ms = [NSMutableString stringWithCapacity:64]; + [ms appendString:@"\""]; + [ms appendString:[self->value stringValue]]; + [ms appendString:@"\""]; + return ms; } - (NSString *)stringValue { - return [NSString stringWithFormat:@"%@ = %@", - [self keyPath], - [self valueStringValue]]; + NSMutableString *ms; + + ms = [NSMutableString stringWithCapacity:64]; + [ms appendString:[[self keyPath] description]]; + [ms appendString:@" = "]; + [ms appendString:[self valueStringValue]]; + return ms; } - (NSString *)description { @@ -105,6 +116,7 @@ @end /* NGRuleAssignment */ + @implementation NGRuleKeyAssignment /* operations */ diff --git a/sope-core/NGExtensions/NGRuleEngine.subproj/NGRuleContext.m b/sope-core/NGExtensions/NGRuleEngine.subproj/NGRuleContext.m index ae780483..7e38945d 100644 --- a/sope-core/NGExtensions/NGRuleEngine.subproj/NGRuleContext.m +++ b/sope-core/NGExtensions/NGRuleEngine.subproj/NGRuleContext.m @@ -146,7 +146,7 @@ [self debugWithFormat:@" rule %i matches: %@", i, rule]; v = [[rule action] fireInContext:self]; - [values addObject:(v ? v : [NSNull null])]; + [values addObject:(v != nil ? v : (id)[NSNull null])]; } } if (self->debugOn) @@ -188,7 +188,7 @@ /* calculate the rule value */ ruleValue = [self valueForKey:_kp]; - [results addObject:ruleValue ? ruleValue : [NSNull null]]; + [results addObject:(ruleValue != nil ? ruleValue : (id)[NSNull null])]; } return results; } diff --git a/sope-core/NGExtensions/NGStack.m b/sope-core/NGExtensions/NGStack.m index 9a3f5eae..f2cd2c25 100644 --- a/sope-core/NGExtensions/NGStack.m +++ b/sope-core/NGExtensions/NGStack.m @@ -220,7 +220,7 @@ - (NSString *)description { return [NSString stringWithFormat: - @"<%@[0x%08X] capacity=%u SP=%u count=%u content=%s>", + @"<%@[0x%p] capacity=%u SP=%u count=%u content=%s>", NSStringFromClass([self class]), (unsigned)self, [self capacity], [self stackPointer], [self count], [[[self toArray] description] cString]]; diff --git a/sope-core/NGExtensions/Version b/sope-core/NGExtensions/Version index 629cbb0c..6cd27609 100644 --- a/sope-core/NGExtensions/Version +++ b/sope-core/NGExtensions/Version @@ -1,6 +1,6 @@ # version -SUBMINOR_VERSION:=183 +SUBMINOR_VERSION:=184 # v4.3.115 requires libFoundation v1.0.59 # v4.2.72 requires libEOControl v4.2.39 diff --git a/sope-core/NGStreams/ChangeLog b/sope-core/NGStreams/ChangeLog index b08c2919..f9f12df0 100644 --- a/sope-core/NGStreams/ChangeLog +++ b/sope-core/NGStreams/ChangeLog @@ -1,3 +1,7 @@ +2006-07-03 Helge Hess + + * use %p for pointer formats, fixed gcc 4.1 warnings (v4.5.50) + 2005-08-10 Helge Hess * reorganized inclusion to support frameworks (v4.5.49) diff --git a/sope-core/NGStreams/GNUmakefile.preamble b/sope-core/NGStreams/GNUmakefile.preamble index 25f2e99a..f135cd94 100644 --- a/sope-core/NGStreams/GNUmakefile.preamble +++ b/sope-core/NGStreams/GNUmakefile.preamble @@ -37,7 +37,11 @@ ADDITIONAL_LIB_DIRS += \ $(foreach dir,$(DEP_DIRS),-F$(GNUSTEP_BUILD_DIR)/$(dir)) endif +ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64) +SYSTEM_LIB_DIR += -L/usr/local/lib64 -L/usr/lib64 +else SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib +endif # activating SSL support diff --git a/sope-core/NGStreams/NGActiveSocket.m b/sope-core/NGStreams/NGActiveSocket.m index 0fcefd52..841cb9cc 100644 --- a/sope-core/NGStreams/NGActiveSocket.m +++ b/sope-core/NGStreams/NGActiveSocket.m @@ -712,7 +712,7 @@ : (int)(self->receiveTimeout * 1000.0)); #if DEBUG if ((readResult < 0) && (errno == EINVAL)) { - NSLog(@"%s: invalid argument in NGDescriptorRecv(%i, 0x%08X, %i, %i)", + NSLog(@"%s: invalid argument in NGDescriptorRecv(%i, 0x%p, %i, %i)", __PRETTY_FUNCTION__, self->fd, _buf, _len, 0, (self->receiveTimeout == 0.0) @@ -1096,7 +1096,7 @@ - (NSString *)description { NSMutableString *d = [NSMutableString stringWithCapacity:64]; - [d appendFormat:@"<%@[0x%08X]: mode=%@ address=%@", + [d appendFormat:@"<%@[0x%p]: mode=%@ address=%@", NSStringFromClass([self class]), (unsigned)self, [self modeDescription], [self localAddress]]; diff --git a/sope-core/NGStreams/NGByteBuffer.m b/sope-core/NGStreams/NGByteBuffer.m index 121b5722..842cdd0a 100644 --- a/sope-core/NGStreams/NGByteBuffer.m +++ b/sope-core/NGStreams/NGByteBuffer.m @@ -333,7 +333,7 @@ static Class DataStreamClass = Nil; ms = [NSMutableString stringWithCapacity:128]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; if (self->source) [ms appendFormat:@" source=%@", self->source]; [ms appendFormat:@" mode=%@", [self modeDescription]]; diff --git a/sope-core/NGStreams/NGCTextStream.m b/sope-core/NGStreams/NGCTextStream.m index a6b12f3c..a061c5a6 100644 --- a/sope-core/NGStreams/NGCTextStream.m +++ b/sope-core/NGStreams/NGCTextStream.m @@ -246,7 +246,7 @@ static void _flushAtExit(void) { } NS_ENDHANDLER; - return buffer ? NGCharBuffer8_makeStringAndDealloc(buffer) : nil; + return buffer ? NGCharBuffer8_makeStringAndDealloc(buffer) : (NSString *)nil; } - (NSEnumerator *)lineEnumerator { diff --git a/sope-core/NGStreams/NGCharBuffer.m b/sope-core/NGStreams/NGCharBuffer.m index 0821efe8..0c74d2ac 100644 --- a/sope-core/NGStreams/NGCharBuffer.m +++ b/sope-core/NGStreams/NGCharBuffer.m @@ -184,7 +184,7 @@ typedef struct NGCharBufferLA { // description - (NSString *)description { - return [NSString stringWithFormat:@"<%@[0x%08X] source=%@ la=%d", + return [NSString stringWithFormat:@"<%@[0x%p] source=%@ la=%d", NSStringFromClass([self class]), (unsigned)self, self->source, diff --git a/sope-core/NGStreams/NGDatagramPacket.m b/sope-core/NGStreams/NGDatagramPacket.m index c58484d9..62ff0611 100644 --- a/sope-core/NGStreams/NGDatagramPacket.m +++ b/sope-core/NGStreams/NGDatagramPacket.m @@ -87,7 +87,7 @@ /* description */ - (NSString *)description { - return [NSString stringWithFormat:@"<%@[0x%08X]: from=%@ to=%@ size=%i>", + return [NSString stringWithFormat:@"<%@[0x%p]: from=%@ to=%@ size=%i>", NSStringFromClass([self class]), (unsigned)self, [self sender], [self receiver], [self packetSize]]; } diff --git a/sope-core/NGStreams/NGDescriptorFunctions.m b/sope-core/NGStreams/NGDescriptorFunctions.m index 82fd975a..362e9b5a 100644 --- a/sope-core/NGStreams/NGDescriptorFunctions.m +++ b/sope-core/NGStreams/NGDescriptorFunctions.m @@ -180,7 +180,7 @@ int NGDescriptorRecv(int _fd, char *_buf, int _len, int _flags, int _timeout /* } if (enableDescLogging) { - NSLog(@"%s(fd=%i,buf=0x%08X,len=%i,flags=%i,timeout=%i)", + NSLog(@"%s(fd=%i,buf=0x%p,len=%i,flags=%i,timeout=%i)", __PRETTY_FUNCTION__, _fd,_buf,_len,_flags,_timeout); } @@ -193,7 +193,7 @@ int NGDescriptorRecv(int _fd, char *_buf, int _len, int _flags, int _timeout /* if (enableDescLogging) { if ((result < 0) && (errorCode == EINVAL)) { - NSLog(@"%s: invalid argument in recv(%i, 0x%08X, %i, %i)", + NSLog(@"%s: invalid argument in recv(%i, 0x%p, %i, %i)", __PRETTY_FUNCTION__, _fd, _buf, _len, _flags); } } diff --git a/sope-core/NGStreams/NGFileStream.m b/sope-core/NGStreams/NGFileStream.m index 2784d838..72824b7a 100644 --- a/sope-core/NGStreams/NGFileStream.m +++ b/sope-core/NGStreams/NGFileStream.m @@ -634,13 +634,14 @@ static void _checkOpen(NGFileStream *self, NSString *_reason) { - (NSString *)description { return [NSString stringWithFormat: - @"<%@[0x%08X] path=%@ mode=%@>", + @"<%@[0x%p] path=%@ mode=%@>", NSStringFromClass([self class]), (unsigned)self, - self->systemPath ? self->systemPath : @"nil", + self->systemPath ? self->systemPath : (NSString *)@"nil", [self modeDescription]]; } -@end +@end /* NGFileStream */ + @implementation _NGConcreteFileStreamFileHandle diff --git a/sope-core/NGStreams/NGFilterStream.m b/sope-core/NGStreams/NGFilterStream.m index de6ca3ba..1b16f220 100644 --- a/sope-core/NGStreams/NGFilterStream.m +++ b/sope-core/NGStreams/NGFilterStream.m @@ -152,7 +152,7 @@ - (NSString *)description { return [NSString stringWithFormat: - @"<%@[0x%08X] source=%@ mode=%@>", + @"<%@[0x%p] source=%@ mode=%@>", NSStringFromClass([self class]), (unsigned)self, self->source ? (id)self->source : (id)@"nil", [self modeDescription]]; diff --git a/sope-core/NGStreams/NGInternetSocketAddress.m b/sope-core/NGStreams/NGInternetSocketAddress.m index d50abdc4..d029a9de 100644 --- a/sope-core/NGStreams/NGInternetSocketAddress.m +++ b/sope-core/NGStreams/NGInternetSocketAddress.m @@ -638,7 +638,7 @@ static inline NSString *_nameOfLocalhost(void) { id tmp; ms = [NSMutableString stringWithCapacity:128]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; if ((tmp = [self hostName]) != nil) [ms appendFormat:@" host=%@", tmp]; diff --git a/sope-core/NGStreams/NGInternetSocketDomain.m b/sope-core/NGStreams/NGInternetSocketDomain.m index 0980416c..a95105ca 100644 --- a/sope-core/NGStreams/NGInternetSocketDomain.m +++ b/sope-core/NGStreams/NGInternetSocketDomain.m @@ -113,7 +113,7 @@ static NGInternetSocketDomain *domain = nil; /* description */ - (NSString *)description { - return [NSString stringWithFormat:@"", (unsigned)self]; + return [NSString stringWithFormat:@"", (unsigned)self]; } @end /* NGInternetSocketDomain */ diff --git a/sope-core/NGStreams/NGLocalSocketAddress.m b/sope-core/NGStreams/NGLocalSocketAddress.m index dc16f511..2f2745c1 100644 --- a/sope-core/NGStreams/NGLocalSocketAddress.m +++ b/sope-core/NGStreams/NGLocalSocketAddress.m @@ -100,7 +100,7 @@ static NSString *socketDirectoryPath = @"/tmp"; int addressCounter = 0; NSString *newPath; - newPath = [NSString stringWithFormat:@"_ngsocket_%08X_%08X_%03d", + newPath = [NSString stringWithFormat:@"_ngsocket_%p_%p_%03d", getpid(), [NSThread currentThread], addressCounter]; newPath = [socketDirectoryPath stringByAppendingPathComponent:newPath]; @@ -116,10 +116,12 @@ static NSString *socketDirectoryPath = @"/tmp"; NSString *path; path = (_length < 3) - ? @"" - : [NSString stringWithCString:nun->sun_path]; + ? (id)@"" + : [[NSString alloc] initWithCString:nun->sun_path]; - return [self initWithPath:path]; + self = [self initWithPath:path]; + [path release]; path = nil; + return self; } - (void)dealloc { @@ -219,7 +221,7 @@ static NSString *socketDirectoryPath = @"/tmp"; - (NSString *)stringValue { NSString *p = [self path]; - return [p length] == 0 ? @"*" : (id)p; + return [p length] == 0 ? (NSString *)@"*" : p; } - (NSString *)description { @@ -228,11 +230,10 @@ static NSString *socketDirectoryPath = @"/tmp"; if ([p length] == 0) p = @"[no path]"; - return [NSString stringWithFormat:@"<0x%08X[%@]: %@>", - self, NSStringFromClass([self class]), - p]; + return [NSString stringWithFormat:@"<0x%p[%@]: %@>", + self, NSStringFromClass([self class]), p]; } -@end +@end /* NGLocalSocketAddress */ #endif /* !WIN32 */ diff --git a/sope-core/NGStreams/NGLocalSocketDomain.m b/sope-core/NGStreams/NGLocalSocketDomain.m index d5d57862..4f854f1b 100644 --- a/sope-core/NGStreams/NGLocalSocketDomain.m +++ b/sope-core/NGStreams/NGLocalSocketDomain.m @@ -130,7 +130,7 @@ static NGLocalSocketDomain *domain = nil; - (NSString *)description { return [NSString stringWithFormat: - @"", (unsigned)self]; + @"", (unsigned)self]; } @end /* NGLocalSocketDomain */ diff --git a/sope-core/NGStreams/NGSocket.m b/sope-core/NGStreams/NGSocket.m index 2397491b..8ccf24df 100644 --- a/sope-core/NGStreams/NGSocket.m +++ b/sope-core/NGStreams/NGSocket.m @@ -601,7 +601,7 @@ static inline BOOL getBoolOption(id self, int _option) { - (NSString *)description { return [NSString stringWithFormat: - @"<%@[0x%08X]: fd=%i type=%i bound=%@ domain=%@>", + @"<%@[0x%p]: fd=%i type=%i bound=%@ domain=%@>", NSStringFromClass([self class]), (unsigned)self, [self fileDescriptor], [self socketType], diff --git a/sope-core/NGStreams/NGSocketExceptions.m b/sope-core/NGStreams/NGSocketExceptions.m index 8ed3befa..50867f3f 100644 --- a/sope-core/NGStreams/NGSocketExceptions.m +++ b/sope-core/NGStreams/NGSocketExceptions.m @@ -61,14 +61,15 @@ } - (id)initWithHostName:(NSString *)_name reason:(NSString *)_reason { - self = [super initWithReason: - [NSString stringWithFormat: - @"Could not resolve host %@: %@", - _name, _reason ? _reason : @"error"] - socket:nil]; - if (self) { + NSString *r; + + r = [[NSString alloc] initWithFormat:@"Could not resolve host %@: %@", + _name, _reason ? _reason : (NSString *)@"error"]; + if ((self = [super initWithReason:r socket:nil]) != nil) { self->hostName = [_name copy]; } + [r release]; r = nil; + return self; } diff --git a/sope-core/NGStreams/NGStream.m b/sope-core/NGStreams/NGStream.m index 486b787f..857f7fee 100644 --- a/sope-core/NGStreams/NGStream.m +++ b/sope-core/NGStreams/NGStream.m @@ -109,7 +109,7 @@ - (NSString *)description { return [NSString stringWithFormat: - @"<%@[0x%08X] mode=%@>", + @"<%@[0x%p] mode=%@>", NSStringFromClass([self class]), (unsigned)self, [self modeDescription]]; } diff --git a/sope-core/NGStreams/NGStreamCoder.m b/sope-core/NGStreams/NGStreamCoder.m index 5c674c6d..4d18ffe7 100644 --- a/sope-core/NGStreams/NGStreamCoder.m +++ b/sope-core/NGStreams/NGStreamCoder.m @@ -429,7 +429,7 @@ FINAL void _readObjC(NGStreamCoder *self, void *_value, const char *_type); class_get_class_name(_object)); } else { - NSLog(@"encoding reference to object 0x%08X<%s> ..", + NSLog(@"encoding reference to object 0x%p<%s> ..", _object, class_get_class_name(*(Class *)_object)); } #endif @@ -447,7 +447,7 @@ FINAL void _readObjC(NGStreamCoder *self, void *_value, const char *_type); class_get_class_name(_object), [_object version]); } else { - NSLog(@"encoding object 0x%08X<%s> ..", + NSLog(@"encoding object 0x%p<%s> ..", _object, class_get_class_name(*(Class *)_object)); } #endif diff --git a/sope-core/NGStreams/NGStreamPipe.m b/sope-core/NGStreams/NGStreamPipe.m index 0153781a..90c43f3b 100644 --- a/sope-core/NGStreams/NGStreamPipe.m +++ b/sope-core/NGStreams/NGStreamPipe.m @@ -196,7 +196,7 @@ static const int NGInvalidUnixDescriptor = -1; /* description */ - (NSString *)description { - return [NSString stringWithFormat:@"<0x%08X[%@]: in=%i out=%i>", + return [NSString stringWithFormat:@"<0x%p[%@]: in=%i out=%i>", self, NSStringFromClass([self class]), self->fildes[0], self->fildes[1]]; } diff --git a/sope-core/NGStreams/NGTaskStream.m b/sope-core/NGStreams/NGTaskStream.m index 3319faf3..eda02558 100644 --- a/sope-core/NGStreams/NGTaskStream.m +++ b/sope-core/NGStreams/NGTaskStream.m @@ -86,7 +86,7 @@ - (NSString *)description { return [NSString stringWithFormat: - @"<%@[0x%08X] task=%@ mode=%@>", + @"<%@[0x%p] task=%@ mode=%@>", NSStringFromClass([self class]), (unsigned)self, self->task, [self modeDescription]]; diff --git a/sope-core/NGStreams/NGTerminalSupport.m b/sope-core/NGStreams/NGTerminalSupport.m index dff71930..2959c5d8 100644 --- a/sope-core/NGStreams/NGTerminalSupport.m +++ b/sope-core/NGStreams/NGTerminalSupport.m @@ -51,11 +51,12 @@ #if defined(WIN32) return nil; #else - return [self isOpen] ? NGDescriptorGetTtyName(self->fd) : nil; + return [self isOpen] ? NGDescriptorGetTtyName(self->fd) : (NSString *)nil; #endif } -@end +@end /* NGFileStream(NGTerminalSupport) */ + @implementation NGFilterStream(NGTerminalSupport) @@ -75,7 +76,8 @@ : NO; } -@end +@end /* NGFilterStream(NGTerminalSupport) */ + @implementation NGTextStream(NGTerminalSupport) @@ -86,7 +88,8 @@ return nil; } -@end +@end /* NGTextStream(NGTerminalSupport) */ + @implementation NGCTextStream(NGTerminalSupport) @@ -106,7 +109,7 @@ : NO; } -@end +@end /* NGCTextStream(NGTerminalSupport) */ void __link_NGStreams_NGTerminalSupport(void) { __link_NGStreams_NGTerminalSupport(); diff --git a/sope-core/NGStreams/Version b/sope-core/NGStreams/Version index 704a8fa2..f7227d67 100644 --- a/sope-core/NGStreams/Version +++ b/sope-core/NGStreams/Version @@ -1,3 +1,3 @@ # version file -SUBMINOR_VERSION:=49 +SUBMINOR_VERSION:=50 diff --git a/sope-core/NGStreams/fhs.make b/sope-core/NGStreams/fhs.make index 1b5e8e02..d7ea4c05 100644 --- a/sope-core/NGStreams/fhs.make +++ b/sope-core/NGStreams/fhs.make @@ -5,9 +5,14 @@ ifneq ($(FHS_INSTALL_ROOT),) FHS_INCLUDE_DIR=$(FHS_INSTALL_ROOT)/include/ -FHS_LIB_DIR=$(FHS_INSTALL_ROOT)/lib/ FHS_BIN_DIR=$(FHS_INSTALL_ROOT)/bin/ +ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64) +FHS_LIB_DIR=$(FHS_INSTALL_ROOT)/lib64/ +else +FHS_LIB_DIR=$(FHS_INSTALL_ROOT)/lib/ +endif + fhs-header-dirs :: $(MKDIRS) $(FHS_INCLUDE_DIR)$(libNGStreams_HEADER_FILES_INSTALL_DIR) diff --git a/sope-core/samples/subclassing.m b/sope-core/samples/subclassing.m index f7add526..1e8626f0 100644 --- a/sope-core/samples/subclassing.m +++ b/sope-core/samples/subclassing.m @@ -68,7 +68,7 @@ static void myPrint(id self, SEL _cmd, int arg) { c = [NSObject subclass:@"MyObject" ivars:@"blah", @"@", @"blub", @"c", @"blab", @"s", nil]; - printf("MyObject is 0x%08X\n", (unsigned)c); + printf("MyObject is 0x%p\n", (unsigned)c); printf("MyObject name is %s\n", c->name); printf("MyObject super-name is %s\n", c->super_class->name); @@ -125,7 +125,7 @@ static void myPrint(id self, SEL _cmd, int arg) { c = [NSRunLoop subclass:@"MyRunLoop" ivars:@"blah", @"@", @"blub", @"c", @"blab", @"s", nil]; - printf("MyRunLoop is 0x%08X\n", (unsigned int)c); + printf("MyRunLoop is 0x%p\n", (unsigned int)c); printf("MyRunLoop name is %s\n", c->name); printf("MyRunLoop super-name is %s\n", c->super_class->name); -- 2.39.5