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
f730d13c
Commit
f730d13c
authored
May 20, 2011
by
Adam Martinson
Committed by
Alexandre Julliard
May 20, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3/domdoc: Add support for VT_ARRAY|VT_UI1 in domdoc_load().
parent
17f72b8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
140 additions
and
1 deletion
+140
-1
domdoc.c
dlls/msxml3/domdoc.c
+47
-0
domdoc.c
dlls/msxml3/tests/domdoc.c
+93
-1
No files found.
dlls/msxml3/domdoc.c
View file @
f730d13c
...
...
@@ -2113,6 +2113,8 @@ static HRESULT WINAPI domdoc_load(
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_variant
(
&
source
));
if
(
!
isSuccessful
)
return
E_POINTER
;
*
isSuccessful
=
VARIANT_FALSE
;
assert
(
&
This
->
node
);
...
...
@@ -2126,6 +2128,51 @@ static HRESULT WINAPI domdoc_load(
if
(
!
V_BSTRREF
(
&
source
))
return
E_INVALIDARG
;
filename
=
*
V_BSTRREF
(
&
source
);
break
;
case
VT_ARRAY
|
VT_UI1
:
{
SAFEARRAY
*
psa
=
V_ARRAY
(
&
source
);
char
*
str
;
LONG
len
;
UINT
dim
=
SafeArrayGetDim
(
psa
);
switch
(
dim
)
{
case
0
:
ERR
(
"SAFEARRAY == NULL
\n
"
);
hr
=
This
->
error
=
E_INVALIDARG
;
break
;
case
1
:
/* Only takes UTF-8 strings.
* NOT NULL-terminated. */
SafeArrayAccessData
(
psa
,
(
void
**
)
&
str
);
SafeArrayGetUBound
(
psa
,
1
,
&
len
);
if
((
xmldoc
=
doparse
(
This
,
str
,
++
len
,
XML_CHAR_ENCODING_UTF8
)))
{
hr
=
This
->
error
=
S_OK
;
*
isSuccessful
=
VARIANT_TRUE
;
TRACE
(
"parsed document %p
\n
"
,
xmldoc
);
}
else
{
This
->
error
=
E_FAIL
;
TRACE
(
"failed to parse document
\n
"
);
}
SafeArrayUnaccessData
(
psa
);
if
(
xmldoc
)
{
xmldoc
->
_private
=
create_priv
();
return
attach_xmldoc
(
This
,
xmldoc
);
}
break
;
default:
FIXME
(
"unhandled SAFEARRAY dim: %d
\n
"
,
dim
);
hr
=
This
->
error
=
E_NOTIMPL
;
}
}
break
;
case
VT_UNKNOWN
:
hr
=
IUnknown_QueryInterface
(
V_UNKNOWN
(
&
source
),
&
IID_IXMLDOMDocument3
,
(
void
**
)
&
pNewDoc
);
if
(
hr
==
S_OK
)
...
...
dlls/msxml3/tests/domdoc.c
View file @
f730d13c
...
...
@@ -9946,13 +9946,15 @@ static void test_selection(void)
static
void
test_load
(
void
)
{
IXMLDOMDocument
*
doc
;
IXMLDOMNodeList
*
list
;
VARIANT_BOOL
b
;
HANDLE
hfile
;
VARIANT
src
;
HRESULT
hr
;
BOOL
ret
;
BSTR
path
;
BSTR
path
,
bstr1
,
bstr2
;
DWORD
written
;
void
*
ptr
;
/* prepare a file */
hfile
=
CreateFileA
(
"test.xml"
,
GENERIC_WRITE
|
GENERIC_READ
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
...
...
@@ -9992,6 +9994,96 @@ static void test_load(void)
IXMLDOMDocument_Release
(
doc
);
DeleteFileA
(
"test.xml"
);
doc
=
create_document
(
&
IID_IXMLDOMDocument
);
hr
=
IXMLDOMDocument_loadXML
(
doc
,
_bstr_
(
szExampleXML
),
&
b
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
b
==
VARIANT_TRUE
,
"got %d
\n
"
,
b
);
hr
=
IXMLDOMDocument_selectNodes
(
doc
,
_bstr_
(
"//*"
),
&
list
);
EXPECT_HR
(
hr
,
S_OK
);
bstr1
=
_bstr_
(
list_to_string
(
list
));
hr
=
IXMLDOMNodeList_reset
(
list
);
EXPECT_HR
(
hr
,
S_OK
);
IXMLDOMDocument_Release
(
doc
);
doc
=
create_document
(
&
IID_IXMLDOMDocument
);
VariantInit
(
&
src
);
V_ARRAY
(
&
src
)
=
SafeArrayCreateVector
(
VT_UI1
,
0
,
lstrlenA
(
szExampleXML
));
V_VT
(
&
src
)
=
VT_ARRAY
|
VT_UI1
;
ok
(
V_ARRAY
(
&
src
)
!=
NULL
,
"SafeArrayCreateVector() returned NULL
\n
"
);
ptr
=
NULL
;
hr
=
SafeArrayAccessData
(
V_ARRAY
(
&
src
),
&
ptr
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
ptr
!=
NULL
,
"SafeArrayAccessData() returned NULL
\n
"
);
memcpy
(
ptr
,
szExampleXML
,
lstrlenA
(
szExampleXML
));
hr
=
SafeArrayUnlock
(
V_ARRAY
(
&
src
));
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IXMLDOMDocument_load
(
doc
,
src
,
&
b
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
b
==
VARIANT_TRUE
,
"got %d
\n
"
,
b
);
hr
=
IXMLDOMDocument_selectNodes
(
doc
,
_bstr_
(
"//*"
),
&
list
);
EXPECT_HR
(
hr
,
S_OK
);
bstr2
=
_bstr_
(
list_to_string
(
list
));
hr
=
IXMLDOMNodeList_reset
(
list
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
lstrcmpW
(
bstr1
,
bstr2
)
==
0
,
"strings not equal: %s : %s
\n
"
,
wine_dbgstr_w
(
bstr1
),
wine_dbgstr_w
(
bstr2
));
IXMLDOMDocument_Release
(
doc
);
IXMLDOMNodeList_Release
(
list
);
VariantClear
(
&
src
);
/* UTF-16 isn't accepted */
doc
=
create_document
(
&
IID_IXMLDOMDocument
);
V_ARRAY
(
&
src
)
=
SafeArrayCreateVector
(
VT_UI1
,
0
,
lstrlenW
(
szComplete1
)
*
sizeof
(
WCHAR
));
V_VT
(
&
src
)
=
VT_ARRAY
|
VT_UI1
;
ok
(
V_ARRAY
(
&
src
)
!=
NULL
,
"SafeArrayCreateVector() returned NULL
\n
"
);
ptr
=
NULL
;
hr
=
SafeArrayAccessData
(
V_ARRAY
(
&
src
),
&
ptr
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
ptr
!=
NULL
,
"SafeArrayAccessData() returned NULL
\n
"
);
memcpy
(
ptr
,
szComplete1
,
lstrlenW
(
szComplete1
)
*
sizeof
(
WCHAR
));
hr
=
SafeArrayUnlock
(
V_ARRAY
(
&
src
));
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IXMLDOMDocument_load
(
doc
,
src
,
&
b
);
todo_wine
EXPECT_HR
(
hr
,
S_FALSE
);
todo_wine
ok
(
b
==
VARIANT_FALSE
,
"got %d
\n
"
,
b
);
VariantClear
(
&
src
);
/* it doesn't like it as a VT_ARRAY|VT_UI2 either */
V_ARRAY
(
&
src
)
=
SafeArrayCreateVector
(
VT_UI2
,
0
,
lstrlenW
(
szComplete1
));
V_VT
(
&
src
)
=
VT_ARRAY
|
VT_UI2
;
ok
(
V_ARRAY
(
&
src
)
!=
NULL
,
"SafeArrayCreateVector() returned NULL
\n
"
);
ptr
=
NULL
;
hr
=
SafeArrayAccessData
(
V_ARRAY
(
&
src
),
&
ptr
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
ptr
!=
NULL
,
"SafeArrayAccessData() returned NULL
\n
"
);
memcpy
(
ptr
,
szComplete1
,
lstrlenW
(
szComplete1
)
*
sizeof
(
WCHAR
));
hr
=
SafeArrayUnlock
(
V_ARRAY
(
&
src
));
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IXMLDOMDocument_load
(
doc
,
src
,
&
b
);
todo_wine
EXPECT_HR
(
hr
,
E_INVALIDARG
);
ok
(
b
==
VARIANT_FALSE
,
"got %d
\n
"
,
b
);
VariantClear
(
&
src
);
IXMLDOMDocument_Release
(
doc
);
free_bstrs
();
}
...
...
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