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
0b57ba19
Commit
0b57ba19
authored
Jan 29, 2016
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 29, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Implement WsWriteValue.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2f372673
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
165 additions
and
1 deletion
+165
-1
writer.c
dlls/webservices/tests/writer.c
+107
-0
webservices.spec
dlls/webservices/webservices.spec
+1
-1
writer.c
dlls/webservices/writer.c
+57
-0
No files found.
dlls/webservices/tests/writer.c
View file @
0b57ba19
...
...
@@ -800,6 +800,112 @@ static void test_WsWriteElement(void)
WsFreeWriter
(
writer
);
}
static
void
test_WsWriteValue
(
void
)
{
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"t"
},
ns
=
{
0
,
NULL
};
ULONG
i
;
static
const
struct
{
WS_VALUE_TYPE
type
;
INT64
val
;
ULONG
size
;
const
char
*
result
;
const
char
*
result2
;
}
tests
[]
=
{
{
WS_BOOL_VALUE_TYPE
,
~
0
,
sizeof
(
BOOL
),
"<t>true</t>"
,
"<t t=
\"
true
\"
/>"
},
{
WS_BOOL_VALUE_TYPE
,
FALSE
,
sizeof
(
BOOL
),
"<t>false</t>"
,
"<t t=
\"
false
\"
/>"
},
{
WS_INT8_VALUE_TYPE
,
-
128
,
sizeof
(
INT8
),
"<t>-128</t>"
,
"<t t=
\"
-128
\"
/>"
},
{
WS_INT16_VALUE_TYPE
,
-
32768
,
sizeof
(
INT16
),
"<t>-32768</t>"
,
"<t t=
\"
-32768
\"
/>"
},
{
WS_INT32_VALUE_TYPE
,
-
2147483647
-
1
,
sizeof
(
INT32
),
"<t>-2147483648</t>"
,
"<t t=
\"
-2147483648
\"
/>"
},
{
WS_INT64_VALUE_TYPE
,
-
9223372036854775807
-
1
,
sizeof
(
INT64
),
"<t>-9223372036854775808</t>"
,
"<t t=
\"
-9223372036854775808
\"
/>"
},
{
WS_UINT8_VALUE_TYPE
,
255
,
sizeof
(
UINT8
),
"<t>255</t>"
,
"<t t=
\"
255
\"
/>"
},
{
WS_UINT16_VALUE_TYPE
,
65535
,
sizeof
(
UINT16
),
"<t>65535</t>"
,
"<t t=
\"
65535
\"
/>"
},
{
WS_UINT32_VALUE_TYPE
,
~
0u
,
sizeof
(
UINT32
),
"<t>4294967295</t>"
,
"<t t=
\"
4294967295
\"
/>"
},
{
WS_UINT64_VALUE_TYPE
,
~
0
,
sizeof
(
UINT64
),
"<t>18446744073709551615</t>"
,
"<t t=
\"
18446744073709551615
\"
/>"
},
};
hr
=
WsCreateWriter
(
NULL
,
0
,
&
writer
,
NULL
)
;
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteValue
(
NULL
,
tests
[
0
].
type
,
&
tests
[
0
].
val
,
tests
[
0
].
size
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteValue
(
writer
,
tests
[
0
].
type
,
&
tests
[
0
].
val
,
tests
[
0
].
size
,
NULL
);
ok
(
hr
==
WS_E_INVALID_FORMAT
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
/* zero size */
hr
=
WsWriteValue
(
writer
,
tests
[
0
].
type
,
&
tests
[
0
].
val
,
0
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
/* NULL value */
hr
=
WsWriteValue
(
writer
,
tests
[
0
].
type
,
NULL
,
0
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
/* element type mapping */
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
i
++
)
{
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteValue
(
writer
,
tests
[
i
].
type
,
&
tests
[
i
].
val
,
tests
[
i
].
size
,
NULL
);
ok
(
hr
==
S_OK
,
"%u: got %08x
\n
"
,
i
,
hr
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
tests
[
i
].
result
,
__LINE__
);
}
/* attribute type mapping */
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
i
++
)
{
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartAttribute
(
writer
,
NULL
,
&
localname
,
&
ns
,
FALSE
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteValue
(
writer
,
tests
[
i
].
type
,
&
tests
[
i
].
val
,
tests
[
i
].
size
,
NULL
);
ok
(
hr
==
S_OK
,
"%u: got %08x
\n
"
,
i
,
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
,
tests
[
i
].
result2
,
__LINE__
);
}
WsFreeWriter
(
writer
);
}
START_TEST
(
writer
)
{
test_WsCreateWriter
();
...
...
@@ -810,6 +916,7 @@ START_TEST(writer)
test_WsWriteStartAttribute
();
test_WsWriteType
();
test_WsWriteElement
();
test_WsWriteValue
();
test_basic_type
();
test_simple_struct_type
();
}
dlls/webservices/webservices.spec
View file @
0b57ba19
...
...
@@ -186,7 +186,7 @@
@ stdcall WsWriteStartElement(ptr ptr ptr ptr ptr)
@ stdcall WsWriteText(ptr ptr ptr)
@ stdcall WsWriteType(ptr long long ptr long ptr long ptr)
@ st
ub WsWriteValue
@ st
dcall WsWriteValue(ptr long ptr long ptr)
@ stdcall WsWriteXmlBuffer(ptr ptr ptr)
@ stdcall WsWriteXmlBufferToBytes(ptr ptr ptr ptr long ptr ptr ptr ptr)
@ stub WsWriteXmlnsAttribute
...
...
dlls/webservices/writer.c
View file @
0b57ba19
...
...
@@ -1414,6 +1414,63 @@ HRESULT WINAPI WsWriteType( WS_XML_WRITER *handle, WS_TYPE_MAPPING mapping, WS_T
return
hr
;
}
static
WS_TYPE
map_value_type
(
WS_VALUE_TYPE
type
)
{
switch
(
type
)
{
case
WS_BOOL_VALUE_TYPE
:
return
WS_BOOL_TYPE
;
case
WS_INT8_VALUE_TYPE
:
return
WS_INT8_TYPE
;
case
WS_INT16_VALUE_TYPE
:
return
WS_INT16_TYPE
;
case
WS_INT32_VALUE_TYPE
:
return
WS_INT32_TYPE
;
case
WS_INT64_VALUE_TYPE
:
return
WS_INT64_TYPE
;
case
WS_UINT8_VALUE_TYPE
:
return
WS_UINT8_TYPE
;
case
WS_UINT16_VALUE_TYPE
:
return
WS_UINT16_TYPE
;
case
WS_UINT32_VALUE_TYPE
:
return
WS_UINT32_TYPE
;
case
WS_UINT64_VALUE_TYPE
:
return
WS_UINT64_TYPE
;
case
WS_FLOAT_VALUE_TYPE
:
return
WS_FLOAT_TYPE
;
case
WS_DOUBLE_VALUE_TYPE
:
return
WS_DOUBLE_TYPE
;
case
WS_DECIMAL_VALUE_TYPE
:
return
WS_DECIMAL_TYPE
;
case
WS_DATETIME_VALUE_TYPE
:
return
WS_DATETIME_TYPE
;
case
WS_TIMESPAN_VALUE_TYPE
:
return
WS_TIMESPAN_TYPE
;
case
WS_GUID_VALUE_TYPE
:
return
WS_GUID_TYPE
;
default:
FIXME
(
"unhandled type %u
\n
"
,
type
);
return
~
0u
;
}
}
/**************************************************************************
* WsWriteValue [webservices.@]
*/
HRESULT
WINAPI
WsWriteValue
(
WS_XML_WRITER
*
handle
,
WS_VALUE_TYPE
value_type
,
const
void
*
value
,
ULONG
size
,
WS_ERROR
*
error
)
{
struct
writer
*
writer
=
(
struct
writer
*
)
handle
;
WS_TYPE_MAPPING
mapping
;
WS_TYPE
type
;
TRACE
(
"%p %u %p %u %p
\n
"
,
handle
,
value_type
,
value
,
size
,
error
);
if
(
error
)
FIXME
(
"ignoring error parameter
\n
"
);
if
(
!
writer
||
!
value
||
(
type
=
map_value_type
(
value_type
))
==
~
0u
)
return
E_INVALIDARG
;
switch
(
writer
->
state
)
{
case
WRITER_STATE_STARTATTRIBUTE
:
mapping
=
WS_ATTRIBUTE_TYPE_MAPPING
;
break
;
case
WRITER_STATE_STARTELEMENT
:
mapping
=
WS_ELEMENT_TYPE_MAPPING
;
break
;
default:
return
WS_E_INVALID_FORMAT
;
}
return
write_type
(
writer
,
mapping
,
type
,
NULL
,
WS_WRITE_REQUIRED_VALUE
,
value
,
size
);
}
/**************************************************************************
* WsWriteXmlBuffer [webservices.@]
*/
...
...
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