Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4f58e116
Commit
4f58e116
authored
Jun 20, 2011
by
Adam Martinson
Committed by
Alexandre Julliard
Jun 21, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Add support for VT_BSTR|VT_BYREF in domdoc_save().
parent
5ab513bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
48 deletions
+71
-48
domdoc.c
dlls/msxml3/domdoc.c
+51
-47
domdoc.c
dlls/msxml3/tests/domdoc.c
+20
-1
No files found.
dlls/msxml3/domdoc.c
View file @
4f58e116
...
...
@@ -2423,70 +2423,74 @@ static HRESULT WINAPI domdoc_save(
xmlNodePtr
xmldecl
;
HRESULT
ret
=
S_OK
;
TRACE
(
"(%p)->(var(vt %d, %s))
\n
"
,
This
,
V_VT
(
&
destination
),
V_VT
(
&
destination
)
==
VT_BSTR
?
debugstr_w
(
V_BSTR
(
&
destination
))
:
NULL
);
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_variant
(
&
destination
));
if
(
V_VT
(
&
destination
)
!=
VT_BSTR
&&
V_VT
(
&
destination
)
!=
VT_UNKNOWN
)
switch
(
V_VT
(
&
destination
)
)
{
FIXME
(
"Unhandled vt %d
\n
"
,
V_VT
(
&
destination
));
return
S_FALSE
;
}
if
(
V_VT
(
&
destination
)
==
VT_UNKNOWN
)
{
IUnknown
*
pUnk
=
V_UNKNOWN
(
&
destination
);
IXMLDOMDocument2
*
document
;
IStream
*
stream
;
ret
=
IUnknown_QueryInterface
(
pUnk
,
&
IID_IXMLDOMDocument3
,
(
void
**
)
&
document
);
if
(
ret
==
S_OK
)
case
VT_UNKNOWN
:
{
VARIANT_BOOL
success
;
BSTR
xml
;
IUnknown
*
pUnk
=
V_UNKNOWN
(
&
destination
);
IXMLDOMDocument2
*
document
;
IStream
*
stream
;
ret
=
I
XMLDOMDocument3_get_xml
(
iface
,
&
xml
);
ret
=
I
Unknown_QueryInterface
(
pUnk
,
&
IID_IXMLDOMDocument3
,
(
void
**
)
&
document
);
if
(
ret
==
S_OK
)
{
ret
=
IXMLDOMDocument3_loadXML
(
document
,
xml
,
&
success
);
SysFreeString
(
xml
);
VARIANT_BOOL
success
;
BSTR
xml
;
ret
=
IXMLDOMDocument3_get_xml
(
iface
,
&
xml
);
if
(
ret
==
S_OK
)
{
ret
=
IXMLDOMDocument3_loadXML
(
document
,
xml
,
&
success
);
SysFreeString
(
xml
);
}
IXMLDOMDocument3_Release
(
document
);
return
ret
;
}
IXMLDOMDocument3_Release
(
document
);
return
ret
;
ret
=
IUnknown_QueryInterface
(
pUnk
,
&
IID_IStream
,
(
void
**
)
&
stream
);
if
(
ret
==
S_OK
)
{
ctx
=
xmlSaveToIO
(
domdoc_stream_save_writecallback
,
domdoc_stream_save_closecallback
,
stream
,
NULL
,
XML_SAVE_NO_DECL
);
if
(
!
ctx
)
{
IStream_Release
(
stream
);
return
E_FAIL
;
}
}
}
break
;
ret
=
IUnknown_QueryInterface
(
pUnk
,
&
IID_IStream
,
(
void
**
)
&
stream
);
if
(
ret
==
S_OK
)
case
VT_BSTR
:
case
VT_BSTR
|
VT_BYREF
:
{
ctx
=
xmlSaveToIO
(
domdoc_stream_save_writecallback
,
domdoc_stream_save_closecallback
,
stream
,
NULL
,
XML_SAVE_NO_DECL
);
/* save with file path */
HANDLE
handle
=
CreateFileW
(
(
V_VT
(
&
destination
)
&
VT_BYREF
)
?
*
V_BSTRREF
(
&
destination
)
:
V_BSTR
(
&
destination
),
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
{
WARN
(
"failed to create file
\n
"
);
return
E_FAIL
;
}
if
(
!
ctx
)
/* disable top XML declaration */
ctx
=
xmlSaveToIO
(
domdoc_save_writecallback
,
domdoc_save_closecallback
,
handle
,
NULL
,
XML_SAVE_NO_DECL
);
if
(
!
ctx
)
{
IStream_Release
(
stream
);
CloseHandle
(
handle
);
return
E_FAIL
;
}
}
}
else
{
/* save with file path */
HANDLE
handle
=
CreateFileW
(
V_BSTR
(
&
destination
),
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
{
WARN
(
"failed to create file
\n
"
);
return
E_FAIL
;
}
break
;
/* disable top XML declaration */
ctx
=
xmlSaveToIO
(
domdoc_save_writecallback
,
domdoc_save_closecallback
,
handle
,
NULL
,
XML_SAVE_NO_DECL
);
if
(
!
ctx
)
{
CloseHandle
(
handle
);
return
E_FAIL
;
}
default:
FIXME
(
"Unhandled VARIANT: %s
\n
"
,
debugstr_variant
(
&
destination
));
return
S_FALSE
;
}
xmldecl
=
xmldoc_unlink_xmldecl
(
get_doc
(
This
));
...
...
dlls/msxml3/tests/domdoc.c
View file @
4f58e116
...
...
@@ -6859,7 +6859,7 @@ static void test_save(void)
IXMLDOMDocument
*
doc
,
*
doc2
;
IXMLDOMElement
*
root
;
VARIANT
file
,
vDoc
;
BSTR
sOrig
,
sNew
;
BSTR
sOrig
,
sNew
,
filename
;
char
buffer
[
100
];
DWORD
read
=
0
;
HANDLE
hfile
;
...
...
@@ -6909,6 +6909,25 @@ static void test_save(void)
hr
=
IXMLDOMDocument_save
(
doc
,
file
);
EXPECT_HR
(
hr
,
S_OK
);
hfile
=
CreateFileA
(
"test.xml"
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"Could not open file: %u
\n
"
,
GetLastError
());
if
(
hfile
==
INVALID_HANDLE_VALUE
)
return
;
ReadFile
(
hfile
,
buffer
,
sizeof
(
buffer
),
&
read
,
NULL
);
ok
(
read
!=
0
,
"could not read file
\n
"
);
ok
(
buffer
[
0
]
!=
'<'
||
buffer
[
1
]
!=
'?'
,
"File contains processing instruction
\n
"
);
CloseHandle
(
hfile
);
DeleteFile
(
"test.xml"
);
/* save to path VT_BSTR | VT_BYREF */
filename
=
_bstr_
(
"test.xml"
);
V_VT
(
&
file
)
=
VT_BSTR
|
VT_BYREF
;
V_BSTRREF
(
&
file
)
=
&
filename
;
hr
=
IXMLDOMDocument_save
(
doc
,
file
);
EXPECT_HR
(
hr
,
S_OK
);
IXMLDOMDocument_Release
(
doc
);
hfile
=
CreateFileA
(
"test.xml"
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
...
...
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