Invocation fixups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16412 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-04-10 12:34:05 +00:00
parent 07aaa54e02
commit e9b6860374
3 changed files with 20 additions and 10 deletions

View file

@ -1,3 +1,10 @@
2003-04-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/callframe.m:
* Source/cifframe.m:
Fix error in returning data via pointer arguments ... was writing to
wrong memory location.
2003-04-09 Richard Frith-Macdonald <rfm@gnu.org> 2003-04-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSTcpPort.m: * Source/GSTcpPort.m:

View file

@ -674,7 +674,7 @@ callframe_build_return (NSInvocation *inv,
{ {
/* Step through all the arguments, finding the ones that were /* Step through all the arguments, finding the ones that were
passed by reference. */ passed by reference. */
for (tmptype = objc_skip_argspec (tmptype), argnum = 0; for (tmptype = objc_skip_argspec (tmptype), argnum = 0;
*tmptype != '\0'; *tmptype != '\0';
tmptype = objc_skip_argspec (tmptype), argnum++) tmptype = objc_skip_argspec (tmptype), argnum++)
{ {
@ -694,9 +694,10 @@ callframe_build_return (NSInvocation *inv,
ctxt->flags = flags; ctxt->flags = flags;
if (*tmptype == _C_PTR if (*tmptype == _C_PTR
&& ((flags & _F_OUT) || !(flags & _F_IN))) && ((flags & _F_OUT) || !(flags & _F_IN)))
{ {
void *ptr; void *ptr;
/* The argument is a pointer (to a non-char), and /* The argument is a pointer (to a non-char), and
the pointer's value is qualified as an OUT the pointer's value is qualified as an OUT
parameter, or it not explicitly qualified as an parameter, or it not explicitly qualified as an
@ -705,11 +706,12 @@ callframe_build_return (NSInvocation *inv,
tmptype++; tmptype++;
ctxt->type = tmptype; ctxt->type = tmptype;
(*decoder) (ctxt); /* Use the original pointer to find the buffer
/* Copy the pointed-to data back to the original * to store the returned data */
pointer */
[inv getArgument: &ptr atIndex: argnum]; [inv getArgument: &ptr atIndex: argnum];
memcpy(ptr, datum, objc_sizeof_type(tmptype)); ctxt->datum = ptr;
(*decoder) (ctxt);
} }
else if (*tmptype == _C_CHARPTR else if (*tmptype == _C_CHARPTR
&& ((flags & _F_OUT) || !(flags & _F_IN))) && ((flags & _F_OUT) || !(flags & _F_IN)))

View file

@ -1102,11 +1102,12 @@ cifframe_build_return (NSInvocation *inv,
tmptype++; tmptype++;
ctxt->type = tmptype; ctxt->type = tmptype;
(*decoder) (ctxt); /* Use the original pointer to find the buffer
/* Copy the pointed-to data back to the original * to store the returned data */
pointer */
[inv getArgument: &ptr atIndex: argnum]; [inv getArgument: &ptr atIndex: argnum];
memcpy(ptr, datum, objc_sizeof_type(tmptype)); ctxt->datum = ptr;
(*decoder) (ctxt);
} }
else if (*tmptype == _C_CHARPTR else if (*tmptype == _C_CHARPTR
&& ((flags & _F_OUT) || !(flags & _F_IN))) && ((flags & _F_OUT) || !(flags & _F_IN)))