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
3cd0bfd4
Commit
3cd0bfd4
authored
Sep 15, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite/writer: Handle empty local name in WriteAttributeString().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
538bc11b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
18 deletions
+22
-18
writer.c
dlls/xmllite/tests/writer.c
+7
-3
writer.c
dlls/xmllite/writer.c
+15
-15
No files found.
dlls/xmllite/tests/writer.c
View file @
3cd0bfd4
...
...
@@ -1580,8 +1580,8 @@ static void test_WriteAttributeString(void)
{
NULL
,
NULL
,
L"http://www.w3.org/2000/xmlns/"
,
L"defuri"
,
"<e />"
,
"<e"
,
E_INVALIDARG
},
{
L""
,
L"a"
,
L"http://www.w3.org/2000/xmlns/"
,
L"defuri"
,
"<e />"
,
"<e"
,
WR_E_XMLNSPREFIXDECLARATION
,
1
,
1
,
1
},
{
L""
,
NULL
,
L"http://www.w3.org/2000/xmlns/"
,
L"defuri"
,
"<e />"
,
"<e"
,
E_INVALIDARG
},
{
L""
,
L""
,
L"http://www.w3.org/2000/xmlns/"
,
L"defuri"
,
"<e />"
,
"<e"
,
E_INVALIDARG
,
1
,
1
,
1
},
{
NULL
,
L""
,
L"http://www.w3.org/2000/xmlns/"
,
L"defuri"
,
"<e />"
,
"<e"
,
E_INVALIDARG
,
1
,
1
,
1
},
{
L""
,
L""
,
L"http://www.w3.org/2000/xmlns/"
,
L"defuri"
,
"<e />"
,
"<e"
,
E_INVALIDARG
},
{
NULL
,
L""
,
L"http://www.w3.org/2000/xmlns/"
,
L"defuri"
,
"<e />"
,
"<e"
,
E_INVALIDARG
},
{
L"prefix"
,
L"a"
,
L"http://www.w3.org/2000/xmlns/"
,
L"defuri"
,
"<e />"
,
"<e"
,
WR_E_XMLNSURIDECLARATION
,
1
,
1
,
1
},
{
L"prefix"
,
NULL
,
L"http://www.w3.org/2000/xmlns/"
,
L"defuri"
,
"<e />"
,
"<e"
,
E_INVALIDARG
},
{
L"prefix"
,
NULL
,
NULL
,
L"b"
,
"<e />"
,
"<e"
,
E_INVALIDARG
},
...
...
@@ -1619,6 +1619,8 @@ static void test_WriteAttributeString(void)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
attribute_tests
);
++
i
)
{
winetest_push_context
(
"Test %u"
,
i
);
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
...
...
@@ -1630,7 +1632,7 @@ static void test_WriteAttributeString(void)
hr
=
IXmlWriter_WriteAttributeString
(
writer
,
attribute_tests
[
i
].
prefix
,
attribute_tests
[
i
].
local
,
attribute_tests
[
i
].
uri
,
attribute_tests
[
i
].
value
);
todo_wine_if
(
attribute_tests
[
i
].
todo_hr
)
ok
(
hr
==
attribute_tests
[
i
].
hr
,
"
%u: unexpected hr %#lx, expected %#lx.
\n
"
,
i
,
hr
,
attribute_tests
[
i
].
hr
);
ok
(
hr
==
attribute_tests
[
i
].
hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
attribute_tests
[
i
].
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#lx.
\n
"
,
hr
);
...
...
@@ -1645,6 +1647,8 @@ static void test_WriteAttributeString(void)
check_output
(
stream
,
attribute_tests
[
i
].
output
,
attribute_tests
[
i
].
todo
,
__LINE__
);
IStream_Release
(
stream
);
winetest_pop_context
();
}
/* With namespaces */
...
...
dlls/xmllite/writer.c
View file @
3cd0bfd4
...
...
@@ -912,21 +912,21 @@ static BOOL is_valid_xml_space_value(const WCHAR *value)
static
HRESULT
WINAPI
xmlwriter_WriteAttributeString
(
IXmlWriter
*
iface
,
LPCWSTR
prefix
,
LPCWSTR
local
,
LPCWSTR
uri
,
LPCWSTR
value
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
xmlwriter
*
writer
=
impl_from_IXmlWriter
(
iface
);
BOOL
is_xmlns_prefix
,
is_xmlns_local
;
int
prefix_len
,
local_len
;
struct
ns
*
ns
;
HRESULT
hr
;
TRACE
(
"%p
%s %s %s %s
\n
"
,
This
,
debugstr_w
(
prefix
),
debugstr_w
(
local
),
debugstr_w
(
uri
),
debugstr_w
(
value
));
TRACE
(
"%p
, %s, %s, %s, %s.
\n
"
,
iface
,
debugstr_w
(
prefix
),
debugstr_w
(
local
),
debugstr_w
(
uri
),
debugstr_w
(
value
));
switch
(
This
->
state
)
switch
(
writer
->
state
)
{
case
XmlWriterState_Initial
:
return
E_UNEXPECTED
;
case
XmlWriterState_Ready
:
case
XmlWriterState_DocClosed
:
This
->
state
=
XmlWriterState_DocClosed
;
writer
->
state
=
XmlWriterState_DocClosed
;
return
WR_E_INVALIDACTION
;
case
XmlWriterState_InvalidEncoding
:
return
MX_E_ENCODING
;
...
...
@@ -939,7 +939,7 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
if
(
is_xmlns_prefix
&&
is_empty_string
(
uri
)
&&
is_empty_string
(
local
))
return
WR_E_NSPREFIXDECLARED
;
if
(
!
local
)
if
(
is_empty_string
(
local
)
)
return
E_INVALIDARG
;
/* Validate prefix and local name */
...
...
@@ -954,7 +954,7 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
/* Trivial case, no prefix. */
if
(
prefix_len
==
0
&&
is_empty_string
(
uri
))
{
write_output_attribute
(
This
,
prefix
,
prefix_len
,
local
,
local_len
,
value
);
write_output_attribute
(
writer
,
prefix
,
prefix_len
,
local
,
local_len
,
value
);
return
S_OK
;
}
...
...
@@ -969,7 +969,7 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
if
(
!
is_empty_string
(
uri
))
return
WR_E_XMLPREFIXDECLARATION
;
write_output_attribute
(
This
,
prefix
,
prefix_len
,
local
,
local_len
,
value
);
write_output_attribute
(
writer
,
prefix
,
prefix_len
,
local
,
local_len
,
value
);
return
S_OK
;
}
...
...
@@ -980,11 +980,11 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
return
WR_E_XMLNSPREFIXDECLARATION
;
/* Look for exact match defined in current element, and write it out. */
if
(
!
(
ns
=
writer_find_ns_current
(
This
,
prefix
,
value
)))
ns
=
writer_push_ns
(
This
,
local
,
local_len
,
value
);
if
(
!
(
ns
=
writer_find_ns_current
(
writer
,
prefix
,
value
)))
ns
=
writer_push_ns
(
writer
,
local
,
local_len
,
value
);
ns
->
emitted
=
TRUE
;
write_output_attribute
(
This
,
L"xmlns"
,
5
,
local
,
local_len
,
value
);
write_output_attribute
(
writer
,
L"xmlns"
,
5
,
local
,
local_len
,
value
);
return
S_OK
;
}
...
...
@@ -992,11 +992,11 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
/* Ignore prefix if URI wasn't specified. */
if
(
is_xmlns_local
&&
is_empty_string
(
uri
))
{
write_output_attribute
(
This
,
NULL
,
0
,
L"xmlns"
,
5
,
value
);
write_output_attribute
(
writer
,
NULL
,
0
,
L"xmlns"
,
5
,
value
);
return
S_OK
;
}
if
(
!
(
ns
=
writer_find_ns
(
This
,
prefix
,
uri
)))
if
(
!
(
ns
=
writer_find_ns
(
writer
,
prefix
,
uri
)))
{
if
(
is_empty_string
(
prefix
)
&&
!
is_empty_string
(
uri
))
{
...
...
@@ -1004,13 +1004,13 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
return
E_NOTIMPL
;
}
if
(
!
is_empty_string
(
uri
))
ns
=
writer_push_ns
(
This
,
prefix
,
prefix_len
,
uri
);
ns
=
writer_push_ns
(
writer
,
prefix
,
prefix_len
,
uri
);
}
if
(
ns
)
write_output_attribute
(
This
,
ns
->
prefix
,
ns
->
prefix_len
,
local
,
local_len
,
value
);
write_output_attribute
(
writer
,
ns
->
prefix
,
ns
->
prefix_len
,
local
,
local_len
,
value
);
else
write_output_attribute
(
This
,
prefix
,
prefix_len
,
local
,
local_len
,
value
);
write_output_attribute
(
writer
,
prefix
,
prefix_len
,
local
,
local_len
,
value
);
return
S_OK
;
}
...
...
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