Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a1c9801d
Commit
a1c9801d
authored
May 15, 2017
by
Hans Leidekker
Committed by
Alexandre Julliard
May 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Treat empty prefixes as NULL.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
bae46fb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
11 deletions
+36
-11
writer.c
dlls/webservices/tests/writer.c
+30
-5
writer.c
dlls/webservices/writer.c
+6
-6
No files found.
dlls/webservices/tests/writer.c
View file @
a1c9801d
...
...
@@ -395,7 +395,7 @@ static void test_WsWriteStartElement(void)
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_XML_STRING
prefix
=
{
1
,
(
BYTE
*
)
"p"
},
ns
=
{
2
,
(
BYTE
*
)
"ns"
},
ns2
=
{
3
,
(
BYTE
*
)
"ns2"
};
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"a"
},
localname2
=
{
1
,
(
BYTE
*
)
"b"
};
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"a"
},
localname2
=
{
1
,
(
BYTE
*
)
"b"
}
,
empty
=
{
0
,
NULL
}
;
hr
=
WsCreateWriter
(
NULL
,
0
,
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -469,6 +469,17 @@ static void test_WsWriteStartElement(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<p:a xmlns:p=
\"
ns
\"
><b xmlns=
\"
ns2
\"
/></p:a>"
,
__LINE__
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
&
empty
,
&
localname
,
&
empty
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndStartElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<a></a>"
,
__LINE__
);
WsFreeWriter
(
writer
);
}
...
...
@@ -476,7 +487,8 @@ static void test_WsWriteStartAttribute(void)
{
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_XML_STRING
prefix
=
{
1
,
(
BYTE
*
)
"p"
},
localname
=
{
3
,
(
BYTE
*
)
"str"
},
ns
=
{
2
,
(
BYTE
*
)
"ns"
};
WS_XML_STRING
prefix
=
{
1
,
(
BYTE
*
)
"p"
},
localname
=
{
3
,
(
BYTE
*
)
"str"
};
WS_XML_STRING
localname2
=
{
3
,
(
BYTE
*
)
"len"
},
ns
=
{
2
,
(
BYTE
*
)
"ns"
},
empty
=
{
0
,
NULL
};
WS_XML_UTF8_TEXT
text
=
{{
WS_XML_TEXT_TYPE_UTF8
}};
hr
=
WsCreateWriter
(
NULL
,
0
,
&
writer
,
NULL
);
...
...
@@ -492,9 +504,7 @@ static void test_WsWriteStartAttribute(void)
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
/* WsWriteStartAttribute doesn't output anything */
localname
.
length
=
3
;
localname
.
bytes
=
(
BYTE
*
)
"len"
;
hr
=
WsWriteStartAttribute
(
writer
,
&
prefix
,
&
localname
,
&
ns
,
FALSE
,
NULL
);
hr
=
WsWriteStartAttribute
(
writer
,
&
prefix
,
&
localname2
,
&
ns
,
FALSE
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
""
,
__LINE__
);
...
...
@@ -513,6 +523,21 @@ static void test_WsWriteStartAttribute(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<p:str p:len=
\"
0
\"
xmlns:p=
\"
ns
\"
/>"
,
__LINE__
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
&
prefix
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartAttribute
(
writer
,
&
empty
,
&
localname2
,
&
empty
,
FALSE
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndAttribute
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<p:str len=
\"\"
xmlns:p=
\"
ns
\"
/>"
,
__LINE__
);
WsFreeWriter
(
writer
);
}
...
...
dlls/webservices/writer.c
View file @
a1c9801d
...
...
@@ -518,12 +518,12 @@ static HRESULT write_attribute( struct writer *writer, WS_XML_ATTRIBUTE *attr )
/* ' prefix:attr="value"' */
size
=
attr
->
localName
->
length
+
4
/* ' =""' */
;
if
(
prefix
)
size
+=
prefix
->
length
+
1
/* ':' */
;
if
(
prefix
&&
prefix
->
length
)
size
+=
prefix
->
length
+
1
/* ':' */
;
if
(
text
)
size
+=
text
->
value
.
length
;
if
((
hr
=
write_grow_buffer
(
writer
,
size
))
!=
S_OK
)
return
hr
;
write_char
(
writer
,
' '
);
if
(
prefix
)
if
(
prefix
&&
prefix
->
length
)
{
write_bytes
(
writer
,
prefix
->
bytes
,
prefix
->
length
);
write_char
(
writer
,
':'
);
...
...
@@ -734,11 +734,11 @@ static HRESULT write_startelement( struct writer *writer )
/* '<prefix:localname prefix:attr="value"... xmlns:prefix="ns"'... */
size
=
elem
->
localName
->
length
+
1
/* '<' */
;
if
(
elem
->
prefix
)
size
+=
elem
->
prefix
->
length
+
1
/* ':' */
;
if
(
elem
->
prefix
&&
elem
->
prefix
->
length
)
size
+=
elem
->
prefix
->
length
+
1
/* ':' */
;
if
((
hr
=
write_grow_buffer
(
writer
,
size
))
!=
S_OK
)
return
hr
;
write_char
(
writer
,
'<'
);
if
(
elem
->
prefix
)
if
(
elem
->
prefix
&&
elem
->
prefix
->
length
)
{
write_bytes
(
writer
,
elem
->
prefix
->
bytes
,
elem
->
prefix
->
length
);
write_char
(
writer
,
':'
);
...
...
@@ -796,12 +796,12 @@ static HRESULT write_endelement( struct writer *writer, const WS_XML_ELEMENT_NOD
/* '</prefix:localname>' */
size
=
elem
->
localName
->
length
+
3
/* '</>' */
;
if
(
elem
->
prefix
)
size
+=
elem
->
prefix
->
length
+
1
/* ':' */
;
if
(
elem
->
prefix
&&
elem
->
prefix
->
length
)
size
+=
elem
->
prefix
->
length
+
1
/* ':' */
;
if
((
hr
=
write_grow_buffer
(
writer
,
size
))
!=
S_OK
)
return
hr
;
write_char
(
writer
,
'<'
);
write_char
(
writer
,
'/'
);
if
(
elem
->
prefix
)
if
(
elem
->
prefix
&&
elem
->
prefix
->
length
)
{
write_bytes
(
writer
,
elem
->
prefix
->
bytes
,
elem
->
prefix
->
length
);
write_char
(
writer
,
':'
);
...
...
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