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
89bbd132
Commit
89bbd132
authored
Jul 25, 2022
by
Paul Gofman
Committed by
Alexandre Julliard
Jul 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Use node_get_text() in domelem_get_nodeTypedValue() if no type is present.
parent
7341eb30
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
6 deletions
+77
-6
element.c
dlls/msxml3/element.c
+7
-1
domdoc.c
dlls/msxml3/tests/domdoc.c
+70
-5
No files found.
dlls/msxml3/element.c
View file @
89bbd132
...
...
@@ -454,7 +454,6 @@ static inline HRESULT variant_from_dt(XDR_DT dt, xmlChar* str, VARIANT* v)
switch
(
dt
)
{
case
DT_INVALID
:
case
DT_STRING
:
case
DT_NMTOKEN
:
case
DT_NMTOKENS
:
...
...
@@ -736,6 +735,13 @@ static HRESULT WINAPI domelem_get_nodeTypedValue(
V_VT
(
v
)
=
VT_NULL
;
dt
=
element_get_dt
(
get_element
(
This
));
if
(
dt
==
DT_INVALID
)
{
if
(
SUCCEEDED
(
hr
=
node_get_text
(
&
This
->
node
,
&
V_BSTR
(
v
))))
V_VT
(
v
)
=
VT_BSTR
;
return
hr
;
}
content
=
xmlNodeGetContent
(
get_element
(
This
));
hr
=
variant_from_dt
(
dt
,
content
,
v
);
xmlFree
(
content
);
...
...
dlls/msxml3/tests/domdoc.c
View file @
89bbd132
...
...
@@ -906,7 +906,11 @@ static const CHAR szTypeValueXML[] =
"<?xml version=
\"
1.0
\"
encoding=
\"
utf-8
\"
?>
\n
"
"<root xmlns:dt=
\"
urn:schemas-microsoft-com:datatypes
\"
>
\n
"
" <string>Wine</string>
\n
"
" <string2 dt:dt=
\"
string
\"
>String</string2>
\n
"
" <string2 dt:dt=
\"
string
\"
>String </string2>
\n
"
" <string3> Wine Wine </string3>
\n
"
" <string4>
\n
Wine Wine
\t
</string4>
\n
"
" <string5> </string5>
\n
"
" <nested><s1> s1 </s1><s2>
\n
s2 s2
\t
</s2></nested>
\n
"
" <number dt:dt=
\"
number
\"
>12.44</number>
\n
"
" <number2 dt:dt=
\"
NUMbEr
\"
>-3.71e3</number2>
\n
"
" <int dt:dt=
\"
int
\"
>-13</int>
\n
"
...
...
@@ -6994,11 +6998,16 @@ typedef struct _nodetypedvalue_t {
const
char
*
name
;
VARTYPE
type
;
const
char
*
value
;
/* value in string format */
BOOL
no_type
;
}
nodetypedvalue_t
;
static
const
nodetypedvalue_t
get_nodetypedvalue
[]
=
{
{
"root/string"
,
VT_BSTR
,
"Wine"
},
{
"root/string2"
,
VT_BSTR
,
"String"
},
{
"root/string"
,
VT_BSTR
,
"Wine"
,
TRUE
},
{
"root/string2"
,
VT_BSTR
,
"String "
},
{
"root/string3"
,
VT_BSTR
,
" Wine Wine "
,
TRUE
},
{
"root/string4"
,
VT_BSTR
,
"
\n
Wine Wine
\t
"
,
TRUE
},
{
"root/string5"
,
VT_BSTR
,
""
,
TRUE
},
{
"root/nested"
,
VT_BSTR
,
" s1
\n
s2 s2
\t
"
,
TRUE
},
{
"root/number"
,
VT_BSTR
,
"12.44"
},
{
"root/number2"
,
VT_BSTR
,
"-3.71e3"
},
{
"root/int"
,
VT_I4
,
"-13"
},
...
...
@@ -7025,6 +7034,24 @@ static const nodetypedvalue_t get_nodetypedvalue[] = {
{
0
}
};
static
const
char
*
strip_spaces
(
const
char
*
str
)
{
static
char
buf
[
256
];
const
char
*
p
;
while
(
isspace
(
*
str
))
++
str
;
p
=
str
+
strlen
(
str
);
while
(
p
!=
str
&&
isspace
(
p
[
-
1
]))
--
p
;
memcpy
(
buf
,
str
,
p
-
str
);
buf
[
p
-
str
]
=
0
;
return
buf
;
}
static
void
test_nodeTypedValue
(
void
)
{
const
nodetypedvalue_t
*
entry
=
get_nodetypedvalue
;
...
...
@@ -7220,8 +7247,46 @@ static void test_nodeTypedValue(void)
"expected %s, got %s
\n
"
,
entry
->
value
,
wine_dbgstr_w
(
V_BSTR
(
&
value
)));
}
else
ok
(
lstrcmpW
(
V_BSTR
(
&
value
),
_bstr_
(
entry
->
value
))
==
0
,
"expected %s, got %s
\n
"
,
entry
->
value
,
wine_dbgstr_w
(
V_BSTR
(
&
value
)));
{
BSTR
bstr
,
expected
;
expected
=
entry
->
no_type
?
_bstr_
(
strip_spaces
(
entry
->
value
))
:
_bstr_
(
entry
->
value
);
ok
(
!
wcscmp
(
V_BSTR
(
&
value
),
expected
),
"expected %s, got %s
\n
"
,
debugstr_w
(
expected
),
wine_dbgstr_w
(
V_BSTR
(
&
value
)));
if
(
entry
->
no_type
)
{
VariantClear
(
&
value
);
hr
=
IXMLDOMDocument_get_preserveWhiteSpace
(
doc
,
&
b
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
b
==
VARIANT_FALSE
,
"got %d
\n
"
,
b
);
hr
=
IXMLDOMNode_get_text
(
node
,
&
bstr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
wcscmp
(
bstr
,
expected
),
"expected %s, got %s
\n
"
,
debugstr_w
(
expected
),
wine_dbgstr_w
(
bstr
));
SysFreeString
(
bstr
);
hr
=
IXMLDOMDocument_put_preserveWhiteSpace
(
doc
,
VARIANT_TRUE
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
expected
=
_bstr_
(
entry
->
value
);
hr
=
IXMLDOMNode_get_text
(
node
,
&
bstr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
wcscmp
(
bstr
,
expected
),
"expected %s, got %s
\n
"
,
debugstr_w
(
expected
),
wine_dbgstr_w
(
bstr
));
SysFreeString
(
bstr
);
hr
=
IXMLDOMNode_get_nodeTypedValue
(
node
,
&
value
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
V_VT
(
&
value
)
==
entry
->
type
,
"incorrect type, expected %d, got %d
\n
"
,
entry
->
type
,
V_VT
(
&
value
));
ok
(
!
wcscmp
(
V_BSTR
(
&
value
),
expected
),
"expected %s, got %s
\n
"
,
debugstr_w
(
expected
),
wine_dbgstr_w
(
V_BSTR
(
&
value
)));
hr
=
IXMLDOMDocument_put_preserveWhiteSpace
(
doc
,
VARIANT_FALSE
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
}
}
VariantClear
(
&
value
);
IXMLDOMNode_Release
(
node
);
...
...
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