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
86738d09
Commit
86738d09
authored
Apr 28, 2017
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Implement WsWriteBytes.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e6129147
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
1 deletion
+109
-1
writer.c
dlls/webservices/tests/writer.c
+68
-0
webservices.spec
dlls/webservices/webservices.spec
+1
-1
writer.c
dlls/webservices/writer.c
+40
-0
No files found.
dlls/webservices/tests/writer.c
View file @
86738d09
...
...
@@ -3114,6 +3114,73 @@ static void test_WsWriteQualifiedName(void)
WsFreeWriter
(
writer
);
}
static
void
test_WsWriteBytes
(
void
)
{
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"t"
},
localname2
=
{
1
,
(
BYTE
*
)
"a"
},
ns
=
{
0
,
NULL
};
WS_XML_WRITER
*
writer
;
HRESULT
hr
;
hr
=
WsWriteBytes
(
NULL
,
NULL
,
0
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsCreateWriter
(
NULL
,
0
,
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteBytes
(
writer
,
NULL
,
0
,
NULL
);
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteBytes
(
writer
,
"test"
,
0
,
NULL
);
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteBytes
(
writer
,
NULL
,
1
,
NULL
);
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteBytes
(
writer
,
"test"
,
sizeof
(
"test"
),
NULL
);
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteBytes
(
writer
,
"test"
,
sizeof
(
"test"
),
NULL
);
ok
(
hr
==
WS_E_INVALID_FORMAT
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
/* element */
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteBytes
(
writer
,
"test"
,
sizeof
(
"test"
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<t>dGVzdAA=</t>"
,
__LINE__
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
/* attribute */
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartAttribute
(
writer
,
NULL
,
&
localname2
,
&
ns
,
FALSE
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteBytes
(
writer
,
"test"
,
sizeof
(
"test"
),
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
,
"<t a=
\"
dGVzdAA=
\"
/>"
,
__LINE__
);
WsFreeWriter
(
writer
);
}
START_TEST
(
writer
)
{
test_WsCreateWriter
();
...
...
@@ -3148,4 +3215,5 @@ START_TEST(writer)
test_datetime
();
test_repeating_element
();
test_WsWriteQualifiedName
();
test_WsWriteBytes
();
}
dlls/webservices/webservices.spec
View file @
86738d09
...
...
@@ -167,7 +167,7 @@
@ stdcall WsWriteArray(ptr ptr ptr long ptr long long long ptr)
@ stdcall WsWriteAttribute(ptr ptr long ptr long ptr)
@ stdcall WsWriteBody(ptr ptr long ptr long ptr)
@ st
ub WsWriteBytes
@ st
dcall WsWriteBytes(ptr ptr long ptr)
@ stub WsWriteChars
@ stub WsWriteCharsUtf8
@ stdcall WsWriteElement(ptr ptr long ptr long ptr)
...
...
dlls/webservices/writer.c
View file @
86738d09
...
...
@@ -1697,6 +1697,7 @@ HRESULT WINAPI WsWriteText( WS_XML_WRITER *handle, const WS_XML_TEXT *text, WS_E
HRESULT
hr
;
TRACE
(
"%p %p %p
\n
"
,
handle
,
text
,
error
);
if
(
error
)
FIXME
(
"ignoring error parameter
\n
"
);
if
(
!
writer
||
!
text
)
return
E_INVALIDARG
;
...
...
@@ -1715,6 +1716,45 @@ HRESULT WINAPI WsWriteText( WS_XML_WRITER *handle, const WS_XML_TEXT *text, WS_E
return
hr
;
}
/**************************************************************************
* WsWriteBytes [webservices.@]
*/
HRESULT
WINAPI
WsWriteBytes
(
WS_XML_WRITER
*
handle
,
const
void
*
bytes
,
ULONG
count
,
WS_ERROR
*
error
)
{
struct
writer
*
writer
=
(
struct
writer
*
)
handle
;
WS_XML_BASE64_TEXT
base64
;
HRESULT
hr
;
TRACE
(
"%p %p %u %p
\n
"
,
handle
,
bytes
,
count
,
error
);
if
(
error
)
FIXME
(
"ignoring error parameter
\n
"
);
if
(
!
writer
)
return
E_INVALIDARG
;
EnterCriticalSection
(
&
writer
->
cs
);
if
(
writer
->
magic
!=
WRITER_MAGIC
)
{
LeaveCriticalSection
(
&
writer
->
cs
);
return
E_INVALIDARG
;
}
if
(
!
writer
->
output_type
)
{
LeaveCriticalSection
(
&
writer
->
cs
);
return
WS_E_INVALID_OPERATION
;
}
base64
.
text
.
textType
=
WS_XML_TEXT_TYPE_BASE64
;
base64
.
bytes
=
(
BYTE
*
)
bytes
;
base64
.
length
=
count
;
if
(
writer
->
state
==
WRITER_STATE_STARTATTRIBUTE
)
hr
=
write_set_attribute_value
(
writer
,
&
base64
.
text
);
else
hr
=
write_text_node
(
writer
,
&
base64
.
text
);
LeaveCriticalSection
(
&
writer
->
cs
);
return
hr
;
}
static
HRESULT
write_type_text
(
struct
writer
*
writer
,
WS_TYPE_MAPPING
mapping
,
const
WS_XML_TEXT
*
text
)
{
switch
(
mapping
)
...
...
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