Hopefully fix semantics for key path handling

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22647 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-03-13 07:00:49 +00:00
parent eba401bc85
commit 6557439b89
2 changed files with 25 additions and 8 deletions

View file

@ -1,3 +1,9 @@
2006-03-13 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSKeyValueCoding.m: Attemptm to fix problems introduced into
keypath code and reported by Helge ... ensure kvc mnethods are called
for each element in the path.
2006-03-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPropertyList.m: Allow for quoting of numeric/date values

View file

@ -311,14 +311,18 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
{
end++;
}
aKey = [[NSString alloc] initWithBytes: buf + start
length: end - start
encoding: NSASCIIStringEncoding];
AUTORELEASE(aKey);
if (end >= size)
{
break;
[o setValue: anObject forKey: aKey];
return;
}
o = ValueForKey(o, buf + start, end - start);
o = [o valueForKey: aKey];
start = ++end;
}
SetValueForKey(o, anObject, buf + start, end - start);
}
@ -702,7 +706,11 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
{
break;
}
o = ValueForKey(o, buf + start, end - start);
aKey = [[NSString alloc] initWithBytes: buf + start
length: end - start
encoding: NSASCIIStringEncoding];
AUTORELEASE(aKey);
o = [o valueForKey: aKey];
start = ++end;
}
if (o == nil)
@ -752,21 +760,24 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
char buf[size+1];
unsigned start = 0;
unsigned end = 0;
id o = nil;
id o = self;
[aKey getCString: buf
maxLength: size+1
encoding: NSASCIIStringEncoding];
while (start < size && self != nil)
while (start < size && o != nil)
{
end = start;
while (end < size && buf[end] != '.')
{
end++;
}
o = ValueForKey(self, buf + start, end - start);
aKey = [[NSString alloc] initWithBytes: buf + start
length: end - start
encoding: NSASCIIStringEncoding];
AUTORELEASE(aKey);
o = [o valueForKey: aKey];
start = ++end;
self = o;
}
return o;
}