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
5eed03cb
Commit
5eed03cb
authored
Jan 29, 2016
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 29, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Implement WsWriteAttribute.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0b57ba19
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
1 deletion
+95
-1
writer.c
dlls/webservices/tests/writer.c
+66
-0
webservices.spec
dlls/webservices/webservices.spec
+1
-1
writer.c
dlls/webservices/writer.c
+28
-0
No files found.
dlls/webservices/tests/writer.c
View file @
5eed03cb
...
...
@@ -906,6 +906,71 @@ static void test_WsWriteValue(void)
WsFreeWriter
(
writer
);
}
static
void
test_WsWriteAttribute
(
void
)
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_STRUCT_DESCRIPTION
s
;
WS_FIELD_DESCRIPTION
f
,
*
fields
[
1
];
WS_ATTRIBUTE_DESCRIPTION
desc
;
WS_XML_STRING
localname
=
{
3
,
(
BYTE
*
)
"str"
},
ns
=
{
0
,
NULL
};
struct
test
{
const
WCHAR
*
str
;
}
*
test
;
hr
=
WsCreateWriter
(
NULL
,
0
,
&
writer
,
NULL
)
;
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
/* text field mapping */
memset
(
&
f
,
0
,
sizeof
(
f
)
);
f
.
mapping
=
WS_TEXT_FIELD_MAPPING
;
f
.
type
=
WS_WSZ_TYPE
;
fields
[
0
]
=
&
f
;
memset
(
&
s
,
0
,
sizeof
(
s
)
);
s
.
size
=
sizeof
(
struct
test
);
s
.
alignment
=
TYPE_ALIGNMENT
(
struct
test
);
s
.
fields
=
fields
;
s
.
fieldCount
=
1
;
desc
.
attributeLocalName
=
&
localname
;
desc
.
attributeNs
=
&
ns
;
desc
.
type
=
WS_STRUCT_TYPE
;
desc
.
typeDescription
=
&
s
;
test
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
test
)
);
test
->
str
=
testW
;
hr
=
WsWriteAttribute
(
NULL
,
&
desc
,
WS_WRITE_REQUIRED_POINTER
,
&
test
,
sizeof
(
test
),
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteAttribute
(
writer
,
NULL
,
WS_WRITE_REQUIRED_POINTER
,
&
test
,
sizeof
(
test
),
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteAttribute
(
writer
,
&
desc
,
WS_WRITE_REQUIRED_POINTER
,
NULL
,
0
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteAttribute
(
writer
,
&
desc
,
WS_WRITE_REQUIRED_POINTER
,
&
test
,
sizeof
(
test
),
NULL
);
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
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
);
hr
=
WsWriteAttribute
(
writer
,
&
desc
,
WS_WRITE_REQUIRED_POINTER
,
&
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
,
"<str str=
\"
test
\"
/>"
,
__LINE__
);
HeapFree
(
GetProcessHeap
(),
0
,
test
);
WsFreeWriter
(
writer
);
}
START_TEST
(
writer
)
{
test_WsCreateWriter
();
...
...
@@ -917,6 +982,7 @@ START_TEST(writer)
test_WsWriteType
();
test_WsWriteElement
();
test_WsWriteValue
();
test_WsWriteAttribute
();
test_basic_type
();
test_simple_struct_type
();
}
dlls/webservices/webservices.spec
View file @
5eed03cb
...
...
@@ -165,7 +165,7 @@
@ stub WsTrimXmlWhitespace
@ stub WsVerifyXmlNCName
@ stub WsWriteArray
@ st
ub WsWriteAttribute
@ st
dcall WsWriteAttribute(ptr ptr long ptr long ptr)
@ stub WsWriteBody
@ stub WsWriteBytes
@ stub WsWriteChars
...
...
dlls/webservices/writer.c
View file @
5eed03cb
...
...
@@ -1349,6 +1349,34 @@ static HRESULT write_type( struct writer *writer, WS_TYPE_MAPPING mapping, WS_TY
}
/**************************************************************************
* WsWriteAttribute [webservices.@]
*/
HRESULT
WINAPI
WsWriteAttribute
(
WS_XML_WRITER
*
handle
,
const
WS_ATTRIBUTE_DESCRIPTION
*
desc
,
WS_WRITE_OPTION
option
,
const
void
*
value
,
ULONG
size
,
WS_ERROR
*
error
)
{
struct
writer
*
writer
=
(
struct
writer
*
)
handle
;
HRESULT
hr
;
TRACE
(
"%p %p %u %p %u %p
\n
"
,
handle
,
desc
,
option
,
value
,
size
,
error
);
if
(
error
)
FIXME
(
"ignoring error parameter
\n
"
);
if
(
!
writer
||
!
desc
||
!
desc
->
attributeLocalName
||
!
desc
->
attributeNs
||
!
value
)
return
E_INVALIDARG
;
if
(
writer
->
state
!=
WRITER_STATE_STARTELEMENT
)
return
WS_E_INVALID_OPERATION
;
if
((
hr
=
write_add_attribute
(
writer
,
NULL
,
desc
->
attributeLocalName
,
desc
->
attributeNs
,
FALSE
))
!=
S_OK
)
return
hr
;
if
((
hr
=
write_type
(
writer
,
WS_ATTRIBUTE_TYPE_MAPPING
,
desc
->
type
,
desc
->
typeDescription
,
option
,
value
,
size
))
!=
S_OK
)
return
hr
;
writer
->
state
=
WRITER_STATE_STARTELEMENT
;
return
S_OK
;
}
/**************************************************************************
* WsWriteElement [webservices.@]
*/
HRESULT
WINAPI
WsWriteElement
(
WS_XML_WRITER
*
handle
,
const
WS_ELEMENT_DESCRIPTION
*
desc
,
...
...
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