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
e9435db2
Commit
e9435db2
authored
Nov 11, 2015
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Avoid writing redundant namespace attributes.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c08fb1a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
writer.c
dlls/webservices/writer.c
+23
-2
No files found.
dlls/webservices/writer.c
View file @
e9435db2
...
...
@@ -73,6 +73,7 @@ struct writer
enum
writer_state
state
;
struct
node
*
root
;
struct
node
*
current
;
WS_XML_STRING
*
current_ns
;
WS_XML_WRITER_OUTPUT_TYPE
output_type
;
struct
xmlbuf
*
output_buf
;
WS_HEAP
*
output_heap
;
...
...
@@ -123,6 +124,7 @@ static HRESULT get_writer_prop( struct writer *writer, WS_XML_WRITER_PROPERTY_ID
static
void
free_writer
(
struct
writer
*
writer
)
{
destroy_nodes
(
writer
->
root
);
heap_free
(
writer
->
current_ns
);
WsFreeHeap
(
writer
->
output_heap
);
heap_free
(
writer
);
}
...
...
@@ -161,8 +163,11 @@ static HRESULT write_init_state( struct writer *writer )
{
struct
node
*
node
;
heap_free
(
writer
->
current_ns
);
writer
->
current_ns
=
NULL
;
destroy_nodes
(
writer
->
root
);
writer
->
root
=
NULL
;
if
(
!
(
node
=
alloc_node
(
WS_XML_NODE_TYPE_EOF
)))
return
E_OUTOFMEMORY
;
write_insert_eof
(
writer
,
node
);
writer
->
state
=
WRITER_STATE_INITIAL
;
...
...
@@ -476,6 +481,20 @@ static HRESULT write_attribute( struct writer *writer, WS_XML_ATTRIBUTE *attr )
return
S_OK
;
}
static
inline
BOOL
is_current_namespace
(
struct
writer
*
writer
,
const
WS_XML_STRING
*
ns
)
{
return
(
WsXmlStringEquals
(
writer
->
current_ns
,
ns
,
NULL
)
==
S_OK
);
}
static
HRESULT
set_current_namespace
(
struct
writer
*
writer
,
const
WS_XML_STRING
*
ns
)
{
WS_XML_STRING
*
str
;
if
(
!
(
str
=
alloc_xml_string
(
(
const
char
*
)
ns
->
bytes
,
ns
->
length
)))
return
E_OUTOFMEMORY
;
heap_free
(
writer
->
current_ns
);
writer
->
current_ns
=
str
;
return
S_OK
;
}
static
HRESULT
write_startelement
(
struct
writer
*
writer
)
{
WS_XML_ELEMENT_NODE
*
elem
=
(
WS_XML_ELEMENT_NODE
*
)
writer
->
current
;
...
...
@@ -486,7 +505,7 @@ static HRESULT write_startelement( struct writer *writer )
size
=
elem
->
localName
->
length
+
1
/* '<' */
;
if
(
elem
->
prefix
)
size
+=
elem
->
prefix
->
length
+
1
/* ':' */
;
if
(
elem
->
ns
->
length
)
if
(
elem
->
ns
->
length
&&
!
is_current_namespace
(
writer
,
elem
->
ns
)
)
{
size
+=
strlen
(
" xmlns"
)
+
elem
->
ns
->
length
+
3
/* '=""' */
;
if
(
elem
->
prefix
)
size
+=
elem
->
prefix
->
length
+
1
/* ':' */
;
...
...
@@ -504,8 +523,10 @@ static HRESULT write_startelement( struct writer *writer )
{
if
((
hr
=
write_attribute
(
writer
,
elem
->
attributes
[
i
]
))
!=
S_OK
)
return
hr
;
}
if
(
elem
->
ns
->
length
)
if
(
elem
->
ns
->
length
&&
!
is_current_namespace
(
writer
,
elem
->
ns
)
)
{
if
((
hr
=
set_current_namespace
(
writer
,
elem
->
ns
))
!=
S_OK
)
return
hr
;
write_bytes
(
writer
,
(
const
BYTE
*
)
" xmlns"
,
6
);
if
(
elem
->
prefix
)
{
...
...
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