diff --git a/ChangeLog b/ChangeLog index a58e21e..ebb1de1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,60 @@ +2003-02-04 Stephane Corthesy + + * Tools/eoutil.m: implemented. + + * EOAndQualifier.m: replaced autorelease by AUTORELEASE + * EOClassDescription.m: added #include + and note about subclassing NSClassDescription + * EOEditingContext.m: removed EOAccess inclusion; note that we need to + rewrite -faultForRawRow:entityNamed:editingContext: to break dependency + to EOAccess + * EOFault.m: implemented +doesNotRecognizeSelector: + * EOFaultHandler.m: added #include and #include + + * EOFetchSpecification.m: added #import + * EOGenericRecord.h: declaration of -valueForKey: and + -takeValue:forKey: needs to be done only when !FOUNDATION_HAS_KVC + * EOGenericRecord.m: removed #import and #import + ; added #include ; + declared +eoCalculateSizeWith:forArray:; corrected +initialize (doesn't + return a value); renamed +removeDestoyedObject: to + +removeDestroyedObject:; modified + -initWithEditingContext:classDescription:globalID: to no longer depend + on EOAccess via EOEntity; some methods need to be implemented only when + !FOUNDATION_HAS_KVC (else they are already correctly implemented in + NSObject), some others only when FOUNDATION_HAS_KVC + (-handleQueryWithUnboundKey: and handleTakeValue:forUnboundKey:); in + -smartTakeValue:forKey:, removed dependency to EOAccess via + EORelationship; corrected problem with macro NSDebugMLog, which should + be replaced by other macro anyway; modified -eoCalculateSizeWith: to no + longer depend on EOAccess via EOEntity + * EOGlobalID.m: added #include and #include ; added + cast in +assignGloballyUniqueBytes: + * EOKeyComparisonQualifier.m: added casts + * EOKeyGlobalID.m: replaced retain by RETAIN + * EOKeyValueCoding.h: removed #import + ; added - (id)storedValueForKeyPath: + (NSString *)key; declared some methods only when !FOUNDATION_HAS_KVC; + declared hidden methods for MacOS X. + * EOKeyValueCoding.m: added #include ; implemented some + methods only when !FOUNDATION_HAS_KVC; corrected problem with macros + NSDebugMLog/NSWarnLog, which should be replaced by other macro anyway; + declared -[NSMutableDictionary(EOKeyValueCodingPrivate) + takeValue:forKeyPath:isSmart:]; corrected zombie in + -[NSMutableDictionary(EOKeyValueCoding) takeValue:forKeyPath:isSmart:] + * EOKeyValueQualifier: added casts + * EOMutableKnownKeyDictionary.m: added #warning about missing method; + moved method implementation to avoid warning + * EONSAddOns.m: added casts + * EOObjectStoreCoordinator.m: corrected problem with macro NSDebugMLog, + which should be replaced by other macro anyway + * EOQualifier.m: added #include ; + corrected problem with macro NSDebugLog, which should be replaced by + other macro anyway; replaced retain by RETAIN; in -doesContain:, no + need to test against NSMutableArray class + * EOSortOrdering.m: replaced retain by RETAIN; avoid autoreleased + objects; replaced mutableCopy by initWithArray:copyItems: + 2003-02-03 Stephane Corthesy * Postgres95Adaptor.m: made some changes to externalTypeNames (needs diff --git a/EOControl/EOAndQualifier.m b/EOControl/EOAndQualifier.m index f5be4b8..a5fe394 100644 --- a/EOControl/EOAndQualifier.m +++ b/EOControl/EOAndQualifier.m @@ -51,7 +51,7 @@ RCS_ID("$Id$") + (EOQualifier *)qualifierWithQualifierArray: (NSArray *)array { - return [[[self alloc] initWithQualifierArray: array] autorelease]; + return AUTORELEASE([[self alloc] initWithQualifierArray: array]); } + (EOQualifier *)qualifierWithQualifiers: (EOQualifier *)qualifiers, ... @@ -70,7 +70,7 @@ RCS_ID("$Id$") va_end(ap); - return [[[self alloc] initWithQualifierArray: qualArray] autorelease]; + return AUTORELEASE([[self alloc] initWithQualifierArray: qualArray]); } - (id) initWithQualifiers: (EOQualifier *)qualifiers, ... diff --git a/EOControl/EOClassDescription.m b/EOControl/EOClassDescription.m index 746b2ac..e716505 100644 --- a/EOControl/EOClassDescription.m +++ b/EOControl/EOClassDescription.m @@ -47,8 +47,12 @@ RCS_ID("$Id$") #import #import +#include + //?? #define NOT_FOUND_CLASS_DESCRIPTION ([NSObject class]) //we use NSObject class as a "not found" value******* +// NOTE: (stephane@sente.ch) Should we subclass NSClassDescription? + @implementation EOClassDescription diff --git a/EOControl/EOEditingContext.m b/EOControl/EOEditingContext.m index 1d52721..f2d77b8 100644 --- a/EOControl/EOEditingContext.m +++ b/EOControl/EOEditingContext.m @@ -48,7 +48,8 @@ RCS_ID("$Id$") #import #import -#import + +@class EOEntityClassDescription; @implementation EOEditingContext @@ -2487,6 +2488,7 @@ modified state of the object.**/ classDesc = (id)[EOClassDescription classDescriptionForEntityName: entityName]; +#warning (stephane@sente.ch) ERROR: trying to use EOEntity/EOEntityDescription which are defined in EOAccess globalID = [[classDesc entity] globalIDForRow: row]; object = [self objectForGlobalID: globalID]; diff --git a/EOControl/EOFault.m b/EOControl/EOFault.m index 6c66bdf..65107cd 100644 --- a/EOControl/EOFault.m +++ b/EOControl/EOFault.m @@ -118,7 +118,7 @@ typedef struct { + (BOOL)isKindOfClass: (Class)aClass { - if(aClass == [EOFault class]) + if (aClass == [EOFault class]) return YES; return NO; @@ -126,8 +126,12 @@ typedef struct { + (void)doesNotRecognizeSelector: (SEL)sel { - return; - [self notImplemented: _cmd]; + [NSException raise: NSInvalidArgumentException + format: @"%@ -- %@ 0x%x: selector \"%@\" not recognized", + NSStringFromSelector(_cmd), + NSStringFromClass([self class]), + self, + NSStringFromSelector(sel)]; } + (BOOL)respondsToSelector: (SEL)sel diff --git a/EOControl/EOFaultHandler.m b/EOControl/EOFaultHandler.m index 1ff90fe..ded2708 100644 --- a/EOControl/EOFaultHandler.m +++ b/EOControl/EOFaultHandler.m @@ -49,6 +49,12 @@ RCS_ID("$Id$") #import #import +#ifndef GNU_RUNTIME +#include +#endif + +#include + BOOL __isGCEnabled(Class class_) { diff --git a/EOControl/EOFetchSpecification.m b/EOControl/EOFetchSpecification.m index 8e227b5..610e7c3 100644 --- a/EOControl/EOFetchSpecification.m +++ b/EOControl/EOFetchSpecification.m @@ -36,6 +36,7 @@ RCS_ID("$Id$") #import +#import #import #import diff --git a/EOControl/EOGenericRecord.h b/EOControl/EOGenericRecord.h index db5ec78..57c95f0 100644 --- a/EOControl/EOGenericRecord.h +++ b/EOControl/EOGenericRecord.h @@ -51,9 +51,11 @@ classDescription: (EOClassDescription *)classDesc globalID: (EOGlobalID *)globalID; +#if !FOUNDATION_HAS_KVC - (id)valueForKey: (NSString *)key; - (void)takeValue: (id)value forKey: (NSString *)key; +#endif + (void)eoCalculateAllSizeWith: (NSMutableDictionary*)dict; - (unsigned int)eoCalculateSizeWith: (NSMutableDictionary*)dict; diff --git a/EOControl/EOGenericRecord.m b/EOControl/EOGenericRecord.m index 742f178..d8f4b8c 100644 --- a/EOControl/EOGenericRecord.m +++ b/EOControl/EOGenericRecord.m @@ -49,9 +49,6 @@ RCS_ID("$Id$") #import -#import -#import - #import #import #import @@ -61,6 +58,10 @@ RCS_ID("$Id$") #import #import +#ifndef GNU_RUNTIME +#include +#endif + @interface NSObject (EOCalculateSize) - (unsigned int)eoGetSize; @@ -84,6 +85,11 @@ RCS_ID("$Id$") forFault: (id)object; @end +@interface EOGenericRecord(EOCalculateSize) ++ (unsigned int)eoCalculateSizeWith: (NSMutableDictionary *)dict + forArray: (NSArray *)array; +@end + static NSHashTable *allGenericRecords = NULL; static NSRecursiveLock *allGenericRecordsLock = nil; @@ -93,14 +99,13 @@ static NSRecursiveLock *allGenericRecordsLock = nil; + (void) initialize { - if ([[super superclass] initialize]) + [[super superclass] initialize]; + + if (self == [EOGenericRecord class] && !allGenericRecords) { - if (self == [EOGenericRecord class]) - { - allGenericRecords = NSCreateHashTable(NSNonOwnedPointerHashCallBacks, - 1000); - allGenericRecordsLock = [NSRecursiveLock new]; - } + allGenericRecords = NSCreateHashTable(NSNonOwnedPointerHashCallBacks, + 1000); + allGenericRecordsLock = [NSRecursiveLock new]; } } @@ -111,7 +116,7 @@ static NSRecursiveLock *allGenericRecordsLock = nil; [allGenericRecordsLock unlock]; } -+ (void)removeDestoyedObject: (EOGenericRecord *)o ++ (void)removeDestroyedObject: (EOGenericRecord *)o { [allGenericRecordsLock lock]; NSHashRemove(allGenericRecords, o); @@ -134,7 +139,7 @@ static NSRecursiveLock *allGenericRecordsLock = nil; { if ((self = [self init])) { - EOEntity *entity = nil; + NSMutableArray *classPropertyNames = nil; EOMutableKnownKeyDictionary *entityMKKD = nil; if (!classDesc) @@ -151,14 +156,25 @@ static NSRecursiveLock *allGenericRecordsLock = nil; ASSIGN(classDescription, classDesc); - entity = [(EOEntityClassDescription*)classDesc entity]; - NSAssert(entity, @"No entity"); + // Get class properties (attributes + relationships) + classPropertyNames = [[NSMutableArray alloc] + initWithArray: [classDesc attributeKeys]]; + [classPropertyNames addObjectsFromArray: + [classDesc toOneRelationshipKeys]]; + [classPropertyNames addObjectsFromArray: + [classDesc toManyRelationshipKeys]]; - entityMKKD = [entity _dictionaryForProperties]; + NSAssert1([classPropertyNames count] > 0, + @"No classPropertyNames in %@", classDesc); + + entityMKKD = [EOMutableKnownKeyDictionary + dictionaryWithInitializer: + [[EOMKKDInitializer newWithKeyArray: classPropertyNames] autorelease]]; ASSIGN(dictionary,entityMKKD); EOFLOGObjectLevelArgs(@"EOGenericRecord", @"Record %p: dictionary=%@", self, dictionary); + [classPropertyNames release]; } return self; @@ -170,7 +186,7 @@ static NSRecursiveLock *allGenericRecordsLock = nil; @"Deallocate EOGenericRecord %p (dict=%p)", self, dictionary); - [[self class] removeDestoyedObject: self]; + [[self class] removeDestroyedObject: self]; DESTROY(classDescription); DESTROY(dictionary); @@ -183,6 +199,8 @@ static NSRecursiveLock *allGenericRecordsLock = nil; return classDescription; } +#if !FOUNDATION_HAS_KVC + static const char _c_id[2] = { _C_ID, NULL }; //used to allow derived object implementation @@ -601,17 +619,21 @@ static const char _c_id[2] = { _C_ID, NULL }; EOFLOGObjectFnStopCond(@"EOGenericRecordKVC"); } +#endif /* !FOUNDATION_HAS_KVC */ /** if key is a bidirectional rel, use addObject:toBothSidesOfRelationship otherwise call takeValue:forKey: **/ - (void)smartTakeValue: (id)anObject forKey: (NSString *)aKey { - EORelationship *rel = [classDescription relationshipNamed: aKey]; + BOOL isToMany = [[classDescription toManyRelationshipKeys] + containsObject: aKey]; //NSDebugMLog(@"aKey=%@ rel=%@ anObject=%@", aKey, rel, anObject); //NSDebugMLog(@"[rel isBidirectional]=%d", [rel isBidirectional]); - if (rel && [rel isBidirectional]) + if ((isToMany + || [[classDescription toOneRelationshipKeys] containsObject: aKey]) + && [classDescription inverseForRelationshipKey: aKey] != nil) { if (isNilOrEONull(anObject)) { @@ -619,7 +641,7 @@ static const char _c_id[2] = { _C_ID, NULL }; if (isNilOrEONull(oldObj)) { - if (![rel isToMany]) + if (!isToMany) [self takeValue: anObject forKey: aKey]; } @@ -636,6 +658,7 @@ static const char _c_id[2] = { _C_ID, NULL }; forKey: aKey]; } +#if !FOUNDATION_HAS_KVC - (void) takeValue: (id)anObject forKey: (NSString*)aKey { SEL sel; @@ -788,6 +811,54 @@ static const char _c_id[2] = { _C_ID, NULL }; return value; } +#else /* FOUNDATION_HAS_KVC */ + +- (id) handleQueryWithUnboundKey: (NSString *)key +{ + id value; + + EOFLOGObjectFnStartCond(@"EOGenericRecordKVC"); + EOFLOGObjectLevelArgs(@"EOGenericRecordKVC", + @"Unbound key named %@", + key); + + if (![dictionary hasKey: key]) + return [super handleQueryWithUnboundKey: key]; + + value = [dictionary objectForKey: key]; + + EOFLOGObjectLevelArgs(@"EOGenericRecordKVC", @"value %p (class=%@)", + value, [value class]); + EOFLOGObjectFnStopCond(@"EOGenericRecordKVC"); + + return value; +} + +- (void) handleTakeValue: (id)value forUnboundKey: (NSString *)key +{ + EOFLOGObjectFnStartCond(@"EOGenericRecordKVC"); + EOFLOGObjectLevelArgs(@"EOGenericRecordKVC", + @"Unbound key named %@", + key); + + [self willChange]; + + if (![dictionary hasKey:key]) + [super handleTakeValue:value forUnboundKey: key]; + + if (value) + [dictionary setObject: value + forKey: key]; + else +// [dictionary setObject: [EONull null] +// forKey: key]; + [dictionary removeObjectForKey: key]; + + EOFLOGObjectFnStopCond(@"EOGenericRecordKVC"); +} + +#endif /* FOUNDATION_HAS_KVC */ + /** used in -decription for self toOne or toMany objects to avoid infinite loop in description **/ @@ -901,7 +972,7 @@ infinite loop in description **/ stringWithFormat: @"<%p %@: classDescription=%@>", obj, NSStringFromClass([obj class]), - [obj classDescription]] + [(EOGenericRecord *)obj classDescription]] forKey: key]; } } @@ -967,7 +1038,7 @@ infinite loop in description **/ [allGenericRecordsLock unlock]; - NSDebugMLog(@"CALCULATE STOPEXC"); + NSDebugMLog(@"CALCULATE STOPEXC", ""); [localException raise]; } NS_ENDHANDLER; @@ -1017,8 +1088,12 @@ infinite loop in description **/ //NSDebugMLog(@"classDescription=%@", classDescription); - props = [[(EOEntityClassDescription *)classDescription entity] - classPropertyNames]; + // Get class properties (attributes + relationships) + props = [NSMutableArray arrayWithArray: [classDescription attributeKeys]]; + [(NSMutableArray *)props addObjectsFromArray: + [classDescription toOneRelationshipKeys]]; + [(NSMutableArray *)props addObjectsFromArray: + [classDescription toManyRelationshipKeys]]; size += [self eoGetSize]; size += [dictionary eoGetSize]; diff --git a/EOControl/EOGlobalID.m b/EOControl/EOGlobalID.m index a7686c7..0b29514 100644 --- a/EOControl/EOGlobalID.m +++ b/EOControl/EOGlobalID.m @@ -41,6 +41,8 @@ RCS_ID("$Id$") #import #import +#include +#include #include #include @@ -114,7 +116,7 @@ static unsigned long sequenceRev = 0; sequence-- % 0xff, getpid() % 0xff, (unsigned int)time( NULL ) % 0xffff, - sequenceRev++ % 0xffff); + (unsigned int)sequenceRev++ % 0xffff); if (sequence == 0) sequence = 65535; diff --git a/EOControl/EOKeyComparisonQualifier.m b/EOControl/EOKeyComparisonQualifier.m index 94b0b12..717696e 100644 --- a/EOControl/EOKeyComparisonQualifier.m +++ b/EOControl/EOKeyComparisonQualifier.m @@ -122,19 +122,19 @@ RCS_ID("$Id$") } else if (sel_eq(_selector, EOQualifierOperatorLessThan) == YES) { - return [leftKey compare: rightKey] == NSOrderedAscending; + return [(NSObject *)leftKey compare: rightKey] == NSOrderedAscending; } else if (sel_eq(_selector, EOQualifierOperatorGreaterThan) == YES) { - return [leftKey compare: rightKey] == NSOrderedDescending; + return [(NSObject *)leftKey compare: rightKey] == NSOrderedDescending; } else if (sel_eq(_selector, EOQualifierOperatorLessThanOrEqualTo) == YES) { - return [leftKey compare: rightKey] != NSOrderedDescending; + return [(NSObject *)leftKey compare: rightKey] != NSOrderedDescending; } else if (sel_eq(_selector, EOQualifierOperatorGreaterThanOrEqualTo) == YES) { - return [leftKey compare: rightKey] != NSOrderedAscending; + return [(NSObject *)leftKey compare: rightKey] != NSOrderedAscending; } else if (sel_eq(_selector, EOQualifierOperatorContains) == YES) { diff --git a/EOControl/EOKeyGlobalID.m b/EOControl/EOKeyGlobalID.m index 03da23c..0482742 100644 --- a/EOControl/EOKeyGlobalID.m +++ b/EOControl/EOKeyGlobalID.m @@ -160,7 +160,7 @@ RCS_ID("$Id$") self = [super init]; [coder decodeValueOfObjCType: @encode(unsigned short) at: &_keyCount]; - _entityName = [[coder decodeObject] retain]; + _entityName = RETAIN([coder decodeObject]); _keyValues = NSZoneMalloc([coder objectZone], _keyCount); [coder decodeArrayOfObjCType: @encode(id) count: _keyCount at: _keyValues]; diff --git a/EOControl/EOKeyValueCoding.h b/EOControl/EOKeyValueCoding.h index f256d68..b0d2b5a 100644 --- a/EOControl/EOKeyValueCoding.h +++ b/EOControl/EOKeyValueCoding.h @@ -32,8 +32,6 @@ #import #import -#import - @interface NSObject (EOKVCPAdditions2) - (void)smartTakeValue: (id)anObject @@ -42,11 +40,19 @@ forKeyPath: (NSString *)aKeyPath; - (void)takeStoredValue: value forKeyPath: (NSString *)key; +- (id)storedValueForKeyPath: (NSString *)key; +#if !FOUNDATION_HAS_KVC - (void)takeStoredValuesFromDictionary: (NSDictionary *)dictionary; +#endif - (NSDictionary *)valuesForKeyPaths: (NSArray *)keyPaths; - (NSDictionary *)storedValuesForKeyPaths: (NSArray *)keyPaths; @end +#if NeXT_Foundation_LIBRARY +@interface NSObject (MacOSXRevealed) +- (void)takeStoredValuesFromDictionary: (NSDictionary *)dictionary; +@end +#endif @interface NSArray (EOKeyValueCoding) - (id)valueForKey: (NSString *)key; @@ -61,6 +67,7 @@ +#if !FOUNDATION_HAS_KVC @interface NSDictionary (EOKeyValueCoding) - (id)valueForKey: (NSString *)key; @end @@ -70,6 +77,7 @@ - (void)takeValue: (id)value forKey: (NSString*)key; @end +#endif extern NSString *EOUnknownKeyException; extern NSString *EOTargetObjectUserInfoKey; diff --git a/EOControl/EOKeyValueCoding.m b/EOControl/EOKeyValueCoding.m index eee79c5..49e7914 100644 --- a/EOControl/EOKeyValueCoding.m +++ b/EOControl/EOKeyValueCoding.m @@ -55,6 +55,7 @@ RCS_ID("$Id$") #import #include +#include #import #import @@ -145,6 +146,7 @@ RCS_ID("$Id$") return obj; } +#if !FOUNDATION_HAS_KVC - (void)takeStoredValuesFromDictionary: (NSDictionary *)dictionary { NSEnumerator *keyEnum; @@ -167,6 +169,7 @@ RCS_ID("$Id$") EOFLOGObjectFnStopCond(@"EOKVC"); } +#endif /* !FOUNDATION_HAS_KVC */ - (NSDictionary *)storedValuesForKeyPaths: (NSArray *)keyPaths { @@ -315,7 +318,7 @@ RCS_ID("$Id$") if (warnedCount == NO) { warnedCount = YES; - NSWarnLog(@"use of special 'count' key may works differently with only foundation base"); + NSWarnLog(@"use of special 'count' key may works differently with only foundation base", ""); } result = [super valueForKey: key]; } @@ -396,7 +399,7 @@ RCS_ID("$Id$") if (warnedCount == NO) { warnedCount = YES; - NSWarnLog(@"use of special 'count' key may works differently with only foundation base"); + NSWarnLog(@"use of special 'count' key may works differently with only foundation base", ""); } result = [super valueForKeyPath: keyPath]; } @@ -518,6 +521,7 @@ RCS_ID("$Id$") @implementation NSDictionary (EOKeyValueCoding) +#if !FOUNDATION_HAS_KVC - (id)valueForKey:(NSString *)key { id value; @@ -536,7 +540,7 @@ RCS_ID("$Id$") if (warnedAllValues == NO) { warnedAllValues = YES; - NSWarnLog(@"use of special 'allValues' key works differently with only foundation base"); + NSWarnLog(@"use of special 'allValues' key works differently with only foundation base", ""); } value = [self allValues]; @@ -547,7 +551,7 @@ RCS_ID("$Id$") if (warnedAllKeys == NO) { warnedAllKeys = YES; - NSWarnLog(@"use of special 'allKeys' key works differently with only foundation base"); + NSWarnLog(@"use of special 'allKeys' key works differently with only foundation base", ""); } value = [self allKeys]; @@ -558,7 +562,7 @@ RCS_ID("$Id$") if (warnedCount == NO) { warnedCount = YES; - NSWarnLog(@"use of special 'count' key works differently with only foundation base"); + NSWarnLog(@"use of special 'count' key works differently with only foundation base", ""); } value = [NSNumber numberWithInt: [self count]]; @@ -681,6 +685,7 @@ RCS_ID("$Id$") return value; } +#endif /* !FOUNDATION_HAS_KVC */ - (id)storedValueForKeyPath: (NSString*)keyPath { @@ -768,8 +773,15 @@ RCS_ID("$Id$") @end +@interface NSMutableDictionary(EOKeyValueCodingPrivate) +- (void)takeValue: (id)value + forKeyPath: (NSString *)keyPath + isSmart: (BOOL)smartFlag; +@end + @implementation NSMutableDictionary (EOKeyValueCoding) +#if !FOUNDATION_HAS_KVC - (void)takeValue: (id)value forKey: (NSString *)key { @@ -797,6 +809,7 @@ RCS_ID("$Id$") EOFLOGObjectFnStopCond(@"EOKVC"); } +#endif /* !FOUNDATION_HAS_KVC */ - (void)smartTakeValue: (id)value forKeyPath: (NSString*)keyPath @@ -806,6 +819,7 @@ RCS_ID("$Id$") isSmart:YES]; } +#if !FOUNDATION_HAS_KVC - (void)takeValue: (id)value forKeyPath: (NSString *)keyPath { @@ -813,6 +827,7 @@ RCS_ID("$Id$") forKeyPath:keyPath isSmart:NO]; } +#endif /* !FOUNDATION_HAS_KVC */ - (void)takeValue: (id)value forKeyPath: (NSString *)keyPath @@ -837,7 +852,7 @@ RCS_ID("$Id$") //EOFLOGObjectLevelArgs(@"EOKVC", @"keyPathArray=%@", keyPathArray); - tmpKey = [keyPathArray objectAtIndex: 0]; + tmpKey = RETAIN([keyPathArray objectAtIndex: 0]); //EOFLOGObjectLevelArgs(@"EOKVC", @"tmpKey=%@", tmpKey); [keyPathArray removeObjectAtIndex: 0]; @@ -846,13 +861,15 @@ RCS_ID("$Id$") [key appendString: @"."]; if ([tmpKey hasSuffix: @"'"]) { - tmpKey = [tmpKey stringByDeletingSuffix: @"'"]; + ASSIGN(tmpKey, [tmpKey stringByDeletingSuffix: @"'"]); [key appendString: tmpKey]; break; } else [key appendString: tmpKey]; + RELEASE(tmpKey); + //EOFLOGObjectLevelArgs(@"EOKVC", @"key=%@", key); } diff --git a/EOControl/EOKeyValueQualifier.m b/EOControl/EOKeyValueQualifier.m index 9e55fe4..354fdba 100644 --- a/EOControl/EOKeyValueQualifier.m +++ b/EOControl/EOKeyValueQualifier.m @@ -116,27 +116,27 @@ operatorSelector: (SEL)selector if (sel_eq(_selector, EOQualifierOperatorEqual) == YES) { - return [key compare: _value] == NSOrderedSame; + return [(NSString *)key compare: _value] == NSOrderedSame; } else if (sel_eq(_selector, EOQualifierOperatorNotEqual) == YES) { - return [key compare: _value] != NSOrderedSame; + return [(NSString *)key compare: _value] != NSOrderedSame; } else if (sel_eq(_selector, EOQualifierOperatorLessThan) == YES) { - return [key compare: _value] == NSOrderedAscending; + return [(NSString *)key compare: _value] == NSOrderedAscending; } else if (sel_eq(_selector, EOQualifierOperatorGreaterThan) == YES) { - return [key compare: _value] == NSOrderedDescending; + return [(NSString *)key compare: _value] == NSOrderedDescending; } else if (sel_eq(_selector, EOQualifierOperatorLessThanOrEqualTo) == YES) { - return [key compare: _value] != NSOrderedDescending; + return [(NSString *)key compare: _value] != NSOrderedDescending; } else if (sel_eq(_selector, EOQualifierOperatorGreaterThanOrEqualTo) == YES) { - return [key compare: _value] != NSOrderedAscending; + return [(NSString *)key compare: _value] != NSOrderedAscending; } else if (sel_eq(_selector, EOQualifierOperatorContains) == YES) { diff --git a/EOControl/EOMutableKnownKeyDictionary.m b/EOControl/EOMutableKnownKeyDictionary.m index 7c7e8c1..ad660e1 100644 --- a/EOControl/EOMutableKnownKeyDictionary.m +++ b/EOControl/EOMutableKnownKeyDictionary.m @@ -472,6 +472,7 @@ RCS_ID("$Id$") + (id)dictionaryFromDictionary: (NSDictionary *)dict subsetMapping: (EOMKKDSubsetMapping *)subsetMapping { +#warning (stephane@sente.ch) Method is really not implemented! return [[self newDictionaryFromDictionary: dict subsetMapping: subsetMapping zone: NULL] autorelease]; @@ -518,14 +519,6 @@ RCS_ID("$Id$") @implementation EOMutableKnownKeyDictionary -+ (id)dictionaryFromDictionary: (NSDictionary *)dict - subsetMapping: (EOMKKDSubsetMapping *)subsetMapping -{ - return [[self newDictionaryFromDictionary: dict - subsetMapping: subsetMapping - zone: NULL] autorelease]; -} - + (id)newDictionaryFromDictionary: (NSDictionary*)dict subsetMapping: (EOMKKDSubsetMapping*)subsetMapping zone: (NSZone*)zone @@ -584,6 +577,14 @@ RCS_ID("$Id$") return newDict; } ++ (id)dictionaryFromDictionary: (NSDictionary *)dict + subsetMapping: (EOMKKDSubsetMapping *)subsetMapping +{ + return [[self newDictionaryFromDictionary: dict + subsetMapping: subsetMapping + zone: NULL] autorelease]; +} + + (id)newDictionaryWithObjects: (id*)objects arrayMapping: (id)mapping zone: (NSZone*)zone diff --git a/EOControl/EONSAddOns.m b/EOControl/EONSAddOns.m index b108922..6980dce 100644 --- a/EOControl/EONSAddOns.m +++ b/EOControl/EONSAddOns.m @@ -422,7 +422,7 @@ RCS_ID("$Id$") - (NSComparisonResult)eoCompareOnName: (id)object { - return [[self name] compare: [object name]]; + return [(NSString *)[(id)self name] compare: [object name]]; } @end diff --git a/EOControl/EOObjectStoreCoordinator.m b/EOControl/EOObjectStoreCoordinator.m index f35c2df..62f79f5 100644 --- a/EOControl/EOObjectStoreCoordinator.m +++ b/EOControl/EOObjectStoreCoordinator.m @@ -62,12 +62,12 @@ NSString *EOCooperatingObjectStoreNeeded = @"EOCooperatingObjectStoreNeeded"; - (void)dealloc { - NSDebugMLog(@"dealloc coordinator"); + NSDebugMLog(@"dealloc coordinator", ""); DESTROY(_stores); DESTROY(_userInfo); [super dealloc]; - NSDebugMLog(@"dealloc coordinator end"); + NSDebugMLog(@"dealloc coordinator end", ""); } - (void)addCooperatingObjectStore: (EOCooperatingObjectStore *)store diff --git a/EOControl/EOQualifier.m b/EOControl/EOQualifier.m index 3b33aa4..70f32fa 100644 --- a/EOControl/EOQualifier.m +++ b/EOControl/EOQualifier.m @@ -49,6 +49,8 @@ RCS_ID("$Id$") #import #import +#include + @implementation NSNumber (EOQualifierExtras) @@ -127,7 +129,7 @@ static NSString *getOperator(const char **cFormat, const char **s) { while (**s && !isalnum(**s) && !isspace(**s) && **s != '%' && **s != '\'') { - NSDebugLog(@"avoid gcc 3.1.1 bug which optimizes to segfault"); + NSDebugLog(@"avoid gcc 3.1.1 bug which optimizes to segfault", ""); (*s)++; } @@ -811,7 +813,7 @@ static Class whichQualifier(const char **cFormat, const char **s) { if ((self = [super init])) { - _key = [[coder decodeObject] retain]; + _key = RETAIN([coder decodeObject]); } return self; @@ -873,13 +875,12 @@ static Class whichQualifier(const char **cFormat, const char **s) - (BOOL)isNotEqualTo: (id)object { - return ([self isEqual: object] ? NO : YES); + return ([self isEqualTo: object] ? NO : YES); } - (BOOL)doesContain: (id)object { - if ([self isKindOfClass: [NSArray class]] - || [self isKindOfClass: [NSMutableArray class]]) + if ([self isKindOfClass: [NSArray class]]) return [(NSArray *)self containsObject: object]; return NO; diff --git a/EOControl/EOSortOrdering.m b/EOControl/EOSortOrdering.m index e54caa5..27f5bc8 100644 --- a/EOControl/EOSortOrdering.m +++ b/EOControl/EOSortOrdering.m @@ -65,7 +65,7 @@ RCS_ID("$Id$") self = [super init]; [coder decodeValueOfObjCType: @encode(SEL) at: &_selector]; - _key = [[coder decodeObject] retain]; + _key = RETAIN([coder decodeObject]); return self; } @@ -129,12 +129,17 @@ RCS_ID("$Id$") return self; else { - NSMutableArray *sortedArray = [[self mutableCopy] autorelease]; + NSMutableArray *sortedArray = [[NSMutableArray alloc] + initWithArray: self copyItems: NO]; + NSArray *result; [sortedArray sortUsingKeyOrderArray: orderArray]; // make array immutable but don't copy as mutable arrays copy deep - return [NSArray arrayWithArray: sortedArray]; + result = [NSArray arrayWithArray: sortedArray]; + [sortedArray release]; + + return result; } } @@ -275,18 +280,18 @@ RCS_ID("$Id$") if (count > 1) { - EOSortOrdering *order; - NSEnumerator *orderEnum; + int i, max; //NSString *key; - - orderEnum = [orderArray objectEnumerator]; - if ((order = [orderEnum nextObject])) - { + + max = [orderArray count]; + for (i = 0; i < max; i++) + { + EOSortOrdering *order = [orderArray objectAtIndex: i]; //id a, b; - + [self _sortUsingKeyOrder: order fromIndex: 0 - count: [self count]]; + count: count]; #if 0 key = [order key]; diff --git a/Tools/GNUmakefile b/Tools/GNUmakefile index c361979..8235e6a 100644 --- a/Tools/GNUmakefile +++ b/Tools/GNUmakefile @@ -32,7 +32,7 @@ include $(GNUSTEP_MAKEFILES)/common.make include ../Version # The library to be compiled -TOOL_NAME=gdlgsdoc +TOOL_NAME=gdlgsdoc eoutil LIBRARIES_DEPEND_UPON=-lgnustep-base -lgnustep-db2control -lgnustep-db2 @@ -81,6 +81,11 @@ gdl2gsdoc_AGSDOC_FLAGS = \ }' -Up gdl2gsdoc +eoutil_OBJC_FILES = eoutil.m + +eoutil_HEADER_FILES = + + -include Makefile.preamble -include GNUmakefile.local