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

webservices: Add support for GUID records in the writer.

parent 30abce87
......@@ -1541,7 +1541,7 @@ static HRESULT read_attribute_value_bin( struct reader *reader, WS_XML_ATTRIBUTE
if (!(text_utf8 = alloc_utf8_text( str->bytes, str->length ))) return E_OUTOFMEMORY;
break;
case RECORD_UNIQUEID_TEXT:
case RECORD_UNIQUE_ID_TEXT:
{
WS_XML_UNIQUE_ID_TEXT *text_unique_id;
if ((hr = read_bytes( reader, (unsigned char *)&guid, sizeof(guid) )) != S_OK) return hr;
......@@ -1549,7 +1549,7 @@ static HRESULT read_attribute_value_bin( struct reader *reader, WS_XML_ATTRIBUTE
attr->value = &text_unique_id->text;
return S_OK;
}
case RECORD_UUID_TEXT:
case RECORD_GUID_TEXT:
{
WS_XML_GUID_TEXT *guid_text;
if ((hr = read_bytes( reader, (unsigned char *)&guid, sizeof(guid) )) != S_OK) return hr;
......@@ -2446,14 +2446,14 @@ static HRESULT read_text_bin( struct reader *reader )
if (!(node = alloc_utf8_text_node( str->bytes, str->length, NULL ))) return E_OUTOFMEMORY;
break;
}
case RECORD_UNIQUEID_TEXT:
case RECORD_UNIQUEID_TEXT_WITH_ENDELEMENT:
case RECORD_UNIQUE_ID_TEXT:
case RECORD_UNIQUE_ID_TEXT_WITH_ENDELEMENT:
if ((hr = read_bytes( reader, (unsigned char *)&uuid, sizeof(uuid) )) != S_OK) return hr;
if (!(node = alloc_unique_id_text_node( &uuid ))) return E_OUTOFMEMORY;
break;
case RECORD_UUID_TEXT:
case RECORD_UUID_TEXT_WITH_ENDELEMENT:
case RECORD_GUID_TEXT:
case RECORD_GUID_TEXT_WITH_ENDELEMENT:
if ((hr = read_bytes( reader, (unsigned char *)&uuid, sizeof(uuid) )) != S_OK) return hr;
if (!(node = alloc_guid_text_node( &uuid ))) return E_OUTOFMEMORY;
break;
......@@ -5857,6 +5857,9 @@ ULONG get_type_size( WS_TYPE type, const void *desc )
case WS_GUID_TYPE:
return sizeof(GUID);
case WS_UNIQUE_ID_TYPE:
return sizeof(WS_UNIQUE_ID);
case WS_STRING_TYPE:
return sizeof(WS_STRING);
......
......@@ -317,12 +317,12 @@ enum record_type
RECORD_EMPTY_TEXT_WITH_ENDELEMENT = 0xa9,
RECORD_DICTIONARY_TEXT = 0xaa,
RECORD_DICTIONARY_TEXT_WITH_ENDELEMENT = 0xab,
RECORD_UNIQUEID_TEXT = 0xac,
RECORD_UNIQUEID_TEXT_WITH_ENDELEMENT = 0xad,
RECORD_UNIQUE_ID_TEXT = 0xac,
RECORD_UNIQUE_ID_TEXT_WITH_ENDELEMENT = 0xad,
RECORD_TIMESPAN_TEXT = 0xae,
RECORD_TIMESPAN_TEXT_WITH_ENDELEMENT = 0xaf,
RECORD_UUID_TEXT = 0xb0,
RECORD_UUID_TEXT_WITH_ENDELEMENT = 0xb1,
RECORD_GUID_TEXT = 0xb0,
RECORD_GUID_TEXT_WITH_ENDELEMENT = 0xb1,
RECORD_UINT64_TEXT = 0xb2,
RECORD_UINT64_TEXT_WITH_ENDELEMENT = 0xb3,
RECORD_BOOL_TEXT = 0xb4,
......
......@@ -716,6 +716,9 @@ static enum record_type get_attr_text_record_type( const WS_XML_TEXT *text )
if (text_double->value <= MAX_INT32) return RECORD_INT32_TEXT;
return RECORD_INT64_TEXT;
}
case WS_XML_TEXT_TYPE_GUID:
return RECORD_GUID_TEXT;
default:
FIXME( "unhandled text type %u\n", text->textType );
return 0;
......@@ -851,8 +854,15 @@ static HRESULT write_attribute_value_bin( struct writer *writer, const WS_XML_TE
write_bytes( writer, (const BYTE *)&text_double->value, sizeof(text_double->value) );
return S_OK;
}
case RECORD_GUID_TEXT:
{
WS_XML_GUID_TEXT *text_guid = (WS_XML_GUID_TEXT *)text;
if ((hr = write_grow_buffer( writer, sizeof(text_guid->value) )) != S_OK) return hr;
write_bytes( writer, (const BYTE *)&text_guid->value, sizeof(text_guid->value) );
return S_OK;
}
default:
ERR( "unhandled record type %02x\n", type );
FIXME( "unhandled record type %02x\n", type );
return E_NOTIMPL;
}
}
......@@ -2481,6 +2491,9 @@ static enum record_type get_text_record_type( const WS_XML_TEXT *text )
if (text_double->value <= MAX_INT32) return RECORD_INT32_TEXT_WITH_ENDELEMENT;
return RECORD_INT64_TEXT_WITH_ENDELEMENT;
}
case WS_XML_TEXT_TYPE_GUID:
return RECORD_GUID_TEXT_WITH_ENDELEMENT;
default:
FIXME( "unhandled text type %u\n", text->textType );
return 0;
......@@ -2621,6 +2634,14 @@ static HRESULT write_text_bin( struct writer *writer, const WS_XML_TEXT *text, U
write_bytes( writer, (const BYTE *)&text_double->value, sizeof(text_double->value) );
return S_OK;
}
case RECORD_GUID_TEXT_WITH_ENDELEMENT:
{
WS_XML_GUID_TEXT *text_guid = (WS_XML_GUID_TEXT *)text;
if ((hr = write_grow_buffer( writer, 1 + sizeof(text_guid->value) )) != S_OK) return hr;
write_char( writer, type );
write_bytes( writer, (const BYTE *)&text_guid->value, sizeof(text_guid->value) );
return S_OK;
}
default:
FIXME( "unhandled record type %02x\n", type );
return E_NOTIMPL;
......@@ -3160,8 +3181,7 @@ static HRESULT write_type_guid( struct writer *writer, WS_TYPE_MAPPING mapping,
const WS_GUID_DESCRIPTION *desc, WS_WRITE_OPTION option,
const void *value, ULONG size )
{
WS_XML_UTF8_TEXT utf8;
unsigned char buf[37]; /* "00000000-0000-0000-0000-000000000000" */
WS_XML_GUID_TEXT text_guid;
const GUID *ptr;
HRESULT hr;
......@@ -3175,10 +3195,9 @@ static HRESULT write_type_guid( struct writer *writer, WS_TYPE_MAPPING mapping,
if ((hr = get_value_ptr( option, value, size, sizeof(GUID), (const void **)&ptr )) != S_OK) return hr;
if (option == WS_WRITE_NILLABLE_POINTER && !ptr) return write_add_nil_attribute( writer );
utf8.text.textType = WS_XML_TEXT_TYPE_UTF8;
utf8.value.bytes = buf;
utf8.value.length = format_guid( ptr, buf );
return write_type_text( writer, mapping, &utf8.text );
text_guid.text.textType = WS_XML_TEXT_TYPE_GUID;
text_guid.value = *ptr;
return write_type_text( writer, mapping, &text_guid.text );
}
static HRESULT write_type_unique_id( 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