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
6f65dbc0
Commit
6f65dbc0
authored
May 25, 2017
by
Hans Leidekker
Committed by
Alexandre Julliard
May 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Add support for reading comments in binary mode.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b9953cef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
2 deletions
+55
-2
reader.c
dlls/webservices/reader.c
+39
-2
reader.c
dlls/webservices/tests/reader.c
+16
-0
No files found.
dlls/webservices/reader.c
View file @
6f65dbc0
...
...
@@ -1942,7 +1942,7 @@ static HRESULT read_endelement( struct reader *reader )
}
}
static
HRESULT
read_comment
(
struct
reader
*
reader
)
static
HRESULT
read_comment
_text
(
struct
reader
*
reader
)
{
unsigned
int
len
=
0
,
ch
,
skip
;
const
unsigned
char
*
start
;
...
...
@@ -1982,6 +1982,39 @@ static HRESULT read_comment( struct reader *reader )
return
S_OK
;
}
static
HRESULT
read_comment_bin
(
struct
reader
*
reader
)
{
struct
node
*
node
,
*
parent
;
WS_XML_COMMENT_NODE
*
comment
;
unsigned
char
type
;
ULONG
len
;
HRESULT
hr
;
if
((
hr
=
read_byte
(
reader
,
&
type
))
!=
S_OK
)
return
hr
;
if
(
type
!=
RECORD_COMMENT
)
return
WS_E_INVALID_FORMAT
;
if
((
hr
=
read_int31
(
reader
,
&
len
))
!=
S_OK
)
return
hr
;
if
(
!
(
parent
=
find_parent
(
reader
)))
return
WS_E_INVALID_FORMAT
;
if
(
!
(
node
=
alloc_node
(
WS_XML_NODE_TYPE_COMMENT
)))
return
E_OUTOFMEMORY
;
comment
=
(
WS_XML_COMMENT_NODE
*
)
node
;
if
(
!
(
comment
->
value
.
bytes
=
heap_alloc
(
len
)))
{
heap_free
(
node
);
return
E_OUTOFMEMORY
;
}
if
((
hr
=
read_bytes
(
reader
,
comment
->
value
.
bytes
,
len
))
!=
S_OK
)
{
free_node
(
node
);
return
E_OUTOFMEMORY
;
}
comment
->
value
.
length
=
len
;
read_insert_node
(
reader
,
parent
,
node
);
reader
->
state
=
READER_STATE_COMMENT
;
return
S_OK
;
}
static
HRESULT
read_startcdata
(
struct
reader
*
reader
)
{
struct
node
*
node
,
*
endnode
,
*
parent
;
...
...
@@ -2074,7 +2107,7 @@ static HRESULT read_node_text( struct reader *reader )
}
else
if
(
!
read_cmp
(
reader
,
"</"
,
2
))
return
read_endelement_text
(
reader
);
else
if
(
!
read_cmp
(
reader
,
"<![CDATA["
,
9
))
return
read_startcdata
(
reader
);
else
if
(
!
read_cmp
(
reader
,
"<!--"
,
4
))
return
read_comment
(
reader
);
else
if
(
!
read_cmp
(
reader
,
"<!--"
,
4
))
return
read_comment
_text
(
reader
);
else
if
(
!
read_cmp
(
reader
,
"<"
,
1
))
return
read_element_text
(
reader
);
else
if
(
!
read_cmp
(
reader
,
"/>"
,
2
)
||
!
read_cmp
(
reader
,
">"
,
1
))
return
read_startelement_text
(
reader
);
else
return
read_text_text
(
reader
);
...
...
@@ -2106,6 +2139,10 @@ static HRESULT read_node_bin( struct reader *reader )
{
return
read_endelement_bin
(
reader
);
}
else
if
(
type
==
RECORD_COMMENT
)
{
return
read_comment_bin
(
reader
);
}
else
if
(
type
>=
RECORD_SHORT_ELEMENT
&&
type
<=
RECORD_PREFIX_ELEMENT_Z
)
{
return
read_element_bin
(
reader
);
...
...
dlls/webservices/tests/reader.c
View file @
6f65dbc0
...
...
@@ -4516,11 +4516,14 @@ static void test_binary_encoding(void)
{
0x41
,
0x02
,
'p'
,
'2'
,
0x01
,
't'
,
0x09
,
0x02
,
'p'
,
'2'
,
0x02
,
'n'
,
's'
,
0x01
};
static
const
char
res4
[]
=
{
0x41
,
0x02
,
'p'
,
'2'
,
0x01
,
't'
,
0x09
,
0x02
,
'p'
,
'2'
,
0x02
,
'n'
,
's'
,
0x99
,
0x04
,
't'
,
'e'
,
's'
,
't'
};
static
const
char
res200
[]
=
{
0x02
,
0x07
,
'c'
,
'o'
,
'm'
,
'm'
,
'e'
,
'n'
,
't'
};
const
WS_XML_NODE
*
node
;
const
WS_XML_ELEMENT_NODE
*
elem
;
const
WS_XML_ATTRIBUTE
*
attr
;
const
WS_XML_TEXT_NODE
*
text
;
const
WS_XML_UTF8_TEXT
*
utf8
;
const
WS_XML_COMMENT_NODE
*
comment
;
WS_XML_READER
*
reader
;
HRESULT
hr
;
...
...
@@ -4659,6 +4662,19 @@ static void test_binary_encoding(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
node
->
nodeType
==
WS_XML_NODE_TYPE_END_ELEMENT
,
"got %u
\n
"
,
node
->
nodeType
);
/* comment */
hr
=
set_input_bin
(
reader
,
res200
,
sizeof
(
res200
)
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsReadNode
(
reader
,
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_COMMENT
,
"got %u
\n
"
,
node
->
nodeType
);
comment
=
(
const
WS_XML_COMMENT_NODE
*
)
node
;
ok
(
comment
->
value
.
length
==
7
,
"got %u
\n
"
,
comment
->
value
.
length
);
ok
(
!
memcmp
(
comment
->
value
.
bytes
,
"comment"
,
7
),
"wrong data
\n
"
);
WsFreeReader
(
reader
);
}
...
...
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