Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a5b492eb
Commit
a5b492eb
authored
Jan 23, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 23, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Initial implementation of ::getPrefix().
parent
91390a72
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
186 additions
and
7 deletions
+186
-7
mxnamespace.c
dlls/msxml3/mxnamespace.c
+44
-3
domdoc.c
dlls/msxml3/tests/domdoc.c
+142
-4
No files found.
dlls/msxml3/mxnamespace.c
View file @
a5b492eb
/*
* IMXNamespaceManager implementation
*
* Copyright 2011 Nikolay Sivov for CodeWeavers
* Copyright 2011
-2012
Nikolay Sivov for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -143,6 +143,22 @@ static HRESULT get_declared_prefix_idx(const struct nscontext *ctxt, LONG index,
return
S_OK
;
}
/* returned stored pointer, caller needs to copy it */
static
HRESULT
get_declared_prefix_uri
(
const
struct
nscontext
*
ctxt
,
const
WCHAR
*
uri
,
BSTR
*
prefix
)
{
int
i
;
for
(
i
=
0
;
i
<
ctxt
->
count
;
i
++
)
if
(
!
strcmpW
(
ctxt
->
ns
[
i
].
uri
,
uri
))
{
*
prefix
=
ctxt
->
ns
[
i
].
prefix
;
return
S_OK
;
}
*
prefix
=
NULL
;
return
E_FAIL
;
}
static
HRESULT
get_uri_from_prefix
(
const
struct
nscontext
*
ctxt
,
const
WCHAR
*
prefix
,
BSTR
*
uri
)
{
int
i
;
...
...
@@ -294,8 +310,33 @@ static HRESULT WINAPI namespacemanager_getPrefix(IMXNamespaceManager *iface,
const
WCHAR
*
uri
,
LONG
index
,
WCHAR
*
prefix
,
int
*
prefix_len
)
{
namespacemanager
*
This
=
impl_from_IMXNamespaceManager
(
iface
);
FIXME
(
"(%p)->(%s %d %p %p): stub
\n
"
,
This
,
debugstr_w
(
uri
),
index
,
prefix
,
prefix_len
);
return
E_NOTIMPL
;
struct
nscontext
*
ctxt
;
HRESULT
hr
;
BSTR
prfx
;
TRACE
(
"(%p)->(%s %d %p %p)
\n
"
,
This
,
debugstr_w
(
uri
),
index
,
prefix
,
prefix_len
);
if
(
!
uri
||
!*
uri
||
!
prefix_len
)
return
E_INVALIDARG
;
ctxt
=
LIST_ENTRY
(
list_head
(
&
This
->
ctxts
),
struct
nscontext
,
entry
);
hr
=
get_declared_prefix_uri
(
ctxt
,
uri
,
&
prfx
);
if
(
hr
==
S_OK
)
{
/* TODO: figure out what index argument is for */
if
(
index
)
return
E_FAIL
;
if
(
prefix
)
{
if
(
*
prefix_len
<
(
INT
)
SysStringLen
(
prfx
))
return
E_XML_BUFFERTOOSMALL
;
strcpyW
(
prefix
,
prfx
);
}
*
prefix_len
=
SysStringLen
(
prfx
);
TRACE
(
"prefix=%s
\n
"
,
debugstr_w
(
prfx
));
}
return
hr
;
}
static
HRESULT
WINAPI
namespacemanager_getURI
(
IMXNamespaceManager
*
iface
,
...
...
dlls/msxml3/tests/domdoc.c
View file @
a5b492eb
...
...
@@ -10403,7 +10403,7 @@ static void test_domobj_dispex(IUnknown *obj)
IDispatchEx_Release
(
dispex
);
}
static
void
test_
ns
namespacemanager
(
void
)
static
void
test_
mx
namespacemanager
(
void
)
{
static
const
char
xmluriA
[]
=
"http://www.w3.org/XML/1998/namespace"
;
IVBMXNamespaceManager
*
mgr2
;
...
...
@@ -10521,10 +10521,148 @@ todo_wine {
IMXNamespaceManager_Release
(
nsmgr
);
/* ::getPrefix() */
hr
=
CoCreateInstance
(
&
CLSID_MXNamespaceManager40
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IMXNamespaceManager
,
(
void
**
)
&
nsmgr
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
NULL
,
0
,
NULL
,
NULL
);
EXPECT_HR
(
hr
,
E_INVALIDARG
);
len
=
-
1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
NULL
,
0
,
NULL
,
&
len
);
EXPECT_HR
(
hr
,
E_INVALIDARG
);
ok
(
len
==
-
1
,
"got %d
\n
"
,
len
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
"ns0 uri"
),
0
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
E_FAIL
);
ok
(
buffW
[
0
]
==
0x1
,
"got %x
\n
"
,
buffW
[
0
]);
ok
(
len
==
100
,
"got %d
\n
"
,
len
);
len
=
0
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
"ns0 uri"
),
0
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
E_FAIL
);
ok
(
buffW
[
0
]
==
0x1
,
"got %x
\n
"
,
buffW
[
0
]);
ok
(
len
==
0
,
"got %d
\n
"
,
len
);
hr
=
IMXNamespaceManager_declarePrefix
(
nsmgr
,
_bstr_
(
"ns1"
),
_bstr_
(
"ns1 uri"
));
EXPECT_HR
(
hr
,
S_OK
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
"ns1 uri"
),
0
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
!
lstrcmpW
(
buffW
,
_bstr_
(
"ns1"
)),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
ok
(
len
==
3
,
"got %d
\n
"
,
len
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
"http://www.w3.org/XML/1998/namespace"
),
0
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
!
lstrcmpW
(
buffW
,
_bstr_
(
"xml"
)),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
ok
(
len
==
3
,
"got %d
\n
"
,
len
);
/* with null buffer it's possible to get required length */
len
=
100
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
"http://www.w3.org/XML/1998/namespace"
),
0
,
NULL
,
&
len
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
len
==
3
,
"got %d
\n
"
,
len
);
len
=
0
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
"http://www.w3.org/XML/1998/namespace"
),
0
,
NULL
,
&
len
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
len
==
3
,
"got %d
\n
"
,
len
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
"ns1 uri"
),
1
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
E_FAIL
);
ok
(
buffW
[
0
]
==
0x1
,
"got %x
\n
"
,
buffW
[
0
]);
ok
(
len
==
100
,
"got %d
\n
"
,
len
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
"ns1 uri"
),
2
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
E_FAIL
);
ok
(
buffW
[
0
]
==
0x1
,
"got %x
\n
"
,
buffW
[
0
]);
ok
(
len
==
100
,
"got %d
\n
"
,
len
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
""
),
0
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
E_INVALIDARG
);
ok
(
buffW
[
0
]
==
0x1
,
"got %x
\n
"
,
buffW
[
0
]);
ok
(
len
==
100
,
"got %d
\n
"
,
len
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
""
),
1
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
E_INVALIDARG
);
ok
(
buffW
[
0
]
==
0x1
,
"got %x
\n
"
,
buffW
[
0
]);
ok
(
len
==
100
,
"got %d
\n
"
,
len
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
NULL
,
0
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
E_INVALIDARG
);
ok
(
buffW
[
0
]
==
0x1
,
"got %x
\n
"
,
buffW
[
0
]);
ok
(
len
==
100
,
"got %d
\n
"
,
len
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
"ns0 uri"
),
1
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
E_FAIL
);
ok
(
buffW
[
0
]
==
0x1
,
"got %x
\n
"
,
buffW
[
0
]);
ok
(
len
==
100
,
"got %d
\n
"
,
len
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
""
),
1
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
E_INVALIDARG
);
ok
(
buffW
[
0
]
==
0x1
,
"got %x
\n
"
,
buffW
[
0
]);
ok
(
len
==
100
,
"got %d
\n
"
,
len
);
/* declare another one, indices are shifted */
hr
=
IMXNamespaceManager_declarePrefix
(
nsmgr
,
_bstr_
(
"ns2"
),
_bstr_
(
"ns2 uri"
));
EXPECT_HR
(
hr
,
S_OK
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
"ns1 uri"
),
0
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
!
lstrcmpW
(
buffW
,
_bstr_
(
"ns1"
)),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
ok
(
len
==
3
,
"got %d
\n
"
,
len
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
"ns2 uri"
),
0
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
!
lstrcmpW
(
buffW
,
_bstr_
(
"ns2"
)),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
ok
(
len
==
3
,
"got %d
\n
"
,
len
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
"ns2 uri"
),
1
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
E_FAIL
);
ok
(
buffW
[
0
]
==
0x1
,
"got %x
\n
"
,
buffW
[
0
]);
ok
(
len
==
100
,
"got %d
\n
"
,
len
);
len
=
100
;
buffW
[
0
]
=
0x1
;
hr
=
IMXNamespaceManager_getPrefix
(
nsmgr
,
_bstr_
(
""
),
1
,
buffW
,
&
len
);
EXPECT_HR
(
hr
,
E_INVALIDARG
);
ok
(
buffW
[
0
]
==
0x1
,
"got %x
\n
"
,
buffW
[
0
]);
ok
(
len
==
100
,
"got %d
\n
"
,
len
);
IMXNamespaceManager_Release
(
nsmgr
);
free_bstrs
();
}
static
void
test_
ns
namespacemanager_override
(
void
)
static
void
test_
mx
namespacemanager_override
(
void
)
{
IMXNamespaceManager
*
nsmgr
;
WCHAR
buffW
[
250
];
...
...
@@ -11478,8 +11616,8 @@ START_TEST(domdoc)
&
IID_IMXNamespaceManager
,
(
void
**
)
&
unk
);
if
(
hr
==
S_OK
)
{
test_
ns
namespacemanager
();
test_
ns
namespacemanager_override
();
test_
mx
namespacemanager
();
test_
mx
namespacemanager_override
();
IUnknown_Release
(
unk
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment