OLD | NEW |
| (Empty) |
1 //------------------------------------------------------------------------------
--------- | |
2 // $Id$ | |
3 // Copyright (c) 2009 by Mulle Kybernetik. See License file for details. | |
4 //------------------------------------------------------------------------------
--------- | |
5 | |
6 #import "OCMBoxedReturnValueProvider.h" | |
7 | |
8 | |
9 @implementation OCMBoxedReturnValueProvider | |
10 | |
11 - (void)handleInvocation:(NSInvocation *)anInvocation | |
12 { | |
13 const char* returnType = [[anInvocation methodSignature] methodReturnTyp
e]; | |
14 const char* valueType = [(NSValue *)returnValue objCType]; | |
15 // ARM64 uses 'B' for BOOLS in method signatures but 'c' in NSValue; tha
t case should match. | |
16 if(strcmp(returnType, valueType) != 0 && !(strcmp(returnType, "B") == 0
&& strcmp(valueType, "c") == 0)) | |
17 @throw [NSException exceptionWithName:NSInvalidArgumentException
reason:@"Return value does not match method signature." userInfo:nil]; | |
18 void *buffer = malloc([[anInvocation methodSignature] methodReturnLength
]); | |
19 [returnValue getValue:buffer]; | |
20 [anInvocation setReturnValue:buffer]; | |
21 free(buffer); | |
22 } | |
23 | |
24 @end | |
OLD | NEW |