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
83e4e135
Commit
83e4e135
authored
Nov 11, 2015
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Implement WsWriteText.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
112e1af5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
2 deletions
+81
-2
reader.c
dlls/webservices/reader.c
+1
-1
writer.c
dlls/webservices/tests/writer.c
+46
-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
+32
-0
No files found.
dlls/webservices/reader.c
View file @
83e4e135
...
...
@@ -659,7 +659,7 @@ WS_XML_STRING *alloc_xml_string( const char *data, ULONG len )
return
ret
;
}
static
WS_XML_UTF8_TEXT
*
alloc_utf8_text
(
const
char
*
data
,
ULONG
len
)
WS_XML_UTF8_TEXT
*
alloc_utf8_text
(
const
char
*
data
,
ULONG
len
)
{
WS_XML_UTF8_TEXT
*
ret
;
...
...
dlls/webservices/tests/writer.c
View file @
83e4e135
...
...
@@ -404,6 +404,51 @@ static void test_WsWriteStartElement(void)
WsFreeWriter
(
writer
);
}
static
void
test_WsWriteStartAttribute
(
void
)
{
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_XML_STRING
prefix
=
{
1
,
(
BYTE
*
)
"p"
},
localname
=
{
3
,
(
BYTE
*
)
"str"
},
ns
=
{
2
,
(
BYTE
*
)
"ns"
};
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
,
&
prefix
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartAttribute
(
NULL
,
&
prefix
,
&
localname
,
&
ns
,
FALSE
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
/* WsWriteStartAttribute doesn't output anything */
localname
.
length
=
3
;
localname
.
bytes
=
(
BYTE
*
)
"len"
;
hr
=
WsWriteStartAttribute
(
writer
,
&
prefix
,
&
localname
,
&
ns
,
FALSE
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
""
,
__LINE__
);
text
.
text
.
textType
=
WS_XML_TEXT_TYPE_UTF8
;
text
.
value
.
length
=
1
;
text
.
value
.
bytes
=
(
BYTE
*
)
"0"
;
hr
=
WsWriteText
(
writer
,
&
text
.
text
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
""
,
__LINE__
);
/* WsWriteEndAttribute doesn't output anything */
hr
=
WsWriteEndAttribute
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
""
,
__LINE__
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<p:str p:len=
\"
0
\"
xmlns:p=
\"
ns
\"
/>"
,
__LINE__
);
WsFreeWriter
(
writer
);
}
START_TEST
(
writer
)
{
test_WsCreateWriter
();
...
...
@@ -411,4 +456,5 @@ START_TEST(writer)
test_WsSetOutput
();
test_WsSetOutputToBuffer
();
test_WsWriteStartElement
();
test_WsWriteStartAttribute
();
}
dlls/webservices/webservices.spec
View file @
83e4e135
...
...
@@ -184,7 +184,7 @@
@ stdcall WsWriteStartAttribute(ptr ptr ptr ptr long ptr)
@ stub WsWriteStartCData
@ stdcall WsWriteStartElement(ptr ptr ptr ptr ptr)
@ st
ub WsWriteText
@ st
dcall WsWriteText(ptr ptr ptr)
@ stub WsWriteType
@ stub WsWriteValue
@ stub WsWriteXmlBuffer
...
...
dlls/webservices/webservices_private.h
View file @
83e4e135
...
...
@@ -29,6 +29,7 @@ void *ws_realloc( WS_HEAP *, void *, SIZE_T ) DECLSPEC_HIDDEN;
void
ws_free
(
WS_HEAP
*
,
void
*
)
DECLSPEC_HIDDEN
;
const
char
*
debugstr_xmlstr
(
const
WS_XML_STRING
*
)
DECLSPEC_HIDDEN
;
WS_XML_STRING
*
alloc_xml_string
(
const
char
*
,
ULONG
)
DECLSPEC_HIDDEN
;
WS_XML_UTF8_TEXT
*
alloc_utf8_text
(
const
char
*
,
ULONG
)
DECLSPEC_HIDDEN
;
HRESULT
append_attribute
(
WS_XML_ELEMENT_NODE
*
,
WS_XML_ATTRIBUTE
*
)
DECLSPEC_HIDDEN
;
void
free_attribute
(
WS_XML_ATTRIBUTE
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/webservices/writer.c
View file @
83e4e135
...
...
@@ -738,3 +738,35 @@ error:
free_node
(
node
);
return
hr
;
}
/**************************************************************************
* WsWriteText [webservices.@]
*/
HRESULT
WINAPI
WsWriteText
(
WS_XML_WRITER
*
handle
,
const
WS_XML_TEXT
*
text
,
WS_ERROR
*
error
)
{
struct
writer
*
writer
=
(
struct
writer
*
)
handle
;
WS_XML_ELEMENT_NODE
*
elem
;
WS_XML_UTF8_TEXT
*
src
,
*
dst
;
TRACE
(
"%p %p %p
\n
"
,
handle
,
text
,
error
);
if
(
!
writer
||
!
text
)
return
E_INVALIDARG
;
if
(
writer
->
state
!=
WRITER_STATE_STARTATTRIBUTE
)
{
FIXME
(
"can't handle writer state %u
\n
"
,
writer
->
state
);
return
E_NOTIMPL
;
}
if
(
text
->
textType
!=
WS_XML_TEXT_TYPE_UTF8
)
{
FIXME
(
"text type %u not supported
\n
"
,
text
->
textType
);
return
E_NOTIMPL
;
}
src
=
(
WS_XML_UTF8_TEXT
*
)
text
;
if
(
!
(
dst
=
alloc_utf8_text
(
(
const
char
*
)
src
->
value
.
bytes
,
src
->
value
.
length
)))
return
E_OUTOFMEMORY
;
elem
=
(
WS_XML_ELEMENT_NODE
*
)
writer
->
current
;
elem
->
attributes
[
elem
->
attributeCount
-
1
]
->
value
=
(
WS_XML_TEXT
*
)
dst
;
return
S_OK
;
}
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