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
df5c1b6e
Commit
df5c1b6e
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 writing comments in binary mode.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e0b5496c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
3 deletions
+39
-3
writer.c
dlls/webservices/tests/writer.c
+16
-2
writer.c
dlls/webservices/writer.c
+23
-1
No files found.
dlls/webservices/tests/writer.c
View file @
df5c1b6e
...
...
@@ -3130,8 +3130,10 @@ static void test_repeating_element(void)
static
const
WS_XML_STRING
*
init_xmlstring
(
const
char
*
src
,
WS_XML_STRING
*
str
)
{
if
(
!
src
)
return
NULL
;
str
->
length
=
strlen
(
src
);
str
->
bytes
=
(
BYTE
*
)
src
;
str
->
length
=
strlen
(
src
);
str
->
bytes
=
(
BYTE
*
)
src
;
str
->
dictionary
=
NULL
;
str
->
id
=
0
;
return
str
;
}
...
...
@@ -3453,6 +3455,8 @@ static void test_binary_encoding(void)
{
0x40
,
0x01
,
't'
,
0x05
,
0x02
,
'p'
,
'2'
,
0x01
,
't'
,
0x98
,
0x00
,
0x09
,
0x02
,
'p'
,
'2'
,
0x02
,
'n'
,
's'
,
0x01
};
static
const
char
res103
[]
=
{
0x40
,
0x01
,
't'
,
0x05
,
0x02
,
'p'
,
'2'
,
0x01
,
't'
,
0x98
,
0x04
,
't'
,
'e'
,
's'
,
't'
,
0x09
,
0x02
,
'p'
,
'2'
,
0x02
,
'n'
,
's'
,
0x01
};
static
const
char
res200
[]
=
{
0x02
,
0x07
,
'c'
,
'o'
,
'm'
,
'm'
,
'e'
,
'n'
,
't'
};
WS_XML_WRITER_BINARY_ENCODING
bin
=
{{
WS_XML_WRITER_ENCODING_TYPE_BINARY
}};
WS_XML_WRITER_BUFFER_OUTPUT
buf
=
{{
WS_XML_WRITER_OUTPUT_TYPE_BUFFER
}};
static
const
char
prefix
[]
=
"p"
,
prefix2
[]
=
"p2"
;
...
...
@@ -3460,6 +3464,7 @@ static void test_binary_encoding(void)
const
WS_XML_STRING
*
prefix_ptr
,
*
localname_ptr
,
*
ns_ptr
;
WS_XML_STRING
str
,
str2
,
str3
,
localname2
=
{
1
,
(
BYTE
*
)
"t"
},
empty
=
{
0
,
NULL
};
WS_XML_UTF8_TEXT
utf8
=
{{
WS_XML_TEXT_TYPE_UTF8
}};
WS_XML_COMMENT_NODE
comment
=
{{
WS_XML_NODE_TYPE_COMMENT
}};
WS_XML_WRITER
*
writer
;
HRESULT
hr
;
ULONG
i
;
...
...
@@ -3549,6 +3554,15 @@ static void test_binary_encoding(void)
if
(
hr
==
S_OK
)
check_output_bin
(
writer
,
attr_tests
[
i
].
result
,
attr_tests
[
i
].
len_result
,
__LINE__
);
}
hr
=
WsSetOutput
(
writer
,
&
bin
.
encoding
,
&
buf
.
output
,
NULL
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
comment
.
value
.
bytes
=
(
BYTE
*
)
"comment"
;
comment
.
value
.
length
=
sizeof
(
"comment"
)
-
1
;
hr
=
WsWriteNode
(
writer
,
&
comment
.
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
check_output_bin
(
writer
,
res200
,
sizeof
(
res200
),
__LINE__
);
WsFreeWriter
(
writer
);
}
...
...
dlls/webservices/writer.c
View file @
df5c1b6e
...
...
@@ -3551,7 +3551,7 @@ static HRESULT write_add_comment_node( struct writer *writer, const WS_XML_STRIN
return
S_OK
;
}
static
HRESULT
write_comment
(
struct
writer
*
writer
)
static
HRESULT
write_comment
_text
(
struct
writer
*
writer
)
{
const
WS_XML_COMMENT_NODE
*
comment
=
(
const
WS_XML_COMMENT_NODE
*
)
writer
->
current
;
HRESULT
hr
;
...
...
@@ -3563,6 +3563,28 @@ static HRESULT write_comment( struct writer *writer )
return
S_OK
;
}
static
HRESULT
write_comment_bin
(
struct
writer
*
writer
)
{
const
WS_XML_COMMENT_NODE
*
comment
=
(
const
WS_XML_COMMENT_NODE
*
)
writer
->
current
;
HRESULT
hr
;
if
((
hr
=
write_grow_buffer
(
writer
,
1
))
!=
S_OK
)
return
hr
;
write_char
(
writer
,
RECORD_COMMENT
);
return
write_string
(
writer
,
comment
->
value
.
bytes
,
comment
->
value
.
length
);
}
static
HRESULT
write_comment
(
struct
writer
*
writer
)
{
switch
(
writer
->
output_enc
)
{
case
WS_XML_WRITER_ENCODING_TYPE_TEXT
:
return
write_comment_text
(
writer
);
case
WS_XML_WRITER_ENCODING_TYPE_BINARY
:
return
write_comment_bin
(
writer
);
default:
ERR
(
"unhandled encoding %u
\n
"
,
writer
->
output_enc
);
return
WS_E_NOT_SUPPORTED
;
}
}
static
HRESULT
write_comment_node
(
struct
writer
*
writer
,
const
WS_XML_STRING
*
value
)
{
HRESULT
hr
;
...
...
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