OLD | NEW |
1 //------------------------------------------------------------------------------
--------- | 1 //------------------------------------------------------------------------------
--------- |
2 // $Id: OCMBoxedReturnValueProvider.m 50 2009-07-16 06:48:19Z erik $ | 2 // $Id$ |
3 // Copyright (c) 2009 by Mulle Kybernetik. See License file for details. | 3 // Copyright (c) 2009 by Mulle Kybernetik. See License file for details. |
4 //------------------------------------------------------------------------------
--------- | 4 //------------------------------------------------------------------------------
--------- |
5 | 5 |
6 #import "OCMBoxedReturnValueProvider.h" | 6 #import "OCMBoxedReturnValueProvider.h" |
7 | 7 |
8 | 8 |
9 @implementation OCMBoxedReturnValueProvider | 9 @implementation OCMBoxedReturnValueProvider |
10 | 10 |
11 - (void)handleInvocation:(NSInvocation *)anInvocation | 11 - (void)handleInvocation:(NSInvocation *)anInvocation |
12 { | 12 { |
13 if(strcmp([[anInvocation methodSignature] methodReturnType], [(NSValue *
)returnValue objCType]) != 0) | 13 if(strcmp([[anInvocation methodSignature] methodReturnType], [(NSValue *
)returnValue objCType]) != 0) |
14 @throw [NSException exceptionWithName:NSInvalidArgumentException
reason:@"Return value does not match method signature." userInfo:nil]; | 14 @throw [NSException exceptionWithName:NSInvalidArgumentException
reason:@"Return value does not match method signature." userInfo:nil]; |
15 void *buffer = malloc([[anInvocation methodSignature] methodReturnLength
]); | 15 void *buffer = malloc([[anInvocation methodSignature] methodReturnLength
]); |
16 [returnValue getValue:buffer]; | 16 [returnValue getValue:buffer]; |
17 [anInvocation setReturnValue:buffer]; | 17 [anInvocation setReturnValue:buffer]; |
18 free(buffer); | 18 free(buffer); |
19 } | 19 } |
20 | 20 |
21 @end | 21 @end |
OLD | NEW |