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
2d5d3a89
Commit
2d5d3a89
authored
Sep 17, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite/writer: Fix "xml:space" output.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6fbf6c33
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
writer.c
dlls/xmllite/tests/writer.c
+14
-0
writer.c
dlls/xmllite/writer.c
+29
-0
No files found.
dlls/xmllite/tests/writer.c
View file @
2d5d3a89
...
@@ -1637,6 +1637,12 @@ static void test_WriteAttributeString(void)
...
@@ -1637,6 +1637,12 @@ static void test_WriteAttributeString(void)
{
"prefix"
,
"xmlns"
,
"uri"
,
""
,
"<e prefix:xmlns=
\"\"
xmlns:prefix=
\"
uri
\"
/>"
,
"<e prefix:xmlns=
\"\"
"
},
{
"prefix"
,
"xmlns"
,
"uri"
,
""
,
"<e prefix:xmlns=
\"\"
xmlns:prefix=
\"
uri
\"
/>"
,
"<e prefix:xmlns=
\"\"
"
},
{
"prefix"
,
"xmlns"
,
NULL
,
"uri"
,
"<e xmlns=
\"
uri
\"
/>"
,
"<e xmlns=
\"
uri
\"
"
},
{
"prefix"
,
"xmlns"
,
NULL
,
"uri"
,
"<e xmlns=
\"
uri
\"
/>"
,
"<e xmlns=
\"
uri
\"
"
},
{
"prefix"
,
"xmlns"
,
""
,
"uri"
,
"<e xmlns=
\"
uri
\"
/>"
,
"<e xmlns=
\"
uri
\"
"
},
{
"prefix"
,
"xmlns"
,
""
,
"uri"
,
"<e xmlns=
\"
uri
\"
/>"
,
"<e xmlns=
\"
uri
\"
"
},
{
"xml"
,
"space"
,
NULL
,
"preserve"
,
"<e xml:space=
\"
preserve
\"
/>"
,
"<e xml:space=
\"
preserve
\"
"
},
{
"xml"
,
"space"
,
""
,
"preserve"
,
"<e xml:space=
\"
preserve
\"
/>"
,
"<e xml:space=
\"
preserve
\"
"
},
{
"xml"
,
"space"
,
NULL
,
"default"
,
"<e xml:space=
\"
default
\"
/>"
,
"<e xml:space=
\"
default
\"
"
},
{
"xml"
,
"space"
,
""
,
"default"
,
"<e xml:space=
\"
default
\"
/>"
,
"<e xml:space=
\"
default
\"
"
},
{
"xml"
,
"a"
,
NULL
,
"value"
,
"<e xml:a=
\"
value
\"
/>"
,
"<e xml:a=
\"
value
\"
"
},
{
"xml"
,
"a"
,
""
,
"value"
,
"<e xml:a=
\"
value
\"
/>"
,
"<e xml:a=
\"
value
\"
"
},
/* Autogenerated prefix names. */
/* Autogenerated prefix names. */
{
NULL
,
"a"
,
"defuri"
,
NULL
,
"<e p1:a=
\"\"
xmlns:p1=
\"
defuri
\"
/>"
,
"<e p1:a=
\"\"
"
,
S_OK
,
1
,
1
,
1
},
{
NULL
,
"a"
,
"defuri"
,
NULL
,
"<e p1:a=
\"\"
xmlns:p1=
\"
defuri
\"
/>"
,
"<e p1:a=
\"\"
"
,
S_OK
,
1
,
1
,
1
},
...
@@ -1655,6 +1661,7 @@ static void test_WriteAttributeString(void)
...
@@ -1655,6 +1661,7 @@ static void test_WriteAttributeString(void)
{
"prefix"
,
NULL
,
"http://www.w3.org/2000/xmlns/"
,
"defuri"
,
"<e />"
,
"<e"
,
E_INVALIDARG
},
{
"prefix"
,
NULL
,
"http://www.w3.org/2000/xmlns/"
,
"defuri"
,
"<e />"
,
"<e"
,
E_INVALIDARG
},
{
"prefix"
,
NULL
,
NULL
,
"b"
,
"<e />"
,
"<e"
,
E_INVALIDARG
},
{
"prefix"
,
NULL
,
NULL
,
"b"
,
"<e />"
,
"<e"
,
E_INVALIDARG
},
{
"prefix"
,
NULL
,
"uri"
,
NULL
,
"<e />"
,
"<e"
,
E_INVALIDARG
},
{
"prefix"
,
NULL
,
"uri"
,
NULL
,
"<e />"
,
"<e"
,
E_INVALIDARG
},
{
"xml"
,
NULL
,
NULL
,
"value"
,
"<e />"
,
"<e"
,
E_INVALIDARG
},
{
"xmlns"
,
"a"
,
"defuri"
,
NULL
,
"<e />"
,
"<e"
,
WR_E_XMLNSPREFIXDECLARATION
},
{
"xmlns"
,
"a"
,
"defuri"
,
NULL
,
"<e />"
,
"<e"
,
WR_E_XMLNSPREFIXDECLARATION
},
{
"xmlns"
,
"a"
,
"b"
,
"uri"
,
"<e />"
,
"<e"
,
WR_E_XMLNSPREFIXDECLARATION
},
{
"xmlns"
,
"a"
,
"b"
,
"uri"
,
"<e />"
,
"<e"
,
WR_E_XMLNSPREFIXDECLARATION
},
{
NULL
,
"xmlns"
,
"uri"
,
NULL
,
"<e />"
,
"<e"
,
WR_E_XMLNSPREFIXDECLARATION
,
0
,
0
,
1
},
{
NULL
,
"xmlns"
,
"uri"
,
NULL
,
"<e />"
,
"<e"
,
WR_E_XMLNSPREFIXDECLARATION
,
0
,
0
,
1
},
...
@@ -1666,6 +1673,13 @@ static void test_WriteAttributeString(void)
...
@@ -1666,6 +1673,13 @@ static void test_WriteAttributeString(void)
{
"xmlns"
,
NULL
,
""
,
"uri"
,
"<e />"
,
"<e"
,
WR_E_NSPREFIXDECLARED
},
{
"xmlns"
,
NULL
,
""
,
"uri"
,
"<e />"
,
"<e"
,
WR_E_NSPREFIXDECLARED
},
{
"xmlns"
,
""
,
NULL
,
"uri"
,
"<e />"
,
"<e"
,
WR_E_NSPREFIXDECLARED
},
{
"xmlns"
,
""
,
NULL
,
"uri"
,
"<e />"
,
"<e"
,
WR_E_NSPREFIXDECLARED
},
{
"xmlns"
,
""
,
""
,
"uri"
,
"<e />"
,
"<e"
,
WR_E_NSPREFIXDECLARED
},
{
"xmlns"
,
""
,
""
,
"uri"
,
"<e />"
,
"<e"
,
WR_E_NSPREFIXDECLARED
},
{
"xml"
,
"space"
,
""
,
"value"
,
"<e />"
,
"<e"
,
WR_E_INVALIDXMLSPACE
},
{
"xml"
,
"space"
,
NULL
,
"value"
,
"<e />"
,
"<e"
,
WR_E_INVALIDXMLSPACE
},
{
"xml"
,
"a"
,
"uri"
,
"value"
,
"<e />"
,
"<e"
,
WR_E_XMLPREFIXDECLARATION
},
{
"xml"
,
"space"
,
NULL
,
"preServe"
,
"<e />"
,
"<e"
,
WR_E_INVALIDXMLSPACE
},
{
"xml"
,
"space"
,
NULL
,
"defAult"
,
"<e />"
,
"<e"
,
WR_E_INVALIDXMLSPACE
},
{
"xml"
,
"space"
,
NULL
,
NULL
,
"<e />"
,
"<e"
,
WR_E_INVALIDXMLSPACE
},
{
"xml"
,
"space"
,
NULL
,
""
,
"<e />"
,
"<e"
,
WR_E_INVALIDXMLSPACE
},
};
};
IXmlWriter
*
writer
;
IXmlWriter
*
writer
;
...
...
dlls/xmllite/writer.c
View file @
2d5d3a89
...
@@ -825,10 +825,23 @@ static void write_output_attribute(xmlwriter *writer, const WCHAR *prefix, int p
...
@@ -825,10 +825,23 @@ static void write_output_attribute(xmlwriter *writer, const WCHAR *prefix, int p
write_output_buffer_quoted
(
writer
->
output
,
value
,
-
1
);
write_output_buffer_quoted
(
writer
->
output
,
value
,
-
1
);
}
}
static
BOOL
is_valid_xml_space_value
(
const
WCHAR
*
value
)
{
static
const
WCHAR
preserveW
[]
=
{
'p'
,
'r'
,
'e'
,
's'
,
'e'
,
'r'
,
'v'
,
'e'
,
0
};
static
const
WCHAR
defaultW
[]
=
{
'd'
,
'e'
,
'f'
,
'a'
,
'u'
,
'l'
,
't'
,
0
};
if
(
!
value
)
return
FALSE
;
return
!
strcmpW
(
value
,
preserveW
)
||
!
strcmpW
(
value
,
defaultW
);
}
static
HRESULT
WINAPI
xmlwriter_WriteAttributeString
(
IXmlWriter
*
iface
,
LPCWSTR
prefix
,
static
HRESULT
WINAPI
xmlwriter_WriteAttributeString
(
IXmlWriter
*
iface
,
LPCWSTR
prefix
,
LPCWSTR
local
,
LPCWSTR
uri
,
LPCWSTR
value
)
LPCWSTR
local
,
LPCWSTR
uri
,
LPCWSTR
value
)
{
{
static
const
WCHAR
spaceattrW
[]
=
{
's'
,
'p'
,
'a'
,
'c'
,
'e'
,
0
};
static
const
WCHAR
xmlnsW
[]
=
{
'x'
,
'm'
,
'l'
,
'n'
,
's'
,
0
};
static
const
WCHAR
xmlnsW
[]
=
{
'x'
,
'm'
,
'l'
,
'n'
,
's'
,
0
};
static
const
WCHAR
xmlW
[]
=
{
'x'
,
'm'
,
'l'
,
0
};
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
int
prefix_len
,
local_len
;
int
prefix_len
,
local_len
;
BOOL
is_xmlns_prefix
;
BOOL
is_xmlns_prefix
;
...
@@ -873,6 +886,22 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
...
@@ -873,6 +886,22 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
return
S_OK
;
return
S_OK
;
}
}
/* Predefined "xml" prefix. */
if
(
prefix_len
&&
!
strcmpW
(
prefix
,
xmlW
))
{
/* Valid "space" value is enforced. */
if
(
!
strcmpW
(
local
,
spaceattrW
)
&&
!
is_valid_xml_space_value
(
value
))
return
WR_E_INVALIDXMLSPACE
;
/* Redefinition is not allowed. */
if
(
!
is_empty_string
(
uri
))
return
WR_E_XMLPREFIXDECLARATION
;
write_output_attribute
(
This
,
prefix
,
prefix_len
,
local
,
local_len
,
value
);
return
S_OK
;
}
if
(
is_xmlns_prefix
||
(
prefix_len
==
0
&&
uri
&&
!
strcmpW
(
uri
,
xmlnsuriW
)))
if
(
is_xmlns_prefix
||
(
prefix_len
==
0
&&
uri
&&
!
strcmpW
(
uri
,
xmlnsuriW
)))
{
{
if
(
prefix_len
&&
!
is_empty_string
(
uri
))
if
(
prefix_len
&&
!
is_empty_string
(
uri
))
...
...
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