Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
c173399d
Commit
c173399d
authored
Jun 14, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Move the pointer check functionality to typegen.c.
parent
fa2b886d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
43 deletions
+32
-43
client.c
tools/widl/client.c
+1
-14
proxy.c
tools/widl/proxy.c
+1
-28
typegen.c
tools/widl/typegen.c
+29
-0
typegen.h
tools/widl/typegen.h
+1
-0
widltypes.h
tools/widl/widltypes.h
+0
-1
No files found.
tools/widl/client.c
View file @
c173399d
...
...
@@ -50,19 +50,6 @@ static void print_client( const char *format, ... )
va_end
(
va
);
}
static
void
check_pointers
(
const
var_t
*
func
)
{
const
var_t
*
var
;
if
(
!
type_get_function_args
(
func
->
type
))
return
;
LIST_FOR_EACH_ENTRY
(
var
,
type_get_function_args
(
func
->
type
),
const
var_t
,
entry
)
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
)
{
const
char
*
callconv
=
get_attrp
(
func
->
type
->
attrs
,
ATTR_CALLCONV
);
...
...
@@ -173,7 +160,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
write_full_pointer_init
(
client
,
indent
,
func
,
FALSE
);
/* check pointers */
check_pointers
(
func
);
write_pointer_checks
(
client
,
indent
,
func
);
print_client
(
"RpcTryFinally
\n
"
);
print_client
(
"{
\n
"
);
...
...
tools/widl/proxy.c
View file @
c173399d
...
...
@@ -120,23 +120,6 @@ static void clear_output_vars( const var_list_t *args )
}
}
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
:
return
TRUE
;
default:
return
0
;
}
}
static
int
need_delegation
(
const
type_t
*
iface
)
{
const
type_t
*
parent
=
type_iface_get_inherit
(
iface
);
...
...
@@ -161,16 +144,6 @@ static int need_delegation_indirect(const type_t *iface)
return
get_delegation_indirect
(
iface
,
NULL
);
}
static
void
proxy_check_pointers
(
const
var_list_t
*
args
)
{
const
var_t
*
arg
;
if
(
!
args
)
return
;
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
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
)
{
unsigned
int
type_offset
=
arg
->
type
->
typestring_offset
;
...
...
@@ -303,7 +276,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx,
print_proxy
(
"{
\n
"
);
indent
++
;
print_proxy
(
"NdrProxyInitialize(This, &_RpcMessage, &__frame->_StubMsg, &Object_StubDesc, %d);
\n
"
,
idx
);
proxy_check_pointers
(
type_get_function_args
(
func
->
type
)
);
write_pointer_checks
(
proxy
,
indent
,
func
);
print_proxy
(
"RpcTryFinally
\n
"
);
print_proxy
(
"{
\n
"
);
...
...
tools/widl/typegen.c
View file @
c173399d
...
...
@@ -373,6 +373,23 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att
return
TGT_INVALID
;
}
static
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
:
return
TRUE
;
default:
return
0
;
}
}
static
int
get_padding
(
const
var_list_t
*
fields
)
{
unsigned
short
offset
=
0
;
...
...
@@ -4720,6 +4737,18 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun
print_file
(
file
,
0
,
"
\n
"
);
}
void
write_pointer_checks
(
FILE
*
file
,
int
indent
,
const
var_t
*
func
)
{
const
var_list_t
*
args
=
type_get_function_args
(
func
->
type
);
const
var_t
*
var
;
if
(
!
args
)
return
;
LIST_FOR_EACH_ENTRY
(
var
,
args
,
const
var_t
,
entry
)
if
(
cant_be_null
(
var
))
print_file
(
file
,
indent
,
"if (!%s) RpcRaiseException(RPC_X_NULL_REF_POINTER);
\n
"
,
var
->
name
);
}
int
write_expr_eval_routines
(
FILE
*
file
,
const
char
*
iface
)
{
static
const
char
*
var_name
=
"pS"
;
...
...
tools/widl/typegen.h
View file @
c173399d
...
...
@@ -77,6 +77,7 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
void
declare_stub_args
(
FILE
*
file
,
int
indent
,
const
var_t
*
func
);
void
write_func_param_struct
(
FILE
*
file
,
const
type_t
*
iface
,
const
type_t
*
func
,
const
char
*
var_decl
,
int
add_retval
);
void
write_pointer_checks
(
FILE
*
file
,
int
indent
,
const
var_t
*
func
);
int
write_expr_eval_routines
(
FILE
*
file
,
const
char
*
iface
);
void
write_expr_eval_routine_list
(
FILE
*
file
,
const
char
*
iface
);
void
write_user_quad_list
(
FILE
*
file
);
...
...
tools/widl/widltypes.h
View file @
c173399d
...
...
@@ -544,7 +544,6 @@ void clear_all_offsets(void);
int
is_ptr
(
const
type_t
*
t
);
int
is_array
(
const
type_t
*
t
);
int
cant_be_null
(
const
var_t
*
v
);
#define tsENUM 1
#define tsSTRUCT 2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment