Hans Leidekker : webservices: Fix is_nil_element in binary mode.

Alexandre Julliard julliard at winehq.org
Wed Jan 24 16:02:31 CST 2018


Module: wine
Branch: master
Commit: 008efda73782534d20a90850d2f35d77d9bee057
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=008efda73782534d20a90850d2f35d77d9bee057

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Jan 24 14:29:57 2018 +0100

webservices: Fix is_nil_element in binary mode.

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

---

 dlls/webservices/reader.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c
index a05b1ed..3e5434c 100644
--- a/dlls/webservices/reader.c
+++ b/dlls/webservices/reader.c
@@ -6458,6 +6458,27 @@ static HRESULT end_mapping( struct reader *reader, WS_TYPE_MAPPING mapping )
     }
 }
 
+static BOOL is_true_text( const WS_XML_TEXT *text )
+{
+    switch (text->textType)
+    {
+    case WS_XML_TEXT_TYPE_UTF8:
+    {
+        const WS_XML_UTF8_TEXT *text_utf8 = (const WS_XML_UTF8_TEXT *)text;
+        if (text_utf8->value.length == 4 && !memcmp( text_utf8->value.bytes, "true", 4 )) return TRUE;
+        return FALSE;
+    }
+    case WS_XML_TEXT_TYPE_BOOL:
+    {
+        const WS_XML_BOOL_TEXT *text_bool = (const WS_XML_BOOL_TEXT *)text;
+        return text_bool->value;
+    }
+    default:
+        ERR( "unhandled text type %u\n", text->textType );
+        return FALSE;
+    }
+}
+
 static HRESULT is_nil_element( const WS_XML_ELEMENT_NODE *elem )
 {
     static const WS_XML_STRING localname = {3, (BYTE *)"nil"};
@@ -6466,12 +6487,10 @@ static HRESULT is_nil_element( const WS_XML_ELEMENT_NODE *elem )
 
     for (i = 0; i < elem->attributeCount; i++)
     {
-        const WS_XML_UTF8_TEXT *text = (WS_XML_UTF8_TEXT *)elem->attributes[i]->value;
-
         if (elem->attributes[i]->isXmlNs) continue;
         if (WsXmlStringEquals( elem->attributes[i]->localName, &localname, NULL ) == S_OK &&
             WsXmlStringEquals( elem->attributes[i]->ns, &ns, NULL ) == S_OK &&
-            text->value.length == 4 && !memcmp( text->value.bytes, "true", 4 )) return TRUE;
+            is_true_text( elem->attributes[i]->value )) return TRUE;
     }
     return FALSE;
 }




More information about the wine-cvs mailing list