mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
widl: Add support for marshalling and unmarshalling conformant strings.
This commit is contained in:
parent
7f2419ceed
commit
413738810f
@ -128,6 +128,7 @@ static void write_function_stubs(type_t *iface)
|
||||
var_t *var;
|
||||
int method_count = 0;
|
||||
unsigned int proc_offset = 0;
|
||||
unsigned int type_offset = 2;
|
||||
|
||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||
while (func)
|
||||
@ -226,7 +227,7 @@ static void write_function_stubs(type_t *iface)
|
||||
|
||||
|
||||
/* marshal arguments */
|
||||
marshall_arguments(client, indent, func);
|
||||
marshall_arguments(client, indent, func, &type_offset);
|
||||
|
||||
/* send/receive message */
|
||||
/* print_client("NdrNsSendReceive(\n"); */
|
||||
|
@ -95,6 +95,7 @@ static void write_function_stubs(type_t *iface)
|
||||
var_t *var;
|
||||
var_t* explicit_handle_var;
|
||||
unsigned int proc_offset = 0;
|
||||
unsigned int type_offset = 2;
|
||||
|
||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||
while (func)
|
||||
@ -197,7 +198,7 @@ static void write_function_stubs(type_t *iface)
|
||||
indent -= 2;
|
||||
fprintf(server, "\n");
|
||||
|
||||
unmarshall_arguments(server, indent, func);
|
||||
unmarshall_arguments(server, indent, func, &type_offset);
|
||||
}
|
||||
|
||||
print_server("if (_StubMsg.Buffer > _StubMsg.BufferEnd)\n");
|
||||
|
@ -281,7 +281,7 @@ unsigned int get_required_buffer_size(type_t *type)
|
||||
}
|
||||
}
|
||||
|
||||
void marshall_arguments(FILE *file, int indent, func_t *func)
|
||||
void marshall_arguments(FILE *file, int indent, func_t *func, unsigned int *type_offset)
|
||||
{
|
||||
unsigned int last_size = 0;
|
||||
var_t *var;
|
||||
@ -332,8 +332,8 @@ void marshall_arguments(FILE *file, int indent, func_t *func)
|
||||
break;
|
||||
|
||||
default:
|
||||
error("marshall_arguments: Unsupported type: %s (0x%02x, ptr_level: 0)\n", var->name, var->type->type);
|
||||
size = 0;
|
||||
error("Unknown/unsupported type: %s (0x%02x)\n", var->name, var->type->type);
|
||||
}
|
||||
|
||||
if (alignment != 0)
|
||||
@ -351,17 +351,43 @@ void marshall_arguments(FILE *file, int indent, func_t *func)
|
||||
|
||||
last_size = size;
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
if (is_attr(var->attrs, ATTR_STRING))
|
||||
{
|
||||
switch (var->type->type)
|
||||
{
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_WCHAR:
|
||||
print_file(file, indent,
|
||||
"NdrConformantStringMarshall(&_StubMsg, (unsigned char *)%s, &__MIDL_TypeFormatString.Format[%d]);\n",
|
||||
var->name, *type_offset);
|
||||
break;
|
||||
default:
|
||||
error("marshall_arguments: Unsupported [string] type: %s (0x%02x, ptr_level: 1)\n", var->name, var->type->type);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (var->type->type)
|
||||
{
|
||||
default:
|
||||
error("marshall_arguments: Unsupported type: %s (0x%02x, ptr_level: 1)\n", var->name, var->type->type);
|
||||
}
|
||||
}
|
||||
last_size = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
error("marshall_arguments: Pointer level %d not supported for variable %s\n", var->ptr_level, var->name);
|
||||
last_size = 0;
|
||||
last_size = 1;
|
||||
}
|
||||
|
||||
var = PREV_LINK(var);
|
||||
}
|
||||
}
|
||||
|
||||
void unmarshall_arguments(FILE *file, int indent, func_t *func)
|
||||
void unmarshall_arguments(FILE *file, int indent, func_t *func, unsigned int *type_offset)
|
||||
{
|
||||
unsigned int last_size = 0;
|
||||
var_t *var;
|
||||
@ -413,8 +439,8 @@ void unmarshall_arguments(FILE *file, int indent, func_t *func)
|
||||
break;
|
||||
|
||||
default:
|
||||
error("unmarshall_arguments: Unsupported type: %s (0x%02x, ptr_level: 0)\n", var->name, var->type->type);
|
||||
size = 0;
|
||||
error("Unknown/unsupported type: %s (0x%02x)\n", var->name, var->type->type);
|
||||
}
|
||||
|
||||
if (alignment != 0)
|
||||
@ -432,10 +458,36 @@ void unmarshall_arguments(FILE *file, int indent, func_t *func)
|
||||
|
||||
last_size = size;
|
||||
}
|
||||
else if (var->ptr_level == 1)
|
||||
{
|
||||
if (is_attr(var->attrs, ATTR_STRING))
|
||||
{
|
||||
switch (var->type->type)
|
||||
{
|
||||
case RPC_FC_CHAR:
|
||||
case RPC_FC_WCHAR:
|
||||
print_file(file, indent,
|
||||
"NdrConformantStringUnmarshall(&_StubMsg, (unsigned char *)%s, &__MIDL_TypeFormatString.Format[%d], 0);\n",
|
||||
var->name, *type_offset);
|
||||
break;
|
||||
default:
|
||||
error("unmarshall_arguments: Unsupported [string] type: %s (0x%02x, ptr_level: 1)\n", var->name, var->type->type);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (var->type->type)
|
||||
{
|
||||
default:
|
||||
error("unmarshall_arguments: Unsupported type: %s (0x%02x, ptr_level: 1)\n", var->name, var->type->type);
|
||||
}
|
||||
}
|
||||
last_size = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
error("unmarshall_arguments: Pointer level %d not supported for variable %s\n", var->ptr_level, var->name);
|
||||
last_size = 0;
|
||||
last_size = 1;
|
||||
}
|
||||
|
||||
var = PREV_LINK(var);
|
||||
|
@ -23,7 +23,7 @@
|
||||
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);
|
||||
void unmarshall_arguments(FILE *file, int indent, func_t *func);
|
||||
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);
|
||||
size_t get_size_procformatstring_var(var_t *var);
|
||||
size_t get_size_typeformatstring_var(var_t *var);
|
||||
|
Loading…
Reference in New Issue
Block a user