[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fix, Base, NSKeyValueCoding (SetValueForKey())
From: |
Georg Fleischmann |
Subject: |
Fix, Base, NSKeyValueCoding (SetValueForKey()) |
Date: |
Tue, 23 Jun 2009 11:54:06 +0800 |
Hi,
here is a fix for NSKeyValueCoding SetValueForKey() to prefer the key
as is (without leading underscore) before trying with underscore (_key).
My problem: When loading a Nib file with a key named "infoPanel" for
NSApplication, the value gets set to "_infoPanel" instead, which also
exists in GNUstep.
Best wishes,
Georg Fleischmann
*** Source/NSKeyValueCoding.m.old 2009-02-28 14:31:08.000000000 +0800
--- Source/NSKeyValueCoding.m 2009-06-23 11:28:56.000000000 +0800
***************
*** 116,143 ****
if ([[self class] accessInstanceVariablesDirectly] == YES)
{
buf[size+4] = '\0';
- buf[3] = '_';
buf[4] = lo;
! name = &buf[3]; // _key
if (GSObjCFindVariable(self, name, &type, &size, &off) == NO)
{
buf[4] = hi;
buf[3] = 's';
buf[2] = 'i';
! buf[1] = '_';
! name = &buf[1]; // _isKey
if (GSObjCFindVariable(self,
name, &type, &size, &off) == NO)
{
buf[4] = lo;
! name = &buf[4]; // key
if (GSObjCFindVariable(self,
name, &type, &size, &off) == NO)
{
buf[4] = hi;
buf[3] = 's';
buf[2] = 'i';
! name = &buf[2]; // isKey
GSObjCFindVariable(self,
name, &type, &size, &off);
}
--- 116,143 ----
if ([[self class] accessInstanceVariablesDirectly] == YES)
{
buf[size+4] = '\0';
buf[4] = lo;
! name = &buf[4]; // key
if (GSObjCFindVariable(self, name, &type, &size, &off) == NO)
{
buf[4] = hi;
buf[3] = 's';
buf[2] = 'i';
! name = &buf[2]; // isKey
if (GSObjCFindVariable(self,
name, &type, &size, &off) == NO)
{
+ buf[3] = '_';
buf[4] = lo;
! name = &buf[3]; // _key
if (GSObjCFindVariable(self,
name, &type, &size, &off) == NO)
{
buf[4] = hi;
buf[3] = 's';
buf[2] = 'i';
! buf[1] = '_';
! name = &buf[1]; // _isKey
GSObjCFindVariable(self,
name, &type, &size, &off);
}
- Fix, Base, NSKeyValueCoding (SetValueForKey()),
Georg Fleischmann <=