widl: Remove unnecessary casts in the generated code.

This commit is contained in:
Alexandre Julliard 2008-09-15 19:40:51 +02:00
parent cdfec4da31
commit f203263528
2 changed files with 16 additions and 38 deletions

View File

@ -128,7 +128,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
if (has_full_pointer) if (has_full_pointer)
write_full_pointer_free(client, indent, func); write_full_pointer_free(client, indent, func);
print_client("NdrFreeBuffer((PMIDL_STUB_MESSAGE)&__frame->_StubMsg);\n"); print_client("NdrFreeBuffer(&__frame->_StubMsg);\n");
if (!implicit_handle && explicit_generic_handle_var) if (!implicit_handle && explicit_generic_handle_var)
{ {
@ -196,14 +196,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
print_client("{\n"); print_client("{\n");
indent++; indent++;
print_client("NdrClientInitializeNew(\n"); print_client("NdrClientInitializeNew(&_RpcMessage, &__frame->_StubMsg, &%s_StubDesc, %d);\n",
indent++; iface->name, method_count);
print_client("(PRPC_MESSAGE)&_RpcMessage,\n");
print_client("(PMIDL_STUB_MESSAGE)&__frame->_StubMsg,\n");
print_client("(PMIDL_STUB_DESC)&%s_StubDesc,\n", iface->name);
print_client("%d);\n", method_count);
indent--;
fprintf(client, "\n");
if (is_attr(def->attrs, ATTR_IDEMPOTENT) || is_attr(def->attrs, ATTR_BROADCAST)) if (is_attr(def->attrs, ATTR_IDEMPOTENT) || is_attr(def->attrs, ATTR_BROADCAST))
{ {
@ -256,16 +250,11 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
write_remoting_arguments(client, indent, func, "", PASS_IN, PHASE_BUFFERSIZE); write_remoting_arguments(client, indent, func, "", PASS_IN, PHASE_BUFFERSIZE);
print_client("NdrGetBuffer(\n"); print_client("NdrGetBuffer(&__frame->_StubMsg, __frame->_StubMsg.BufferLength, ");
indent++;
print_client("(PMIDL_STUB_MESSAGE)&__frame->_StubMsg,\n");
print_client("__frame->_StubMsg.BufferLength,\n");
if (implicit_handle || explicit_handle_var || explicit_generic_handle_var || context_handle_var) if (implicit_handle || explicit_handle_var || explicit_generic_handle_var || context_handle_var)
print_client("__frame->_Handle);\n"); fprintf(client, "__frame->_Handle);\n\n");
else else
print_client("%s__MIDL_AutoBindHandle);\n", iface->name); fprintf(client,"%s__MIDL_AutoBindHandle);\n\n", iface->name);
indent--;
fprintf(client, "\n");
/* marshal arguments */ /* marshal arguments */
write_remoting_arguments(client, indent, func, "", PASS_IN, PHASE_MARSHAL); write_remoting_arguments(client, indent, func, "", PASS_IN, PHASE_MARSHAL);
@ -274,13 +263,9 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
/* print_client("NdrNsSendReceive(\n"); */ /* print_client("NdrNsSendReceive(\n"); */
/* print_client("(unsigned char *)__frame->_StubMsg.Buffer,\n"); */ /* print_client("(unsigned char *)__frame->_StubMsg.Buffer,\n"); */
/* print_client("(RPC_BINDING_HANDLE *) &%s__MIDL_AutoBindHandle);\n", iface->name); */ /* print_client("(RPC_BINDING_HANDLE *) &%s__MIDL_AutoBindHandle);\n", iface->name); */
print_client("NdrSendReceive(\n"); print_client("NdrSendReceive(&__frame->_StubMsg, __frame->_StubMsg.Buffer);\n\n");
indent++;
print_client("(PMIDL_STUB_MESSAGE)&__frame->_StubMsg,\n");
print_client("(unsigned char *)__frame->_StubMsg.Buffer);\n\n");
indent--;
print_client("__frame->_StubMsg.BufferStart = (unsigned char *)_RpcMessage.Buffer;\n"); print_client("__frame->_StubMsg.BufferStart = _RpcMessage.Buffer;\n");
print_client("__frame->_StubMsg.BufferEnd = __frame->_StubMsg.BufferStart + _RpcMessage.BufferLength;\n"); print_client("__frame->_StubMsg.BufferEnd = __frame->_StubMsg.BufferStart + _RpcMessage.BufferLength;\n");
if (has_out_arg_or_return(func)) if (has_out_arg_or_return(func))
@ -289,11 +274,9 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
print_client("if ((_RpcMessage.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n"); print_client("if ((_RpcMessage.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n");
indent++; indent++;
print_client("NdrConvert(\n"); print_client("NdrConvert(&__frame->_StubMsg, (PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n",
indent++; *proc_offset);
print_client("(PMIDL_STUB_MESSAGE)&__frame->_StubMsg,\n"); indent--;
print_client("(PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n", *proc_offset);
indent -= 2;
} }
/* unmarshall arguments */ /* unmarshall arguments */

View File

@ -126,11 +126,9 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
{ {
print_server("if ((_pRpcMessage->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n"); print_server("if ((_pRpcMessage->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n");
indent++; indent++;
print_server("NdrConvert(\n"); print_server("NdrConvert(&__frame->_StubMsg, (PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n",
indent++; *proc_offset);
print_server("(PMIDL_STUB_MESSAGE)&__frame->_StubMsg,\n"); indent--;
print_server("(PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n", *proc_offset);
indent -= 2;
fprintf(server, "\n"); fprintf(server, "\n");
/* unmarshall arguments */ /* unmarshall arguments */
@ -215,7 +213,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
print_server("RpcRaiseException(_Status);\n"); print_server("RpcRaiseException(_Status);\n");
indent--; indent--;
fprintf(server, "\n"); fprintf(server, "\n");
print_server("__frame->_StubMsg.Buffer = (unsigned char *)_pRpcMessage->Buffer;\n"); print_server("__frame->_StubMsg.Buffer = _pRpcMessage->Buffer;\n");
fprintf(server, "\n"); fprintf(server, "\n");
} }
@ -238,10 +236,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
/* calculate buffer length */ /* calculate buffer length */
fprintf(server, "\n"); fprintf(server, "\n");
print_server("_pRpcMessage->BufferLength =\n"); print_server("_pRpcMessage->BufferLength = __frame->_StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer;\n");
indent++;
print_server("(unsigned int)(__frame->_StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer);\n");
indent--;
indent--; indent--;
fprintf(server, "}\n"); fprintf(server, "}\n");
fprintf(server, "\n"); fprintf(server, "\n");