Commit fd423937 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: getPrefix() should check all pushed contexts as well.

parent 43241140
...@@ -144,16 +144,20 @@ static HRESULT get_declared_prefix_idx(const struct nscontext *ctxt, LONG index, ...@@ -144,16 +144,20 @@ static HRESULT get_declared_prefix_idx(const struct nscontext *ctxt, LONG index,
} }
/* returned stored pointer, caller needs to copy it */ /* returned stored pointer, caller needs to copy it */
static HRESULT get_declared_prefix_uri(const struct nscontext *ctxt, const WCHAR *uri, BSTR *prefix) static HRESULT get_declared_prefix_uri(const struct list *ctxts, const WCHAR *uri, BSTR *prefix)
{ {
int i; struct nscontext *ctxt;
LIST_FOR_EACH_ENTRY(ctxt, ctxts, struct nscontext, entry)
{
int i;
for (i = 0; i < ctxt->count; i++) for (i = 0; i < ctxt->count; i++)
if (!strcmpW(ctxt->ns[i].uri, uri)) if (!strcmpW(ctxt->ns[i].uri, uri))
{ {
*prefix = ctxt->ns[i].prefix; *prefix = ctxt->ns[i].prefix;
return S_OK; return S_OK;
} }
}
*prefix = NULL; *prefix = NULL;
return E_FAIL; return E_FAIL;
...@@ -321,7 +325,6 @@ static HRESULT WINAPI namespacemanager_getPrefix(IMXNamespaceManager *iface, ...@@ -321,7 +325,6 @@ static HRESULT WINAPI namespacemanager_getPrefix(IMXNamespaceManager *iface,
const WCHAR *uri, LONG index, WCHAR *prefix, int *prefix_len) const WCHAR *uri, LONG index, WCHAR *prefix, int *prefix_len)
{ {
namespacemanager *This = impl_from_IMXNamespaceManager( iface ); namespacemanager *This = impl_from_IMXNamespaceManager( iface );
struct nscontext *ctxt;
HRESULT hr; HRESULT hr;
BSTR prfx; BSTR prfx;
...@@ -329,9 +332,7 @@ static HRESULT WINAPI namespacemanager_getPrefix(IMXNamespaceManager *iface, ...@@ -329,9 +332,7 @@ static HRESULT WINAPI namespacemanager_getPrefix(IMXNamespaceManager *iface,
if (!uri || !*uri || !prefix_len) return E_INVALIDARG; if (!uri || !*uri || !prefix_len) return E_INVALIDARG;
ctxt = LIST_ENTRY(list_head(&This->ctxts), struct nscontext, entry); hr = get_declared_prefix_uri(&This->ctxts, uri, &prfx);
hr = get_declared_prefix_uri(ctxt, uri, &prfx);
if (hr == S_OK) if (hr == S_OK)
{ {
/* TODO: figure out what index argument is for */ /* TODO: figure out what index argument is for */
......
...@@ -10741,12 +10741,9 @@ todo_wine { ...@@ -10741,12 +10741,9 @@ todo_wine {
len = 100; len = 100;
buffW[0] = 0x1; buffW[0] = 0x1;
hr = IMXNamespaceManager_getPrefix(nsmgr, _bstr_("ns1 uri"), 0, buffW, &len); hr = IMXNamespaceManager_getPrefix(nsmgr, _bstr_("ns1 uri"), 0, buffW, &len);
todo_wine
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
if (hr == S_OK) {
ok(!lstrcmpW(buffW, _bstr_("ns1")), "got %s\n", wine_dbgstr_w(buffW)); ok(!lstrcmpW(buffW, _bstr_("ns1")), "got %s\n", wine_dbgstr_w(buffW));
ok(len == 3, "got %d\n", len); ok(len == 3, "got %d\n", len);
}
hr = IMXNamespaceManager_declarePrefix(nsmgr, _bstr_("ns2"), _bstr_("ns2 uri")); hr = IMXNamespaceManager_declarePrefix(nsmgr, _bstr_("ns2"), _bstr_("ns2 uri"));
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
...@@ -10766,22 +10763,16 @@ todo_wine ...@@ -10766,22 +10763,16 @@ todo_wine
len = 100; len = 100;
buffW[0] = 0x1; buffW[0] = 0x1;
hr = IMXNamespaceManager_getPrefix(nsmgr, _bstr_("ns2 uri"), 0, buffW, &len); hr = IMXNamespaceManager_getPrefix(nsmgr, _bstr_("ns2 uri"), 0, buffW, &len);
todo_wine
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
if (hr == S_OK) {
ok(!lstrcmpW(buffW, _bstr_("ns2")), "got %s\n", wine_dbgstr_w(buffW)); ok(!lstrcmpW(buffW, _bstr_("ns2")), "got %s\n", wine_dbgstr_w(buffW));
ok(len == 3, "got %d\n", len); ok(len == 3, "got %d\n", len);
}
len = 100; len = 100;
buffW[0] = 0x1; buffW[0] = 0x1;
hr = IMXNamespaceManager_getPrefix(nsmgr, _bstr_("ns1 uri"), 0, buffW, &len); hr = IMXNamespaceManager_getPrefix(nsmgr, _bstr_("ns1 uri"), 0, buffW, &len);
todo_wine
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
if (hr == S_OK) {
ok(!lstrcmpW(buffW, _bstr_("ns1")), "got %s\n", wine_dbgstr_w(buffW)); ok(!lstrcmpW(buffW, _bstr_("ns1")), "got %s\n", wine_dbgstr_w(buffW));
ok(len == 3, "got %d\n", len); ok(len == 3, "got %d\n", len);
}
hr = IMXNamespaceManager_popContext(nsmgr); hr = IMXNamespaceManager_popContext(nsmgr);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment