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
9080329e
Commit
9080329e
authored
May 13, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 13, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite/writer: Implement SetOutput() for writer.
parent
e58070ab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
4 deletions
+65
-4
reader.c
dlls/xmllite/reader.c
+1
-1
writer.c
dlls/xmllite/writer.c
+64
-3
No files found.
dlls/xmllite/reader.c
View file @
9080329e
...
...
@@ -642,7 +642,7 @@ static void readerinput_release_stream(xmlreaderinput *readerinput)
/* Queries already stored interface for IStream/ISequentialStream.
Interface supplied on creation will be overwritten */
static
HRESULT
readerinput_query_for_stream
(
xmlreaderinput
*
readerinput
)
static
inline
HRESULT
readerinput_query_for_stream
(
xmlreaderinput
*
readerinput
)
{
HRESULT
hr
;
...
...
dlls/xmllite/writer.c
View file @
9080329e
...
...
@@ -39,15 +39,19 @@ typedef struct
IXmlWriterOutput
IXmlWriterOutput_iface
;
LONG
ref
;
IUnknown
*
output
;
ISequentialStream
*
stream
;
IMalloc
*
imalloc
;
xml_encoding
encoding
;
}
xmlwriteroutput
;
static
const
struct
IUnknownVtbl
xmlwriteroutputvtbl
;
typedef
struct
_xmlwriter
{
IXmlWriter
IXmlWriter_iface
;
LONG
ref
;
IMalloc
*
imalloc
;
xmlwriteroutput
*
output
;
}
xmlwriter
;
static
inline
xmlwriter
*
impl_from_IXmlWriter
(
IXmlWriter
*
iface
)
...
...
@@ -82,6 +86,26 @@ static inline void writer_free(xmlwriter *writer, void *mem)
m_free
(
writer
->
imalloc
,
mem
);
}
static
void
writeroutput_release_stream
(
xmlwriteroutput
*
writeroutput
)
{
if
(
writeroutput
->
stream
)
{
ISequentialStream_Release
(
writeroutput
->
stream
);
writeroutput
->
stream
=
NULL
;
}
}
static
inline
HRESULT
writeroutput_query_for_stream
(
xmlwriteroutput
*
writeroutput
)
{
HRESULT
hr
;
writeroutput_release_stream
(
writeroutput
);
hr
=
IUnknown_QueryInterface
(
writeroutput
->
output
,
&
IID_IStream
,
(
void
**
)
&
writeroutput
->
stream
);
if
(
hr
!=
S_OK
)
hr
=
IUnknown_QueryInterface
(
writeroutput
->
output
,
&
IID_ISequentialStream
,
(
void
**
)
&
writeroutput
->
stream
);
return
hr
;
}
static
HRESULT
WINAPI
xmlwriter_QueryInterface
(
IXmlWriter
*
iface
,
REFIID
riid
,
void
**
ppvObject
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
...
...
@@ -116,6 +140,7 @@ static ULONG WINAPI xmlwriter_Release(IXmlWriter *iface)
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
ref
==
0
)
{
IMalloc
*
imalloc
=
This
->
imalloc
;
if
(
This
->
output
)
IUnknown_Release
(
&
This
->
output
->
IXmlWriterOutput_iface
);
writer_free
(
This
,
This
);
if
(
imalloc
)
IMalloc_Release
(
imalloc
);
}
...
...
@@ -124,13 +149,46 @@ static ULONG WINAPI xmlwriter_Release(IXmlWriter *iface)
}
/*** IXmlWriter methods ***/
static
HRESULT
WINAPI
xmlwriter_SetOutput
(
IXmlWriter
*
iface
,
IUnknown
*
pO
utput
)
static
HRESULT
WINAPI
xmlwriter_SetOutput
(
IXmlWriter
*
iface
,
IUnknown
*
o
utput
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
IXmlWriterOutput
*
writeroutput
;
HRESULT
hr
;
FIXME
(
"%p %p
\n
"
,
This
,
pO
utput
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
o
utput
);
return
E_NOTIMPL
;
if
(
This
->
output
)
{
writeroutput_release_stream
(
This
->
output
);
IUnknown_Release
(
&
This
->
output
->
IXmlWriterOutput_iface
);
This
->
output
=
NULL
;
}
/* just reset current output */
if
(
!
output
)
return
S_OK
;
/* now try IXmlWriterOutput, ISequentialStream, IStream */
hr
=
IUnknown_QueryInterface
(
output
,
&
IID_IXmlWriterOutput
,
(
void
**
)
&
writeroutput
);
if
(
hr
==
S_OK
)
{
if
(
writeroutput
->
lpVtbl
==
&
xmlwriteroutputvtbl
)
This
->
output
=
impl_from_IXmlWriterOutput
(
writeroutput
);
else
{
ERR
(
"got external IXmlWriterOutput implementation: %p, vtbl=%p
\n
"
,
writeroutput
,
writeroutput
->
lpVtbl
);
IUnknown_Release
(
writeroutput
);
return
E_FAIL
;
}
}
if
(
hr
!=
S_OK
||
!
writeroutput
)
{
/* create IXmlWriterOutput basing on supplied interface */
hr
=
CreateXmlWriterOutputWithEncodingName
(
output
,
This
->
imalloc
,
NULL
,
&
writeroutput
);
if
(
hr
!=
S_OK
)
return
hr
;
This
->
output
=
impl_from_IXmlWriterOutput
(
writeroutput
);
}
return
writeroutput_query_for_stream
(
This
->
output
);
}
static
HRESULT
WINAPI
xmlwriter_GetProperty
(
IXmlWriter
*
iface
,
UINT
nProperty
,
LONG_PTR
*
ppValue
)
...
...
@@ -471,6 +529,7 @@ static ULONG WINAPI xmlwriteroutput_Release(IXmlWriterOutput *iface)
{
IMalloc
*
imalloc
=
This
->
imalloc
;
if
(
This
->
output
)
IUnknown_Release
(
This
->
output
);
if
(
This
->
stream
)
ISequentialStream_Release
(
This
->
stream
);
writeroutput_free
(
This
,
This
);
if
(
imalloc
)
IMalloc_Release
(
imalloc
);
}
...
...
@@ -507,6 +566,7 @@ HRESULT WINAPI CreateXmlWriter(REFIID riid, void **obj, IMalloc *imalloc)
writer
->
ref
=
1
;
writer
->
imalloc
=
imalloc
;
if
(
imalloc
)
IMalloc_AddRef
(
imalloc
);
writer
->
output
=
NULL
;
*
obj
=
&
writer
->
IXmlWriter_iface
;
...
...
@@ -537,6 +597,7 @@ HRESULT WINAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream,
writeroutput
->
imalloc
=
imalloc
;
if
(
imalloc
)
IMalloc_AddRef
(
imalloc
);
writeroutput
->
encoding
=
parse_encoding_name
(
encoding
,
-
1
);
writeroutput
->
stream
=
NULL
;
IUnknown_QueryInterface
(
stream
,
&
IID_IUnknown
,
(
void
**
)
&
writeroutput
->
output
);
...
...
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