webservices: Support more writer states in WsWriteText.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2016-02-03 15:43:45 +01:00 committed by Alexandre Julliard
parent b960e6f81b
commit 50797a803d
1 changed files with 15 additions and 10 deletions

View File

@ -794,27 +794,32 @@ static inline void write_set_attribute_value( struct writer *writer, WS_XML_TEXT
HRESULT WINAPI WsWriteText( WS_XML_WRITER *handle, const WS_XML_TEXT *text, WS_ERROR *error )
{
struct writer *writer = (struct writer *)handle;
WS_XML_UTF8_TEXT *src, *dst;
WS_XML_UTF8_TEXT *dst, *src = (WS_XML_UTF8_TEXT *)text;
HRESULT hr;
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 (writer->state == WRITER_STATE_STARTATTRIBUTE)
{
if (!(dst = alloc_utf8_text( src->value.bytes, src->value.length )))
return E_OUTOFMEMORY;
write_set_attribute_value( writer, &dst->text );
}
else
{
if ((hr = write_grow_buffer( writer, src->value.length )) != S_OK) return hr;
write_bytes( writer, src->value.bytes, src->value.length );
}
return S_OK;
}