widl: Pass a state into marshall_arguments and unmarshall_arguments to
decide which parameters should be considered based on their direction.
This commit is contained in:
parent
24d1b71d91
commit
7e5cf94f13
|
@ -227,7 +227,7 @@ static void write_function_stubs(type_t *iface)
|
|||
|
||||
|
||||
/* marshal arguments */
|
||||
marshall_arguments(client, indent, func, &type_offset);
|
||||
marshall_arguments(client, indent, func, &type_offset, PASS_IN);
|
||||
|
||||
/* send/receive message */
|
||||
/* print_client("NdrNsSendReceive(\n"); */
|
||||
|
|
|
@ -198,7 +198,7 @@ static void write_function_stubs(type_t *iface)
|
|||
indent -= 2;
|
||||
fprintf(server, "\n");
|
||||
|
||||
unmarshall_arguments(server, indent, func, &type_offset);
|
||||
unmarshall_arguments(server, indent, func, &type_offset, PASS_OUT);
|
||||
}
|
||||
|
||||
print_server("if (_StubMsg.Buffer > _StubMsg.BufferEnd)\n");
|
||||
|
|
|
@ -281,7 +281,8 @@ unsigned int get_required_buffer_size(type_t *type)
|
|||
}
|
||||
}
|
||||
|
||||
void marshall_arguments(FILE *file, int indent, func_t *func, unsigned int *type_offset)
|
||||
void marshall_arguments(FILE *file, int indent, func_t *func,
|
||||
unsigned int *type_offset, enum pass pass)
|
||||
{
|
||||
unsigned int last_size = 0;
|
||||
var_t *var;
|
||||
|
@ -293,6 +294,26 @@ void marshall_arguments(FILE *file, int indent, func_t *func, unsigned int *type
|
|||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
for (; var; *type_offset += get_size_typeformatstring_var(var), var = PREV_LINK(var))
|
||||
{
|
||||
int in_attr = is_attr(var->attrs, ATTR_IN);
|
||||
int out_attr = is_attr(var->attrs, ATTR_OUT);
|
||||
|
||||
if (!in_attr && !out_attr)
|
||||
in_attr = 1;
|
||||
|
||||
switch (pass)
|
||||
{
|
||||
case PASS_IN:
|
||||
if (!in_attr)
|
||||
continue;
|
||||
break;
|
||||
case PASS_OUT:
|
||||
if (!out_attr)
|
||||
continue;
|
||||
break;
|
||||
case PASS_RETURN:
|
||||
break;
|
||||
}
|
||||
|
||||
if (var->ptr_level == 0 && !var->array)
|
||||
{
|
||||
unsigned int size;
|
||||
|
@ -413,7 +434,8 @@ void marshall_arguments(FILE *file, int indent, func_t *func, unsigned int *type
|
|||
}
|
||||
}
|
||||
|
||||
void unmarshall_arguments(FILE *file, int indent, func_t *func, unsigned int *type_offset)
|
||||
void unmarshall_arguments(FILE *file, int indent, func_t *func,
|
||||
unsigned int *type_offset, enum pass pass)
|
||||
{
|
||||
unsigned int last_size = 0;
|
||||
var_t *var;
|
||||
|
@ -425,6 +447,26 @@ void unmarshall_arguments(FILE *file, int indent, func_t *func, unsigned int *ty
|
|||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
for (; var; *type_offset += get_size_typeformatstring_var(var), var = PREV_LINK(var))
|
||||
{
|
||||
int in_attr = is_attr(var->attrs, ATTR_IN);
|
||||
int out_attr = is_attr(var->attrs, ATTR_OUT);
|
||||
|
||||
if (!in_attr && !out_attr)
|
||||
in_attr = 1;
|
||||
|
||||
switch (pass)
|
||||
{
|
||||
case PASS_IN:
|
||||
if (!in_attr)
|
||||
continue;
|
||||
break;
|
||||
case PASS_OUT:
|
||||
if (!out_attr)
|
||||
continue;
|
||||
break;
|
||||
case PASS_RETURN:
|
||||
break;
|
||||
}
|
||||
|
||||
if (var->ptr_level == 0 && !var->array)
|
||||
{
|
||||
unsigned int size;
|
||||
|
|
|
@ -20,10 +20,17 @@
|
|||
*/
|
||||
|
||||
|
||||
enum pass
|
||||
{
|
||||
PASS_IN,
|
||||
PASS_OUT,
|
||||
PASS_RETURN
|
||||
};
|
||||
|
||||
void write_procformatstring(FILE *file, type_t *iface);
|
||||
void write_typeformatstring(FILE *file, type_t *iface);
|
||||
unsigned int get_required_buffer_size(type_t *type);
|
||||
void marshall_arguments(FILE *file, int indent, func_t *func, unsigned int *type_offset);
|
||||
void unmarshall_arguments(FILE *file, int indent, func_t *func, unsigned int *type_offset);
|
||||
void marshall_arguments(FILE *file, int indent, func_t *func, unsigned int *type_offset, enum pass pass);
|
||||
void unmarshall_arguments(FILE *file, int indent, func_t *func, unsigned int *type_offset, enum pass pass);
|
||||
size_t get_size_procformatstring_var(var_t *var);
|
||||
size_t get_size_typeformatstring_var(var_t *var);
|
||||
|
|
Loading…
Reference in New Issue