webservices: Trace return values.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2018-10-17 13:42:36 +02:00 committed by Alexandre Julliard
parent 91ef13ce7e
commit 366e693f6b
8 changed files with 426 additions and 513 deletions

View File

@ -518,6 +518,7 @@ void WINAPI WsFreeChannel( WS_CHANNEL *handle )
HRESULT WINAPI WsResetChannel( WS_CHANNEL *handle, WS_ERROR *error )
{
struct channel *channel = (struct channel *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p\n", handle, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -533,15 +534,13 @@ HRESULT WINAPI WsResetChannel( WS_CHANNEL *handle, WS_ERROR *error )
}
if (channel->state != WS_CHANNEL_STATE_CREATED && channel->state != WS_CHANNEL_STATE_CLOSED)
{
LeaveCriticalSection( &channel->cs );
return WS_E_INVALID_OPERATION;
}
hr = WS_E_INVALID_OPERATION;
else
reset_channel( channel );
LeaveCriticalSection( &channel->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
/**************************************************************************
@ -583,6 +582,7 @@ HRESULT WINAPI WsGetChannelProperty( WS_CHANNEL *handle, WS_CHANNEL_PROPERTY_ID
}
LeaveCriticalSection( &channel->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -611,6 +611,7 @@ HRESULT WINAPI WsSetChannelProperty( WS_CHANNEL *handle, WS_CHANNEL_PROPERTY_ID
hr = prop_set( channel->prop, channel->prop_count, id, value, size );
LeaveCriticalSection( &channel->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -653,15 +654,11 @@ HRESULT WINAPI WsOpenChannel( WS_CHANNEL *handle, const WS_ENDPOINT_ADDRESS *end
return E_INVALIDARG;
}
if (channel->state != WS_CHANNEL_STATE_CREATED)
{
LeaveCriticalSection( &channel->cs );
return WS_E_INVALID_OPERATION;
}
hr = open_channel( channel, endpoint );
if (channel->state != WS_CHANNEL_STATE_CREATED) hr = WS_E_INVALID_OPERATION;
else hr = open_channel( channel, endpoint );
LeaveCriticalSection( &channel->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -734,6 +731,7 @@ HRESULT WINAPI WsShutdownSessionChannel( WS_CHANNEL *handle, const WS_ASYNC_CONT
hr = shutdown_session( channel );
LeaveCriticalSection( &channel->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -749,6 +747,7 @@ static void close_channel( struct channel *channel )
HRESULT WINAPI WsCloseChannel( WS_CHANNEL *handle, const WS_ASYNC_CONTEXT *ctx, WS_ERROR *error )
{
struct channel *channel = (struct channel *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p %p\n", handle, ctx, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -767,7 +766,8 @@ HRESULT WINAPI WsCloseChannel( WS_CHANNEL *handle, const WS_ASYNC_CONTEXT *ctx,
close_channel( channel );
LeaveCriticalSection( &channel->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
static HRESULT parse_http_url( const WCHAR *url, ULONG len, URL_COMPONENTS *uc )
@ -1348,6 +1348,7 @@ HRESULT WINAPI WsSendMessage( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS_MESS
done:
LeaveCriticalSection( &channel->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1388,6 +1389,7 @@ HRESULT WINAPI WsSendReplyMessage( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS
done:
LeaveCriticalSection( &channel->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1959,6 +1961,7 @@ HRESULT WINAPI WsReceiveMessage( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS_M
hr = receive_message( channel, msg, desc, count, option, read_option, heap, value, size, index );
LeaveCriticalSection( &channel->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1991,6 +1994,7 @@ HRESULT WINAPI WsReadMessageStart( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS
}
LeaveCriticalSection( &channel->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -2020,6 +2024,7 @@ HRESULT WINAPI WsReadMessageEnd( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS_A
hr = WsReadEnvelopeEnd( msg, NULL );
LeaveCriticalSection( &channel->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -2052,6 +2057,7 @@ HRESULT WINAPI WsWriteMessageStart( WS_CHANNEL *handle, WS_MESSAGE *msg, const W
done:
LeaveCriticalSection( &channel->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -2081,6 +2087,7 @@ HRESULT WINAPI WsWriteMessageEnd( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS_
if ((hr = WsWriteEnvelopeEnd( msg, NULL )) == S_OK) hr = send_message( channel, msg );
LeaveCriticalSection( &channel->cs );
TRACE( "returning %08x\n", hr );
return hr;
}

View File

@ -151,6 +151,7 @@ void WINAPI WsFreeError( WS_ERROR *handle )
HRESULT WINAPI WsResetError( WS_ERROR *handle )
{
struct error *error = (struct error *)handle;
HRESULT hr = S_OK;
TRACE( "%p\n", handle );
@ -167,7 +168,8 @@ HRESULT WINAPI WsResetError( WS_ERROR *handle )
reset_error( error );
LeaveCriticalSection( &error->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
/**************************************************************************
@ -194,6 +196,7 @@ HRESULT WINAPI WsGetErrorProperty( WS_ERROR *handle, WS_ERROR_PROPERTY_ID id, vo
hr = prop_get( error->prop, error->prop_count, id, buf, size );
LeaveCriticalSection( &error->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -227,14 +230,10 @@ HRESULT WINAPI WsSetErrorProperty( WS_ERROR *handle, WS_ERROR_PROPERTY_ID id, co
return E_INVALIDARG;
}
if (id == WS_ERROR_PROPERTY_LANGID)
{
LeaveCriticalSection( &error->cs );
return WS_E_INVALID_OPERATION;
}
hr = prop_set( error->prop, error->prop_count, id, value, size );
if (id == WS_ERROR_PROPERTY_LANGID) hr = WS_E_INVALID_OPERATION;
else hr = prop_set( error->prop, error->prop_count, id, value, size );
LeaveCriticalSection( &error->cs );
TRACE( "returning %08x\n", hr );
return hr;
}

View File

@ -260,6 +260,7 @@ void WINAPI WsFreeHeap( WS_HEAP *handle )
HRESULT WINAPI WsResetHeap( WS_HEAP *handle, WS_ERROR *error )
{
struct heap *heap = (struct heap *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p\n", handle, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -277,7 +278,8 @@ HRESULT WINAPI WsResetHeap( WS_HEAP *handle, WS_ERROR *error )
reset_heap( heap );
LeaveCriticalSection( &heap->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
/**************************************************************************
@ -317,6 +319,7 @@ HRESULT WINAPI WsGetHeapProperty( WS_HEAP *handle, WS_HEAP_PROPERTY_ID id, void
}
LeaveCriticalSection( &heap->cs );
TRACE( "returning %08x\n", hr );
return hr;
}

View File

@ -469,15 +469,11 @@ HRESULT WINAPI WsOpenListener( WS_LISTENER *handle, WS_STRING *url, const WS_ASY
return E_INVALIDARG;
}
if (listener->state != WS_LISTENER_STATE_CREATED)
{
LeaveCriticalSection( &listener->cs );
return WS_E_INVALID_OPERATION;
}
hr = open_listener( listener, url );
if (listener->state != WS_LISTENER_STATE_CREATED) hr = WS_E_INVALID_OPERATION;
else hr = open_listener( listener, url );
LeaveCriticalSection( &listener->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -493,6 +489,7 @@ static void close_listener( struct listener *listener )
HRESULT WINAPI WsCloseListener( WS_LISTENER *handle, const WS_ASYNC_CONTEXT *ctx, WS_ERROR *error )
{
struct listener *listener = (struct listener *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p %p\n", handle, ctx, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -511,7 +508,8 @@ HRESULT WINAPI WsCloseListener( WS_LISTENER *handle, const WS_ASYNC_CONTEXT *ctx
close_listener( listener );
LeaveCriticalSection( &listener->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
/**************************************************************************
@ -520,6 +518,7 @@ HRESULT WINAPI WsCloseListener( WS_LISTENER *handle, const WS_ASYNC_CONTEXT *ctx
HRESULT WINAPI WsResetListener( WS_LISTENER *handle, WS_ERROR *error )
{
struct listener *listener = (struct listener *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p\n", handle, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -535,15 +534,13 @@ HRESULT WINAPI WsResetListener( WS_LISTENER *handle, WS_ERROR *error )
}
if (listener->state != WS_LISTENER_STATE_CREATED && listener->state != WS_LISTENER_STATE_CLOSED)
{
LeaveCriticalSection( &listener->cs );
return WS_E_INVALID_OPERATION;
}
hr = WS_E_INVALID_OPERATION;
else
reset_listener( listener );
LeaveCriticalSection( &listener->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
/**************************************************************************
@ -590,6 +587,7 @@ HRESULT WINAPI WsGetListenerProperty( WS_LISTENER *handle, WS_LISTENER_PROPERTY_
}
LeaveCriticalSection( &listener->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -618,6 +616,7 @@ HRESULT WINAPI WsSetListenerProperty( WS_LISTENER *handle, WS_LISTENER_PROPERTY_
hr = prop_set( listener->prop, listener->prop_count, id, value, size );
LeaveCriticalSection( &listener->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -645,12 +644,9 @@ HRESULT WINAPI WsAcceptChannel( WS_LISTENER *handle, WS_CHANNEL *channel_handle,
return E_INVALIDARG;
}
if (listener->state != WS_LISTENER_STATE_OPEN || listener->channel)
if (listener->state != WS_LISTENER_STATE_OPEN || listener->channel) hr = WS_E_INVALID_OPERATION;
else
{
LeaveCriticalSection( &listener->cs );
return WS_E_INVALID_OPERATION;
}
wait = listener->wait;
cancel = listener->cancel;
listener->channel = channel_handle;
@ -662,20 +658,26 @@ HRESULT WINAPI WsAcceptChannel( WS_LISTENER *handle, WS_CHANNEL *channel_handle,
SOCKET socket = listener->u.tcp.socket;
LeaveCriticalSection( &listener->cs );
return channel_accept_tcp( socket, wait, cancel, channel_handle );
hr = channel_accept_tcp( socket, wait, cancel, channel_handle );
TRACE( "returning %08x\n", hr );
return hr;
}
case WS_UDP_CHANNEL_BINDING:
{
SOCKET socket = listener->u.udp.socket;
LeaveCriticalSection( &listener->cs );
return channel_accept_udp( socket, wait, cancel, channel_handle );
hr = channel_accept_udp( socket, wait, cancel, channel_handle );
TRACE( "returning %08x\n", hr );
return hr;
}
default:
FIXME( "listener binding %u not supported\n", listener->binding );
break;
}
}
LeaveCriticalSection( &listener->cs );
TRACE( "returning %08x\n", hr );
return hr;
}

View File

@ -294,6 +294,7 @@ void WINAPI WsFreeMessage( WS_MESSAGE *handle )
HRESULT WINAPI WsResetMessage( WS_MESSAGE *handle, WS_ERROR *error )
{
struct msg *msg = (struct msg *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p\n", handle, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -311,7 +312,8 @@ HRESULT WINAPI WsResetMessage( WS_MESSAGE *handle, WS_ERROR *error )
reset_msg( msg );
LeaveCriticalSection( &msg->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
/**************************************************************************
@ -383,6 +385,7 @@ HRESULT WINAPI WsGetMessageProperty( WS_MESSAGE *handle, WS_MESSAGE_PROPERTY_ID
}
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -423,6 +426,7 @@ HRESULT WINAPI WsSetMessageProperty( WS_MESSAGE *handle, WS_MESSAGE_PROPERTY_ID
}
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -452,12 +456,9 @@ HRESULT WINAPI WsAddressMessage( WS_MESSAGE *handle, const WS_ENDPOINT_ADDRESS *
return E_INVALIDARG;
}
if (msg->state < WS_MESSAGE_STATE_INITIALIZED || msg->is_addressed)
if (msg->state < WS_MESSAGE_STATE_INITIALIZED || msg->is_addressed) hr = WS_E_INVALID_OPERATION;
else
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
}
if (addr && addr->url.length)
{
if (!(msg->addr.chars = heap_alloc( addr->url.length * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY;
@ -467,10 +468,11 @@ HRESULT WINAPI WsAddressMessage( WS_MESSAGE *handle, const WS_ENDPOINT_ADDRESS *
msg->addr.length = addr->url.length;
}
}
}
if (hr == S_OK) msg->is_addressed = TRUE;
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -743,20 +745,16 @@ HRESULT WINAPI WsWriteEnvelopeStart( WS_MESSAGE *handle, WS_XML_WRITER *writer,
return E_INVALIDARG;
}
if (msg->state != WS_MESSAGE_STATE_INITIALIZED)
if (msg->state != WS_MESSAGE_STATE_INITIALIZED) hr = WS_E_INVALID_OPERATION;
else if ((hr = write_envelope( msg )) == S_OK &&
(hr = write_envelope_start( msg, writer )) == S_OK)
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
}
if ((hr = write_envelope( msg )) != S_OK) goto done;
if ((hr = write_envelope_start( msg, writer )) != S_OK) goto done;
msg->writer_body = writer;
msg->state = WS_MESSAGE_STATE_WRITING;
}
done:
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -781,15 +779,12 @@ HRESULT WINAPI WsWriteEnvelopeEnd( WS_MESSAGE *handle, WS_ERROR *error )
return E_INVALIDARG;
}
if (msg->state != WS_MESSAGE_STATE_WRITING)
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
}
if ((hr = write_envelope_end( msg->writer_body )) == S_OK) msg->state = WS_MESSAGE_STATE_DONE;
if (msg->state != WS_MESSAGE_STATE_WRITING) hr = WS_E_INVALID_OPERATION;
else if ((hr = write_envelope_end( msg->writer_body )) == S_OK)
msg->state = WS_MESSAGE_STATE_DONE;
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -817,8 +812,8 @@ HRESULT WINAPI WsWriteBody( WS_MESSAGE *handle, const WS_ELEMENT_DESCRIPTION *de
if (msg->state != WS_MESSAGE_STATE_WRITING)
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
hr = WS_E_INVALID_OPERATION;
goto done;
}
if (desc->elementLocalName &&
@ -832,6 +827,7 @@ HRESULT WINAPI WsWriteBody( WS_MESSAGE *handle, const WS_ELEMENT_DESCRIPTION *de
done:
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -917,13 +913,8 @@ HRESULT WINAPI WsReadEnvelopeStart( WS_MESSAGE *handle, WS_XML_READER *reader, W
return E_INVALIDARG;
}
if (msg->state != WS_MESSAGE_STATE_EMPTY)
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
}
if ((hr = read_envelope_start( msg, reader )) == S_OK &&
if (msg->state != WS_MESSAGE_STATE_EMPTY) hr = WS_E_INVALID_OPERATION;
else if ((hr = read_envelope_start( msg, reader )) == S_OK &&
(hr = create_header_buffer( reader, msg->heap, &msg->buf )) == S_OK)
{
msg->reader_body = reader;
@ -931,6 +922,7 @@ HRESULT WINAPI WsReadEnvelopeStart( WS_MESSAGE *handle, WS_XML_READER *reader, W
}
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -962,15 +954,12 @@ HRESULT WINAPI WsReadEnvelopeEnd( WS_MESSAGE *handle, WS_ERROR *error )
return E_INVALIDARG;
}
if (msg->state != WS_MESSAGE_STATE_READING)
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
}
if ((hr = read_envelope_end( msg->reader_body )) == S_OK) msg->state = WS_MESSAGE_STATE_DONE;
if (msg->state != WS_MESSAGE_STATE_READING) hr = WS_E_INVALID_OPERATION;
else if ((hr = read_envelope_end( msg->reader_body )) == S_OK)
msg->state = WS_MESSAGE_STATE_DONE;
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -996,15 +985,11 @@ HRESULT WINAPI WsReadBody( WS_MESSAGE *handle, const WS_ELEMENT_DESCRIPTION *des
return E_INVALIDARG;
}
if (msg->state != WS_MESSAGE_STATE_READING)
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
}
hr = WsReadElement( msg->reader_body, desc, option, heap, value, size, NULL );
if (msg->state != WS_MESSAGE_STATE_READING) hr = WS_E_INVALID_OPERATION;
else hr = WsReadElement( msg->reader_body, desc, option, heap, value, size, NULL );
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1035,19 +1020,15 @@ HRESULT WINAPI WsInitializeMessage( WS_MESSAGE *handle, WS_MESSAGE_INITIALIZATIO
return E_INVALIDARG;
}
if (msg->state >= WS_MESSAGE_STATE_INITIALIZED)
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
}
if ((hr = write_envelope( msg )) == S_OK)
if (msg->state >= WS_MESSAGE_STATE_INITIALIZED) hr = WS_E_INVALID_OPERATION;
else if ((hr = write_envelope( msg )) == S_OK)
{
msg->init = init;
msg->state = WS_MESSAGE_STATE_INITIALIZED;
}
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1164,8 +1145,8 @@ HRESULT WINAPI WsSetHeader( WS_MESSAGE *handle, WS_HEADER_TYPE type, WS_TYPE val
if (msg->state < WS_MESSAGE_STATE_INITIALIZED)
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
hr = WS_E_INVALID_OPERATION;
goto done;
}
for (i = 0; i < msg->header_count; i++)
@ -1194,6 +1175,7 @@ HRESULT WINAPI WsSetHeader( WS_MESSAGE *handle, WS_HEADER_TYPE type, WS_TYPE val
done:
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1256,15 +1238,11 @@ HRESULT WINAPI WsGetHeader( WS_MESSAGE *handle, WS_HEADER_TYPE type, WS_TYPE val
return E_INVALIDARG;
}
if (msg->state < WS_MESSAGE_STATE_INITIALIZED)
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
}
hr = get_standard_header( msg, type, value_type, option, heap, value, size );
if (msg->state < WS_MESSAGE_STATE_INITIALIZED) hr = WS_E_INVALID_OPERATION;
else hr = get_standard_header( msg, type, value_type, option, heap, value, size );
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1298,18 +1276,10 @@ HRESULT WINAPI WsRemoveHeader( WS_MESSAGE *handle, WS_HEADER_TYPE type, WS_ERROR
return E_INVALIDARG;
}
if (msg->state < WS_MESSAGE_STATE_INITIALIZED)
if (msg->state < WS_MESSAGE_STATE_INITIALIZED) hr = WS_E_INVALID_OPERATION;
else if (type < WS_ACTION_HEADER || type > WS_FAULT_TO_HEADER) hr = E_INVALIDARG;
else
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
}
if (type < WS_ACTION_HEADER || type > WS_FAULT_TO_HEADER)
{
LeaveCriticalSection( &msg->cs );
return E_INVALIDARG;
}
for (i = 0; i < msg->header_count; i++)
{
if (msg->header[i]->type == type)
@ -1319,10 +1289,11 @@ HRESULT WINAPI WsRemoveHeader( WS_MESSAGE *handle, WS_HEADER_TYPE type, WS_ERROR
break;
}
}
if (removed) hr = write_envelope( msg );
}
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1440,8 +1411,8 @@ HRESULT WINAPI WsAddMappedHeader( WS_MESSAGE *handle, const WS_XML_STRING *name,
if (msg->state < WS_MESSAGE_STATE_INITIALIZED)
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
hr = WS_E_INVALID_OPERATION;
goto done;
}
for (i = 0; i < msg->header_count; i++)
@ -1469,6 +1440,7 @@ HRESULT WINAPI WsAddMappedHeader( WS_MESSAGE *handle, const WS_XML_STRING *name,
done:
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1478,6 +1450,7 @@ done:
HRESULT WINAPI WsRemoveMappedHeader( WS_MESSAGE *handle, const WS_XML_STRING *name, WS_ERROR *error )
{
struct msg *msg = (struct msg *)handle;
HRESULT hr = S_OK;
ULONG i;
TRACE( "%p %s %p\n", handle, debugstr_xmlstr(name), error );
@ -1493,12 +1466,9 @@ HRESULT WINAPI WsRemoveMappedHeader( WS_MESSAGE *handle, const WS_XML_STRING *na
return E_INVALIDARG;
}
if (msg->state < WS_MESSAGE_STATE_INITIALIZED)
if (msg->state < WS_MESSAGE_STATE_INITIALIZED) hr = WS_E_INVALID_OPERATION;
else
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
}
for (i = 0; i < msg->header_count; i++)
{
if (msg->header[i]->type || !msg->header[i]->mapped) continue;
@ -1508,9 +1478,11 @@ HRESULT WINAPI WsRemoveMappedHeader( WS_MESSAGE *handle, const WS_XML_STRING *na
break;
}
}
}
LeaveCriticalSection( &msg->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
static HRESULT write_custom_header( WS_XML_WRITER *writer, const WS_XML_STRING *name, const WS_XML_STRING *ns,
@ -1572,8 +1544,8 @@ HRESULT WINAPI WsAddCustomHeader( WS_MESSAGE *handle, const WS_ELEMENT_DESCRIPTI
if (msg->state < WS_MESSAGE_STATE_INITIALIZED)
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
hr = WS_E_INVALID_OPERATION;
goto done;
}
if ((hr = grow_header_array( msg, msg->header_count + 1 )) != S_OK) goto done;
@ -1584,6 +1556,7 @@ HRESULT WINAPI WsAddCustomHeader( WS_MESSAGE *handle, const WS_ELEMENT_DESCRIPTI
done:
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1636,15 +1609,11 @@ HRESULT WINAPI WsGetCustomHeader( WS_MESSAGE *handle, const WS_ELEMENT_DESCRIPTI
return E_INVALIDARG;
}
if (msg->state < WS_MESSAGE_STATE_INITIALIZED)
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
}
hr = get_custom_header( msg, desc, option, heap, value, size );
if (msg->state < WS_MESSAGE_STATE_INITIALIZED) hr = WS_E_INVALID_OPERATION;
else hr = get_custom_header( msg, desc, option, heap, value, size );
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1672,12 +1641,9 @@ HRESULT WINAPI WsRemoveCustomHeader( WS_MESSAGE *handle, const WS_XML_STRING *na
return E_INVALIDARG;
}
if (msg->state < WS_MESSAGE_STATE_INITIALIZED)
if (msg->state < WS_MESSAGE_STATE_INITIALIZED) hr = WS_E_INVALID_OPERATION;
else
{
LeaveCriticalSection( &msg->cs );
return WS_E_INVALID_OPERATION;
}
for (i = 0; i < msg->header_count; i++)
{
if (msg->header[i]->type || msg->header[i]->mapped) continue;
@ -1689,10 +1655,11 @@ HRESULT WINAPI WsRemoveCustomHeader( WS_MESSAGE *handle, const WS_XML_STRING *na
i--;
}
}
if (removed) hr = write_envelope( msg );
}
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1817,6 +1784,7 @@ HRESULT message_insert_http_headers( WS_MESSAGE *handle, HINTERNET req )
done:
heap_free( header );
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
}

View File

@ -219,6 +219,7 @@ HRESULT WINAPI WsCreateServiceProxyFromTemplate( WS_CHANNEL_TYPE channel_type,
HRESULT WINAPI WsResetServiceProxy( WS_SERVICE_PROXY *handle, WS_ERROR *error )
{
struct proxy *proxy = (struct proxy *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p\n", handle, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -234,15 +235,13 @@ HRESULT WINAPI WsResetServiceProxy( WS_SERVICE_PROXY *handle, WS_ERROR *error )
}
if (proxy->state != WS_SERVICE_PROXY_STATE_CREATED && proxy->state != WS_SERVICE_PROXY_STATE_CLOSED)
{
LeaveCriticalSection( &proxy->cs );
return WS_E_INVALID_OPERATION;
}
hr = WS_E_INVALID_OPERATION;
else
reset_proxy( proxy );
LeaveCriticalSection( &proxy->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
/**************************************************************************
@ -304,6 +303,7 @@ HRESULT WINAPI WsGetServiceProxyProperty( WS_SERVICE_PROXY *handle, WS_PROXY_PRO
}
LeaveCriticalSection( &proxy->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -334,6 +334,7 @@ HRESULT WINAPI WsOpenServiceProxy( WS_SERVICE_PROXY *handle, const WS_ENDPOINT_A
proxy->state = WS_SERVICE_PROXY_STATE_OPEN;
LeaveCriticalSection( &proxy->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -363,6 +364,7 @@ HRESULT WINAPI WsCloseServiceProxy( WS_SERVICE_PROXY *handle, const WS_ASYNC_CON
proxy->state = WS_SERVICE_PROXY_STATE_CLOSED;
LeaveCriticalSection( &proxy->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -544,5 +546,6 @@ HRESULT WINAPI WsCall( WS_SERVICE_PROXY *handle, const WS_OPERATION_DESCRIPTION
done:
WsFreeMessage( msg );
LeaveCriticalSection( &proxy->cs );
TRACE( "returning %08x\n", hr );
return hr;
}

View File

@ -622,6 +622,7 @@ HRESULT WINAPI WsFillReader( WS_XML_READER *handle, ULONG min_size, const WS_ASY
WS_ERROR *error )
{
struct reader *reader = (struct reader *)handle;
HRESULT hr = S_OK;
TRACE( "%p %u %p %p\n", handle, min_size, ctx, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -641,7 +642,8 @@ HRESULT WINAPI WsFillReader( WS_XML_READER *handle, ULONG min_size, const WS_ASY
reader->read_pos = 0;
LeaveCriticalSection( &reader->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
/**************************************************************************
@ -657,6 +659,7 @@ HRESULT WINAPI WsGetNamespaceFromPrefix( WS_XML_READER *handle, const WS_XML_STR
static const WS_XML_STRING xmlns_ns = {29, (BYTE *)"http://www.w3.org/2000/xmlns/"};
struct reader *reader = (struct reader *)handle;
BOOL found = FALSE;
HRESULT hr = S_OK;
TRACE( "%p %s %d %p %p\n", handle, debugstr_xmlstr(prefix), required, ns, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -671,13 +674,8 @@ HRESULT WINAPI WsGetNamespaceFromPrefix( WS_XML_READER *handle, const WS_XML_STR
return E_INVALIDARG;
}
if (reader->state != READER_STATE_STARTELEMENT)
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_OPERATION;
}
if (!prefix->length)
if (reader->state != READER_STATE_STARTELEMENT) hr = WS_E_INVALID_OPERATION;
else if (!prefix->length)
{
*ns = &empty_ns;
found = TRUE;
@ -711,14 +709,18 @@ HRESULT WINAPI WsGetNamespaceFromPrefix( WS_XML_READER *handle, const WS_XML_STR
LeaveCriticalSection( &reader->cs );
if (!found)
if (hr == S_OK && !found)
{
if (required) hr = WS_E_INVALID_FORMAT;
else
{
if (required) return WS_E_INVALID_FORMAT;
*ns = NULL;
return S_FALSE;
hr = S_FALSE;
}
}
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
/**************************************************************************
@ -728,6 +730,7 @@ HRESULT WINAPI WsGetReaderNode( WS_XML_READER *handle, const WS_XML_NODE **node,
WS_ERROR *error )
{
struct reader *reader = (struct reader *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p %p\n", handle, node, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -745,6 +748,7 @@ HRESULT WINAPI WsGetReaderNode( WS_XML_READER *handle, const WS_XML_NODE **node,
*node = &reader->current->hdr.node;
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return S_OK;
}
@ -778,16 +782,12 @@ HRESULT WINAPI WsGetReaderProperty( WS_XML_READER *handle, WS_XML_READER_PROPERT
return E_INVALIDARG;
}
if (!reader->input_type)
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_OPERATION;
}
if (id == WS_XML_READER_PROPERTY_CHARSET) hr = get_charset( reader, buf, size );
if (!reader->input_type) hr = WS_E_INVALID_OPERATION;
else if (id == WS_XML_READER_PROPERTY_CHARSET) hr = get_charset( reader, buf, size );
else hr = prop_get( reader->prop, reader->prop_count, id, buf, size );
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -3098,6 +3098,7 @@ HRESULT WINAPI WsReadEndElement( WS_XML_READER *handle, WS_ERROR *error )
hr = read_endelement( reader );
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -3125,6 +3126,7 @@ HRESULT WINAPI WsReadNode( WS_XML_READER *handle, WS_ERROR *error )
hr = read_node( reader );
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -3171,6 +3173,7 @@ HRESULT WINAPI WsSkipNode( WS_XML_READER *handle, WS_ERROR *error )
hr = skip_node( reader );
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -3198,6 +3201,7 @@ HRESULT WINAPI WsReadStartElement( WS_XML_READER *handle, WS_ERROR *error )
hr = read_startelement( reader );
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -3227,6 +3231,7 @@ HRESULT WINAPI WsReadToStartElement( WS_XML_READER *handle, const WS_XML_STRING
hr = read_to_startelement( reader, found );
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -3523,15 +3528,11 @@ HRESULT WINAPI WsMoveReader( WS_XML_READER *handle, WS_MOVE_TO move, BOOL *found
return E_INVALIDARG;
}
if (!reader->input_type)
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_OPERATION;
}
hr = read_move_to( reader, move, found );
if (!reader->input_type) hr = WS_E_INVALID_OPERATION;
else hr = read_move_to( reader, move, found );
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -3542,6 +3543,7 @@ HRESULT WINAPI WsReadStartAttribute( WS_XML_READER *handle, ULONG index, WS_ERRO
{
struct reader *reader = (struct reader *)handle;
const WS_XML_ELEMENT_NODE *elem;
HRESULT hr = S_OK;
TRACE( "%p %u %p\n", handle, index, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -3557,16 +3559,15 @@ HRESULT WINAPI WsReadStartAttribute( WS_XML_READER *handle, ULONG index, WS_ERRO
}
elem = &reader->current->hdr;
if (reader->state != READER_STATE_STARTELEMENT || index >= elem->attributeCount)
if (reader->state != READER_STATE_STARTELEMENT || index >= elem->attributeCount) hr = WS_E_INVALID_FORMAT;
else
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_FORMAT;
}
reader->current_attr = index;
reader->state = READER_STATE_STARTATTRIBUTE;
}
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return S_OK;
}
@ -3576,6 +3577,7 @@ HRESULT WINAPI WsReadStartAttribute( WS_XML_READER *handle, ULONG index, WS_ERRO
HRESULT WINAPI WsReadEndAttribute( WS_XML_READER *handle, WS_ERROR *error )
{
struct reader *reader = (struct reader *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p\n", handle, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -3590,16 +3592,12 @@ HRESULT WINAPI WsReadEndAttribute( WS_XML_READER *handle, WS_ERROR *error )
return E_INVALIDARG;
}
if (reader->state != READER_STATE_STARTATTRIBUTE)
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_FORMAT;
}
reader->state = READER_STATE_STARTELEMENT;
if (reader->state != READER_STATE_STARTATTRIBUTE) hr = WS_E_INVALID_FORMAT;
else reader->state = READER_STATE_STARTELEMENT;
LeaveCriticalSection( &reader->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
static HRESULT str_to_bool( const unsigned char *str, ULONG len, BOOL *ret )
@ -4061,27 +4059,13 @@ HRESULT WINAPI WsReadQualifiedName( WS_XML_READER *handle, WS_HEAP *heap, WS_XML
return E_INVALIDARG;
}
if (!reader->input_type)
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_OPERATION;
}
if (!localname)
{
LeaveCriticalSection( &reader->cs );
return E_INVALIDARG;
}
if (reader->state != READER_STATE_TEXT)
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_FORMAT;
}
hr = read_qualified_name( reader, heap, prefix, localname, ns );
if (!reader->input_type) hr = WS_E_INVALID_OPERATION;
else if (!localname) hr = E_INVALIDARG;
else if (reader->state != READER_STATE_TEXT) hr = WS_E_INVALID_FORMAT;
else hr = read_qualified_name( reader, heap, prefix, localname, ns );
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -4299,13 +4283,8 @@ HRESULT WINAPI WsFindAttribute( WS_XML_READER *handle, const WS_XML_STRING *loca
return E_INVALIDARG;
}
if (node_type( reader->current ) != WS_XML_NODE_TYPE_ELEMENT)
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_OPERATION;
}
if (!find_attribute( reader, localname, ns, index ))
if (node_type( reader->current ) != WS_XML_NODE_TYPE_ELEMENT) hr = WS_E_INVALID_OPERATION;
else if (!find_attribute( reader, localname, ns, index ))
{
if (required) hr = WS_E_INVALID_FORMAT;
else
@ -4316,6 +4295,7 @@ HRESULT WINAPI WsFindAttribute( WS_XML_READER *handle, const WS_XML_STRING *loca
}
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -6701,12 +6681,8 @@ HRESULT WINAPI WsReadType( WS_XML_READER *handle, WS_TYPE_MAPPING mapping, WS_TY
return E_INVALIDARG;
}
if ((hr = read_type( reader, mapping, type, NULL, NULL, desc, option, heap, value, size, &found )) != S_OK)
if ((hr = read_type( reader, mapping, type, NULL, NULL, desc, option, heap, value, size, &found )) == S_OK)
{
LeaveCriticalSection( &reader->cs );
return hr;
}
switch (mapping)
{
case WS_ELEMENT_TYPE_MAPPING:
@ -6716,10 +6692,11 @@ HRESULT WINAPI WsReadType( WS_XML_READER *handle, WS_TYPE_MAPPING mapping, WS_TY
default:
break;
}
if (hr == S_OK && !read_end_of_data( reader )) hr = WS_E_INVALID_FORMAT;
}
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -6774,6 +6751,7 @@ HRESULT WINAPI WsReadElement( WS_XML_READER *handle, const WS_ELEMENT_DESCRIPTIO
desc->elementNs, desc->typeDescription, option, heap, value, size, &found );
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -6805,6 +6783,7 @@ HRESULT WINAPI WsReadValue( WS_XML_READER *handle, WS_VALUE_TYPE value_type, voi
NULL, value, size, &found );
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -6832,16 +6811,12 @@ HRESULT WINAPI WsReadAttribute( WS_XML_READER *handle, const WS_ATTRIBUTE_DESCRI
return E_INVALIDARG;
}
if (!reader->input_type)
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_OPERATION;
}
hr = read_type( reader, WS_ATTRIBUTE_TYPE_MAPPING, desc->type, desc->attributeLocalName,
if (!reader->input_type) hr = WS_E_INVALID_OPERATION;
else hr = read_type( reader, WS_ATTRIBUTE_TYPE_MAPPING, desc->type, desc->attributeLocalName,
desc->attributeNs, desc->typeDescription, option, heap, value, size, &found );
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -6984,6 +6959,7 @@ HRESULT WINAPI WsSetInput( WS_XML_READER *handle, const WS_XML_READER_ENCODING *
done:
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -7033,6 +7009,7 @@ HRESULT WINAPI WsSetInputToBuffer( WS_XML_READER *handle, WS_XML_BUFFER *buffer,
done:
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -7042,6 +7019,7 @@ done:
HRESULT WINAPI WsGetReaderPosition( WS_XML_READER *handle, WS_XML_NODE_POSITION *pos, WS_ERROR *error )
{
struct reader *reader = (struct reader *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p %p\n", handle, pos, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -7056,17 +7034,16 @@ HRESULT WINAPI WsGetReaderPosition( WS_XML_READER *handle, WS_XML_NODE_POSITION
return E_INVALIDARG;
}
if (!reader->input_buf)
if (!reader->input_buf) hr = WS_E_INVALID_OPERATION;
else
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_OPERATION;
}
pos->buffer = (WS_XML_BUFFER *)reader->input_buf;
pos->node = reader->current;
}
LeaveCriticalSection( &reader->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
/**************************************************************************
@ -7075,6 +7052,7 @@ HRESULT WINAPI WsGetReaderPosition( WS_XML_READER *handle, WS_XML_NODE_POSITION
HRESULT WINAPI WsSetReaderPosition( WS_XML_READER *handle, const WS_XML_NODE_POSITION *pos, WS_ERROR *error )
{
struct reader *reader = (struct reader *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p %p\n", handle, pos, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -7089,16 +7067,12 @@ HRESULT WINAPI WsSetReaderPosition( WS_XML_READER *handle, const WS_XML_NODE_POS
return E_INVALIDARG;
}
if (!reader->input_buf)
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_OPERATION;
}
reader->current = pos->node;
if (!reader->input_buf) hr = WS_E_INVALID_OPERATION;
else reader->current = pos->node;
LeaveCriticalSection( &reader->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
static HRESULT utf8_to_base64( const WS_XML_UTF8_TEXT *utf8, WS_XML_BASE64_TEXT *base64 )
@ -7115,7 +7089,7 @@ static HRESULT utf8_to_base64( const WS_XML_UTF8_TEXT *utf8, WS_XML_BASE64_TEXT
HRESULT WINAPI WsReadBytes( WS_XML_READER *handle, void *bytes, ULONG max_count, ULONG *count, WS_ERROR *error )
{
struct reader *reader = (struct reader *)handle;
HRESULT hr;
HRESULT hr = S_OK;
TRACE( "%p %p %u %p %p\n", handle, bytes, max_count, count, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -7132,14 +7106,13 @@ HRESULT WINAPI WsReadBytes( WS_XML_READER *handle, void *bytes, ULONG max_count,
if (!reader->input_type)
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_OPERATION;
hr = WS_E_INVALID_OPERATION;
goto done;
}
if (!count)
{
LeaveCriticalSection( &reader->cs );
return E_INVALIDARG;
hr = E_INVALIDARG;
goto done;
}
*count = 0;
@ -7148,17 +7121,12 @@ HRESULT WINAPI WsReadBytes( WS_XML_READER *handle, void *bytes, ULONG max_count,
const WS_XML_TEXT_NODE *text = (const WS_XML_TEXT_NODE *)reader->current;
WS_XML_BASE64_TEXT base64;
if ((hr = utf8_to_base64( (const WS_XML_UTF8_TEXT *)text->text, &base64 )) != S_OK)
{
LeaveCriticalSection( &reader->cs );
return hr;
}
if ((hr = utf8_to_base64( (const WS_XML_UTF8_TEXT *)text->text, &base64 )) != S_OK) goto done;
if (reader->text_conv_offset == base64.length)
{
heap_free( base64.bytes );
hr = read_node( reader );
LeaveCriticalSection( &reader->cs );
return hr;
goto done;
}
*count = min( base64.length - reader->text_conv_offset, max_count );
memcpy( bytes, base64.bytes + reader->text_conv_offset, *count );
@ -7166,8 +7134,10 @@ HRESULT WINAPI WsReadBytes( WS_XML_READER *handle, void *bytes, ULONG max_count,
heap_free( base64.bytes );
}
done:
LeaveCriticalSection( &reader->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
static HRESULT utf8_to_utf16( const WS_XML_UTF8_TEXT *utf8, WS_XML_UTF16_TEXT *utf16 )
@ -7185,6 +7155,7 @@ static HRESULT utf8_to_utf16( const WS_XML_UTF8_TEXT *utf8, WS_XML_UTF16_TEXT *u
HRESULT WINAPI WsReadChars( WS_XML_READER *handle, WCHAR *chars, ULONG max_count, ULONG *count, WS_ERROR *error )
{
struct reader *reader = (struct reader *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p %u %p %p\n", handle, chars, max_count, count, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -7201,14 +7172,13 @@ HRESULT WINAPI WsReadChars( WS_XML_READER *handle, WCHAR *chars, ULONG max_count
if (!reader->input_type)
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_OPERATION;
hr = WS_E_INVALID_OPERATION;
goto done;
}
if (!count)
{
LeaveCriticalSection( &reader->cs );
return E_INVALIDARG;
hr = E_INVALIDARG;
goto done;
}
*count = 0;
@ -7218,17 +7188,12 @@ HRESULT WINAPI WsReadChars( WS_XML_READER *handle, WCHAR *chars, ULONG max_count
WS_XML_UTF16_TEXT utf16;
HRESULT hr;
if ((hr = utf8_to_utf16( (const WS_XML_UTF8_TEXT *)text->text, &utf16 )) != S_OK)
{
LeaveCriticalSection( &reader->cs );
return hr;
}
if ((hr = utf8_to_utf16( (const WS_XML_UTF8_TEXT *)text->text, &utf16 )) != S_OK) goto done;
if (reader->text_conv_offset == utf16.byteCount / sizeof(WCHAR))
{
heap_free( utf16.bytes );
hr = read_node( reader );
LeaveCriticalSection( &reader->cs );
return hr;
goto done;
}
*count = min( utf16.byteCount / sizeof(WCHAR) - reader->text_conv_offset, max_count );
memcpy( chars, utf16.bytes + reader->text_conv_offset * sizeof(WCHAR), *count * sizeof(WCHAR) );
@ -7236,8 +7201,10 @@ HRESULT WINAPI WsReadChars( WS_XML_READER *handle, WCHAR *chars, ULONG max_count
heap_free( utf16.bytes );
}
done:
LeaveCriticalSection( &reader->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
/**************************************************************************
@ -7246,7 +7213,7 @@ HRESULT WINAPI WsReadChars( WS_XML_READER *handle, WCHAR *chars, ULONG max_count
HRESULT WINAPI WsReadCharsUtf8( WS_XML_READER *handle, BYTE *bytes, ULONG max_count, ULONG *count, WS_ERROR *error )
{
struct reader *reader = (struct reader *)handle;
HRESULT hr;
HRESULT hr = S_OK;
TRACE( "%p %p %u %p %p\n", handle, bytes, max_count, count, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -7263,14 +7230,13 @@ HRESULT WINAPI WsReadCharsUtf8( WS_XML_READER *handle, BYTE *bytes, ULONG max_co
if (!reader->input_type)
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_OPERATION;
hr = WS_E_INVALID_OPERATION;
goto done;
}
if (!count)
{
LeaveCriticalSection( &reader->cs );
return E_INVALIDARG;
hr = E_INVALIDARG;
goto done;
}
*count = 0;
@ -7282,16 +7248,17 @@ HRESULT WINAPI WsReadCharsUtf8( WS_XML_READER *handle, BYTE *bytes, ULONG max_co
if (reader->text_conv_offset == utf8->value.length)
{
hr = read_node( reader );
LeaveCriticalSection( &reader->cs );
return hr;
goto done;
}
*count = min( utf8->value.length - reader->text_conv_offset, max_count );
memcpy( bytes, utf8->value.bytes + reader->text_conv_offset, *count );
reader->text_conv_offset += *count;
}
done:
LeaveCriticalSection( &reader->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
static HRESULT move_to_element( struct reader *reader )
@ -7328,7 +7295,7 @@ HRESULT WINAPI WsReadXmlBuffer( WS_XML_READER *handle, WS_HEAP *heap, WS_XML_BUF
{
struct reader *reader = (struct reader *)handle;
WS_XML_WRITER *writer = NULL;
WS_XML_BUFFER *buffer;
WS_XML_BUFFER *buffer = NULL;
HRESULT hr;
TRACE( "%p %p %p %p\n", handle, heap, ret, error );
@ -7345,21 +7312,20 @@ HRESULT WINAPI WsReadXmlBuffer( WS_XML_READER *handle, WS_HEAP *heap, WS_XML_BUF
return E_INVALIDARG;
}
if (!reader->input_type)
if (!reader->input_type) hr = WS_E_INVALID_OPERATION;
else
{
LeaveCriticalSection( &reader->cs );
return WS_E_INVALID_OPERATION;
}
if ((hr = WsCreateWriter( NULL, 0, &writer, NULL )) != S_OK) goto done;
if ((hr = WsCreateXmlBuffer( heap, NULL, 0, &buffer, NULL )) != S_OK) goto done;
if ((hr = WsSetOutputToBuffer( writer, buffer, NULL, 0, NULL )) != S_OK) goto done;
if ((hr = copy_tree( reader, writer )) == S_OK) *ret = buffer;
}
done:
if (hr != S_OK) free_xmlbuf( (struct xmlbuf *)buffer );
WsFreeWriter( writer );
LeaveCriticalSection( &reader->cs );
TRACE( "returning %08x\n", hr );
return hr;
}

View File

@ -294,12 +294,9 @@ HRESULT WINAPI WsGetWriterProperty( WS_XML_WRITER *handle, WS_XML_WRITER_PROPERT
return E_INVALIDARG;
}
if (!writer->output_type)
if (!writer->output_type) hr = WS_E_INVALID_OPERATION;
else
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
switch (id)
{
case WS_XML_WRITER_PROPERTY_BYTES:
@ -329,8 +326,10 @@ HRESULT WINAPI WsGetWriterProperty( WS_XML_WRITER *handle, WS_XML_WRITER_PROPERT
default:
hr = prop_get( writer->prop, writer->prop_count, id, buf, size );
}
}
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -438,6 +437,7 @@ HRESULT WINAPI WsSetOutput( WS_XML_WRITER *handle, const WS_XML_WRITER_ENCODING
done:
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -485,6 +485,7 @@ HRESULT WINAPI WsSetOutputToBuffer( WS_XML_WRITER *handle, WS_XML_BUFFER *buffer
done:
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1476,6 +1477,7 @@ HRESULT WINAPI WsGetPrefixFromNamespace( WS_XML_WRITER *handle, const WS_XML_STR
}
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1654,6 +1656,7 @@ static HRESULT set_namespaces( struct writer *writer )
HRESULT WINAPI WsWriteEndAttribute( WS_XML_WRITER *handle, WS_ERROR *error )
{
struct writer *writer = (struct writer *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p\n", handle, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -1671,7 +1674,8 @@ HRESULT WINAPI WsWriteEndAttribute( WS_XML_WRITER *handle, WS_ERROR *error )
writer->state = WRITER_STATE_STARTELEMENT;
LeaveCriticalSection( &writer->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
static HRESULT write_attributes( struct writer *writer, const WS_XML_ELEMENT_NODE *elem )
@ -1913,6 +1917,7 @@ HRESULT WINAPI WsWriteEndElement( WS_XML_WRITER *handle, WS_ERROR *error )
hr = write_endelement_node( writer );
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -1957,19 +1962,18 @@ HRESULT WINAPI WsWriteEndStartElement( WS_XML_WRITER *handle, WS_ERROR *error )
return E_INVALIDARG;
}
if (writer->state != WRITER_STATE_STARTELEMENT)
if (writer->state != WRITER_STATE_STARTELEMENT) hr = WS_E_INVALID_OPERATION;
else
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
if ((hr = set_namespaces( writer )) != S_OK) goto done;
if ((hr = write_startelement( writer )) != S_OK) goto done;
if ((hr = write_endstartelement( writer )) != S_OK) goto done;
writer->state = WRITER_STATE_ENDSTARTELEMENT;
}
done:
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -2033,16 +2037,12 @@ HRESULT WINAPI WsWriteStartAttribute( WS_XML_WRITER *handle, const WS_XML_STRING
return E_INVALIDARG;
}
if (writer->state != WRITER_STATE_STARTELEMENT)
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
if ((hr = write_add_attribute( writer, prefix, localname, ns, single )) == S_OK)
if (writer->state != WRITER_STATE_STARTELEMENT) hr = WS_E_INVALID_OPERATION;
else if ((hr = write_add_attribute( writer, prefix, localname, ns, single )) == S_OK)
writer->state = WRITER_STATE_STARTATTRIBUTE;
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -2121,6 +2121,7 @@ HRESULT WINAPI WsWriteStartCData( WS_XML_WRITER *handle, WS_ERROR *error )
hr = write_cdata_node( writer );
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -2162,15 +2163,11 @@ HRESULT WINAPI WsWriteEndCData( WS_XML_WRITER *handle, WS_ERROR *error )
return E_INVALIDARG;
}
if (writer->state != WRITER_STATE_TEXT)
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
hr = write_endcdata_node( writer );
if (writer->state != WRITER_STATE_TEXT) hr = WS_E_INVALID_OPERATION;
else hr = write_endcdata_node( writer );
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -2257,6 +2254,7 @@ HRESULT WINAPI WsWriteStartElement( WS_XML_WRITER *handle, const WS_XML_STRING *
hr = write_element_node( writer, prefix, localname, ns );
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -2892,6 +2890,7 @@ HRESULT WINAPI WsWriteText( WS_XML_WRITER *handle, const WS_XML_TEXT *text, WS_E
else hr = write_text_node( writer, text );
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -2917,20 +2916,19 @@ HRESULT WINAPI WsWriteBytes( WS_XML_WRITER *handle, const void *bytes, ULONG cou
return E_INVALIDARG;
}
if (!writer->output_type)
if (!writer->output_type) hr = WS_E_INVALID_OPERATION;
else
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
base64.text.textType = WS_XML_TEXT_TYPE_BASE64;
base64.bytes = (BYTE *)bytes;
base64.length = count;
if (writer->state == WRITER_STATE_STARTATTRIBUTE) hr = write_set_attribute_value( writer, &base64.text );
else hr = write_text_node( writer, &base64.text );
}
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -2956,20 +2954,19 @@ HRESULT WINAPI WsWriteChars( WS_XML_WRITER *handle, const WCHAR *chars, ULONG co
return E_INVALIDARG;
}
if (!writer->output_type)
if (!writer->output_type) hr = WS_E_INVALID_OPERATION;
else
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
utf16.text.textType = WS_XML_TEXT_TYPE_UTF16;
utf16.bytes = (BYTE *)chars;
utf16.byteCount = count * sizeof(WCHAR);
if (writer->state == WRITER_STATE_STARTATTRIBUTE) hr = write_set_attribute_value( writer, &utf16.text );
else hr = write_text_node( writer, &utf16.text );
}
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -2995,20 +2992,19 @@ HRESULT WINAPI WsWriteCharsUtf8( WS_XML_WRITER *handle, const BYTE *bytes, ULONG
return E_INVALIDARG;
}
if (!writer->output_type)
if (!writer->output_type) hr = WS_E_INVALID_OPERATION;
else
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
utf8.text.textType = WS_XML_TEXT_TYPE_UTF8;
utf8.value.bytes = (BYTE *)bytes;
utf8.value.length = count;
if (writer->state == WRITER_STATE_STARTATTRIBUTE) hr = write_set_attribute_value( writer, &utf8.text );
else hr = write_text_node( writer, &utf8.text );
}
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -3892,22 +3888,15 @@ HRESULT WINAPI WsWriteAttribute( WS_XML_WRITER *handle, const WS_ATTRIBUTE_DESCR
return E_INVALIDARG;
}
if (writer->state != WRITER_STATE_STARTELEMENT)
if (writer->state != WRITER_STATE_STARTELEMENT) hr = WS_E_INVALID_OPERATION;
else if ((hr = write_add_attribute( writer, NULL, desc->attributeLocalName, desc->attributeNs, FALSE )) == S_OK)
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
if ((hr = write_add_attribute( writer, NULL, desc->attributeLocalName, desc->attributeNs, FALSE )) != S_OK)
{
LeaveCriticalSection( &writer->cs );
return hr;
}
writer->state = WRITER_STATE_STARTATTRIBUTE;
hr = write_type( writer, WS_ATTRIBUTE_TYPE_MAPPING, desc->type, desc->typeDescription, option, value, size );
}
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -3944,6 +3933,7 @@ HRESULT WINAPI WsWriteElement( WS_XML_WRITER *handle, const WS_ELEMENT_DESCRIPTI
done:
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -3990,6 +3980,7 @@ HRESULT WINAPI WsWriteType( WS_XML_WRITER *handle, WS_TYPE_MAPPING mapping, WS_T
}
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -4059,6 +4050,7 @@ HRESULT WINAPI WsWriteValue( WS_XML_WRITER *handle, WS_VALUE_TYPE value_type, co
if (hr == S_OK) hr = write_type( writer, mapping, type, NULL, WS_WRITE_REQUIRED_VALUE, value, size );
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -4090,21 +4082,21 @@ HRESULT WINAPI WsWriteArray( WS_XML_WRITER *handle, const WS_XML_STRING *localna
if (!writer->output_type)
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
hr = WS_E_INVALID_OPERATION;
goto done;
}
if (!localname || !ns || (type = map_value_type( value_type )) == ~0u)
{
LeaveCriticalSection( &writer->cs );
return E_INVALIDARG;
hr = E_INVALIDARG;
goto done;
}
type_size = get_type_size( type, NULL );
if (size % type_size || (offset + count) * type_size > size || (count && !array))
{
LeaveCriticalSection( &writer->cs );
return E_INVALIDARG;
hr = E_INVALIDARG;
goto done;
}
for (i = offset; i < count; i++)
@ -4118,6 +4110,7 @@ HRESULT WINAPI WsWriteArray( WS_XML_WRITER *handle, const WS_XML_STRING *localna
done:
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -4156,6 +4149,7 @@ HRESULT WINAPI WsWriteXmlBuffer( WS_XML_WRITER *handle, WS_XML_BUFFER *buffer, W
done:
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -4210,6 +4204,7 @@ HRESULT WINAPI WsWriteXmlBufferToBytes( WS_XML_WRITER *handle, WS_XML_BUFFER *bu
done:
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -4236,16 +4231,12 @@ HRESULT WINAPI WsWriteXmlnsAttribute( WS_XML_WRITER *handle, const WS_XML_STRING
return E_INVALIDARG;
}
if (writer->state != WRITER_STATE_STARTELEMENT)
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
if (!namespace_in_scope( &writer->current->hdr, prefix, ns ))
if (writer->state != WRITER_STATE_STARTELEMENT) hr = WS_E_INVALID_OPERATION;
else if (!namespace_in_scope( &writer->current->hdr, prefix, ns ))
hr = add_namespace_attribute( writer, prefix, ns, single );
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -4290,27 +4281,13 @@ HRESULT WINAPI WsWriteQualifiedName( WS_XML_WRITER *handle, const WS_XML_STRING
return E_INVALIDARG;
}
if (!writer->output_type)
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
if (writer->state != WRITER_STATE_STARTELEMENT)
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_FORMAT;
}
if (!localname || (!prefix && !ns))
{
LeaveCriticalSection( &writer->cs );
return E_INVALIDARG;
}
hr = write_qualified_name( writer, prefix, localname, ns );
if (!writer->output_type) hr = WS_E_INVALID_OPERATION;
else if (writer->state != WRITER_STATE_STARTELEMENT) hr = WS_E_INVALID_FORMAT;
else if (!localname || (!prefix && !ns)) hr = E_INVALIDARG;
else hr = write_qualified_name( writer, prefix, localname, ns );
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -4406,15 +4383,11 @@ HRESULT WINAPI WsMoveWriter( WS_XML_WRITER *handle, WS_MOVE_TO move, BOOL *found
return E_INVALIDARG;
}
if (!writer->output_type)
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
hr = write_move_to( writer, move, found );
if (!writer->output_type) hr = WS_E_INVALID_OPERATION;
else hr = write_move_to( writer, move, found );
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -4424,6 +4397,7 @@ HRESULT WINAPI WsMoveWriter( WS_XML_WRITER *handle, WS_MOVE_TO move, BOOL *found
HRESULT WINAPI WsGetWriterPosition( WS_XML_WRITER *handle, WS_XML_NODE_POSITION *pos, WS_ERROR *error )
{
struct writer *writer = (struct writer *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p %p\n", handle, pos, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -4438,17 +4412,16 @@ HRESULT WINAPI WsGetWriterPosition( WS_XML_WRITER *handle, WS_XML_NODE_POSITION
return E_INVALIDARG;
}
if (!writer->output_type)
if (!writer->output_type) hr = WS_E_INVALID_OPERATION;
else
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
pos->buffer = (WS_XML_BUFFER *)writer->output_buf;
pos->node = writer->current;
}
LeaveCriticalSection( &writer->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
/**************************************************************************
@ -4457,6 +4430,7 @@ HRESULT WINAPI WsGetWriterPosition( WS_XML_WRITER *handle, WS_XML_NODE_POSITION
HRESULT WINAPI WsSetWriterPosition( WS_XML_WRITER *handle, const WS_XML_NODE_POSITION *pos, WS_ERROR *error )
{
struct writer *writer = (struct writer *)handle;
HRESULT hr = S_OK;
TRACE( "%p %p %p\n", handle, pos, error );
if (error) FIXME( "ignoring error parameter\n" );
@ -4471,16 +4445,12 @@ HRESULT WINAPI WsSetWriterPosition( WS_XML_WRITER *handle, const WS_XML_NODE_POS
return E_INVALIDARG;
}
if (!writer->output_type)
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
writer->current = pos->node;
if (!writer->output_type) hr = WS_E_INVALID_OPERATION;
else writer->current = pos->node;
LeaveCriticalSection( &writer->cs );
return S_OK;
TRACE( "returning %08x\n", hr );
return hr;
}
static HRESULT write_add_comment_node( struct writer *writer, const WS_XML_STRING *value )
@ -4635,15 +4605,11 @@ HRESULT WINAPI WsWriteNode( WS_XML_WRITER *handle, const WS_XML_NODE *node, WS_E
return E_INVALIDARG;
}
if (!writer->output_type)
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_OPERATION;
}
hr = write_node( writer, node );
if (!writer->output_type) hr = WS_E_INVALID_OPERATION;
else hr = write_node( writer, node );
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}
@ -4758,12 +4724,9 @@ HRESULT WINAPI WsCopyNode( WS_XML_WRITER *handle, WS_XML_READER *reader, WS_ERRO
return E_INVALIDARG;
}
if (!(parent = find_parent( writer )))
if (!(parent = find_parent( writer ))) hr = WS_E_INVALID_FORMAT;
else
{
LeaveCriticalSection( &writer->cs );
return WS_E_INVALID_FORMAT;
}
if ((hr = copy_node( reader, writer->output_enc, &node )) != S_OK) goto done;
current = writer->current;
write_insert_node( writer, parent, node );
@ -4773,9 +4736,11 @@ HRESULT WINAPI WsCopyNode( WS_XML_WRITER *handle, WS_XML_READER *reader, WS_ERRO
writer->current = current;
WsMoveReader( reader, WS_MOVE_TO_NEXT_NODE, NULL, NULL );
}
done:
LeaveCriticalSection( &writer->cs );
TRACE( "returning %08x\n", hr );
return hr;
}