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
164024ea
Commit
164024ea
authored
Jun 21, 2017
by
Hans Leidekker
Committed by
Alexandre Julliard
Jun 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Add support for reading WS_UNIQUE_ID values.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9fa4ed78
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
9 deletions
+97
-9
reader.c
dlls/webservices/reader.c
+70
-0
reader.c
dlls/webservices/tests/reader.c
+27
-9
No files found.
dlls/webservices/reader.c
View file @
164024ea
...
@@ -3578,6 +3578,19 @@ static HRESULT str_to_string( const unsigned char *str, ULONG len, WS_HEAP *heap
...
@@ -3578,6 +3578,19 @@ static HRESULT str_to_string( const unsigned char *str, ULONG len, WS_HEAP *heap
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
str_to_unique_id
(
const
unsigned
char
*
str
,
ULONG
len
,
WS_HEAP
*
heap
,
WS_UNIQUE_ID
*
ret
)
{
if
(
len
==
45
&&
!
memcmp
(
str
,
"urn:uuid:"
,
9
))
{
ret
->
uri
.
length
=
0
;
ret
->
uri
.
chars
=
NULL
;
return
str_to_guid
(
str
+
9
,
len
-
9
,
&
ret
->
guid
);
}
memset
(
&
ret
->
guid
,
0
,
sizeof
(
ret
->
guid
)
);
return
str_to_string
(
str
,
len
,
heap
,
&
ret
->
uri
);
}
static
inline
unsigned
char
decode_char
(
unsigned
char
c
)
static
inline
unsigned
char
decode_char
(
unsigned
char
c
)
{
{
if
(
c
>=
'A'
&&
c
<=
'Z'
)
return
c
-
'A'
;
if
(
c
>=
'A'
&&
c
<=
'Z'
)
return
c
-
'A'
;
...
@@ -4714,6 +4727,57 @@ static HRESULT read_type_guid( struct reader *reader, WS_TYPE_MAPPING mapping,
...
@@ -4714,6 +4727,57 @@ static HRESULT read_type_guid( struct reader *reader, WS_TYPE_MAPPING mapping,
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
read_type_unique_id
(
struct
reader
*
reader
,
WS_TYPE_MAPPING
mapping
,
const
WS_XML_STRING
*
localname
,
const
WS_XML_STRING
*
ns
,
const
WS_UNIQUE_ID_DESCRIPTION
*
desc
,
WS_READ_OPTION
option
,
WS_HEAP
*
heap
,
void
*
ret
,
ULONG
size
)
{
WS_XML_UTF8_TEXT
*
utf8
;
WS_UNIQUE_ID
val
=
{{
0
}};
HRESULT
hr
;
BOOL
found
;
if
(
desc
)
FIXME
(
"ignoring description
\n
"
);
if
((
hr
=
read_get_text
(
reader
,
mapping
,
localname
,
ns
,
&
utf8
,
&
found
))
!=
S_OK
)
return
hr
;
if
(
found
&&
(
hr
=
str_to_unique_id
(
utf8
->
value
.
bytes
,
utf8
->
value
.
length
,
heap
,
&
val
))
!=
S_OK
)
return
hr
;
switch
(
option
)
{
case
WS_READ_REQUIRED_VALUE
:
if
(
!
found
)
return
WS_E_INVALID_FORMAT
;
/* fall through */
case
WS_READ_NILLABLE_VALUE
:
if
(
size
!=
sizeof
(
val
))
return
E_INVALIDARG
;
*
(
WS_UNIQUE_ID
*
)
ret
=
val
;
break
;
case
WS_READ_REQUIRED_POINTER
:
if
(
!
found
)
return
WS_E_INVALID_FORMAT
;
/* fall through */
case
WS_READ_OPTIONAL_POINTER
:
case
WS_READ_NILLABLE_POINTER
:
{
WS_UNIQUE_ID
*
heap_val
=
NULL
;
if
(
size
!=
sizeof
(
heap_val
))
return
E_INVALIDARG
;
if
(
found
)
{
if
(
!
(
heap_val
=
ws_alloc
(
heap
,
sizeof
(
*
heap_val
)
)))
return
WS_E_QUOTA_EXCEEDED
;
*
heap_val
=
val
;
}
*
(
WS_UNIQUE_ID
**
)
ret
=
heap_val
;
break
;
}
default:
FIXME
(
"read option %u not supported
\n
"
,
option
);
return
E_NOTIMPL
;
}
return
S_OK
;
}
static
HRESULT
read_type_string
(
struct
reader
*
reader
,
WS_TYPE_MAPPING
mapping
,
static
HRESULT
read_type_string
(
struct
reader
*
reader
,
WS_TYPE_MAPPING
mapping
,
const
WS_XML_STRING
*
localname
,
const
WS_XML_STRING
*
ns
,
const
WS_XML_STRING
*
localname
,
const
WS_XML_STRING
*
ns
,
const
WS_STRING_DESCRIPTION
*
desc
,
WS_READ_OPTION
option
,
const
WS_STRING_DESCRIPTION
*
desc
,
WS_READ_OPTION
option
,
...
@@ -4976,6 +5040,7 @@ static WS_READ_OPTION get_field_read_option( WS_TYPE type, ULONG options )
...
@@ -4976,6 +5040,7 @@ static WS_READ_OPTION get_field_read_option( WS_TYPE type, ULONG options )
case
WS_DOUBLE_TYPE
:
case
WS_DOUBLE_TYPE
:
case
WS_DATETIME_TYPE
:
case
WS_DATETIME_TYPE
:
case
WS_GUID_TYPE
:
case
WS_GUID_TYPE
:
case
WS_UNIQUE_ID_TYPE
:
case
WS_STRING_TYPE
:
case
WS_STRING_TYPE
:
case
WS_BYTES_TYPE
:
case
WS_BYTES_TYPE
:
case
WS_XML_STRING_TYPE
:
case
WS_XML_STRING_TYPE
:
...
@@ -5383,6 +5448,11 @@ static HRESULT read_type( struct reader *reader, WS_TYPE_MAPPING mapping, WS_TYP
...
@@ -5383,6 +5448,11 @@ static HRESULT read_type( struct reader *reader, WS_TYPE_MAPPING mapping, WS_TYP
return
hr
;
return
hr
;
break
;
break
;
case
WS_UNIQUE_ID_TYPE
:
if
((
hr
=
read_type_unique_id
(
reader
,
mapping
,
localname
,
ns
,
desc
,
option
,
heap
,
value
,
size
))
!=
S_OK
)
return
hr
;
break
;
case
WS_STRING_TYPE
:
case
WS_STRING_TYPE
:
if
((
hr
=
read_type_string
(
reader
,
mapping
,
localname
,
ns
,
desc
,
option
,
heap
,
value
,
size
))
!=
S_OK
)
if
((
hr
=
read_type_string
(
reader
,
mapping
,
localname
,
ns
,
desc
,
option
,
heap
,
value
,
size
))
!=
S_OK
)
return
hr
;
return
hr
;
...
...
dlls/webservices/tests/reader.c
View file @
164024ea
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
#include "webservices.h"
#include "webservices.h"
#include "wine/test.h"
#include "wine/test.h"
static
const
GUID
guid_null
;
static
const
char
data1
[]
=
static
const
char
data1
[]
=
"<?xml version=
\"
1.0
\"
encoding=
\"
utf-8
\"
?>"
;
"<?xml version=
\"
1.0
\"
encoding=
\"
utf-8
\"
?>"
;
...
@@ -1360,9 +1362,6 @@ static void prepare_type_test( WS_XML_READER *reader, const char *data, ULONG si
...
@@ -1360,9 +1362,6 @@ static void prepare_type_test( WS_XML_READER *reader, const char *data, ULONG si
hr
=
set_input
(
reader
,
data
,
size
);
hr
=
set_input
(
reader
,
data
,
size
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsFillReader
(
reader
,
size
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsReadToStartElement
(
reader
,
NULL
,
NULL
,
NULL
,
NULL
);
hr
=
WsReadToStartElement
(
reader
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
@@ -1373,8 +1372,7 @@ static void prepare_type_test( WS_XML_READER *reader, const char *data, ULONG si
...
@@ -1373,8 +1372,7 @@ static void prepare_type_test( WS_XML_READER *reader, const char *data, ULONG si
static
void
test_WsReadType
(
void
)
static
void
test_WsReadType
(
void
)
{
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
},
test2W
[]
=
{
' '
,
't'
,
'e'
,
's'
,
't'
,
' '
};
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
},
test2W
[]
=
{
' '
,
't'
,
'e'
,
's'
,
't'
,
' '
};
static
const
GUID
guid1
=
{
0
,
0
,
0
,{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}};
static
const
GUID
guid
=
{
0
,
0
,
0
,{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0xa1
}};
static
const
GUID
guid2
=
{
0
,
0
,
0
,{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0xa1
}};
static
const
char
utf8
[]
=
{
'<'
,
't'
,
'>'
,
0xe2
,
0x80
,
0x99
,
'<'
,
'/'
,
't'
,
'>'
};
static
const
char
utf8
[]
=
{
'<'
,
't'
,
'>'
,
0xe2
,
0x80
,
0x99
,
'<'
,
'/'
,
't'
,
'>'
};
static
const
WCHAR
utf8W
[]
=
{
0x2019
,
0
};
static
const
WCHAR
utf8W
[]
=
{
0x2019
,
0
};
HRESULT
hr
;
HRESULT
hr
;
...
@@ -1399,6 +1397,7 @@ static void test_WsReadType(void)
...
@@ -1399,6 +1397,7 @@ static void test_WsReadType(void)
GUID
val_guid
;
GUID
val_guid
;
WS_BYTES
val_bytes
;
WS_BYTES
val_bytes
;
WS_STRING
val_string
;
WS_STRING
val_string
;
WS_UNIQUE_ID
val_id
;
hr
=
WsCreateHeap
(
1
<<
16
,
0
,
NULL
,
0
,
&
heap
,
NULL
);
hr
=
WsCreateHeap
(
1
<<
16
,
0
,
NULL
,
0
,
&
heap
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
@@ -1650,7 +1649,7 @@ static void test_WsReadType(void)
...
@@ -1650,7 +1649,7 @@ static void test_WsReadType(void)
hr
=
WsReadType
(
reader
,
WS_ELEMENT_CONTENT_TYPE_MAPPING
,
WS_GUID_TYPE
,
NULL
,
hr
=
WsReadType
(
reader
,
WS_ELEMENT_CONTENT_TYPE_MAPPING
,
WS_GUID_TYPE
,
NULL
,
WS_READ_REQUIRED_VALUE
,
heap
,
&
val_guid
,
sizeof
(
val_guid
),
NULL
);
WS_READ_REQUIRED_VALUE
,
heap
,
&
val_guid
,
sizeof
(
val_guid
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
val_guid
,
&
guid
1
),
"wrong guid
\n
"
);
ok
(
IsEqualGUID
(
&
val_guid
,
&
guid
_null
),
"wrong guid
\n
"
);
memset
(
&
val_guid
,
0
,
sizeof
(
val_guid
)
);
memset
(
&
val_guid
,
0
,
sizeof
(
val_guid
)
);
prepare_type_test
(
reader
,
"<t>00000000-0000-0000-0000-0000000000a1</t>"
,
prepare_type_test
(
reader
,
"<t>00000000-0000-0000-0000-0000000000a1</t>"
,
...
@@ -1658,7 +1657,7 @@ static void test_WsReadType(void)
...
@@ -1658,7 +1657,7 @@ static void test_WsReadType(void)
hr
=
WsReadType
(
reader
,
WS_ELEMENT_CONTENT_TYPE_MAPPING
,
WS_GUID_TYPE
,
NULL
,
hr
=
WsReadType
(
reader
,
WS_ELEMENT_CONTENT_TYPE_MAPPING
,
WS_GUID_TYPE
,
NULL
,
WS_READ_REQUIRED_VALUE
,
heap
,
&
val_guid
,
sizeof
(
val_guid
),
NULL
);
WS_READ_REQUIRED_VALUE
,
heap
,
&
val_guid
,
sizeof
(
val_guid
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
val_guid
,
&
guid
2
),
"wrong guid
\n
"
);
ok
(
IsEqualGUID
(
&
val_guid
,
&
guid
),
"wrong guid
\n
"
);
memset
(
&
val_guid
,
0
,
sizeof
(
val_guid
)
);
memset
(
&
val_guid
,
0
,
sizeof
(
val_guid
)
);
prepare_type_test
(
reader
,
"<t>00000000-0000-0000-0000-0000000000A1</t>"
,
prepare_type_test
(
reader
,
"<t>00000000-0000-0000-0000-0000000000A1</t>"
,
...
@@ -1666,7 +1665,7 @@ static void test_WsReadType(void)
...
@@ -1666,7 +1665,7 @@ static void test_WsReadType(void)
hr
=
WsReadType
(
reader
,
WS_ELEMENT_CONTENT_TYPE_MAPPING
,
WS_GUID_TYPE
,
NULL
,
hr
=
WsReadType
(
reader
,
WS_ELEMENT_CONTENT_TYPE_MAPPING
,
WS_GUID_TYPE
,
NULL
,
WS_READ_REQUIRED_VALUE
,
heap
,
&
val_guid
,
sizeof
(
val_guid
),
NULL
);
WS_READ_REQUIRED_VALUE
,
heap
,
&
val_guid
,
sizeof
(
val_guid
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
val_guid
,
&
guid
2
),
"wrong guid
\n
"
);
ok
(
IsEqualGUID
(
&
val_guid
,
&
guid
),
"wrong guid
\n
"
);
memset
(
&
val_bytes
,
0
,
sizeof
(
val_bytes
)
);
memset
(
&
val_bytes
,
0
,
sizeof
(
val_bytes
)
);
prepare_type_test
(
reader
,
"<t>dGVzdA==</t>"
,
sizeof
(
"<t>dGVzdA==</t>"
)
-
1
);
prepare_type_test
(
reader
,
"<t>dGVzdA==</t>"
,
sizeof
(
"<t>dGVzdA==</t>"
)
-
1
);
...
@@ -1705,6 +1704,26 @@ static void test_WsReadType(void)
...
@@ -1705,6 +1704,26 @@ static void test_WsReadType(void)
ok
(
val_string
.
length
==
6
,
"got %u
\n
"
,
val_string
.
length
);
ok
(
val_string
.
length
==
6
,
"got %u
\n
"
,
val_string
.
length
);
ok
(
!
memcmp
(
val_string
.
chars
,
test2W
,
sizeof
(
test2W
)
),
"wrong data
\n
"
);
ok
(
!
memcmp
(
val_string
.
chars
,
test2W
,
sizeof
(
test2W
)
),
"wrong data
\n
"
);
memset
(
&
val_id
,
0
,
sizeof
(
val_id
)
);
val_id
.
guid
.
Data1
=
0xdeadbeef
;
prepare_type_test
(
reader
,
"<t> test </t>"
,
sizeof
(
"<t> test </t>"
)
-
1
);
hr
=
WsReadType
(
reader
,
WS_ELEMENT_CONTENT_TYPE_MAPPING
,
WS_UNIQUE_ID_TYPE
,
NULL
,
WS_READ_REQUIRED_VALUE
,
heap
,
&
val_id
,
sizeof
(
val_id
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
val_id
.
uri
.
length
==
6
,
"got %u
\n
"
,
val_string
.
length
);
ok
(
!
memcmp
(
val_id
.
uri
.
chars
,
test2W
,
sizeof
(
test2W
)
),
"wrong data
\n
"
);
ok
(
IsEqualGUID
(
&
val_id
.
guid
,
&
guid_null
),
"wrong guid
\n
"
);
memset
(
&
val_id
,
0
,
sizeof
(
val_id
)
);
prepare_type_test
(
reader
,
"<t>urn:uuid:00000000-0000-0000-0000-0000000000a1</t>"
,
sizeof
(
"<t>urn:uuid:00000000-0000-0000-0000-0000000000a1</t>"
)
-
1
);
hr
=
WsReadType
(
reader
,
WS_ELEMENT_CONTENT_TYPE_MAPPING
,
WS_UNIQUE_ID_TYPE
,
NULL
,
WS_READ_REQUIRED_VALUE
,
heap
,
&
val_id
,
sizeof
(
val_id
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
!
val_id
.
uri
.
length
,
"got %u
\n
"
,
val_string
.
length
);
ok
(
val_id
.
uri
.
chars
==
NULL
,
"chars set %s
\n
"
,
wine_dbgstr_wn
(
val_id
.
uri
.
chars
,
val_id
.
uri
.
length
)
);
ok
(
IsEqualGUID
(
&
val_id
.
guid
,
&
guid
),
"wrong guid
\n
"
);
WsFreeReader
(
reader
);
WsFreeReader
(
reader
);
WsFreeHeap
(
heap
);
WsFreeHeap
(
heap
);
}
}
...
@@ -3842,7 +3861,6 @@ static void test_field_options(void)
...
@@ -3842,7 +3861,6 @@ static void test_field_options(void)
static
const
char
xml
[]
=
static
const
char
xml
[]
=
"<t xmlns:i=
\"
http://www.w3.org/2001/XMLSchema-instance
\"
><wsz i:nil=
\"
true
\"
/>"
"<t xmlns:i=
\"
http://www.w3.org/2001/XMLSchema-instance
\"
><wsz i:nil=
\"
true
\"
/>"
"<s i:nil=
\"
true
\"
/></t>"
;
"<s i:nil=
\"
true
\"
/></t>"
;
static
const
GUID
guid_null
=
{
0
};
HRESULT
hr
;
HRESULT
hr
;
WS_HEAP
*
heap
;
WS_HEAP
*
heap
;
WS_XML_READER
*
reader
;
WS_XML_READER
*
reader
;
...
...
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