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
caeecfa2
Commit
caeecfa2
authored
May 15, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 15, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite/writer: Implement Flush() method.
parent
a0f67c36
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
9 deletions
+43
-9
writer.c
dlls/xmllite/tests/writer.c
+7
-7
writer.c
dlls/xmllite/writer.c
+36
-2
No files found.
dlls/xmllite/tests/writer.c
View file @
caeecfa2
...
...
@@ -170,24 +170,24 @@ static void test_writestartdocument(void)
hr
=
IXmlWriter_WriteProcessingInstruction
(
writer
,
xmlW
,
versionW
);
ok
(
hr
==
E_UNEXPECTED
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_SetOutput
(
writer
,
(
IUnknown
*
)
stream
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
/* nothing written yet */
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
E_NOTIMPL
)
{
IStream_Release
(
stream
);
IXmlWriter_Release
(
writer
);
return
;
}
hr
=
GetHGlobalFromStream
(
stream
,
&
hglobal
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
...
...
dlls/xmllite/writer.c
View file @
caeecfa2
...
...
@@ -2,6 +2,7 @@
* IXmlWriter implementation
*
* Copyright 2011 Alistair Leslie-Hughes
* Copyright 2014 Nikolay Sivov for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -62,6 +63,7 @@ typedef struct
IMalloc
*
imalloc
;
xml_encoding
encoding
;
struct
output_buffer
buffer
;
ULONG
stream_written
;
}
xmlwriteroutput
;
static
const
struct
IUnknownVtbl
xmlwriteroutputvtbl
;
...
...
@@ -223,6 +225,11 @@ static HRESULT write_output_buffer_quoted(xmlwriteroutput *output, const WCHAR *
return
S_OK
;
}
static
inline
void
reset_output_buffer
(
xmlwriteroutput
*
output
)
{
output
->
stream_written
=
0
;
}
static
void
writeroutput_release_stream
(
xmlwriteroutput
*
writeroutput
)
{
if
(
writeroutput
->
stream
)
{
...
...
@@ -243,6 +250,31 @@ static inline HRESULT writeroutput_query_for_stream(xmlwriteroutput *writeroutpu
return
hr
;
}
static
HRESULT
writeroutput_flush_stream
(
xmlwriteroutput
*
output
)
{
struct
output_buffer
*
buffer
;
ULONG
written
=
0
,
len
;
HRESULT
hr
;
if
(
!
output
||
!
output
->
stream
)
return
S_OK
;
buffer
=
&
output
->
buffer
;
len
=
buffer
->
written
-
output
->
stream_written
;
if
(
!
len
)
return
S_OK
;
hr
=
ISequentialStream_Write
(
output
->
stream
,
buffer
->
data
+
output
->
stream_written
,
len
,
&
written
);
if
(
FAILED
(
hr
))
{
WARN
(
"write to stream failed (0x%08x)
\n
"
,
hr
);
return
hr
;
}
output
->
stream_written
+=
written
;
return
S_OK
;
}
static
HRESULT
WINAPI
xmlwriter_QueryInterface
(
IXmlWriter
*
iface
,
REFIID
riid
,
void
**
ppvObject
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
...
...
@@ -295,6 +327,7 @@ static HRESULT WINAPI xmlwriter_SetOutput(IXmlWriter *iface, IUnknown *output)
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
output
);
if
(
This
->
output
)
{
reset_output_buffer
(
This
->
output
);
writeroutput_release_stream
(
This
->
output
);
IUnknown_Release
(
&
This
->
output
->
IXmlWriterOutput_iface
);
This
->
output
=
NULL
;
...
...
@@ -662,9 +695,9 @@ static HRESULT WINAPI xmlwriter_Flush(IXmlWriter *iface)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXM
E
(
"%p
\n
"
,
This
);
TRAC
E
(
"%p
\n
"
,
This
);
return
E_NOTIMPL
;
return
writeroutput_flush_stream
(
This
->
output
)
;
}
static
const
struct
IXmlWriterVtbl
xmlwriter_vtbl
=
...
...
@@ -825,6 +858,7 @@ HRESULT WINAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream,
if
(
imalloc
)
IMalloc_AddRef
(
imalloc
);
writeroutput
->
encoding
=
parse_encoding_name
(
encoding
?
encoding
:
utf8W
,
-
1
);
writeroutput
->
stream
=
NULL
;
writeroutput
->
stream_written
=
0
;
hr
=
init_output_buffer
(
writeroutput
);
if
(
FAILED
(
hr
))
{
IUnknown_Release
(
&
writeroutput
->
IXmlWriterOutput_iface
);
...
...
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