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
df7e24ff
Commit
df7e24ff
authored
Mar 27, 2020
by
Hans Leidekker
Committed by
Alexandre Julliard
Mar 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Implement WS_TYPE_ATTRIBUTE_FIELD_MAPPING for the reader.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6d5eef9c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
8 deletions
+99
-8
reader.c
dlls/webservices/reader.c
+37
-8
reader.c
dlls/webservices/tests/reader.c
+62
-0
No files found.
dlls/webservices/reader.c
View file @
df7e24ff
...
...
@@ -5968,6 +5968,29 @@ static HRESULT read_type_qname( struct reader *reader, WS_TYPE_MAPPING mapping,
return
S_OK
;
}
static
HRESULT
read_type_description
(
struct
reader
*
reader
,
WS_TYPE_MAPPING
mapping
,
const
WS_XML_STRING
*
localname
,
const
WS_XML_STRING
*
ns
,
const
WS_STRUCT_DESCRIPTION
*
desc
,
WS_READ_OPTION
option
,
WS_HEAP
*
heap
,
void
*
ret
,
ULONG
size
,
BOOL
*
found
)
{
switch
(
option
)
{
case
WS_READ_REQUIRED_POINTER
:
case
WS_READ_OPTIONAL_POINTER
:
{
if
(
size
!=
sizeof
(
desc
))
return
E_INVALIDARG
;
*
(
const
WS_STRUCT_DESCRIPTION
**
)
ret
=
desc
;
*
found
=
TRUE
;
break
;
}
default:
FIXME
(
"read option %u not supported
\n
"
,
option
);
return
E_NOTIMPL
;
}
return
S_OK
;
}
static
BOOL
is_empty_text_node
(
const
struct
node
*
node
)
{
const
WS_XML_TEXT_NODE
*
text
=
(
const
WS_XML_TEXT_NODE
*
)
node
;
...
...
@@ -6165,7 +6188,8 @@ static WS_READ_OPTION get_field_read_option( WS_TYPE type, ULONG options )
}
}
static
HRESULT
read_type_field
(
struct
reader
*
,
const
WS_FIELD_DESCRIPTION
*
,
WS_HEAP
*
,
char
*
,
ULONG
);
static
HRESULT
read_type_field
(
struct
reader
*
,
const
WS_STRUCT_DESCRIPTION
*
,
const
WS_FIELD_DESCRIPTION
*
,
WS_HEAP
*
,
char
*
,
ULONG
);
static
HRESULT
read_type_union
(
struct
reader
*
reader
,
const
WS_UNION_DESCRIPTION
*
desc
,
WS_HEAP
*
heap
,
void
*
ret
,
ULONG
size
,
BOOL
*
found
)
...
...
@@ -6193,7 +6217,7 @@ static HRESULT read_type_union( struct reader *reader, const WS_UNION_DESCRIPTIO
else
{
ULONG
offset
=
desc
->
fields
[
i
]
->
field
.
offset
;
if
((
hr
=
read_type_field
(
reader
,
&
desc
->
fields
[
i
]
->
field
,
heap
,
ret
,
offset
))
!=
S_OK
)
return
hr
;
if
((
hr
=
read_type_field
(
reader
,
NULL
,
&
desc
->
fields
[
i
]
->
field
,
heap
,
ret
,
offset
))
!=
S_OK
)
return
hr
;
*
(
int
*
)((
char
*
)
ret
+
desc
->
enumOffset
)
=
desc
->
fields
[
i
]
->
value
;
}
...
...
@@ -6297,8 +6321,8 @@ static HRESULT read_type_text( struct reader *reader, const WS_FIELD_DESCRIPTION
return
hr
;
}
static
HRESULT
read_type_field
(
struct
reader
*
reader
,
const
WS_
FIELD_DESCRIPTION
*
desc
,
WS_HEAP
*
heap
,
char
*
buf
,
ULONG
offset
)
static
HRESULT
read_type_field
(
struct
reader
*
reader
,
const
WS_
STRUCT_DESCRIPTION
*
desc_struct
,
const
WS_FIELD_DESCRIPTION
*
desc
,
WS_HEAP
*
heap
,
char
*
buf
,
ULONG
offset
)
{
char
*
ptr
;
WS_READ_OPTION
option
;
...
...
@@ -6323,8 +6347,9 @@ static HRESULT read_type_field( struct reader *reader, const WS_FIELD_DESCRIPTIO
switch
(
desc
->
mapping
)
{
case
WS_TYPE_ATTRIBUTE_FIELD_MAPPING
:
FIXME
(
"WS_TYPE_ATTRIBUTE_FIELD_MAPPING not supported
\n
"
);
return
S_OK
;
hr
=
read_type
(
reader
,
WS_ATTRIBUTE_TYPE_MAPPING
,
desc
->
type
,
desc
->
localName
,
desc
->
ns
,
desc_struct
,
option
,
heap
,
ptr
,
size
,
&
found
);
break
;
case
WS_ATTRIBUTE_FIELD_MAPPING
:
hr
=
read_type
(
reader
,
WS_ATTRIBUTE_TYPE_MAPPING
,
desc
->
type
,
desc
->
localName
,
desc
->
ns
,
...
...
@@ -6424,7 +6449,7 @@ static HRESULT read_type_struct( struct reader *reader, WS_TYPE_MAPPING mapping,
for
(
i
=
0
;
i
<
desc
->
fieldCount
;
i
++
)
{
offset
=
desc
->
fields
[
i
]
->
offset
;
if
((
hr
=
read_type_field
(
reader
,
desc
->
fields
[
i
],
heap
,
buf
,
offset
))
!=
S_OK
)
break
;
if
((
hr
=
read_type_field
(
reader
,
desc
,
desc
->
fields
[
i
],
heap
,
buf
,
offset
))
!=
S_OK
)
break
;
}
switch
(
option
)
...
...
@@ -6651,6 +6676,10 @@ static HRESULT read_type( struct reader *reader, WS_TYPE_MAPPING mapping, WS_TYP
hr
=
read_type_qname
(
reader
,
mapping
,
localname
,
ns
,
desc
,
option
,
heap
,
value
,
size
,
found
);
break
;
case
WS_DESCRIPTION_TYPE
:
hr
=
read_type_description
(
reader
,
mapping
,
localname
,
ns
,
desc
,
option
,
heap
,
value
,
size
,
found
);
break
;
case
WS_STRUCT_TYPE
:
hr
=
read_type_struct
(
reader
,
mapping
,
localname
,
ns
,
desc
,
option
,
heap
,
value
,
size
,
found
);
break
;
...
...
@@ -7419,7 +7448,7 @@ static ULONG get_field_size( const WS_FIELD_DESCRIPTION *desc )
static
HRESULT
read_param
(
struct
reader
*
reader
,
const
WS_FIELD_DESCRIPTION
*
desc
,
WS_HEAP
*
heap
,
void
*
ret
)
{
if
(
!
ret
&&
!
(
ret
=
ws_alloc_zero
(
heap
,
get_field_size
(
desc
)
)))
return
WS_E_QUOTA_EXCEEDED
;
return
read_type_field
(
reader
,
desc
,
heap
,
ret
,
0
);
return
read_type_field
(
reader
,
NULL
,
desc
,
heap
,
ret
,
0
);
}
static
HRESULT
read_param_array
(
struct
reader
*
reader
,
const
WS_FIELD_DESCRIPTION
*
desc
,
WS_HEAP
*
heap
,
...
...
dlls/webservices/tests/reader.c
View file @
df7e24ff
...
...
@@ -6841,6 +6841,67 @@ static void test_stream_input(void)
WsFreeReader
(
reader
);
}
static
void
test_description_type
(
void
)
{
static
WS_XML_STRING
ns
=
{
0
,
NULL
},
ns2
=
{
2
,
(
BYTE
*
)
"ns"
},
localname
=
{
1
,
(
BYTE
*
)
"t"
};
static
WS_XML_STRING
val
=
{
3
,
(
BYTE
*
)
"val"
};
HRESULT
hr
;
WS_XML_READER
*
reader
;
WS_HEAP
*
heap
;
WS_FIELD_DESCRIPTION
f
,
f2
,
*
fields
[
2
];
WS_STRUCT_DESCRIPTION
s
;
struct
test
{
const
WS_STRUCT_DESCRIPTION
*
desc
;
INT32
val
;
}
*
test
;
hr
=
WsCreateHeap
(
1
<<
16
,
0
,
NULL
,
0
,
&
heap
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsCreateReader
(
NULL
,
0
,
&
reader
,
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
;
prepare_struct_type_test
(
reader
,
"<t val=
\"
-1
\"
xmlns=
\"
ns
\"
/>"
);
hr
=
WsReadToStartElement
(
reader
,
&
localname
,
&
ns2
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
test
=
NULL
;
hr
=
WsReadType
(
reader
,
WS_ELEMENT_TYPE_MAPPING
,
WS_STRUCT_TYPE
,
&
s
,
WS_READ_REQUIRED_POINTER
,
heap
,
&
test
,
sizeof
(
test
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
test
!=
NULL
,
"test not set
\n
"
);
if
(
test
)
{
ok
(
test
->
val
==
-
1
,
"got %d
\n
"
,
test
->
val
);
ok
(
test
->
desc
==
&
s
,
"got %p
\n
"
,
test
->
desc
);
}
WsFreeReader
(
reader
);
WsFreeHeap
(
heap
);
}
START_TEST
(
reader
)
{
test_WsCreateError
();
...
...
@@ -6891,4 +6952,5 @@ START_TEST(reader)
test_repeating_element_choice
();
test_empty_text_field
();
test_stream_input
();
test_description_type
();
}
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