diff --git a/ChangeLog b/ChangeLog index 0fa75ad34..844899b37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ * Source/NSKeyValueCoding.m: Fix termination of method names with nuls from report by Manuel Guesdon. * Source/NSDictionary.m: Implement MacOS-X compatible KVC behavior. + Include webobjects/eof extension, with warnings. * Headers/Foundation/NSProtocolChecker.h: Change deprecated import to include. diff --git a/Source/NSDictionary.m b/Source/NSDictionary.m index 714671163..b9462c5d1 100644 --- a/Source/NSDictionary.m +++ b/Source/NSDictionary.m @@ -37,6 +37,7 @@ #include #include #include +#include #include "GSUserDefaults.h" @implementation NSDictionary @@ -942,7 +943,28 @@ static NSString *indentStrings[] = { */ - (id) valueForKey: (NSString*)key { - return [self objectForKey: key]; + id o = [self objectForKey: key]; + + if (o == nil) + { + if ([key isEqualToString: @"count"] == YES) + { + o = [NSNumber numberWithUnsignedInt: [self count]]; + } + else if ([key isEqualToString: @"allKeys"] == YES) + { + o = [self allKeys]; + } + else if ([key isEqualToString: @"allValues"] == YES) + { + o = [self allValues]; + } + if (o != nil) + { + NSWarnMLog(@"Key '%@' would return nil in MacOS-X Foundation", key); + } + } + return o; } @end