Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
db591a05
Commit
db591a05
authored
Feb 03, 2016
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 03, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Implement WsWriteStartCData and WsWriteEndCData.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
48975081
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
6 deletions
+102
-6
writer.c
dlls/webservices/tests/writer.c
+51
-2
webservices.spec
dlls/webservices/webservices.spec
+2
-2
writer.c
dlls/webservices/writer.c
+47
-2
webservices.h
include/webservices.h
+2
-0
No files found.
dlls/webservices/tests/writer.c
View file @
db591a05
...
...
@@ -971,6 +971,54 @@ static void test_WsWriteAttribute(void)
WsFreeWriter
(
writer
);
}
static
void
test_WsWriteStartCData
(
void
)
{
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"t"
},
ns
=
{
0
,
NULL
};
WS_XML_UTF8_TEXT
text
;
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
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndCData
(
writer
,
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
);
check_output
(
writer
,
""
,
__LINE__
);
hr
=
WsWriteStartCData
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<t><![CDATA["
,
__LINE__
);
text
.
text
.
textType
=
WS_XML_TEXT_TYPE_UTF8
;
text
.
value
.
bytes
=
(
BYTE
*
)
"<data>"
;
text
.
value
.
length
=
6
;
hr
=
WsWriteText
(
writer
,
&
text
.
text
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<t><![CDATA[<data>"
,
__LINE__
);
hr
=
WsWriteEndCData
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<t><![CDATA[<data>]]>"
,
__LINE__
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<t><![CDATA[<data>]]></t>"
,
__LINE__
);
WsFreeWriter
(
writer
);
}
START_TEST
(
writer
)
{
test_WsCreateWriter
();
...
...
@@ -980,9 +1028,10 @@ START_TEST(writer)
test_WsWriteStartElement
();
test_WsWriteStartAttribute
();
test_WsWriteType
();
test_basic_type
();
test_simple_struct_type
();
test_WsWriteElement
();
test_WsWriteValue
();
test_WsWriteAttribute
();
test_basic_type
();
test_simple_struct_type
();
test_WsWriteStartCData
();
}
dlls/webservices/webservices.spec
View file @
db591a05
...
...
@@ -172,7 +172,7 @@
@ stub WsWriteCharsUtf8
@ stdcall WsWriteElement(ptr ptr long ptr long ptr)
@ stdcall WsWriteEndAttribute(ptr ptr)
@ st
ub WsWriteEndCData
@ st
dcall WsWriteEndCData(ptr ptr)
@ stdcall WsWriteEndElement(ptr ptr)
@ stdcall WsWriteEndStartElement(ptr ptr)
@ stub WsWriteEnvelopeEnd
...
...
@@ -182,7 +182,7 @@
@ stub WsWriteNode
@ stub WsWriteQualifiedName
@ stdcall WsWriteStartAttribute(ptr ptr ptr ptr long ptr)
@ st
ub WsWriteStartCData
@ st
dcall WsWriteStartCData(ptr ptr)
@ stdcall WsWriteStartElement(ptr ptr ptr ptr ptr)
@ stdcall WsWriteText(ptr ptr ptr)
@ stdcall WsWriteType(ptr long long ptr long ptr long ptr)
...
...
dlls/webservices/writer.c
View file @
db591a05
/*
* Copyright 2015 Hans Leidekker for CodeWeavers
* Copyright 2015
, 2016
Hans Leidekker for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -64,9 +64,11 @@ enum writer_state
WRITER_STATE_STARTELEMENT
,
WRITER_STATE_STARTENDELEMENT
,
WRITER_STATE_STARTATTRIBUTE
,
WRITER_STATE_STARTCDATA
,
WRITER_STATE_ENDSTARTELEMENT
,
WRITER_STATE_TEXT
,
WRITER_STATE_ENDELEMENT
WRITER_STATE_ENDELEMENT
,
WRITER_STATE_ENDCDATA
};
struct
writer
...
...
@@ -727,6 +729,49 @@ HRESULT WINAPI WsWriteStartAttribute( WS_XML_WRITER *handle, const WS_XML_STRING
return
write_add_attribute
(
writer
,
prefix
,
localname
,
ns
,
single
);
}
/**************************************************************************
* WsWriteStartCData [webservices.@]
*/
HRESULT
WINAPI
WsWriteStartCData
(
WS_XML_WRITER
*
handle
,
WS_ERROR
*
error
)
{
struct
writer
*
writer
=
(
struct
writer
*
)
handle
;
HRESULT
hr
;
TRACE
(
"%p %p
\n
"
,
handle
,
error
);
if
(
error
)
FIXME
(
"ignoring error parameter
\n
"
);
if
(
!
writer
)
return
E_INVALIDARG
;
/* flush current start element if necessary */
if
(
writer
->
state
==
WRITER_STATE_STARTELEMENT
&&
((
hr
=
write_endstartelement
(
writer
))
!=
S_OK
))
return
hr
;
if
((
hr
=
write_grow_buffer
(
writer
,
9
))
!=
S_OK
)
return
hr
;
write_bytes
(
writer
,
(
const
BYTE
*
)
"<![CDATA["
,
9
);
writer
->
state
=
WRITER_STATE_STARTCDATA
;
return
S_OK
;
}
/**************************************************************************
* WsWriteEndCData [webservices.@]
*/
HRESULT
WINAPI
WsWriteEndCData
(
WS_XML_WRITER
*
handle
,
WS_ERROR
*
error
)
{
struct
writer
*
writer
=
(
struct
writer
*
)
handle
;
HRESULT
hr
;
TRACE
(
"%p %p
\n
"
,
handle
,
error
);
if
(
error
)
FIXME
(
"ignoring error parameter
\n
"
);
if
(
!
writer
)
return
E_INVALIDARG
;
if
(
writer
->
state
!=
WRITER_STATE_STARTCDATA
)
return
WS_E_INVALID_OPERATION
;
if
((
hr
=
write_grow_buffer
(
writer
,
3
))
!=
S_OK
)
return
hr
;
write_bytes
(
writer
,
(
const
BYTE
*
)
"]]>"
,
3
);
writer
->
state
=
WRITER_STATE_ENDCDATA
;
return
S_OK
;
}
static
HRESULT
write_add_element_node
(
struct
writer
*
writer
,
const
WS_XML_STRING
*
prefix
,
const
WS_XML_STRING
*
localname
,
const
WS_XML_STRING
*
ns
)
{
...
...
include/webservices.h
View file @
db591a05
...
...
@@ -590,10 +590,12 @@ HRESULT WINAPI WsWriteAttribute(WS_XML_WRITER*, const WS_ATTRIBUTE_DESCRIPTION*,
HRESULT
WINAPI
WsWriteElement
(
WS_XML_WRITER
*
,
const
WS_ELEMENT_DESCRIPTION
*
,
WS_WRITE_OPTION
,
const
void
*
,
ULONG
,
WS_ERROR
*
);
HRESULT
WINAPI
WsWriteEndAttribute
(
WS_XML_WRITER
*
,
WS_ERROR
*
);
HRESULT
WINAPI
WsWriteEndCData
(
WS_XML_WRITER
*
,
WS_ERROR
*
);
HRESULT
WINAPI
WsWriteEndElement
(
WS_XML_WRITER
*
,
WS_ERROR
*
);
HRESULT
WINAPI
WsWriteEndStartElement
(
WS_XML_WRITER
*
,
WS_ERROR
*
);
HRESULT
WINAPI
WsWriteStartAttribute
(
WS_XML_WRITER
*
,
const
WS_XML_STRING
*
,
const
WS_XML_STRING
*
,
const
WS_XML_STRING
*
,
BOOL
,
WS_ERROR
*
);
HRESULT
WINAPI
WsWriteStartCData
(
WS_XML_WRITER
*
,
WS_ERROR
*
);
HRESULT
WINAPI
WsWriteStartElement
(
WS_XML_WRITER
*
,
const
WS_XML_STRING
*
,
const
WS_XML_STRING
*
,
const
WS_XML_STRING
*
,
WS_ERROR
*
);
HRESULT
WINAPI
WsWriteText
(
WS_XML_WRITER
*
,
const
WS_XML_TEXT
*
,
WS_ERROR
*
);
...
...
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