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
9c6c813d
Commit
9c6c813d
authored
Sep 13, 2016
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Implement WsWriteArray.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
77b39112
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
127 additions
and
2 deletions
+127
-2
reader.c
dlls/webservices/reader.c
+1
-1
writer.c
dlls/webservices/tests/writer.c
+87
-0
webservices.spec
dlls/webservices/webservices.spec
+1
-1
webservices_private.h
dlls/webservices/webservices_private.h
+1
-0
writer.c
dlls/webservices/writer.c
+35
-0
webservices.h
include/webservices.h
+2
-0
No files found.
dlls/webservices/reader.c
View file @
9c6c813d
...
@@ -3561,7 +3561,7 @@ static HRESULT read_type_next_element_node( struct reader *reader, const WS_XML_
...
@@ -3561,7 +3561,7 @@ static HRESULT read_type_next_element_node( struct reader *reader, const WS_XML_
return
WS_E_INVALID_FORMAT
;
return
WS_E_INVALID_FORMAT
;
}
}
static
ULONG
get_type_size
(
WS_TYPE
type
,
const
WS_STRUCT_DESCRIPTION
*
desc
)
ULONG
get_type_size
(
WS_TYPE
type
,
const
WS_STRUCT_DESCRIPTION
*
desc
)
{
{
switch
(
type
)
switch
(
type
)
{
{
...
...
dlls/webservices/tests/writer.c
View file @
9c6c813d
...
@@ -2223,6 +2223,92 @@ static void test_WsWriteText(void)
...
@@ -2223,6 +2223,92 @@ static void test_WsWriteText(void)
WsFreeWriter
(
writer
);
WsFreeWriter
(
writer
);
}
}
static
void
test_WsWriteArray
(
void
)
{
static
const
WS_XML_STRING
localname
=
{
4
,
(
BYTE
*
)
"item"
},
localname2
=
{
5
,
(
BYTE
*
)
"array"
};
static
const
WS_XML_STRING
ns
=
{
0
,
NULL
};
WS_XML_WRITER
*
writer
;
BOOL
array_bool
[
2
];
HRESULT
hr
;
hr
=
WsCreateWriter
(
NULL
,
0
,
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteArray
(
writer
,
NULL
,
NULL
,
0
,
NULL
,
0
,
0
,
0
,
NULL
);
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteArray
(
writer
,
NULL
,
NULL
,
0
,
NULL
,
0
,
0
,
0
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteArray
(
writer
,
&
localname
,
NULL
,
0
,
NULL
,
0
,
0
,
0
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteArray
(
writer
,
&
localname
,
&
ns
,
0
,
NULL
,
0
,
0
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
""
,
__LINE__
);
hr
=
WsWriteArray
(
writer
,
&
localname
,
&
ns
,
~
0u
,
NULL
,
0
,
0
,
0
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteArray
(
writer
,
&
localname
,
&
ns
,
WS_BOOL_VALUE_TYPE
,
NULL
,
0
,
0
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
""
,
__LINE__
);
array_bool
[
0
]
=
FALSE
;
hr
=
WsWriteArray
(
writer
,
&
localname
,
&
ns
,
WS_BOOL_VALUE_TYPE
,
array_bool
,
0
,
0
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
""
,
__LINE__
);
hr
=
WsWriteArray
(
writer
,
&
localname
,
&
ns
,
WS_BOOL_VALUE_TYPE
,
array_bool
,
sizeof
(
array_bool
),
0
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
""
,
__LINE__
);
hr
=
WsWriteArray
(
writer
,
&
localname
,
&
ns
,
WS_BOOL_VALUE_TYPE
,
NULL
,
sizeof
(
array_bool
),
0
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
""
,
__LINE__
);
hr
=
WsWriteArray
(
writer
,
&
localname
,
&
ns
,
WS_BOOL_VALUE_TYPE
,
NULL
,
sizeof
(
array_bool
),
0
,
1
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteArray
(
writer
,
&
localname
,
&
ns
,
WS_BOOL_VALUE_TYPE
,
array_bool
,
sizeof
(
array_bool
),
0
,
1
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<item>false</item>"
,
__LINE__
);
hr
=
WsWriteArray
(
writer
,
&
localname
,
&
ns
,
WS_BOOL_VALUE_TYPE
,
array_bool
,
sizeof
(
array_bool
)
-
1
,
0
,
2
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteArray
(
writer
,
&
localname
,
&
ns
,
WS_BOOL_VALUE_TYPE
,
array_bool
,
sizeof
(
array_bool
),
0
,
3
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname2
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
array_bool
[
1
]
=
TRUE
;
hr
=
WsWriteArray
(
writer
,
&
localname
,
&
ns
,
WS_BOOL_VALUE_TYPE
,
array_bool
,
sizeof
(
array_bool
),
0
,
2
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<array><item>false</item><item>true</item></array>"
,
__LINE__
);
WsFreeWriter
(
writer
);
}
START_TEST
(
writer
)
START_TEST
(
writer
)
{
{
test_WsCreateWriter
();
test_WsCreateWriter
();
...
@@ -2251,4 +2337,5 @@ START_TEST(writer)
...
@@ -2251,4 +2337,5 @@ START_TEST(writer)
test_double
();
test_double
();
test_field_flags
();
test_field_flags
();
test_WsWriteText
();
test_WsWriteText
();
test_WsWriteArray
();
}
}
dlls/webservices/webservices.spec
View file @
9c6c813d
...
@@ -164,7 +164,7 @@
...
@@ -164,7 +164,7 @@
@ stub WsStartWriterCanonicalization
@ stub WsStartWriterCanonicalization
@ stub WsTrimXmlWhitespace
@ stub WsTrimXmlWhitespace
@ stub WsVerifyXmlNCName
@ stub WsVerifyXmlNCName
@ st
ub WsWriteArray
@ st
dcall WsWriteArray(ptr ptr ptr long ptr long long long ptr)
@ stdcall WsWriteAttribute(ptr ptr long ptr long ptr)
@ stdcall WsWriteAttribute(ptr ptr long ptr long ptr)
@ stdcall WsWriteBody(ptr ptr long ptr long ptr)
@ stdcall WsWriteBody(ptr ptr long ptr long ptr)
@ stub WsWriteBytes
@ stub WsWriteBytes
...
...
dlls/webservices/webservices_private.h
View file @
9c6c813d
...
@@ -35,6 +35,7 @@ void free_attribute( WS_XML_ATTRIBUTE * ) DECLSPEC_HIDDEN;
...
@@ -35,6 +35,7 @@ void free_attribute( WS_XML_ATTRIBUTE * ) DECLSPEC_HIDDEN;
WS_TYPE
map_value_type
(
WS_VALUE_TYPE
)
DECLSPEC_HIDDEN
;
WS_TYPE
map_value_type
(
WS_VALUE_TYPE
)
DECLSPEC_HIDDEN
;
BOOL
set_fp_rounding
(
unsigned
short
*
)
DECLSPEC_HIDDEN
;
BOOL
set_fp_rounding
(
unsigned
short
*
)
DECLSPEC_HIDDEN
;
void
restore_fp_rounding
(
unsigned
short
)
DECLSPEC_HIDDEN
;
void
restore_fp_rounding
(
unsigned
short
)
DECLSPEC_HIDDEN
;
ULONG
get_type_size
(
WS_TYPE
,
const
WS_STRUCT_DESCRIPTION
*
)
DECLSPEC_HIDDEN
;
struct
node
struct
node
{
{
...
...
dlls/webservices/writer.c
View file @
9c6c813d
...
@@ -1997,6 +1997,41 @@ HRESULT WINAPI WsWriteValue( WS_XML_WRITER *handle, WS_VALUE_TYPE value_type, co
...
@@ -1997,6 +1997,41 @@ HRESULT WINAPI WsWriteValue( WS_XML_WRITER *handle, WS_VALUE_TYPE value_type, co
}
}
/**************************************************************************
/**************************************************************************
* WsWriteArray [webservices.@]
*/
HRESULT
WINAPI
WsWriteArray
(
WS_XML_WRITER
*
handle
,
const
WS_XML_STRING
*
localname
,
const
WS_XML_STRING
*
ns
,
WS_VALUE_TYPE
value_type
,
const
void
*
array
,
ULONG
size
,
ULONG
offset
,
ULONG
count
,
WS_ERROR
*
error
)
{
struct
writer
*
writer
=
(
struct
writer
*
)
handle
;
WS_TYPE
type
;
ULONG
type_size
,
i
;
HRESULT
hr
;
TRACE
(
"%p %s %s %u %p %u %u %u %p
\n
"
,
handle
,
debugstr_xmlstr
(
localname
),
debugstr_xmlstr
(
ns
),
value_type
,
array
,
size
,
offset
,
count
,
error
);
if
(
error
)
FIXME
(
"ignoring error parameter
\n
"
);
if
(
!
writer
)
return
E_INVALIDARG
;
if
(
!
writer
->
output_type
)
return
WS_E_INVALID_OPERATION
;
if
(
!
localname
||
!
ns
||
(
type
=
map_value_type
(
value_type
))
==
~
0u
)
return
E_INVALIDARG
;
type_size
=
get_type_size
(
type
,
NULL
);
if
(
size
%
type_size
||
(
offset
+
count
)
*
type_size
>
size
||
(
count
&&
!
array
))
return
E_INVALIDARG
;
for
(
i
=
offset
;
i
<
count
;
i
++
)
{
const
char
*
ptr
=
(
const
char
*
)
array
+
(
offset
+
i
)
*
type_size
;
if
((
hr
=
write_element_node
(
writer
,
NULL
,
localname
,
ns
))
!=
S_OK
)
return
hr
;
if
((
hr
=
write_type
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
type
,
NULL
,
WS_WRITE_REQUIRED_POINTER
,
&
ptr
,
sizeof
(
ptr
)
))
!=
S_OK
)
return
hr
;
if
((
hr
=
write_endelement_node
(
writer
))
!=
S_OK
)
return
hr
;
}
return
S_OK
;
}
/**************************************************************************
* WsWriteXmlBuffer [webservices.@]
* WsWriteXmlBuffer [webservices.@]
*/
*/
HRESULT
WINAPI
WsWriteXmlBuffer
(
WS_XML_WRITER
*
handle
,
WS_XML_BUFFER
*
buffer
,
WS_ERROR
*
error
)
HRESULT
WINAPI
WsWriteXmlBuffer
(
WS_XML_WRITER
*
handle
,
WS_XML_BUFFER
*
buffer
,
WS_ERROR
*
error
)
...
...
include/webservices.h
View file @
9c6c813d
...
@@ -1493,6 +1493,8 @@ HRESULT WINAPI WsSetOutputToBuffer(WS_XML_WRITER*, WS_XML_BUFFER*, const WS_XML_
...
@@ -1493,6 +1493,8 @@ HRESULT WINAPI WsSetOutputToBuffer(WS_XML_WRITER*, WS_XML_BUFFER*, const WS_XML_
HRESULT
WINAPI
WsSetReaderPosition
(
WS_XML_READER
*
,
const
WS_XML_NODE_POSITION
*
,
WS_ERROR
*
);
HRESULT
WINAPI
WsSetReaderPosition
(
WS_XML_READER
*
,
const
WS_XML_NODE_POSITION
*
,
WS_ERROR
*
);
HRESULT
WINAPI
WsSetWriterPosition
(
WS_XML_WRITER
*
,
const
WS_XML_NODE_POSITION
*
,
WS_ERROR
*
);
HRESULT
WINAPI
WsSetWriterPosition
(
WS_XML_WRITER
*
,
const
WS_XML_NODE_POSITION
*
,
WS_ERROR
*
);
HRESULT
WINAPI
WsSkipNode
(
WS_XML_READER
*
,
WS_ERROR
*
);
HRESULT
WINAPI
WsSkipNode
(
WS_XML_READER
*
,
WS_ERROR
*
);
HRESULT
WINAPI
WsWriteArray
(
WS_XML_WRITER
*
,
const
WS_XML_STRING
*
,
const
WS_XML_STRING
*
,
WS_VALUE_TYPE
,
const
void
*
,
ULONG
,
ULONG
,
ULONG
,
WS_ERROR
*
);
HRESULT
WINAPI
WsWriteAttribute
(
WS_XML_WRITER
*
,
const
WS_ATTRIBUTE_DESCRIPTION
*
,
WS_WRITE_OPTION
,
HRESULT
WINAPI
WsWriteAttribute
(
WS_XML_WRITER
*
,
const
WS_ATTRIBUTE_DESCRIPTION
*
,
WS_WRITE_OPTION
,
const
void
*
,
ULONG
,
WS_ERROR
*
);
const
void
*
,
ULONG
,
WS_ERROR
*
);
HRESULT
WINAPI
WsWriteBody
(
WS_MESSAGE
*
,
const
WS_ELEMENT_DESCRIPTION
*
,
WS_WRITE_OPTION
,
const
void
*
,
HRESULT
WINAPI
WsWriteBody
(
WS_MESSAGE
*
,
const
WS_ELEMENT_DESCRIPTION
*
,
WS_WRITE_OPTION
,
const
void
*
,
...
...
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