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
234115c8
Commit
234115c8
authored
Mar 20, 2020
by
Hans Leidekker
Committed by
Alexandre Julliard
Mar 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Implement WS_TYPE_ATTRIBUTE_FIELD_MAPPING for the writer.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9616d258
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
2 deletions
+76
-2
writer.c
dlls/webservices/tests/writer.c
+56
-0
writer.c
dlls/webservices/writer.c
+20
-2
No files found.
dlls/webservices/tests/writer.c
View file @
234115c8
...
...
@@ -4793,6 +4793,61 @@ static void test_stream_output(void)
WsFreeWriter
(
writer
);
}
static
void
test_description_type
(
void
)
{
static
WS_XML_STRING
ns
=
{
0
,
NULL
},
localname
=
{
1
,
(
BYTE
*
)
"t"
},
val
=
{
3
,
(
BYTE
*
)
"val"
};
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_FIELD_DESCRIPTION
f
,
f2
,
*
fields
[
2
];
WS_STRUCT_DESCRIPTION
s
;
struct
test
{
const
WS_STRUCT_DESCRIPTION
*
desc
;
INT32
val
;
}
test
;
hr
=
WsCreateWriter
(
NULL
,
0
,
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
memset
(
&
f
,
0
,
sizeof
(
f
)
);
f
.
mapping
=
WS_TYPE_ATTRIBUTE_FIELD_MAPPING
;
f
.
type
=
WS_DESCRIPTION_TYPE
;
fields
[
0
]
=
&
f
;
memset
(
&
f2
,
0
,
sizeof
(
f2
)
);
f2
.
mapping
=
WS_ATTRIBUTE_FIELD_MAPPING
;
f2
.
localName
=
&
val
;
f2
.
ns
=
&
ns
;
f2
.
offset
=
FIELD_OFFSET
(
struct
test
,
val
);
f2
.
type
=
WS_INT32_TYPE
;
fields
[
1
]
=
&
f2
;
memset
(
&
s
,
0
,
sizeof
(
s
)
);
s
.
size
=
sizeof
(
struct
test
);
s
.
alignment
=
TYPE_ALIGNMENT
(
struct
test
);
s
.
fields
=
fields
;
s
.
fieldCount
=
2
;
s
.
typeLocalName
=
&
localname
;
s
.
typeNs
=
&
ns
;
test
.
desc
=
&
s
;
test
.
val
=
-
1
;
hr
=
set_output
(
writer
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
WS_STRUCT_TYPE
,
&
s
,
WS_WRITE_REQUIRED_VALUE
,
&
test
,
sizeof
(
test
),
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 val=
\"
-1
\"
/>"
,
__LINE__
);
WsFreeWriter
(
writer
);
}
START_TEST
(
writer
)
{
test_WsCreateWriter
();
...
...
@@ -4837,4 +4892,5 @@ START_TEST(writer)
test_text_types_binary
();
test_repeating_element_choice
();
test_stream_output
();
test_description_type
();
}
dlls/webservices/writer.c
View file @
234115c8
...
...
@@ -3760,8 +3760,8 @@ static HRESULT write_type_field( struct writer *writer, const WS_FIELD_DESCRIPTI
return
E_NOTIMPL
;
}
/*
zero-terminated string
s are always pointers */
if
(
desc
->
type
==
WS_WSZ_TYPE
)
field_options
|=
WS_FIELD_POINTER
;
/*
zero-terminated strings and description
s are always pointers */
if
(
desc
->
type
==
WS_WSZ_TYPE
||
desc
->
type
==
WS_DESCRIPTION_TYPE
)
field_options
|=
WS_FIELD_POINTER
;
if
(
field_options
&
WS_FIELD_POINTER
)
size
=
sizeof
(
const
void
*
);
...
...
@@ -3790,6 +3790,10 @@ static HRESULT write_type_field( struct writer *writer, const WS_FIELD_DESCRIPTI
switch
(
desc
->
mapping
)
{
case
WS_TYPE_ATTRIBUTE_FIELD_MAPPING
:
mapping
=
WS_ATTRIBUTE_TYPE_MAPPING
;
break
;
case
WS_ATTRIBUTE_FIELD_MAPPING
:
if
(
!
desc
->
localName
||
!
desc
->
ns
)
return
E_INVALIDARG
;
if
((
hr
=
write_add_attribute
(
writer
,
NULL
,
desc
->
localName
,
desc
->
ns
,
FALSE
))
!=
S_OK
)
...
...
@@ -3910,6 +3914,17 @@ static HRESULT write_type_enum( struct writer *writer, WS_TYPE_MAPPING mapping,
return
write_type_text
(
writer
,
mapping
,
&
utf8
.
text
);
}
static
HRESULT
write_type_description
(
struct
writer
*
writer
,
WS_TYPE_MAPPING
mapping
,
WS_WRITE_OPTION
option
,
const
void
*
value
,
ULONG
size
)
{
const
WS_STRUCT_DESCRIPTION
*
ptr
;
HRESULT
hr
;
if
((
hr
=
get_value_ptr
(
option
,
value
,
size
,
sizeof
(
*
ptr
),
(
const
void
**
)
&
ptr
))
!=
S_OK
)
return
hr
;
if
(
ptr
)
FIXME
(
"ignoring type description %p
\n
"
,
ptr
);
return
S_OK
;
}
static
HRESULT
write_type
(
struct
writer
*
writer
,
WS_TYPE_MAPPING
mapping
,
WS_TYPE
type
,
const
void
*
desc
,
WS_WRITE_OPTION
option
,
const
void
*
value
,
ULONG
size
)
...
...
@@ -3970,6 +3985,9 @@ static HRESULT write_type( struct writer *writer, WS_TYPE_MAPPING mapping, WS_TY
case
WS_XML_QNAME_TYPE
:
return
write_type_qname
(
writer
,
mapping
,
desc
,
option
,
value
,
size
);
case
WS_DESCRIPTION_TYPE
:
return
write_type_description
(
writer
,
mapping
,
option
,
value
,
size
);
case
WS_STRUCT_TYPE
:
return
write_type_struct
(
writer
,
mapping
,
desc
,
option
,
value
,
size
);
...
...
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