mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-21 12:41:19 +00:00
code tidyup and c-99ism fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25341 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
89a0cb9080
commit
324432d9d1
3 changed files with 24 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
|||
2007-07-19 Riccardo Mottola <riccardo@kaffe.org>
|
||||
|
||||
* Source/NSKeyValueCoding.m:
|
||||
* Source/NSKeyValueMutableSet.m:
|
||||
Code cleanup and C99-ism fixes
|
||||
|
||||
2007-07-14 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSKeyValueCoding.m:
|
||||
|
|
|
@ -871,6 +871,7 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
|
|||
NSDictionary *dict;
|
||||
NSException *exp;
|
||||
static IMP o = 0;
|
||||
NSString *reason;
|
||||
|
||||
/* Backward compatibility hack */
|
||||
if (o == 0)
|
||||
|
@ -886,7 +887,7 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
|
|||
self, @"NSTargetObjectUserInfoKey",
|
||||
(aKey ? (id)aKey : (id)@"(nil)"), @"NSUnknownUserInfoKey",
|
||||
nil];
|
||||
NSString * reason = [NSString stringWithFormat:
|
||||
reason = [NSString stringWithFormat:
|
||||
@"Unable to find value for key \"%@\" of object %@ (%@)",
|
||||
aKey, self, [self class]];
|
||||
exp = [NSException exceptionWithName: NSUndefinedKeyException
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
|
||||
+ (NSKeyValueMutableSet *) setForKey: (NSString *)aKey ofObject: (id)anObject
|
||||
{
|
||||
NSKeyValueMutableSet *proxy;
|
||||
unsigned size = [aKey maximumLengthOfBytesUsingEncoding:
|
||||
NSUTF8StringEncoding];
|
||||
char key[size + 1];
|
||||
|
@ -100,7 +101,6 @@
|
|||
*key = toupper(*key);
|
||||
}
|
||||
|
||||
NSKeyValueMutableSet *proxy;
|
||||
|
||||
proxy = [NSKeyValueFastMutableSet setForKey: aKey
|
||||
ofObject: anObject
|
||||
|
@ -454,11 +454,12 @@
|
|||
|
||||
- (void) removeAllObjects
|
||||
{
|
||||
NSSet *nothing;
|
||||
NSSet *theSet = [NSSet setWithSet: [object valueForKey: key]];
|
||||
[object willChangeValueForKey: key
|
||||
withSetMutation: NSKeyValueMinusSetMutation
|
||||
usingObjects: theSet];
|
||||
NSSet *nothing = [NSSet set];
|
||||
nothing = [NSSet set];
|
||||
[setSetInvocation setArgument: ¬hing atIndex: 2];
|
||||
[setSetInvocation invoke];
|
||||
[object didChangeValueForKey: key
|
||||
|
@ -468,11 +469,14 @@
|
|||
|
||||
- (void) addObject: (id)anObject
|
||||
{
|
||||
NSSet *unionSet = [NSSet setWithObject: anObject];
|
||||
NSMutableSet *temp;
|
||||
NSSet *unionSet;
|
||||
|
||||
unionSet = [NSSet setWithObject: anObject];
|
||||
[object willChangeValueForKey: key
|
||||
withSetMutation: NSKeyValueUnionSetMutation
|
||||
usingObjects: unionSet];
|
||||
NSMutableSet *temp = [NSMutableSet setWithSet: [object valueForKey: key]];
|
||||
temp = [NSMutableSet setWithSet: [object valueForKey: key]];
|
||||
[temp addObject: anObject];
|
||||
[setSetInvocation setArgument: &temp atIndex: 2];
|
||||
[setSetInvocation invoke];
|
||||
|
@ -483,11 +487,12 @@
|
|||
|
||||
- (void) removeObject: (id)anObject
|
||||
{
|
||||
NSMutableSet *temp;
|
||||
NSSet *minusSet = [NSSet setWithObject: anObject];
|
||||
[object willChangeValueForKey: key
|
||||
withSetMutation: NSKeyValueMinusSetMutation
|
||||
usingObjects: minusSet];
|
||||
NSMutableSet *temp = [NSMutableSet setWithSet: [object valueForKey: key]];
|
||||
temp = [NSMutableSet setWithSet: [object valueForKey: key]];
|
||||
[temp removeObject: anObject];
|
||||
[setSetInvocation setArgument: &temp atIndex: 2];
|
||||
[setSetInvocation invoke];
|
||||
|
@ -498,10 +503,11 @@
|
|||
|
||||
- (void) unionSet: (id)anObject
|
||||
{
|
||||
NSMutableSet *temp;
|
||||
[object willChangeValueForKey: key
|
||||
withSetMutation: NSKeyValueUnionSetMutation
|
||||
usingObjects: anObject];
|
||||
NSMutableSet *temp = [NSMutableSet setWithSet: [object valueForKey: key]];
|
||||
temp = [NSMutableSet setWithSet: [object valueForKey: key]];
|
||||
[temp unionSet: anObject];
|
||||
[setSetInvocation setArgument: &temp atIndex: 2];
|
||||
[setSetInvocation invoke];
|
||||
|
@ -512,10 +518,11 @@
|
|||
|
||||
- (void) minusSet: (id)anObject
|
||||
{
|
||||
NSMutableSet *temp;
|
||||
[object willChangeValueForKey: key
|
||||
withSetMutation: NSKeyValueMinusSetMutation
|
||||
usingObjects: anObject];
|
||||
NSMutableSet *temp = [NSMutableSet setWithSet: [object valueForKey: key]];
|
||||
temp = [NSMutableSet setWithSet: [object valueForKey: key]];
|
||||
[temp minusSet: anObject];
|
||||
[setSetInvocation setArgument: &temp atIndex: 2];
|
||||
[setSetInvocation invoke];
|
||||
|
@ -526,10 +533,11 @@
|
|||
|
||||
- (void) intersectSet: (id)anObject
|
||||
{
|
||||
NSMutableSet *temp;
|
||||
[object willChangeValueForKey: key
|
||||
withSetMutation: NSKeyValueIntersectSetMutation
|
||||
usingObjects: anObject];
|
||||
NSMutableSet *temp = [NSMutableSet setWithSet: [object valueForKey: key]];
|
||||
temp = [NSMutableSet setWithSet: [object valueForKey: key]];
|
||||
[temp intersectSet: anObject];
|
||||
[setSetInvocation setArgument: &temp atIndex: 2];
|
||||
[setSetInvocation invoke];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue