Nikolay Sivov : msxml3: Implement getValueFromQName() for MXAttributes.

Alexandre Julliard julliard at winehq.org
Thu Mar 15 15:35:20 CDT 2012


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Mar 15 09:58:34 2012 +0300

msxml3: Implement getValueFromQName() for MXAttributes.

---

 dlls/msxml3/mxwriter.c        |   19 +++++++++++++++----
 dlls/msxml3/tests/saxreader.c |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/dlls/msxml3/mxwriter.c b/dlls/msxml3/mxwriter.c
index 3bb4c7a..f0e4b75 100644
--- a/dlls/msxml3/mxwriter.c
+++ b/dlls/msxml3/mxwriter.c
@@ -1873,12 +1873,23 @@ static HRESULT WINAPI SAXAttributes_getValueFromName(ISAXAttributes *iface, cons
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI SAXAttributes_getValueFromQName(ISAXAttributes *iface, const WCHAR * pQName,
-    int nQName, const WCHAR ** pValue, int * nValue)
+static HRESULT WINAPI SAXAttributes_getValueFromQName(ISAXAttributes *iface, const WCHAR *qname,
+    int qname_len, const WCHAR **value, int *value_len)
 {
     mxattributes *This = impl_from_ISAXAttributes( iface );
-    FIXME("(%p)->(%s:%d %p %p): stub\n", This, debugstr_wn(pQName, nQName), nQName, pValue, nValue);
-    return E_NOTIMPL;
+    HRESULT hr;
+    int index;
+
+    TRACE("(%p)->(%s:%d %p %p)\n", This, debugstr_wn(qname, qname_len), qname_len, value, value_len);
+
+    if (!qname || !value || !value_len)
+        return (This->class_version == MSXML_DEFAULT || This->class_version == MSXML3) ? E_POINTER : E_INVALIDARG;
+
+    hr = ISAXAttributes_getIndexFromQName(iface, qname, qname_len, &index);
+    if (hr == S_OK)
+        hr = ISAXAttributes_getValue(iface, index, value, value_len);
+
+    return hr;
 }
 
 static const ISAXAttributesVtbl SAXAttributesVtbl = {
diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c
index e9cfda8..15dfe41 100644
--- a/dlls/msxml3/tests/saxreader.c
+++ b/dlls/msxml3/tests/saxreader.c
@@ -3437,6 +3437,40 @@ static void test_mxattr_addAttribute(void)
             hr = ISAXAttributes_getIndexFromQName(saxattr, _bstr_(table->qname), strlen(table->qname)-1, &index);
             EXPECT_HR(hr, E_INVALIDARG);
             ok(index == -1, "%d: got wrong index %d\n", i, index);
+
+            if (IsEqualGUID(table->clsid, &CLSID_SAXAttributes40) ||
+                IsEqualGUID(table->clsid, &CLSID_SAXAttributes60))
+            {
+                hr = ISAXAttributes_getValueFromQName(saxattr, NULL, 0, NULL, NULL);
+                EXPECT_HR(hr, E_INVALIDARG);
+
+                hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, NULL, NULL);
+                EXPECT_HR(hr, E_INVALIDARG);
+
+                hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, &value, NULL);
+                EXPECT_HR(hr, E_INVALIDARG);
+            }
+            else
+            {
+                hr = ISAXAttributes_getValueFromQName(saxattr, NULL, 0, NULL, NULL);
+                EXPECT_HR(hr, E_POINTER);
+
+                hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, NULL, NULL);
+                EXPECT_HR(hr, E_POINTER);
+
+                hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, &value, NULL);
+                EXPECT_HR(hr, E_POINTER);
+
+                /* versions 4 and 6 crash */
+                hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), strlen(table->qname), NULL, NULL);
+                EXPECT_HR(hr, E_POINTER);
+
+                hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), strlen(table->qname), NULL, &len);
+                EXPECT_HR(hr, E_POINTER);
+            }
+
+            hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), strlen(table->qname), &value, &len);
+            EXPECT_HR(hr, S_OK);
         }
 
         len = -1;




More information about the wine-cvs mailing list