Module: wine Branch: master Commit: 6dd5afd723703c67d79cf8d27e08250a6ad73dba URL: http://source.winehq.org/git/wine.git/?a=commit;h=6dd5afd723703c67d79cf8d27e...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Jan 24 20:05:22 2007 +0100
widl: Export a function to compute the proc format string size for a function.
---
tools/widl/server.c | 10 +--------- tools/widl/typegen.c | 37 +++++++++++++++++++++---------------- tools/widl/typegen.h | 1 + 3 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/tools/widl/server.c b/tools/widl/server.c index 56c2761..75b9647 100644 --- a/tools/widl/server.c +++ b/tools/widl/server.c @@ -270,15 +270,7 @@ static void write_function_stubs(type_t fprintf(server, "\n");
/* update proc_offset */ - if (func->args) - { - LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) - *proc_offset += get_size_procformatstring_var(var); - } - if (!is_void(def->type, NULL)) - *proc_offset += get_size_procformatstring_var(def); - else - *proc_offset += 2; /* FC_END and FC_PAD */ + *proc_offset += get_size_procformatstring_func( func ); } }
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 1e6c2da..ac3ab94 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -1971,6 +1971,25 @@ size_t get_size_procformatstring_var(con }
+size_t get_size_procformatstring_func(const func_t *func) +{ + const var_t *var; + size_t size = 0; + + /* argument list size */ + if (func->args) + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) + size += get_size_procformatstring_var(var); + + /* return value size */ + if (is_void(func->def->type, NULL)) + size += 2; /* FC_END and FC_PAD */ + else + size += get_size_procformatstring_var(func->def); + + return size; +} + size_t get_size_typeformatstring_var(const var_t *var) { unsigned int type_offset = 0; @@ -1983,7 +2002,6 @@ size_t get_size_procformatstring(const i const ifref_t *iface; size_t size = 1; const func_t *func; - const var_t *var;
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry ) { @@ -1991,22 +2009,9 @@ size_t get_size_procformatstring(const i continue;
if (iface->iface->funcs) - { LIST_FOR_EACH_ENTRY( func, iface->iface->funcs, const func_t, entry ) - { - /* argument list size */ - if (func->args) - LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) - size += get_size_procformatstring_var(var); - - var = func->def; - /* return value size */ - if (is_void(var->type, NULL)) - size += 2; - else - size += get_size_procformatstring_var(var); - } - } + if (!is_local(func->def->attrs)) + size += get_size_procformatstring_func( func ); } return size; } diff --git a/tools/widl/typegen.h b/tools/widl/typegen.h index dcbe4d3..7ebf6d9 100644 --- a/tools/widl/typegen.h +++ b/tools/widl/typegen.h @@ -42,6 +42,7 @@ size_t get_type_memsize(const type_t *ty void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, enum pass pass, const var_t *var, const char *varname); void write_remoting_arguments(FILE *file, int indent, const func_t *func, unsigned int *type_offset, enum pass pass, enum remoting_phase phase); size_t get_size_procformatstring_var(const var_t *var); +size_t get_size_procformatstring_func(const func_t *func); size_t get_size_typeformatstring_var(const var_t *var); size_t get_size_procformatstring(const ifref_list_t *ifaces, int for_objects); size_t get_size_typeformatstring(const ifref_list_t *ifaces, int for_objects);