mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
DO patches from Frith-MacDonald
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2573 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7c4c49ef50
commit
d065fb6dd7
3 changed files with 112 additions and 7 deletions
|
@ -655,14 +655,19 @@ mframe_do_call (const char *encoded_types,
|
|||
etmptype = objc_skip_type_qualifiers (encoded_types);
|
||||
tmptype = objc_skip_type_qualifiers (type);
|
||||
|
||||
/* Only encode return values if there is a non-void return value, or
|
||||
if there are values that were passed by reference. */
|
||||
/* xxx Are my tests right? Do we also have to check _F_ONEWAY? */
|
||||
/* Only encode return values if there is a non-void return value,
|
||||
a non-oneway void return value, or if there are values that were
|
||||
passed by reference. */
|
||||
|
||||
/* If there is a return value, encode it. */
|
||||
switch (*tmptype)
|
||||
{
|
||||
case _C_VOID:
|
||||
if ((flags & _F_ONEWAY) == 0)
|
||||
{
|
||||
int dummy = 0;
|
||||
(*encoder) (-1, (void*)&dummy, @encode(int), 0);
|
||||
}
|
||||
/* No return value to encode; do nothing. */
|
||||
break;
|
||||
|
||||
|
@ -904,7 +909,7 @@ mframe_build_return (arglist_t argframe,
|
|||
/* Decode the return value and pass-by-reference values, if there
|
||||
are any. OUT_PARAMETERS should be the value returned by
|
||||
mframe_dissect_call(). */
|
||||
if (out_parameters || *tmptype != _C_VOID)
|
||||
if (out_parameters || *tmptype != _C_VOID || (flags & _F_ONEWAY) == 0)
|
||||
/* xxx What happens with method declared "- (oneway) foo: (out int*)ip;" */
|
||||
/* xxx What happens with method declared "- (in char *) bar;" */
|
||||
/* xxx Is this right? Do we also have to check _F_ONEWAY? */
|
||||
|
@ -913,10 +918,13 @@ mframe_build_return (arglist_t argframe,
|
|||
value, not an argument. */
|
||||
|
||||
/* If there is a return value, decode it, and put it in retframe. */
|
||||
if (*tmptype != _C_VOID)
|
||||
if (*tmptype != _C_VOID || (flags & _F_ONEWAY) == 0)
|
||||
{
|
||||
/* Get the size of the returned value. */
|
||||
retsize = objc_sizeof_type (tmptype);
|
||||
if (*tmptype == _C_VOID)
|
||||
retsize = sizeof(void*);
|
||||
else
|
||||
retsize = objc_sizeof_type (tmptype);
|
||||
/* Allocate memory on the stack to hold the return value.
|
||||
It should be at least 4 * sizeof(void*). */
|
||||
/* xxx We need to test retsize's less than 4. Also note that
|
||||
|
@ -969,6 +977,12 @@ mframe_build_return (arglist_t argframe,
|
|||
(*decoder) (-1, ((char*)retframe), tmptype, flags);
|
||||
break;
|
||||
|
||||
case _C_VOID:
|
||||
{
|
||||
(*decoder) (-1, retframe, @encode(int), 0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* (Among other things, _C_CHARPTR is handled here). */
|
||||
/* Special case BOOL (and other types smaller than int)
|
||||
|
@ -1055,7 +1069,7 @@ mframe_build_return (arglist_t argframe,
|
|||
}
|
||||
}
|
||||
}
|
||||
(*decoder) (0, 0, 0, 0); /* Tell it we have finished. */
|
||||
(*decoder) (0, 0, 0, 0); /* Tell it we have finished. */
|
||||
}
|
||||
else /* matches `if (out_parameters)' */
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue