Module: wine Branch: master Commit: fa2b886d1d431f35c554d55f26e6f21653ffc5db URL: http://source.winehq.org/git/wine.git/?a=commit;h=fa2b886d1d431f35c554d55f26...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Jun 14 12:55:22 2011 +0200
widl: Also check array pointers for null ref pointers.
---
tools/widl/client.c | 13 ++----------- tools/widl/proxy.c | 17 ++++------------- tools/widl/widltypes.h | 1 - 3 files changed, 6 insertions(+), 25 deletions(-)
diff --git a/tools/widl/client.c b/tools/widl/client.c index 8e259b9..84f480b 100644 --- a/tools/widl/client.c +++ b/tools/widl/client.c @@ -59,17 +59,8 @@ static void check_pointers(const var_t *func) return;
LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) - { - if (is_var_ptr(var) && cant_be_null(var)) - { - print_client("if (!%s)\n", var->name); - print_client("{\n"); - indent++; - print_client("RpcRaiseException(RPC_X_NULL_REF_POINTER);\n"); - indent--; - print_client("}\n\n"); - } - } + if (cant_be_null(var)) + print_client("if (!%s) RpcRaiseException(RPC_X_NULL_REF_POINTER);\n", var->name); }
static void write_client_func_decl( const type_t *iface, const var_t *func ) diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index f4bd8d8..2ff8ea1 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -120,16 +120,13 @@ static void clear_output_vars( const var_list_t *args ) } }
-int is_var_ptr(const var_t *v) -{ - return is_ptr(v->type); -} - int cant_be_null(const var_t *v) { switch (typegen_detect_type(v->type, v->attrs, TDT_IGNORE_STRINGS)) { case TGT_ARRAY: + if (!type_array_is_decl_as_ptr( v->type )) return 0; + /* fall through */ case TGT_POINTER: return (get_pointer_fc(v->type, v->attrs, TRUE) == RPC_FC_RP); case TGT_CTXT_HANDLE_POINTER: @@ -170,14 +167,8 @@ static void proxy_check_pointers( const var_list_t *args )
if (!args) return; LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) - { - if (is_var_ptr(arg) && cant_be_null(arg)) { - print_proxy( "if(!%s)\n", arg->name ); - indent++; - print_proxy( "RpcRaiseException(RPC_X_NULL_REF_POINTER);\n"); - indent--; - } - } + if (cant_be_null(arg)) + print_proxy( "if (!%s) RpcRaiseException(RPC_X_NULL_REF_POINTER);\n", arg->name ); }
static void free_variable( const var_t *arg, const char *local_var_prefix ) diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index ccb9d1a..9e9bec6 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -544,7 +544,6 @@ void clear_all_offsets(void);
int is_ptr(const type_t *t); int is_array(const type_t *t); -int is_var_ptr(const var_t *v); int cant_be_null(const var_t *v);
#define tsENUM 1