- Fix offset calculation bug in the ProcFormatString.
- Fix offset calculation bug in the marshalling and unmarshalling code.
- Fix typos in the TypeFormatString.
This makes the [string, out, size_is()] parameters work properly.
Modified: trunk/reactos/tools/widl/ChangeLog
Modified: trunk/reactos/tools/widl/client.c
Modified: trunk/reactos/tools/widl/server.c
_____
Modified: trunk/reactos/tools/widl/ChangeLog
--- trunk/reactos/tools/widl/ChangeLog 2005-07-23 11:51:47 UTC (rev
16702)
+++ trunk/reactos/tools/widl/ChangeLog 2005-07-23 11:55:33 UTC (rev
16703)
@@ -1,5 +1,15 @@
ChangeLog
+2005-07-23 ekohl
+
+ tools/widl/client.c
+ tools/widl/server.c
+
+- Fix offset calculation bug in the ProcFormatString.
+- Fix offset calculation bug in the marshalling and unmarshalling code.
+- Fix typos in the TypeFormatString.
+This makes the [string, out, size_is()] parameters work properly.
+
2005-07-17 ekohl
tools/widl/client.c
_____
Modified: trunk/reactos/tools/widl/client.c
--- trunk/reactos/tools/widl/client.c 2005-07-23 11:51:47 UTC (rev
16702)
+++ trunk/reactos/tools/widl/client.c 2005-07-23 11:55:33 UTC (rev
16703)
@@ -108,7 +108,7 @@
get_var_type_offset(var_t *var)
{
unsigned int toffset = 0;
- void *size_is_attr;
+ void *sizeis_attr;
int string_attr;
if (var->ptr_level == 0)
@@ -133,10 +133,10 @@
}
else if (var->ptr_level == 1)
{
- size_is_attr = get_attrp(var->attrs, ATTR_SIZEIS);
+ sizeis_attr = get_attrp(var->attrs, ATTR_SIZEIS);
string_attr = is_attr(var->attrs, ATTR_STRING);
- if (size_is_attr)
+ if (sizeis_attr)
{
if (string_attr)
{
@@ -337,9 +337,6 @@
}
else if (var->type->type == RPC_FC_RP)
{
- var_t *field = var->type->ref->ref->fields;
- int size;
-
if (in_attr & !out_attr)
print_client("0x4d, /* FC_IN_PARAM
*/\n");
else if (!in_attr & out_attr)
@@ -352,17 +349,6 @@
print_client("0x02,\n");
fprintf(client, "#endif\n");
print_client("NdrFcShort(0x%x),\n",
type_offset);
-
- size = 9;
- while (NEXT_LINK(field)) field =
NEXT_LINK(field);
- while (field)
- {
- size++;
- field = PREV_LINK(field);
- }
- if (size % 2)
- size++;
- type_offset += size;
}
else
{
@@ -389,7 +375,6 @@
print_client("0x02,\n");
fprintf(client, "#endif\n");
print_client("NdrFcShort(0x%x),\n",
type_offset);
- type_offset += 4;
// }
// else
// {
@@ -405,6 +390,8 @@
return;
}
+ type_offset += get_var_type_offset(var);
+
var = PREV_LINK(var);
}
}
@@ -552,7 +539,7 @@
print_client("0x%02x,\n", 0x20 +
type_type);
print_client("0x00,\n");
- fprintf(client, "#ifndef _APLHA_\n");
+ fprintf(client, "#ifndef _ALPHA_\n");
print_client("NdrFcShort(0x%02X),\n",
get_var_stack_offset_32(func,
((expr_t *)sizeis_attr)->u.sval));
fprintf(client, "#else\n");
@@ -568,7 +555,7 @@
print_client("0x%02x,\n", 0x20 +
type_type);
print_client("0x00,\n");
- fprintf(client, "#ifndef _APLHA_\n");
+ fprintf(client, "#ifndef _ALPHA_\n");
print_client("NdrFcShort(0x04),\n");
fprintf(client, "#else\n");
print_client("NdrFcShort(0x08),\n");
@@ -967,7 +954,8 @@
indent++;
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
print_client("(unsigned char __RPC_FAR
*)%s,\n", var->name);
-
print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n",
*type_offset + 2);
+
print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n",
+ local_type_offset + 2);
indent--;
fprintf(client, "\n");
print_client("_StubMsg.Buffer = (unsigned char
__RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~0x3);\n");
@@ -1045,7 +1033,8 @@
indent++;
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
print_client("(unsigned char __RPC_FAR *)%s,\n",
var->name);
-
print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n",
*type_offset);
+
print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n",
+ local_type_offset);
indent--;
fprintf(client, "\n");
}
@@ -1126,7 +1115,7 @@
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
print_client("(unsigned char __RPC_FAR
*)%s,\n", var->name);
print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u]);\n",
- *type_offset + 4);
+ local_type_offset + 4);
indent--;
fprintf(client, "\n");
}
@@ -1184,7 +1173,7 @@
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
print_client("(unsigned char __RPC_FAR *
__RPC_FAR *)&%s,\n", var->name);
print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n",
- *type_offset + 4);
+ local_type_offset + 4);
print_client("(unsigned char)0);\n");
indent--;
fprintf(client, "\n");
@@ -1199,7 +1188,7 @@
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
print_client("(unsigned char __RPC_FAR *
__RPC_FAR *)&%s,\n", var->name);
print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n",
- *type_offset + 4);
+ local_type_offset + 4);
print_client("(unsigned char)0);\n");
indent--;
fprintf(client, "\n");
@@ -1282,7 +1271,7 @@
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
print_client("(unsigned char __RPC_FAR *
__RPC_FAR *)&%s,\n", var->name);
print_client("(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%u],\n",
- *type_offset + 4);
+ local_type_offset + 4);
print_client("(unsigned char)0);\n");
indent--;
fprintf(client, "\n");
_____
Modified: trunk/reactos/tools/widl/server.c
--- trunk/reactos/tools/widl/server.c 2005-07-23 11:51:47 UTC (rev
16702)
+++ trunk/reactos/tools/widl/server.c 2005-07-23 11:55:33 UTC (rev
16703)
@@ -342,9 +342,6 @@
}
else if (var->type->type == RPC_FC_RP)
{
- var_t *field = var->type->ref->ref->fields;
- int size;
-
if (in_attr & !out_attr)
print_server("0x4d, /* FC_IN_PARAM
*/\n");
else if (!in_attr & out_attr)
@@ -357,17 +354,6 @@
print_server("0x02,\n");
fprintf(server, "#endif\n");
print_server("NdrFcShort(0x%x),\n",
type_offset);
-
- size = 9;
- while (NEXT_LINK(field)) field =
NEXT_LINK(field);
- while (field)
- {
- size++;
- field = PREV_LINK(field);
- }
- if (size % 2)
- size++;
- type_offset += size;
}
else
{
@@ -392,7 +378,6 @@
print_server("0x02,\n");
fprintf(server, "#endif\n");
print_server("NdrFcShort(0x%x),\n",
type_offset);
- type_offset += 4;
// }
// else
// {
@@ -402,6 +387,8 @@
// }
}
+ type_offset += get_var_type_offset(var);
+
var = PREV_LINK(var);
}
}
@@ -549,7 +536,7 @@
print_server("0x%02x,\n", 0x20 +
type_type);
print_server("0x00,\n");
- fprintf(server, "#ifndef _APLHA_\n");
+ fprintf(server, "#ifndef _ALPHA_\n");
print_server("NdrFcShort(0x%02X),\n",
get_var_stack_offset_32(func,
((expr_t *)sizeis_attr)->u.sval));
fprintf(server, "#else\n");
@@ -565,7 +552,7 @@
print_server("0x%02x,\n", 0x20 +
type_type);
print_server("0x00,\n");
- fprintf(server, "#ifndef _APLHA_\n");
+ fprintf(server, "#ifndef _ALPHA_\n");
print_server("NdrFcShort(0x04),\n");
fprintf(server, "#else\n");
print_server("NdrFcShort(0x08),\n");
@@ -840,10 +827,10 @@
empty_line = 1;
}
-
- /* calculate the next type offset */
- local_type_offset += get_var_type_offset(var);
}
+
+ /* calculate the next type offset */
+ local_type_offset += get_var_type_offset(var);
}
if (empty_line)