Commit fa2b886d authored by Alexandre Julliard's avatar Alexandre Julliard

widl: Also check array pointers for null ref pointers.

parent c70ef629
......@@ -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 )
......
......@@ -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 )
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment