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
4dcbf2b4
Commit
4dcbf2b4
authored
Mar 24, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 24, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite/writer: Make it possible to use WriteRaw() multiple times.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1cb6fa5e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
8 deletions
+25
-8
writer.c
dlls/xmllite/tests/writer.c
+14
-1
writer.c
dlls/xmllite/writer.c
+11
-7
No files found.
dlls/xmllite/tests/writer.c
View file @
4dcbf2b4
...
@@ -863,6 +863,7 @@ static void test_WriteCData(void)
...
@@ -863,6 +863,7 @@ static void test_WriteCData(void)
static
void
test_WriteRaw
(
void
)
static
void
test_WriteRaw
(
void
)
{
{
static
const
WCHAR
rawW
[]
=
{
'a'
,
'<'
,
':'
,
0
};
static
const
WCHAR
rawW
[]
=
{
'a'
,
'<'
,
':'
,
0
};
static
const
WCHAR
aW
[]
=
{
'a'
,
0
};
IXmlWriter
*
writer
;
IXmlWriter
*
writer
;
IStream
*
stream
;
IStream
*
stream
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -884,6 +885,18 @@ static void test_WriteRaw(void)
...
@@ -884,6 +885,18 @@ static void test_WriteRaw(void)
hr
=
IXmlWriter_WriteRaw
(
writer
,
rawW
);
hr
=
IXmlWriter_WriteRaw
(
writer
,
rawW
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_WriteRaw
(
writer
,
rawW
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_WriteComment
(
writer
,
rawW
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_WriteRaw
(
writer
,
rawW
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_WriteElementString
(
writer
,
NULL
,
aW
,
NULL
,
aW
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"got 0x%08x
\n
"
,
hr
);
...
@@ -899,7 +912,7 @@ static void test_WriteRaw(void)
...
@@ -899,7 +912,7 @@ static void test_WriteRaw(void)
hr
=
IXmlWriter_Flush
(
writer
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>a<:"
);
CHECK_OUTPUT
(
stream
,
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>a<:
a<:<!--a<:-->a<:<a>a</a>
"
);
IXmlWriter_Release
(
writer
);
IXmlWriter_Release
(
writer
);
IStream_Release
(
stream
);
IStream_Release
(
stream
);
...
...
dlls/xmllite/writer.c
View file @
4dcbf2b4
...
@@ -767,10 +767,13 @@ static HRESULT WINAPI xmlwriter_WriteElementString(IXmlWriter *iface, LPCWSTR pr
...
@@ -767,10 +767,13 @@ static HRESULT WINAPI xmlwriter_WriteElementString(IXmlWriter *iface, LPCWSTR pr
case
XmlWriterState_ElemStarted
:
case
XmlWriterState_ElemStarted
:
writer_close_starttag
(
This
);
writer_close_starttag
(
This
);
break
;
break
;
case
XmlWriterState_DocClosed
:
case
XmlWriterState_Ready
:
return
WR_E_INVALIDACTION
;
case
XmlWriterState_DocStarted
:
case
XmlWriterState_PIDocStarted
:
break
;
default:
default:
;
This
->
state
=
XmlWriterState_DocClosed
;
return
WR_E_INVALIDACTION
;
}
}
write_encoding_bom
(
This
);
write_encoding_bom
(
This
);
...
@@ -1043,11 +1046,11 @@ static HRESULT WINAPI xmlwriter_WriteRaw(IXmlWriter *iface, LPCWSTR data)
...
@@ -1043,11 +1046,11 @@ static HRESULT WINAPI xmlwriter_WriteRaw(IXmlWriter *iface, LPCWSTR data)
case
XmlWriterState_PIDocStarted
:
case
XmlWriterState_PIDocStarted
:
break
;
break
;
default:
default:
This
->
state
=
XmlWriterState_DocClosed
;
return
WR_E_INVALIDACTION
;
return
WR_E_INVALIDACTION
;
}
}
write_output_buffer
(
This
->
output
,
data
,
-
1
);
write_output_buffer
(
This
->
output
,
data
,
-
1
);
This
->
state
=
XmlWriterState_DocClosed
;
return
S_OK
;
return
S_OK
;
}
}
...
@@ -1086,6 +1089,7 @@ static HRESULT WINAPI xmlwriter_WriteStartDocument(IXmlWriter *iface, XmlStandal
...
@@ -1086,6 +1089,7 @@ static HRESULT WINAPI xmlwriter_WriteStartDocument(IXmlWriter *iface, XmlStandal
case
XmlWriterState_Ready
:
case
XmlWriterState_Ready
:
break
;
break
;
default:
default:
This
->
state
=
XmlWriterState_DocClosed
;
return
WR_E_INVALIDACTION
;
return
WR_E_INVALIDACTION
;
}
}
...
@@ -1099,6 +1103,9 @@ static HRESULT WINAPI xmlwriter_WriteStartElement(IXmlWriter *iface, LPCWSTR pre
...
@@ -1099,6 +1103,9 @@ static HRESULT WINAPI xmlwriter_WriteStartElement(IXmlWriter *iface, LPCWSTR pre
TRACE
(
"(%p)->(%s %s %s)
\n
"
,
This
,
wine_dbgstr_w
(
prefix
),
wine_dbgstr_w
(
local_name
),
wine_dbgstr_w
(
uri
));
TRACE
(
"(%p)->(%s %s %s)
\n
"
,
This
,
wine_dbgstr_w
(
prefix
),
wine_dbgstr_w
(
local_name
),
wine_dbgstr_w
(
uri
));
if
(
!
local_name
)
return
E_INVALIDARG
;
switch
(
This
->
state
)
switch
(
This
->
state
)
{
{
case
XmlWriterState_Initial
:
case
XmlWriterState_Initial
:
...
@@ -1109,9 +1116,6 @@ static HRESULT WINAPI xmlwriter_WriteStartElement(IXmlWriter *iface, LPCWSTR pre
...
@@ -1109,9 +1116,6 @@ static HRESULT WINAPI xmlwriter_WriteStartElement(IXmlWriter *iface, LPCWSTR pre
;
;
}
}
if
(
!
local_name
)
return
E_INVALIDARG
;
/* close pending element */
/* close pending element */
if
(
This
->
starttagopen
)
if
(
This
->
starttagopen
)
write_output_buffer
(
This
->
output
,
gtW
,
ARRAY_SIZE
(
gtW
));
write_output_buffer
(
This
->
output
,
gtW
,
ARRAY_SIZE
(
gtW
));
...
...
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