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
864559db
Commit
864559db
authored
Aug 25, 2016
by
Hans Leidekker
Committed by
Alexandre Julliard
Aug 26, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Add support for writing WS_STRING and WS_XML_STRING values.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
39509987
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
1 deletion
+97
-1
writer.c
dlls/webservices/tests/writer.c
+51
-1
writer.c
dlls/webservices/writer.c
+46
-0
No files found.
dlls/webservices/tests/writer.c
View file @
864559db
...
...
@@ -577,10 +577,13 @@ static void test_WsWriteType(void)
static
void
test_basic_type
(
void
)
{
static
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"t"
},
ns
=
{
0
,
NULL
};
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"t"
},
ns
=
{
0
,
NULL
}
,
xmlstr
;
GUID
guid
;
WCHAR
*
str
;
WS_STRING
string
;
ULONG
i
;
static
const
struct
{
...
...
@@ -687,6 +690,53 @@ static void test_basic_type(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<t>00000000-0000-0000-0000-000000000000</t>"
,
__LINE__
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
string
.
chars
=
testW
;
string
.
length
=
4
;
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
WS_STRING_TYPE
,
NULL
,
WS_WRITE_REQUIRED_VALUE
,
&
string
,
sizeof
(
string
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<t>test</t>"
,
__LINE__
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
str
=
testW
;
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
WS_WSZ_TYPE
,
NULL
,
WS_WRITE_REQUIRED_POINTER
,
&
str
,
sizeof
(
str
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<t>test</t>"
,
__LINE__
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
xmlstr
.
bytes
=
(
BYTE
*
)
"test"
;
xmlstr
.
length
=
4
;
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
WS_XML_STRING_TYPE
,
NULL
,
WS_WRITE_REQUIRED_VALUE
,
&
xmlstr
,
sizeof
(
xmlstr
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<t>test</t>"
,
__LINE__
);
WsFreeWriter
(
writer
);
}
...
...
dlls/webservices/writer.c
View file @
864559db
...
...
@@ -1516,6 +1516,22 @@ static HRESULT write_type_guid( struct writer *writer, WS_TYPE_MAPPING mapping,
return
write_type_text
(
writer
,
mapping
,
&
utf8
.
text
);
}
static
HRESULT
write_type_string
(
struct
writer
*
writer
,
WS_TYPE_MAPPING
mapping
,
const
WS_STRING_DESCRIPTION
*
desc
,
const
WS_STRING
*
value
)
{
WS_XML_UTF16_TEXT
utf16
;
if
(
desc
)
{
FIXME
(
"description not supported
\n
"
);
return
E_NOTIMPL
;
}
utf16
.
text
.
textType
=
WS_XML_TEXT_TYPE_UTF16
;
utf16
.
bytes
=
(
BYTE
*
)
value
->
chars
;
utf16
.
byteCount
=
value
->
length
*
sizeof
(
WCHAR
);
return
write_type_text
(
writer
,
mapping
,
&
utf16
.
text
);
}
static
HRESULT
write_type_wsz
(
struct
writer
*
writer
,
WS_TYPE_MAPPING
mapping
,
const
WS_WSZ_DESCRIPTION
*
desc
,
const
WCHAR
*
value
)
{
...
...
@@ -1532,6 +1548,22 @@ static HRESULT write_type_wsz( struct writer *writer, WS_TYPE_MAPPING mapping,
return
write_type_text
(
writer
,
mapping
,
&
utf16
.
text
);
}
static
HRESULT
write_type_xml_string
(
struct
writer
*
writer
,
WS_TYPE_MAPPING
mapping
,
const
WS_XML_STRING_DESCRIPTION
*
desc
,
const
WS_XML_STRING
*
value
)
{
WS_XML_UTF8_TEXT
utf8
;
if
(
desc
)
{
FIXME
(
"description not supported
\n
"
);
return
E_NOTIMPL
;
}
utf8
.
text
.
textType
=
WS_XML_TEXT_TYPE_UTF8
;
utf8
.
value
.
bytes
=
value
->
bytes
;
utf8
.
value
.
length
=
value
->
length
;
return
write_type_text
(
writer
,
mapping
,
&
utf8
.
text
);
}
static
HRESULT
write_type
(
struct
writer
*
,
WS_TYPE_MAPPING
,
WS_TYPE
,
const
void
*
,
WS_WRITE_OPTION
,
const
void
*
,
ULONG
);
...
...
@@ -1744,6 +1776,13 @@ static HRESULT write_type( struct writer *writer, WS_TYPE_MAPPING mapping, WS_TY
if
((
hr
=
get_value_ptr
(
option
,
value
,
size
,
(
const
void
**
)
&
ptr
))
!=
S_OK
)
return
hr
;
return
write_type_guid
(
writer
,
mapping
,
desc
,
ptr
);
}
case
WS_STRING_TYPE
:
{
const
WS_STRING
*
ptr
;
if
(
!
option
)
option
=
WS_WRITE_REQUIRED_VALUE
;
if
((
hr
=
get_value_ptr
(
option
,
value
,
size
,
(
const
void
**
)
&
ptr
))
!=
S_OK
)
return
hr
;
return
write_type_string
(
writer
,
mapping
,
desc
,
ptr
);
}
case
WS_WSZ_TYPE
:
{
const
WCHAR
*
ptr
;
...
...
@@ -1754,6 +1793,13 @@ static HRESULT write_type( struct writer *writer, WS_TYPE_MAPPING mapping, WS_TY
if
((
hr
=
get_value_ptr
(
option
,
value
,
size
,
(
const
void
**
)
&
ptr
))
!=
S_OK
)
return
hr
;
return
write_type_wsz
(
writer
,
mapping
,
desc
,
ptr
);
}
case
WS_XML_STRING_TYPE
:
{
const
WS_XML_STRING
*
ptr
;
if
(
!
option
)
option
=
WS_WRITE_REQUIRED_VALUE
;
if
((
hr
=
get_value_ptr
(
option
,
value
,
size
,
(
const
void
**
)
&
ptr
))
!=
S_OK
)
return
hr
;
return
write_type_xml_string
(
writer
,
mapping
,
desc
,
ptr
);
}
default:
FIXME
(
"type %u not supported
\n
"
,
type
);
return
E_NOTIMPL
;
...
...
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