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
bae46fb2
Commit
bae46fb2
authored
May 15, 2017
by
Hans Leidekker
Committed by
Alexandre Julliard
May 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Properly handle readers positioned at BOF or EOF in WsCopyNode.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b37f7e81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
19 deletions
+73
-19
reader.c
dlls/webservices/reader.c
+38
-19
writer.c
dlls/webservices/tests/writer.c
+35
-0
No files found.
dlls/webservices/reader.c
View file @
bae46fb2
...
...
@@ -407,25 +407,6 @@ static void clear_prefixes( struct prefix *prefixes, ULONG count )
}
}
HRESULT
copy_node
(
WS_XML_READER
*
handle
,
struct
node
**
node
)
{
struct
reader
*
reader
=
(
struct
reader
*
)
handle
;
HRESULT
hr
;
EnterCriticalSection
(
&
reader
->
cs
);
if
(
reader
->
magic
!=
READER_MAGIC
)
{
LeaveCriticalSection
(
&
reader
->
cs
);
return
E_INVALIDARG
;
}
hr
=
dup_tree
(
node
,
reader
->
current
);
LeaveCriticalSection
(
&
reader
->
cs
);
return
hr
;
}
static
HRESULT
set_prefix
(
struct
prefix
*
prefix
,
const
WS_XML_STRING
*
str
,
const
WS_XML_STRING
*
ns
)
{
if
(
str
)
...
...
@@ -1654,6 +1635,44 @@ static HRESULT read_node( struct reader *reader )
}
}
HRESULT
copy_node
(
WS_XML_READER
*
handle
,
struct
node
**
node
)
{
struct
reader
*
reader
=
(
struct
reader
*
)
handle
;
const
struct
list
*
ptr
;
const
struct
node
*
start
;
HRESULT
hr
;
EnterCriticalSection
(
&
reader
->
cs
);
if
(
reader
->
magic
!=
READER_MAGIC
)
{
LeaveCriticalSection
(
&
reader
->
cs
);
return
E_INVALIDARG
;
}
if
(
reader
->
current
!=
reader
->
root
)
ptr
=
&
reader
->
current
->
entry
;
else
/* copy whole tree */
{
if
(
!
read_end_of_data
(
reader
))
{
for
(;;)
{
if
((
hr
=
read_node
(
reader
))
!=
S_OK
)
goto
done
;
if
(
node_type
(
reader
->
current
)
==
WS_XML_NODE_TYPE_EOF
)
break
;
}
}
ptr
=
list_head
(
&
reader
->
root
->
children
);
}
start
=
LIST_ENTRY
(
ptr
,
struct
node
,
entry
);
if
(
node_type
(
start
)
==
WS_XML_NODE_TYPE_EOF
)
hr
=
WS_E_INVALID_OPERATION
;
else
hr
=
dup_tree
(
node
,
start
);
done:
LeaveCriticalSection
(
&
reader
->
cs
);
return
hr
;
}
/**************************************************************************
* WsReadEndElement [webservices.@]
*/
...
...
dlls/webservices/tests/writer.c
View file @
bae46fb2
...
...
@@ -2003,6 +2003,41 @@ static void test_WsCopyNode(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
node
->
nodeType
==
WS_XML_NODE_TYPE_EOF
,
"got %u
\n
"
,
node
->
nodeType
);
/* reader positioned at EOF */
hr
=
WsCreateXmlBuffer
(
heap
,
NULL
,
0
,
&
buffer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsSetOutputToBuffer
(
writer
,
buffer
,
NULL
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsCopyNode
(
writer
,
reader
,
NULL
);
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
/* reader positioned at BOF */
hr
=
set_input
(
reader
,
"<v/>"
,
sizeof
(
"<v/>"
)
-
1
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsFillReader
(
reader
,
sizeof
(
"<v/>"
)
-
1
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
node
->
nodeType
==
WS_XML_NODE_TYPE_BOF
,
"got %u
\n
"
,
node
->
nodeType
);
hr
=
WsCreateXmlBuffer
(
heap
,
NULL
,
0
,
&
buffer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsSetOutputToBuffer
(
writer
,
buffer
,
NULL
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsCopyNode
(
writer
,
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output_buffer
(
buffer
,
"<v/>"
,
__LINE__
);
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
node
->
nodeType
==
WS_XML_NODE_TYPE_EOF
,
"got %u
\n
"
,
node
->
nodeType
);
WsFreeReader
(
reader
);
WsFreeWriter
(
writer
);
WsFreeHeap
(
heap
);
...
...
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