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
1ce8be01
Commit
1ce8be01
authored
Sep 02, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 02, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Fix IXMLDOMDocument::getElementsByTagName() for some special cases.
parent
7f5e835c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
20 deletions
+53
-20
domdoc.c
dlls/msxml3/domdoc.c
+26
-12
msxml_private.h
dlls/msxml3/msxml_private.h
+2
-2
nodemap.c
dlls/msxml3/nodemap.c
+1
-1
queryresult.c
dlls/msxml3/queryresult.c
+1
-1
domdoc.c
dlls/msxml3/tests/domdoc.c
+23
-4
No files found.
dlls/msxml3/domdoc.c
View file @
1ce8be01
...
...
@@ -1361,28 +1361,42 @@ static HRESULT WINAPI domdoc_getElementsByTagName(
BSTR
tagName
,
IXMLDOMNodeList
**
resultList
)
{
static
const
WCHAR
xpathformat
[]
=
{
'/'
,
'/'
,
'*'
,
'['
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'-'
,
'n'
,
'a'
,
'm'
,
'e'
,
'('
,
')'
,
'='
,
'\''
,
'%'
,
's'
,
'\''
,
']'
,
0
};
domdoc
*
This
=
impl_from_IXMLDOMDocument3
(
iface
);
LPWSTR
szPattern
;
HRESULT
hr
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
tagName
),
resultList
);
if
(
!
tagName
||
!
resultList
)
return
E_INVALIDARG
;
if
(
tagName
[
0
]
==
'*'
&&
tagName
[
1
]
==
0
)
{
szPattern
=
heap_alloc
(
sizeof
(
WCHAR
)
*
4
);
szPattern
[
0
]
=
szPattern
[
1
]
=
'/'
;
szPattern
[
2
]
=
'*'
;
szPattern
[
3
]
=
0
;
static
const
WCHAR
formatallW
[]
=
{
'/'
,
'/'
,
'*'
,
0
};
hr
=
queryresult_create
((
xmlNodePtr
)
get_doc
(
This
),
formatallW
,
resultList
);
}
else
{
szPattern
=
heap_alloc
(
sizeof
(
WCHAR
)
*
(
20
+
lstrlenW
(
tagName
)
+
1
));
wsprintfW
(
szPattern
,
xpathformat
,
tagName
);
}
static
const
WCHAR
xpathformat
[]
=
{
'/'
,
'/'
,
'*'
,
'['
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'-'
,
'n'
,
'a'
,
'm'
,
'e'
,
'('
,
')'
,
'='
,
'\''
};
static
const
WCHAR
closeW
[]
=
{
'\''
,
']'
,
0
};
LPWSTR
pattern
;
WCHAR
*
ptr
;
INT
length
;
hr
=
queryresult_create
((
xmlNodePtr
)
get_doc
(
This
),
szPattern
,
resultList
);
heap_free
(
szPattern
);
length
=
lstrlenW
(
tagName
);
/* without two WCHARs from format specifier */
ptr
=
pattern
=
heap_alloc
(
sizeof
(
xpathformat
)
+
length
*
sizeof
(
WCHAR
)
+
sizeof
(
closeW
));
memcpy
(
ptr
,
xpathformat
,
sizeof
(
xpathformat
));
ptr
+=
sizeof
(
xpathformat
)
/
sizeof
(
WCHAR
);
memcpy
(
ptr
,
tagName
,
length
*
sizeof
(
WCHAR
));
ptr
+=
length
;
memcpy
(
ptr
,
closeW
,
sizeof
(
closeW
));
hr
=
queryresult_create
((
xmlNodePtr
)
get_doc
(
This
),
pattern
,
resultList
);
heap_free
(
pattern
);
}
return
hr
;
}
...
...
dlls/msxml3/msxml_private.h
View file @
1ce8be01
...
...
@@ -122,13 +122,13 @@ extern IUnknown *create_doc_Implementation(void);
extern
IUnknown
*
create_doc_fragment
(
xmlNodePtr
fragment
);
extern
IUnknown
*
create_doc_entity_ref
(
xmlNodePtr
entity
);
extern
HRESULT
queryresult_create
(
xmlNodePtr
,
LPWSTR
,
IXMLDOMNodeList
**
);
extern
HRESULT
queryresult_create
(
xmlNodePtr
,
LP
C
WSTR
,
IXMLDOMNodeList
**
);
/* data accessors */
xmlNodePtr
xmlNodePtr_from_domnode
(
IXMLDOMNode
*
iface
,
xmlElementType
type
);
/* helpers */
extern
xmlChar
*
xmlChar_from_wchar
(
LPWSTR
str
);
extern
xmlChar
*
xmlChar_from_wchar
(
LP
C
WSTR
str
);
extern
LONG
xmldoc_add_ref
(
xmlDocPtr
doc
);
extern
LONG
xmldoc_release
(
xmlDocPtr
doc
);
...
...
dlls/msxml3/nodemap.c
View file @
1ce8be01
...
...
@@ -185,7 +185,7 @@ static HRESULT WINAPI xmlnodemap_Invoke(
return
hr
;
}
xmlChar
*
xmlChar_from_wchar
(
LPWSTR
str
)
xmlChar
*
xmlChar_from_wchar
(
LP
C
WSTR
str
)
{
DWORD
len
;
xmlChar
*
xmlstr
;
...
...
dlls/msxml3/queryresult.c
View file @
1ce8be01
...
...
@@ -372,7 +372,7 @@ static dispex_static_data_t queryresult_dispex = {
queryresult_iface_tids
};
HRESULT
queryresult_create
(
xmlNodePtr
node
,
LPWSTR
szQuery
,
IXMLDOMNodeList
**
out
)
HRESULT
queryresult_create
(
xmlNodePtr
node
,
LP
C
WSTR
szQuery
,
IXMLDOMNodeList
**
out
)
{
queryresult
*
This
=
heap_alloc_zero
(
sizeof
(
queryresult
));
xmlXPathContextPtr
ctxt
=
xmlXPathNewContext
(
node
->
doc
);
...
...
dlls/msxml3/tests/domdoc.c
View file @
1ce8be01
...
...
@@ -2269,12 +2269,13 @@ static void test_create(void)
static
void
test_getElementsByTagName
(
void
)
{
HRESULT
r
;
BSTR
str
;
VARIANT_BOOL
b
;
IXMLDOMDocument
*
doc
;
IXMLDOMNodeList
*
node_list
;
IXMLDOMDocument
*
doc
;
WCHAR
buff
[
100
];
VARIANT_BOOL
b
;
HRESULT
r
;
LONG
len
;
BSTR
str
;
r
=
CoCreateInstance
(
&
CLSID_DOMDocument
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IXMLDOMDocument
,
(
LPVOID
*
)
&
doc
);
...
...
@@ -2289,6 +2290,13 @@ static void test_getElementsByTagName(void)
SysFreeString
(
str
);
str
=
SysAllocString
(
szstar
);
/* null arguments cases */
r
=
IXMLDOMDocument_getElementsByTagName
(
doc
,
NULL
,
&
node_list
);
ok
(
r
==
E_INVALIDARG
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMDocument_getElementsByTagName
(
doc
,
str
,
NULL
);
ok
(
r
==
E_INVALIDARG
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMDocument_getElementsByTagName
(
doc
,
str
,
&
node_list
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMNodeList_get_length
(
node_list
,
&
len
);
...
...
@@ -2300,6 +2308,17 @@ static void test_getElementsByTagName(void)
IXMLDOMNodeList_Release
(
node_list
);
SysFreeString
(
str
);
/* broken query BSTR */
memcpy
(
&
buff
[
2
],
szstar
,
sizeof
(
szstar
));
/* just a big length */
*
(
DWORD
*
)
buff
=
0xf0f0
;
r
=
IXMLDOMDocument_getElementsByTagName
(
doc
,
&
buff
[
2
],
&
node_list
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMNodeList_get_length
(
node_list
,
&
len
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
ok
(
len
==
6
,
"len %d
\n
"
,
len
);
IXMLDOMNodeList_Release
(
node_list
);
str
=
SysAllocString
(
szbs
);
r
=
IXMLDOMDocument_getElementsByTagName
(
doc
,
str
,
&
node_list
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
...
...
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