Hans Leidekker : webservices: Use the static dictionary only while writing the message header.
Alexandre Julliard
julliard at winehq.org
Wed Jun 20 17:13:13 CDT 2018
Module: wine
Branch: master
Commit: d120f7f8418f32285e3ccc71d5778aa6ce3a60be
URL: https://source.winehq.org/git/wine.git/?a=commit;h=d120f7f8418f32285e3ccc71d5778aa6ce3a60be
Author: Hans Leidekker <hans at codeweavers.com>
Date: Wed Jun 20 15:04:47 2018 +0200
webservices: Use the static dictionary only while writing the message header.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/webservices/channel.c | 30 ++++++++++++++----------------
dlls/webservices/webservices_private.h | 2 +-
dlls/webservices/writer.c | 4 ++--
3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/dlls/webservices/channel.c b/dlls/webservices/channel.c
index 6c7c8af..79d431f 100644
--- a/dlls/webservices/channel.c
+++ b/dlls/webservices/channel.c
@@ -967,15 +967,6 @@ static HRESULT connect_channel( struct channel *channel )
}
}
-static HRESULT write_message( WS_MESSAGE *handle, WS_XML_WRITER *writer, const WS_ELEMENT_DESCRIPTION *desc,
- WS_WRITE_OPTION option, const void *body, ULONG size )
-{
- HRESULT hr;
- if ((hr = WsWriteEnvelopeStart( handle, writer, NULL, NULL, NULL )) != S_OK) return hr;
- if ((hr = WsWriteBody( handle, desc, option, body, size, NULL )) != S_OK) return hr;
- return WsWriteEnvelopeEnd( handle, NULL );
-}
-
static HRESULT send_message_http( HINTERNET request, BYTE *data, ULONG len )
{
if (!WinHttpSendRequest( request, NULL, 0, data, len, len, 0 ))
@@ -1298,8 +1289,7 @@ static HRESULT init_writer( struct channel *channel )
bin.staticDictionary = (WS_XML_DICTIONARY *)&dict_builtin_static.dict;
bin.dynamicStringCallback = dict_cb;
bin.dynamicStringCallbackState = &channel->dict_send;
- if ((hr = WsSetOutput( channel->writer, &bin.encoding, &buf.output, NULL, 0, NULL )) != S_OK) return hr;
- return writer_enable_lookup( channel->writer );
+ return WsSetOutput( channel->writer, &bin.encoding, &buf.output, NULL, 0, NULL );
case WS_ENCODING_XML_BINARY_1:
return WsSetOutput( channel->writer, &bin.encoding, &buf.output, NULL, 0, NULL );
@@ -1310,6 +1300,17 @@ static HRESULT init_writer( struct channel *channel )
}
}
+static HRESULT write_message( struct channel *channel, WS_MESSAGE *msg, const WS_ELEMENT_DESCRIPTION *desc,
+ WS_WRITE_OPTION option, const void *body, ULONG size )
+{
+ HRESULT hr;
+ if ((hr = writer_set_lookup( channel->writer, TRUE )) != S_OK) return hr;
+ if ((hr = WsWriteEnvelopeStart( msg, channel->writer, NULL, NULL, NULL )) != S_OK) return hr;
+ if ((hr = writer_set_lookup( channel->writer, FALSE )) != S_OK) return hr;
+ if ((hr = WsWriteBody( msg, desc, option, body, size, NULL )) != S_OK) return hr;
+ return WsWriteEnvelopeEnd( msg, NULL );
+}
+
/**************************************************************************
* WsSendMessage [webservices.@]
*/
@@ -1339,8 +1340,7 @@ HRESULT WINAPI WsSendMessage( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS_MESS
if ((hr = message_set_action( msg, desc->action )) != S_OK) goto done;
if ((hr = init_writer( channel )) != S_OK) goto done;
- if ((hr = write_message( msg, channel->writer, desc->bodyElementDescription, option, body, size )) != S_OK)
- goto done;
+ if ((hr = write_message( channel, msg, desc->bodyElementDescription, option, body, size )) != S_OK) goto done;
hr = send_message( channel, msg );
done:
@@ -1380,13 +1380,11 @@ HRESULT WINAPI WsSendReplyMessage( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS
if ((hr = message_set_request_id( msg, &req_id )) != S_OK) goto done;
if ((hr = init_writer( channel )) != S_OK) goto done;
- if ((hr = write_message( msg, channel->writer, desc->bodyElementDescription, option, body, size )) != S_OK)
- goto done;
+ if ((hr = write_message( channel, msg, desc->bodyElementDescription, option, body, size )) != S_OK) goto done;
hr = send_message( channel, msg );
done:
LeaveCriticalSection( &channel->cs );
- FIXME( "returning %08x\n", hr );
return hr;
}
diff --git a/dlls/webservices/webservices_private.h b/dlls/webservices/webservices_private.h
index cce49cc..bfc3202 100644
--- a/dlls/webservices/webservices_private.h
+++ b/dlls/webservices/webservices_private.h
@@ -50,7 +50,7 @@ const struct dictionary dict_builtin_static DECLSPEC_HIDDEN;
int find_string( const struct dictionary *, const unsigned char *, ULONG, ULONG * ) DECLSPEC_HIDDEN;
HRESULT insert_string( struct dictionary *, unsigned char *, ULONG, int, ULONG * ) DECLSPEC_HIDDEN;
void clear_dict( struct dictionary * ) DECLSPEC_HIDDEN;
-HRESULT writer_enable_lookup( WS_XML_WRITER * ) DECLSPEC_HIDDEN;
+HRESULT writer_set_lookup( WS_XML_WRITER *, BOOL ) DECLSPEC_HIDDEN;
const char *debugstr_xmlstr( const WS_XML_STRING * ) DECLSPEC_HIDDEN;
WS_XML_STRING *alloc_xml_string( const unsigned char *, ULONG ) DECLSPEC_HIDDEN;
diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c
index 33c1be7..b3d130a 100644
--- a/dlls/webservices/writer.c
+++ b/dlls/webservices/writer.c
@@ -4849,7 +4849,7 @@ done:
return hr;
}
-HRESULT writer_enable_lookup( WS_XML_WRITER *handle )
+HRESULT writer_set_lookup( WS_XML_WRITER *handle, BOOL enable )
{
struct writer *writer = (struct writer *)handle;
@@ -4861,7 +4861,7 @@ HRESULT writer_enable_lookup( WS_XML_WRITER *handle )
return E_INVALIDARG;
}
- writer->dict_do_lookup = TRUE;
+ writer->dict_do_lookup = enable;
LeaveCriticalSection( &writer->cs );
return S_OK;
More information about the wine-cvs
mailing list