1 //---------------------------------------------------------------------------------------
3 // Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
4 //---------------------------------------------------------------------------------------
6 #import "OCMBoxedReturnValueProvider.h"
9 @implementation OCMBoxedReturnValueProvider
11 - (void)handleInvocation:(NSInvocation *)anInvocation
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];
15 void *buffer = malloc([[anInvocation methodSignature] methodReturnLength]);
16 [returnValue getValue:buffer];
17 [anInvocation setReturnValue:buffer];