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
2564862b
Commit
2564862b
authored
Sep 14, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite/writer: Use internal function to create writer output implicitly.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ef7b911a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
22 deletions
+37
-22
writer.c
dlls/xmllite/writer.c
+37
-22
No files found.
dlls/xmllite/writer.c
View file @
2564862b
...
...
@@ -148,6 +148,9 @@ static const char *debugstr_writer_prop(XmlWriterProperty prop)
return
prop_names
[
prop
];
}
static
HRESULT
create_writer_output
(
IUnknown
*
stream
,
IMalloc
*
imalloc
,
xml_encoding
encoding
,
const
WCHAR
*
encoding_name
,
xmlwriteroutput
**
out
);
/* writer output memory allocation functions */
static
inline
void
*
writeroutput_alloc
(
xmlwriteroutput
*
output
,
size_t
len
)
{
...
...
@@ -735,10 +738,10 @@ static HRESULT WINAPI xmlwriter_SetOutput(IXmlWriter *iface, IUnknown *output)
}
if
(
hr
!=
S_OK
||
!
writeroutput
)
{
/*
create IXmlWriterOutput basing on supplied interface
*/
hr
=
CreateXmlWriterOutputWithEncodingName
(
output
,
This
->
imalloc
,
NULL
,
&
writer
output
);
if
(
hr
!=
S_OK
)
return
hr
;
This
->
output
=
impl_from_IXmlWriterOutput
(
writeroutput
)
;
/*
Create output for given stream.
*/
hr
=
create_writer_output
(
output
,
This
->
imalloc
,
XmlEncoding_UTF8
,
NULL
,
&
This
->
output
);
if
(
hr
!=
S_OK
)
return
hr
;
}
if
(
This
->
output
->
encoding
==
XmlEncoding_Unknown
)
...
...
@@ -1795,12 +1798,12 @@ HRESULT WINAPI CreateXmlWriter(REFIID riid, void **obj, IMalloc *imalloc)
}
static
HRESULT
create_writer_output
(
IUnknown
*
stream
,
IMalloc
*
imalloc
,
xml_encoding
encoding
,
const
WCHAR
*
encoding_name
,
IXmlWriterOutput
**
outp
ut
)
const
WCHAR
*
encoding_name
,
xmlwriteroutput
**
o
ut
)
{
xmlwriteroutput
*
writeroutput
;
HRESULT
hr
;
*
out
put
=
NULL
;
*
out
=
NULL
;
if
(
imalloc
)
writeroutput
=
IMalloc_Alloc
(
imalloc
,
sizeof
(
*
writeroutput
));
...
...
@@ -1833,40 +1836,52 @@ static HRESULT create_writer_output(IUnknown *stream, IMalloc *imalloc, xml_enco
IUnknown_QueryInterface
(
stream
,
&
IID_IUnknown
,
(
void
**
)
&
writeroutput
->
output
);
*
out
put
=
&
writeroutput
->
IXmlWriterOutput_iface
;
*
out
=
writeroutput
;
TRACE
(
"
returning iface %p
\n
"
,
*
outp
ut
);
TRACE
(
"
Created writer output %p
\n
"
,
*
o
ut
);
return
S_OK
;
}
HRESULT
WINAPI
CreateXmlWriterOutputWithEncodingName
(
IUnknown
*
stream
,
IMalloc
*
imalloc
,
LPCWSTR
encoding
,
IXmlWriterOutput
**
output
)
HRESULT
WINAPI
CreateXmlWriterOutputWithEncodingName
(
IUnknown
*
stream
,
IMalloc
*
imalloc
,
const
WCHAR
*
encoding
,
IXmlWriterOutput
**
out
)
{
static
const
WCHAR
utf8W
[]
=
{
'U'
,
'T'
,
'F'
,
'-'
,
'8'
,
0
};
xmlwriteroutput
*
output
;
xml_encoding
xml_enc
;
HRESULT
hr
;
TRACE
(
"%p %p %s %p
\n
"
,
stream
,
imalloc
,
debugstr_w
(
encoding
),
out
);
TRACE
(
"%p %p %s %p
\n
"
,
stream
,
imalloc
,
debugstr_w
(
encoding
),
output
);
if
(
!
stream
||
!
out
)
return
E_INVALIDARG
;
if
(
!
stream
||
!
output
)
return
E_INVALIDARG
;
*
out
=
NULL
;
xml_enc
=
parse_encoding_name
(
encoding
?
encoding
:
utf8W
,
-
1
);
return
create_writer_output
(
stream
,
imalloc
,
xml_enc
,
encoding
,
output
);
if
(
SUCCEEDED
(
hr
=
create_writer_output
(
stream
,
imalloc
,
xml_enc
,
encoding
,
&
output
)))
*
out
=
&
output
->
IXmlWriterOutput_iface
;
return
hr
;
}
HRESULT
WINAPI
CreateXmlWriterOutputWithEncodingCodePage
(
IUnknown
*
stream
,
IMalloc
*
imalloc
,
UINT
codepage
,
IXmlWriterOutput
**
output
)
HRESULT
WINAPI
CreateXmlWriterOutputWithEncodingCodePage
(
IUnknown
*
stream
,
IMalloc
*
imalloc
,
UINT
codepage
,
IXmlWriterOutput
**
out
)
{
xmlwriteroutput
*
output
;
xml_encoding
xml_enc
;
HRESULT
hr
;
TRACE
(
"%p %p %u %p
\n
"
,
stream
,
imalloc
,
codepage
,
out
put
);
TRACE
(
"%p %p %u %p
\n
"
,
stream
,
imalloc
,
codepage
,
out
);
if
(
!
stream
||
!
output
)
return
E_INVALIDARG
;
if
(
!
stream
||
!
out
)
return
E_INVALIDARG
;
*
out
=
NULL
;
xml_enc
=
get_encoding_from_codepage
(
codepage
);
return
create_writer_output
(
stream
,
imalloc
,
xml_enc
,
NULL
,
output
);
if
(
SUCCEEDED
(
hr
=
create_writer_output
(
stream
,
imalloc
,
xml_enc
,
NULL
,
&
output
)))
*
out
=
&
output
->
IXmlWriterOutput_iface
;
return
hr
;
}
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