mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-04-25 05:40:55 +00:00
* EOControl/EOClassDescription.m
(-dictionaryForInstanceProperties): Remove casts. ([NSObject-shallowCopy], [NSObject-snapshot]) ([NSObject-updateFromSnapshot:]): Ditto. ([NSObject-validateValue:forKey:]): Correct key determination and use GSSelectorFromName instead of sel_get_any_uid. ([NSObject-addObject:toPropertyWithKey:]): Use GSSelectorFromName instead of sel_get_any_uid. Minor optimization. ([NSObject-removeObject:fromPropertyWithKey:]): Ditto. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@20711 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
985f02b360
commit
2d006a1535
2 changed files with 36 additions and 30 deletions
|
@ -6,6 +6,15 @@
|
|||
and only initialize instance variable if call to super init was
|
||||
successfull.
|
||||
(-shallowCopy): Correct signature.
|
||||
* EOControl/EOClassDescription.m
|
||||
(-dictionaryForInstanceProperties): Remove casts.
|
||||
([NSObject-shallowCopy], [NSObject-snapshot])
|
||||
([NSObject-updateFromSnapshot:]): Ditto.
|
||||
([NSObject-validateValue:forKey:]): Correct key determination and
|
||||
use GSSelectorFromName instead of sel_get_any_uid.
|
||||
([NSObject-addObject:toPropertyWithKey:]): Use GSSelectorFromName
|
||||
instead of sel_get_any_uid. Minor optimization.
|
||||
([NSObject-removeObject:fromPropertyWithKey:]): Ditto.
|
||||
|
||||
2005-02-13 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
* EOControl/EOClassDescription.m:
|
||||
|
|
|
@ -283,7 +283,7 @@ static NSRecursiveLock *local_lock = nil;
|
|||
EOFLOGObjectFnStart();
|
||||
|
||||
// Get class properties (attributes + relationships)
|
||||
classPropertyNames = [((NSMutableArray*)[NSMutableArray alloc])
|
||||
classPropertyNames = [[NSMutableArray alloc]
|
||||
initWithArray: [self attributeKeys]];
|
||||
[classPropertyNames addObjectsFromArray:
|
||||
[self toOneRelationshipKeys]];
|
||||
|
@ -951,20 +951,23 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
}
|
||||
else
|
||||
{
|
||||
SEL validateSelector=NULL;
|
||||
char buf[size+8]; // 8 characters for validate
|
||||
SEL validateSelector;
|
||||
unsigned length = [key length];
|
||||
unsigned char buf[length + 10];
|
||||
|
||||
strcpy(buf, "validate");
|
||||
[key getCString: &buf[8]];
|
||||
if (islower(buf[8]))
|
||||
buf[8] = toupper(buf[8]);
|
||||
buf[length + 8] = ':';
|
||||
buf[length + 9] = 0;
|
||||
|
||||
validateSelector = sel_get_any_uid(buf);
|
||||
|
||||
|
||||
validateSelector = GSSelectorFromName(buf);
|
||||
if (validateSelector && [self respondsToSelector: validateSelector])
|
||||
{
|
||||
exception = [self performSelector: validateSelector
|
||||
withObject: *valueP];
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EOFLOGObjectFnStop();
|
||||
|
@ -1085,7 +1088,7 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
|
||||
- (NSArray *)shallowCopy
|
||||
{
|
||||
return [((NSMutableArray*)[NSArray alloc]) initWithArray: self];
|
||||
return [[NSArray alloc] initWithArray: self];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -1193,7 +1196,7 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
NSDebugMLLog(@"gsdb", @"TOMANY snap=%p key=%@ ==> value %p=%@",
|
||||
snapshot, key, value, value);
|
||||
|
||||
value = AUTORELEASE([((NSArray*)value) shallowCopy]);
|
||||
value = AUTORELEASE([value shallowCopy]);
|
||||
NSDebugMLLog(@"gsdb", @"TOMANY snap=%p key=%@ ==> value %p=%@",
|
||||
snapshot, key, value, value);
|
||||
|
||||
|
@ -1236,7 +1239,7 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
val = nil;
|
||||
|
||||
if ([val isKindOfClass: GDL2NSArrayClass])
|
||||
val = AUTORELEASE([AUTORELEASE([((NSArray*)val) shallowCopy]) mutableCopy]);
|
||||
val = AUTORELEASE([val mutableCopy]);
|
||||
|
||||
GDL2TakeStoredValueForKeyWithImpPtr(self,&selfTSVFK,val,key);
|
||||
}
|
||||
|
@ -1410,8 +1413,6 @@ toPropertyWithKey: (NSString *)key
|
|||
else
|
||||
{
|
||||
char buf[size+7];
|
||||
char lo;
|
||||
char hi;
|
||||
GDL2IMP_BOOL rtsIMP=NULL;
|
||||
SEL sel=NULL;
|
||||
|
||||
|
@ -1419,16 +1420,15 @@ toPropertyWithKey: (NSString *)key
|
|||
|
||||
strcpy(buf, "addTo");
|
||||
[key getCString: &buf[5]];
|
||||
lo = buf[5];
|
||||
hi = islower(lo) ? toupper(lo) : lo;
|
||||
buf[5] = hi;
|
||||
buf[5] = toupper(buf[5]);
|
||||
buf[size+5] = ':';
|
||||
buf[size+6] = '\0';
|
||||
|
||||
EOFLOGObjectLevelArgs(@"EOGenericRecordKVC", @"A aKey=%@ Method [addToKey:] name=%s",
|
||||
EOFLOGObjectLevelArgs(@"EOGenericRecordKVC",
|
||||
@"A aKey=%@ Method [addToKey:] name=%s",
|
||||
key, buf);
|
||||
|
||||
sel = sel_get_any_uid(buf);
|
||||
sel = GSSelectorFromName(buf);
|
||||
|
||||
if (sel && GDL2RespondsToSelectorWithImpPtr(self,&rtsIMP,sel) == YES)
|
||||
{
|
||||
|
@ -1526,8 +1526,6 @@ toPropertyWithKey: (NSString *)key
|
|||
else
|
||||
{
|
||||
char buf[size+12];
|
||||
char lo;
|
||||
char hi;
|
||||
GDL2IMP_BOOL rtsIMP=NULL;
|
||||
SEL sel=NULL;
|
||||
|
||||
|
@ -1535,16 +1533,15 @@ toPropertyWithKey: (NSString *)key
|
|||
|
||||
strcpy(buf, "removeFrom");
|
||||
[key getCString: &buf[10]];
|
||||
lo = buf[10];
|
||||
hi = islower(lo) ? toupper(lo) : lo;
|
||||
buf[10] = hi;
|
||||
buf[10] = toupper(buf[10]);
|
||||
buf[size+10] = ':';
|
||||
buf[size+11] = '\0';
|
||||
|
||||
EOFLOGObjectLevelArgs(@"EOGenericRecordKVC", @"A aKey=%@ Method [removeFromKey:] name=%s",
|
||||
EOFLOGObjectLevelArgs(@"EOGenericRecordKVC",
|
||||
@"A aKey=%@ Method [removeFromKey:] name=%s",
|
||||
key, buf);
|
||||
|
||||
sel = sel_get_any_uid(buf);
|
||||
sel = GSSelectorFromName(buf);
|
||||
|
||||
if (sel && GDL2RespondsToSelectorWithImpPtr(self,&rtsIMP,sel) == YES)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue