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
455f5f23
Commit
455f5f23
authored
Feb 06, 2017
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite: Handle char references within text nodes.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3f4999cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
7 deletions
+47
-7
reader.c
dlls/xmllite/reader.c
+9
-7
reader.c
dlls/xmllite/tests/reader.c
+38
-0
No files found.
dlls/xmllite/reader.c
View file @
455f5f23
...
@@ -2382,6 +2382,8 @@ static HRESULT reader_parse_chardata(xmlreader *reader)
...
@@ -2382,6 +2382,8 @@ static HRESULT reader_parse_chardata(xmlreader *reader)
while
(
*
ptr
)
while
(
*
ptr
)
{
{
static
const
WCHAR
ampW
[]
=
{
'&'
,
0
};
/* CDATA closing sequence ']]>' is not allowed */
/* CDATA closing sequence ']]>' is not allowed */
if
(
ptr
[
0
]
==
']'
&&
ptr
[
1
]
==
']'
&&
ptr
[
2
]
==
'>'
)
if
(
ptr
[
0
]
==
']'
&&
ptr
[
1
]
==
']'
&&
ptr
[
2
]
==
'>'
)
return
WC_E_CDSECTEND
;
return
WC_E_CDSECTEND
;
...
@@ -2398,11 +2400,15 @@ static HRESULT reader_parse_chardata(xmlreader *reader)
...
@@ -2398,11 +2400,15 @@ static HRESULT reader_parse_chardata(xmlreader *reader)
return
S_OK
;
return
S_OK
;
}
}
reader_skipn
(
reader
,
1
);
/* this covers a case when text has leading whitespace chars */
/* this covers a case when text has leading whitespace chars */
if
(
!
is_wchar_space
(
*
ptr
))
reader
->
nodetype
=
XmlNodeType_Text
;
if
(
!
is_wchar_space
(
*
ptr
))
reader
->
nodetype
=
XmlNodeType_Text
;
ptr
++
;
if
(
!
reader_cmp
(
reader
,
ampW
))
reader_parse_reference
(
reader
);
else
reader_skipn
(
reader
,
1
);
ptr
=
reader_get_ptr
(
reader
);
}
}
return
S_OK
;
return
S_OK
;
...
@@ -2413,7 +2419,6 @@ static HRESULT reader_parse_content(xmlreader *reader)
...
@@ -2413,7 +2419,6 @@ static HRESULT reader_parse_content(xmlreader *reader)
{
{
static
const
WCHAR
cdstartW
[]
=
{
'<'
,
'!'
,
'['
,
'C'
,
'D'
,
'A'
,
'T'
,
'A'
,
'['
,
0
};
static
const
WCHAR
cdstartW
[]
=
{
'<'
,
'!'
,
'['
,
'C'
,
'D'
,
'A'
,
'T'
,
'A'
,
'['
,
0
};
static
const
WCHAR
etagW
[]
=
{
'<'
,
'/'
,
0
};
static
const
WCHAR
etagW
[]
=
{
'<'
,
'/'
,
0
};
static
const
WCHAR
ampW
[]
=
{
'&'
,
0
};
if
(
reader
->
resumestate
!=
XmlReadResumeState_Initial
)
if
(
reader
->
resumestate
!=
XmlReadResumeState_Initial
)
{
{
...
@@ -2448,9 +2453,6 @@ static HRESULT reader_parse_content(xmlreader *reader)
...
@@ -2448,9 +2453,6 @@ static HRESULT reader_parse_content(xmlreader *reader)
if
(
!
reader_cmp
(
reader
,
cdstartW
))
if
(
!
reader_cmp
(
reader
,
cdstartW
))
return
reader_parse_cdata
(
reader
);
return
reader_parse_cdata
(
reader
);
if
(
!
reader_cmp
(
reader
,
ampW
))
return
reader_parse_reference
(
reader
);
if
(
!
reader_cmp
(
reader
,
ltW
))
if
(
!
reader_cmp
(
reader
,
ltW
))
return
reader_parse_element
(
reader
);
return
reader_parse_element
(
reader
);
...
...
dlls/xmllite/tests/reader.c
View file @
455f5f23
...
@@ -2049,6 +2049,43 @@ static void test_namespaceuri(void)
...
@@ -2049,6 +2049,43 @@ static void test_namespaceuri(void)
IXmlReader_Release
(
reader
);
IXmlReader_Release
(
reader
);
}
}
static
void
test_read_charref
(
void
)
{
static
const
char
testA
[]
=
"<a b=
\"
c
\"
>dză</a>"
;
static
const
WCHAR
chardataW
[]
=
{
0x01f3
,
0x0103
,
0
};
const
WCHAR
*
value
;
IXmlReader
*
reader
;
XmlNodeType
type
;
IStream
*
stream
;
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"S_OK, got %08x
\n
"
,
hr
);
stream
=
create_stream_on_data
(
testA
,
sizeof
(
testA
));
hr
=
IXmlReader_SetInput
(
reader
,
(
IUnknown
*
)
stream
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Element
,
"Unexpected node type %d
\n
"
,
type
);
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Text
,
"Unexpected node type %d
\n
"
,
type
);
hr
=
IXmlReader_GetValue
(
reader
,
&
value
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
value
,
chardataW
),
"Text value : %s
\n
"
,
wine_dbgstr_w
(
value
));
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_EndElement
,
"Unexpected node type %d
\n
"
,
type
);
IXmlReader_Release
(
reader
);
IStream_Release
(
stream
);
}
START_TEST
(
reader
)
START_TEST
(
reader
)
{
{
test_reader_create
();
test_reader_create
();
...
@@ -2070,4 +2107,5 @@ START_TEST(reader)
...
@@ -2070,4 +2107,5 @@ START_TEST(reader)
test_reader_properties
();
test_reader_properties
();
test_prefix
();
test_prefix
();
test_namespaceuri
();
test_namespaceuri
();
test_read_charref
();
}
}
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