Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
9e49a8d2
Commit
9e49a8d2
authored
Aug 11, 2006
by
Dan Hipschman
Committed by
Alexandre Julliard
Aug 12, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Improve pointer null checking logic.
parent
06497dd4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
18 deletions
+56
-18
client.c
tools/widl/client.c
+7
-15
proxy.c
tools/widl/proxy.c
+47
-3
widltypes.h
tools/widl/widltypes.h
+2
-0
No files found.
tools/widl/client.c
View file @
9e49a8d2
...
...
@@ -83,7 +83,6 @@ static void print_message_buffer_size(const func_t *func)
static
void
check_pointers
(
const
func_t
*
func
)
{
var_t
*
var
;
int
pointer_type
;
if
(
!
func
->
args
)
return
;
...
...
@@ -92,21 +91,14 @@ static void check_pointers(const func_t *func)
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
pointer_type
=
get_attrv
(
var
->
attrs
,
ATTR_POINTERTYPE
);
if
(
!
pointer_type
)
pointer_type
=
RPC_FC_RP
;
if
(
pointer_type
==
RPC_FC_RP
)
if
(
is_pointer
(
var
)
&&
cant_be_null
(
var
))
{
if
(
var
->
ptr_level
>=
1
)
{
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
"
);
}
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
"
);
}
var
=
PREV_LINK
(
var
);
...
...
tools/widl/proxy.c
View file @
9e49a8d2
...
...
@@ -181,20 +181,64 @@ static void clear_output_vars( var_t *arg )
}
}
static
int
is_pointer
(
var_t
*
arg
)
int
is_pointer
(
var_t
*
arg
)
{
if
(
arg
->
ptr_level
)
return
1
;
if
(
arg
->
type
->
type
==
RPC_FC_FP
)
switch
(
ref_type
(
arg
->
type
))
{
case
RPC_FC_RP
:
case
RPC_FC_C_CSTRING
:
case
RPC_FC_C_WSTRING
:
case
RPC_FC_FP
:
case
RPC_FC_OP
:
case
RPC_FC_UP
:
return
1
;
}
return
0
;
}
int
cant_be_null
(
var_t
*
v
)
{
/* Search backwards for the most recent pointer attribute. */
const
attr_t
*
attrs
=
v
->
attrs
;
const
type_t
*
type
=
v
->
type
;
if
(
!
attrs
&&
type
)
{
attrs
=
type
->
attrs
;
type
=
type
->
ref
;
}
while
(
attrs
)
{
int
t
=
get_attrv
(
attrs
,
ATTR_POINTERTYPE
);
if
(
t
==
RPC_FC_FP
||
t
==
RPC_FC_OP
||
t
==
RPC_FC_UP
)
return
0
;
if
(
t
==
RPC_FC_RP
)
return
1
;
if
(
type
)
{
attrs
=
type
->
attrs
;
type
=
type
->
ref
;
}
else
attrs
=
NULL
;
}
return
1
;
/* Default is RPC_FC_RP. */
}
static
void
proxy_check_pointers
(
var_t
*
arg
)
{
END_OF_LIST
(
arg
);
while
(
arg
)
{
if
(
is_pointer
(
arg
))
{
if
(
is_pointer
(
arg
)
&&
cant_be_null
(
arg
)
)
{
print_proxy
(
"if(!%s)
\n
"
,
arg
->
name
);
indent
++
;
print_proxy
(
"RpcRaiseException(RPC_X_NULL_REF_POINTER);
\n
"
);
...
...
tools/widl/widltypes.h
View file @
9e49a8d2
...
...
@@ -299,5 +299,7 @@ struct _typelib_t {
/* Get the actual type field for a type (chase down typedef references). */
unsigned
char
ref_type
(
const
type_t
*
type
);
int
is_pointer
(
var_t
*
v
);
int
cant_be_null
(
var_t
*
v
);
#endif
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