Commit f40d88a0 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

webservices: Add support for UNIQUE_ID records in the writer.

parent b85e6800
...@@ -719,6 +719,9 @@ static enum record_type get_attr_text_record_type( const WS_XML_TEXT *text ) ...@@ -719,6 +719,9 @@ static enum record_type get_attr_text_record_type( const WS_XML_TEXT *text )
case WS_XML_TEXT_TYPE_GUID: case WS_XML_TEXT_TYPE_GUID:
return RECORD_GUID_TEXT; return RECORD_GUID_TEXT;
case WS_XML_TEXT_TYPE_UNIQUE_ID:
return RECORD_UNIQUE_ID_TEXT;
default: default:
FIXME( "unhandled text type %u\n", text->textType ); FIXME( "unhandled text type %u\n", text->textType );
return 0; return 0;
...@@ -861,6 +864,13 @@ static HRESULT write_attribute_value_bin( struct writer *writer, const WS_XML_TE ...@@ -861,6 +864,13 @@ static HRESULT write_attribute_value_bin( struct writer *writer, const WS_XML_TE
write_bytes( writer, (const BYTE *)&text_guid->value, sizeof(text_guid->value) ); write_bytes( writer, (const BYTE *)&text_guid->value, sizeof(text_guid->value) );
return S_OK; return S_OK;
} }
case RECORD_UNIQUE_ID_TEXT:
{
WS_XML_UNIQUE_ID_TEXT *text_unique_id = (WS_XML_UNIQUE_ID_TEXT *)text;
if ((hr = write_grow_buffer( writer, sizeof(text_unique_id->value) )) != S_OK) return hr;
write_bytes( writer, (const BYTE *)&text_unique_id->value, sizeof(text_unique_id->value) );
return S_OK;
}
default: default:
FIXME( "unhandled record type %02x\n", type ); FIXME( "unhandled record type %02x\n", type );
return E_NOTIMPL; return E_NOTIMPL;
...@@ -2494,6 +2504,9 @@ static enum record_type get_text_record_type( const WS_XML_TEXT *text ) ...@@ -2494,6 +2504,9 @@ static enum record_type get_text_record_type( const WS_XML_TEXT *text )
case WS_XML_TEXT_TYPE_GUID: case WS_XML_TEXT_TYPE_GUID:
return RECORD_GUID_TEXT_WITH_ENDELEMENT; return RECORD_GUID_TEXT_WITH_ENDELEMENT;
case WS_XML_TEXT_TYPE_UNIQUE_ID:
return RECORD_UNIQUE_ID_TEXT_WITH_ENDELEMENT;
default: default:
FIXME( "unhandled text type %u\n", text->textType ); FIXME( "unhandled text type %u\n", text->textType );
return 0; return 0;
...@@ -2642,6 +2655,14 @@ static HRESULT write_text_bin( struct writer *writer, const WS_XML_TEXT *text, U ...@@ -2642,6 +2655,14 @@ static HRESULT write_text_bin( struct writer *writer, const WS_XML_TEXT *text, U
write_bytes( writer, (const BYTE *)&text_guid->value, sizeof(text_guid->value) ); write_bytes( writer, (const BYTE *)&text_guid->value, sizeof(text_guid->value) );
return S_OK; return S_OK;
} }
case RECORD_UNIQUE_ID_TEXT_WITH_ENDELEMENT:
{
WS_XML_UNIQUE_ID_TEXT *text_unique_id = (WS_XML_UNIQUE_ID_TEXT *)text;
if ((hr = write_grow_buffer( writer, 1 + sizeof(text_unique_id->value) )) != S_OK) return hr;
write_char( writer, type );
write_bytes( writer, (const BYTE *)&text_unique_id->value, sizeof(text_unique_id->value) );
return S_OK;
}
default: default:
FIXME( "unhandled record type %02x\n", type ); FIXME( "unhandled record type %02x\n", type );
return E_NOTIMPL; return E_NOTIMPL;
...@@ -3204,9 +3225,8 @@ static HRESULT write_type_unique_id( struct writer *writer, WS_TYPE_MAPPING mapp ...@@ -3204,9 +3225,8 @@ static HRESULT write_type_unique_id( struct writer *writer, WS_TYPE_MAPPING mapp
const WS_UNIQUE_ID_DESCRIPTION *desc, WS_WRITE_OPTION option, const WS_UNIQUE_ID_DESCRIPTION *desc, WS_WRITE_OPTION option,
const void *value, ULONG size ) const void *value, ULONG size )
{ {
WS_XML_UTF8_TEXT utf8; WS_XML_UNIQUE_ID_TEXT text_unique_id;
WS_XML_UTF16_TEXT utf16; WS_XML_UTF16_TEXT text_utf16;
unsigned char buf[46]; /* "urn:uuid:00000000-0000-0000-0000-000000000000" */
const WS_UNIQUE_ID *ptr; const WS_UNIQUE_ID *ptr;
HRESULT hr; HRESULT hr;
...@@ -3222,16 +3242,15 @@ static HRESULT write_type_unique_id( struct writer *writer, WS_TYPE_MAPPING mapp ...@@ -3222,16 +3242,15 @@ static HRESULT write_type_unique_id( struct writer *writer, WS_TYPE_MAPPING mapp
if (ptr->uri.length) if (ptr->uri.length)
{ {
utf16.text.textType = WS_XML_TEXT_TYPE_UTF16; text_utf16.text.textType = WS_XML_TEXT_TYPE_UTF16;
utf16.bytes = (BYTE *)ptr->uri.chars; text_utf16.bytes = (BYTE *)ptr->uri.chars;
utf16.byteCount = ptr->uri.length * sizeof(WCHAR); text_utf16.byteCount = ptr->uri.length * sizeof(WCHAR);
return write_type_text( writer, mapping, &utf16.text ); return write_type_text( writer, mapping, &text_utf16.text );
} }
utf8.text.textType = WS_XML_TEXT_TYPE_UTF8; text_unique_id.text.textType = WS_XML_TEXT_TYPE_UNIQUE_ID;
utf8.value.bytes = buf; text_unique_id.value = ptr->guid;
utf8.value.length = format_urn( &ptr->guid, buf ); return write_type_text( writer, mapping, &text_unique_id.text );
return write_type_text( writer, mapping, &utf8.text );
} }
static HRESULT write_type_string( struct writer *writer, WS_TYPE_MAPPING mapping, static HRESULT write_type_string( struct writer *writer, WS_TYPE_MAPPING mapping,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment