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
49bc8b4c
Commit
49bc8b4c
authored
Mar 30, 2016
by
Hans Leidekker
Committed by
Alexandre Julliard
Mar 30, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Add a helper to determine node type.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e4a68fd5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
24 deletions
+29
-24
reader.c
dlls/webservices/reader.c
+19
-19
webservices_private.h
dlls/webservices/webservices_private.h
+5
-0
writer.c
dlls/webservices/writer.c
+5
-5
No files found.
dlls/webservices/reader.c
View file @
49bc8b4c
...
@@ -303,7 +303,7 @@ void free_attribute( WS_XML_ATTRIBUTE *attr )
...
@@ -303,7 +303,7 @@ void free_attribute( WS_XML_ATTRIBUTE *attr )
void
free_node
(
struct
node
*
node
)
void
free_node
(
struct
node
*
node
)
{
{
if
(
!
node
)
return
;
if
(
!
node
)
return
;
switch
(
node
->
hdr
.
node
.
nodeType
)
switch
(
node
_type
(
node
)
)
{
{
case
WS_XML_NODE_TYPE_ELEMENT
:
case
WS_XML_NODE_TYPE_ELEMENT
:
{
{
...
@@ -337,7 +337,7 @@ void free_node( struct node *node )
...
@@ -337,7 +337,7 @@ void free_node( struct node *node )
break
;
break
;
default:
default:
ERR
(
"unhandled type %u
\n
"
,
node
->
hdr
.
node
.
nodeType
);
ERR
(
"unhandled type %u
\n
"
,
node
_type
(
node
)
);
break
;
break
;
}
}
heap_free
(
node
);
heap_free
(
node
);
...
@@ -1117,12 +1117,12 @@ static struct node *read_find_parent( struct reader *reader, const WS_XML_STRING
...
@@ -1117,12 +1117,12 @@ static struct node *read_find_parent( struct reader *reader, const WS_XML_STRING
for
(
parent
=
reader
->
current
;
parent
;
parent
=
parent
->
parent
)
for
(
parent
=
reader
->
current
;
parent
;
parent
=
parent
->
parent
)
{
{
if
(
parent
->
hdr
.
node
.
nodeType
==
WS_XML_NODE_TYPE_BOF
)
if
(
node_type
(
parent
)
==
WS_XML_NODE_TYPE_BOF
)
{
{
if
(
!
localname
)
return
parent
;
if
(
!
localname
)
return
parent
;
return
NULL
;
return
NULL
;
}
}
else
if
(
parent
->
hdr
.
node
.
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
)
else
if
(
node_type
(
parent
)
==
WS_XML_NODE_TYPE_ELEMENT
)
{
{
if
(
!
localname
)
return
parent
;
if
(
!
localname
)
return
parent
;
...
@@ -1540,7 +1540,7 @@ static BOOL move_to_root_element( struct reader *reader )
...
@@ -1540,7 +1540,7 @@ static BOOL move_to_root_element( struct reader *reader )
if
(
!
(
ptr
=
list_head
(
&
reader
->
root
->
children
)))
return
FALSE
;
if
(
!
(
ptr
=
list_head
(
&
reader
->
root
->
children
)))
return
FALSE
;
node
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
node
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
if
(
node
->
hdr
.
node
.
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
)
if
(
node
_type
(
node
)
==
WS_XML_NODE_TYPE_ELEMENT
)
{
{
reader
->
current
=
node
;
reader
->
current
=
node
;
return
TRUE
;
return
TRUE
;
...
@@ -1548,7 +1548,7 @@ static BOOL move_to_root_element( struct reader *reader )
...
@@ -1548,7 +1548,7 @@ static BOOL move_to_root_element( struct reader *reader )
while
((
ptr
=
list_next
(
&
reader
->
root
->
children
,
&
node
->
entry
)))
while
((
ptr
=
list_next
(
&
reader
->
root
->
children
,
&
node
->
entry
)))
{
{
struct
node
*
next
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
struct
node
*
next
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
if
(
n
ext
->
hdr
.
node
.
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
)
if
(
n
ode_type
(
next
)
==
WS_XML_NODE_TYPE_ELEMENT
)
{
{
reader
->
current
=
next
;
reader
->
current
=
next
;
return
TRUE
;
return
TRUE
;
...
@@ -1566,7 +1566,7 @@ static BOOL move_to_next_element( struct reader *reader )
...
@@ -1566,7 +1566,7 @@ static BOOL move_to_next_element( struct reader *reader )
while
((
ptr
=
list_next
(
&
node
->
parent
->
children
,
&
node
->
entry
)))
while
((
ptr
=
list_next
(
&
node
->
parent
->
children
,
&
node
->
entry
)))
{
{
struct
node
*
next
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
struct
node
*
next
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
if
(
n
ext
->
hdr
.
node
.
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
)
if
(
n
ode_type
(
next
)
==
WS_XML_NODE_TYPE_ELEMENT
)
{
{
reader
->
current
=
next
;
reader
->
current
=
next
;
return
TRUE
;
return
TRUE
;
...
@@ -1584,7 +1584,7 @@ static BOOL move_to_prev_element( struct reader *reader )
...
@@ -1584,7 +1584,7 @@ static BOOL move_to_prev_element( struct reader *reader )
while
((
ptr
=
list_prev
(
&
node
->
parent
->
children
,
&
node
->
entry
)))
while
((
ptr
=
list_prev
(
&
node
->
parent
->
children
,
&
node
->
entry
)))
{
{
struct
node
*
prev
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
struct
node
*
prev
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
if
(
prev
->
hdr
.
node
.
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
)
if
(
node_type
(
prev
)
==
WS_XML_NODE_TYPE_ELEMENT
)
{
{
reader
->
current
=
prev
;
reader
->
current
=
prev
;
return
TRUE
;
return
TRUE
;
...
@@ -1601,7 +1601,7 @@ static BOOL move_to_child_element( struct reader *reader )
...
@@ -1601,7 +1601,7 @@ static BOOL move_to_child_element( struct reader *reader )
if
(
!
(
ptr
=
list_head
(
&
reader
->
current
->
children
)))
return
FALSE
;
if
(
!
(
ptr
=
list_head
(
&
reader
->
current
->
children
)))
return
FALSE
;
node
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
node
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
if
(
node
->
hdr
.
node
.
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
)
if
(
node
_type
(
node
)
==
WS_XML_NODE_TYPE_ELEMENT
)
{
{
reader
->
current
=
node
;
reader
->
current
=
node
;
return
TRUE
;
return
TRUE
;
...
@@ -1609,7 +1609,7 @@ static BOOL move_to_child_element( struct reader *reader )
...
@@ -1609,7 +1609,7 @@ static BOOL move_to_child_element( struct reader *reader )
while
((
ptr
=
list_next
(
&
reader
->
current
->
children
,
&
node
->
entry
)))
while
((
ptr
=
list_next
(
&
reader
->
current
->
children
,
&
node
->
entry
)))
{
{
struct
node
*
next
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
struct
node
*
next
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
if
(
n
ext
->
hdr
.
node
.
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
)
if
(
n
ode_type
(
next
)
==
WS_XML_NODE_TYPE_ELEMENT
)
{
{
reader
->
current
=
next
;
reader
->
current
=
next
;
return
TRUE
;
return
TRUE
;
...
@@ -1624,12 +1624,12 @@ static BOOL move_to_end_element( struct reader *reader )
...
@@ -1624,12 +1624,12 @@ static BOOL move_to_end_element( struct reader *reader )
struct
list
*
ptr
;
struct
list
*
ptr
;
struct
node
*
node
=
reader
->
current
;
struct
node
*
node
=
reader
->
current
;
if
(
node
->
hdr
.
node
.
nodeType
!=
WS_XML_NODE_TYPE_ELEMENT
)
return
FALSE
;
if
(
node
_type
(
node
)
!=
WS_XML_NODE_TYPE_ELEMENT
)
return
FALSE
;
if
((
ptr
=
list_tail
(
&
node
->
children
)))
if
((
ptr
=
list_tail
(
&
node
->
children
)))
{
{
struct
node
*
tail
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
struct
node
*
tail
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
if
(
tail
->
hdr
.
node
.
nodeType
==
WS_XML_NODE_TYPE_END_ELEMENT
)
if
(
node_type
(
tail
)
==
WS_XML_NODE_TYPE_END_ELEMENT
)
{
{
reader
->
current
=
tail
;
reader
->
current
=
tail
;
return
TRUE
;
return
TRUE
;
...
@@ -1642,8 +1642,8 @@ static BOOL move_to_parent_element( struct reader *reader )
...
@@ -1642,8 +1642,8 @@ static BOOL move_to_parent_element( struct reader *reader )
{
{
struct
node
*
parent
=
reader
->
current
->
parent
;
struct
node
*
parent
=
reader
->
current
->
parent
;
if
(
parent
&&
(
parent
->
hdr
.
node
.
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
||
if
(
parent
&&
(
node_type
(
parent
)
==
WS_XML_NODE_TYPE_ELEMENT
||
parent
->
hdr
.
node
.
nodeType
==
WS_XML_NODE_TYPE_BOF
))
node_type
(
parent
)
==
WS_XML_NODE_TYPE_BOF
))
{
{
reader
->
current
=
parent
;
reader
->
current
=
parent
;
return
TRUE
;
return
TRUE
;
...
@@ -1905,7 +1905,7 @@ static HRESULT read_get_node_text( struct reader *reader, WS_XML_UTF8_TEXT **ret
...
@@ -1905,7 +1905,7 @@ static HRESULT read_get_node_text( struct reader *reader, WS_XML_UTF8_TEXT **ret
{
{
WS_XML_TEXT_NODE
*
text
;
WS_XML_TEXT_NODE
*
text
;
if
(
reader
->
current
->
hdr
.
node
.
nodeType
!=
WS_XML_NODE_TYPE_TEXT
)
if
(
node_type
(
reader
->
current
)
!=
WS_XML_NODE_TYPE_TEXT
)
return
WS_E_INVALID_FORMAT
;
return
WS_E_INVALID_FORMAT
;
text
=
(
WS_XML_TEXT_NODE
*
)
&
reader
->
current
->
hdr
.
node
;
text
=
(
WS_XML_TEXT_NODE
*
)
&
reader
->
current
->
hdr
.
node
;
...
@@ -1923,7 +1923,7 @@ static HRESULT read_get_attribute_text( struct reader *reader, ULONG index, WS_X
...
@@ -1923,7 +1923,7 @@ static HRESULT read_get_attribute_text( struct reader *reader, ULONG index, WS_X
WS_XML_ELEMENT_NODE
*
elem
=
&
reader
->
current
->
hdr
;
WS_XML_ELEMENT_NODE
*
elem
=
&
reader
->
current
->
hdr
;
WS_XML_ATTRIBUTE
*
attr
;
WS_XML_ATTRIBUTE
*
attr
;
if
(
reader
->
current
->
hdr
.
node
.
nodeType
!=
WS_XML_NODE_TYPE_ELEMENT
)
if
(
node_type
(
reader
->
current
)
!=
WS_XML_NODE_TYPE_ELEMENT
)
return
WS_E_INVALID_FORMAT
;
return
WS_E_INVALID_FORMAT
;
attr
=
elem
->
attributes
[
index
];
attr
=
elem
->
attributes
[
index
];
...
@@ -1977,7 +1977,7 @@ HRESULT WINAPI WsFindAttribute( WS_XML_READER *handle, const WS_XML_STRING *loca
...
@@ -1977,7 +1977,7 @@ HRESULT WINAPI WsFindAttribute( WS_XML_READER *handle, const WS_XML_STRING *loca
if
(
!
reader
||
!
localname
||
!
ns
||
!
index
)
return
E_INVALIDARG
;
if
(
!
reader
||
!
localname
||
!
ns
||
!
index
)
return
E_INVALIDARG
;
if
(
reader
->
current
->
hdr
.
node
.
nodeType
!=
WS_XML_NODE_TYPE_ELEMENT
)
if
(
node_type
(
reader
->
current
)
!=
WS_XML_NODE_TYPE_ELEMENT
)
return
WS_E_INVALID_OPERATION
;
return
WS_E_INVALID_OPERATION
;
if
(
!
find_attribute
(
reader
,
localname
,
ns
,
index
))
if
(
!
find_attribute
(
reader
,
localname
,
ns
,
index
))
...
@@ -2689,7 +2689,7 @@ static BOOL is_empty_text_node( const struct node *node )
...
@@ -2689,7 +2689,7 @@ static BOOL is_empty_text_node( const struct node *node )
const
WS_XML_UTF8_TEXT
*
utf8
;
const
WS_XML_UTF8_TEXT
*
utf8
;
ULONG
i
;
ULONG
i
;
if
(
node
->
hdr
.
node
.
nodeType
!=
WS_XML_NODE_TYPE_TEXT
)
return
FALSE
;
if
(
node
_type
(
node
)
!=
WS_XML_NODE_TYPE_TEXT
)
return
FALSE
;
if
(
text
->
text
->
textType
!=
WS_XML_TEXT_TYPE_UTF8
)
if
(
text
->
text
->
textType
!=
WS_XML_TEXT_TYPE_UTF8
)
{
{
ERR
(
"unhandled text type %u
\n
"
,
text
->
text
->
textType
);
ERR
(
"unhandled text type %u
\n
"
,
text
->
text
->
textType
);
...
@@ -2719,7 +2719,7 @@ static HRESULT read_type_next_node( struct reader *reader, const WS_XML_STRING *
...
@@ -2719,7 +2719,7 @@ static HRESULT read_type_next_node( struct reader *reader, const WS_XML_STRING *
for
(;;)
for
(;;)
{
{
if
((
hr
=
read_node
(
reader
)
!=
S_OK
))
return
hr
;
if
((
hr
=
read_node
(
reader
)
!=
S_OK
))
return
hr
;
type
=
reader
->
current
->
hdr
.
node
.
nodeType
;
type
=
node_type
(
reader
->
current
)
;
if
(
type
==
WS_XML_NODE_TYPE_COMMENT
||
if
(
type
==
WS_XML_NODE_TYPE_COMMENT
||
(
type
==
WS_XML_NODE_TYPE_TEXT
&&
is_empty_text_node
(
reader
->
current
)))
continue
;
(
type
==
WS_XML_NODE_TYPE_TEXT
&&
is_empty_text_node
(
reader
->
current
)))
continue
;
break
;
break
;
...
...
dlls/webservices/webservices_private.h
View file @
49bc8b4c
...
@@ -46,6 +46,11 @@ struct node *alloc_node( WS_XML_NODE_TYPE ) DECLSPEC_HIDDEN;
...
@@ -46,6 +46,11 @@ struct node *alloc_node( WS_XML_NODE_TYPE ) DECLSPEC_HIDDEN;
void
free_node
(
struct
node
*
)
DECLSPEC_HIDDEN
;
void
free_node
(
struct
node
*
)
DECLSPEC_HIDDEN
;
void
destroy_nodes
(
struct
node
*
)
DECLSPEC_HIDDEN
;
void
destroy_nodes
(
struct
node
*
)
DECLSPEC_HIDDEN
;
static
inline
WS_XML_NODE_TYPE
node_type
(
const
struct
node
*
node
)
{
return
node
->
hdr
.
node
.
nodeType
;
}
static
inline
void
*
heap_alloc
(
SIZE_T
size
)
static
inline
void
*
heap_alloc
(
SIZE_T
size
)
{
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
return
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
...
...
dlls/webservices/writer.c
View file @
49bc8b4c
...
@@ -601,8 +601,8 @@ static struct node *write_find_parent_element( struct writer *writer )
...
@@ -601,8 +601,8 @@ static struct node *write_find_parent_element( struct writer *writer )
{
{
struct
node
*
node
=
writer
->
current
;
struct
node
*
node
=
writer
->
current
;
if
(
node
->
hdr
.
node
.
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
)
return
node
;
if
(
node
_type
(
node
)
==
WS_XML_NODE_TYPE_ELEMENT
)
return
node
;
if
(
node
->
parent
->
hdr
.
node
.
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
)
return
node
->
parent
;
if
(
node
_type
(
node
->
parent
)
==
WS_XML_NODE_TYPE_ELEMENT
)
return
node
->
parent
;
return
NULL
;
return
NULL
;
}
}
...
@@ -894,15 +894,15 @@ static HRESULT write_add_element_node( struct writer *writer, const WS_XML_STRIN
...
@@ -894,15 +894,15 @@ static HRESULT write_add_element_node( struct writer *writer, const WS_XML_STRIN
const
WS_XML_STRING
*
localname
,
const
WS_XML_STRING
*
ns
)
const
WS_XML_STRING
*
localname
,
const
WS_XML_STRING
*
ns
)
{
{
struct
node
*
node
;
struct
node
*
node
;
WS_XML_ELEMENT_NODE
*
elem
,
*
current
=
&
writer
->
current
->
hdr
;
WS_XML_ELEMENT_NODE
*
elem
;
HRESULT
hr
;
HRESULT
hr
;
/* flush current start element if necessary */
/* flush current start element if necessary */
if
(
writer
->
state
==
WRITER_STATE_STARTELEMENT
&&
((
hr
=
write_endstartelement
(
writer
))
!=
S_OK
))
if
(
writer
->
state
==
WRITER_STATE_STARTELEMENT
&&
((
hr
=
write_endstartelement
(
writer
))
!=
S_OK
))
return
hr
;
return
hr
;
if
(
!
prefix
&&
current
->
node
.
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
)
if
(
!
prefix
&&
node_type
(
writer
->
current
)
==
WS_XML_NODE_TYPE_ELEMENT
)
prefix
=
current
->
prefix
;
prefix
=
writer
->
current
->
hdr
.
prefix
;
if
(
!
(
node
=
alloc_node
(
WS_XML_NODE_TYPE_ELEMENT
)))
return
E_OUTOFMEMORY
;
if
(
!
(
node
=
alloc_node
(
WS_XML_NODE_TYPE_ELEMENT
)))
return
E_OUTOFMEMORY
;
elem
=
&
node
->
hdr
;
elem
=
&
node
->
hdr
;
...
...
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