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