Hans Leidekker : webservices: Build a session dictionary for strings not present in the static dictionary.

Alexandre Julliard julliard at winehq.org
Wed Sep 6 14:45:36 CDT 2017


Module: wine
Branch: master
Commit: e5704b4e1d4280899bce3b714a0729be9b13db81
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e5704b4e1d4280899bce3b714a0729be9b13db81

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Sep  6 15:56:11 2017 +0200

webservices: Build a session dictionary for strings not present in the static dictionary.

Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/webservices/channel.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/dlls/webservices/channel.c b/dlls/webservices/channel.c
index 1300da8..29c8108 100644
--- a/dlls/webservices/channel.c
+++ b/dlls/webservices/channel.c
@@ -1055,6 +1055,22 @@ HRESULT channel_send_message( WS_CHANNEL *handle, WS_MESSAGE *msg )
     return hr;
 }
 
+static HRESULT CALLBACK dict_cb( void *state, const WS_XML_STRING *str, BOOL *found, ULONG *id, WS_ERROR *error )
+{
+    struct dictionary *dict = state;
+    HRESULT hr = S_OK;
+    int index;
+
+    if ((index = find_string( dict, str->bytes, str->length, id )) == -1 ||
+        (hr = insert_string( dict, str->bytes, str->length, index, id )) == S_OK)
+    {
+        *found = TRUE;
+        return S_OK;
+    }
+    *found = FALSE;
+    return hr;
+}
+
 static HRESULT init_writer( struct channel *channel )
 {
     WS_XML_WRITER_BUFFER_OUTPUT buf = {{WS_XML_WRITER_OUTPUT_TYPE_BUFFER}};
@@ -1073,8 +1089,13 @@ static HRESULT init_writer( struct channel *channel )
         break;
 
     case WS_ENCODING_XML_BINARY_SESSION_1:
-        bin.staticDictionary = (WS_XML_DICTIONARY *)&dict_builtin_static.dict;
-        /* fall through */
+        if ((hr = writer_enable_lookup( channel->writer )) != S_OK) return hr;
+        clear_dict( &channel->dict );
+        bin.staticDictionary           = (WS_XML_DICTIONARY *)&dict_builtin_static.dict;
+        bin.dynamicStringCallback      = dict_cb;
+        bin.dynamicStringCallbackState = &channel->dict;
+        encoding = &bin.encoding;
+        break;
 
     case WS_ENCODING_XML_BINARY_1:
         encoding = &bin.encoding;




More information about the wine-cvs mailing list