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
65e62c33
Commit
65e62c33
authored
Mar 09, 2017
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite/reader: Fix reader position returned for xml declaration node.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6cf9524f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
reader.c
dlls/xmllite/reader.c
+19
-4
reader.c
dlls/xmllite/tests/reader.c
+1
-2
No files found.
dlls/xmllite/reader.c
View file @
65e62c33
...
...
@@ -281,7 +281,8 @@ typedef struct
UINT
depth
;
UINT
max_depth
;
BOOL
is_empty_element
;
struct
element
empty_element
;
struct
element
empty_element
;
/* used for empty elements without end tag <a />,
and to keep <?xml reader position */
UINT
resume
[
XmlReadResume_Last
];
/* offsets used to resume reader */
}
xmlreader
;
...
...
@@ -1294,12 +1295,16 @@ static HRESULT reader_parse_xmldecl(xmlreader *reader)
{
static
const
WCHAR
xmldeclW
[]
=
{
'<'
,
'?'
,
'x'
,
'm'
,
'l'
,
' '
,
0
};
static
const
WCHAR
declcloseW
[]
=
{
'?'
,
'>'
,
0
};
struct
reader_position
position
;
HRESULT
hr
;
/* check if we have "<?xml " */
if
(
reader_cmp
(
reader
,
xmldeclW
))
return
S_FALSE
;
if
(
reader_cmp
(
reader
,
xmldeclW
))
return
S_FALSE
;
reader_skipn
(
reader
,
5
);
reader_skipn
(
reader
,
2
);
position
=
reader
->
position
;
reader_skipn
(
reader
,
3
);
hr
=
reader_parse_versioninfo
(
reader
);
if
(
FAILED
(
hr
))
return
hr
;
...
...
@@ -1313,10 +1318,14 @@ static HRESULT reader_parse_xmldecl(xmlreader *reader)
return
hr
;
reader_skipspaces
(
reader
);
if
(
reader_cmp
(
reader
,
declcloseW
))
return
WC_E_XMLDECL
;
if
(
reader_cmp
(
reader
,
declcloseW
))
return
WC_E_XMLDECL
;
/* skip '?>' */
reader_skipn
(
reader
,
2
);
reader
->
nodetype
=
XmlNodeType_XmlDeclaration
;
reader
->
empty_element
.
position
=
position
;
reader_set_strvalue
(
reader
,
StringValue_LocalName
,
&
strval_xml
);
reader_set_strvalue
(
reader
,
StringValue_QualifiedName
,
&
strval_xml
);
reader_set_strvalue
(
reader
,
StringValue_Value
,
&
strval_empty
);
...
...
@@ -3291,6 +3300,9 @@ static HRESULT WINAPI xmlreader_GetLineNumber(IXmlReader* iface, UINT *line_numb
case
XmlNodeType_Attribute
:
*
line_number
=
This
->
attr
->
position
.
line_number
;
break
;
case
XmlNodeType_XmlDeclaration
:
*
line_number
=
This
->
empty_element
.
position
.
line_number
;
break
;
default:
*
line_number
=
This
->
position
.
line_number
;
break
;
...
...
@@ -3323,6 +3335,9 @@ static HRESULT WINAPI xmlreader_GetLinePosition(IXmlReader* iface, UINT *line_po
case
XmlNodeType_Attribute
:
*
line_position
=
This
->
attr
->
position
.
line_position
;
break
;
case
XmlNodeType_XmlDeclaration
:
*
line_position
=
This
->
empty_element
.
position
.
line_position
;
break
;
default:
*
line_position
=
This
->
position
.
line_position
;
break
;
...
...
dlls/xmllite/tests/reader.c
View file @
65e62c33
...
...
@@ -760,7 +760,6 @@ static void test_read_xmldeclaration(void)
ok
(
type
==
XmlNodeType_XmlDeclaration
,
"Expected XmlNodeType_XmlDeclaration, got %s
\n
"
,
type_to_str
(
type
));
/* new version 1.2.x and 1.3.x properly update position for <?xml ?> */
todo_wine
TEST_READER_POSITION2
(
reader
,
1
,
3
,
~
0u
,
55
);
TEST_DEPTH
(
reader
,
0
);
...
...
@@ -829,6 +828,7 @@ todo_wine
hr
=
IXmlReader_MoveToElement
(
reader
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
TEST_READER_POSITION2
(
reader
,
1
,
3
,
~
0u
,
55
);
type
=
XmlNodeType_None
;
hr
=
IXmlReader_GetNodeType
(
reader
,
&
type
);
...
...
@@ -855,7 +855,6 @@ todo_wine {
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"expected S_OK, got %08x
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_XmlDeclaration
,
"expected XmlDeclaration, got %s
\n
"
,
type_to_str
(
type
));
todo_wine
TEST_READER_POSITION2
(
reader
,
1
,
3
,
~
0u
,
21
);
TEST_READER_STATE
(
reader
,
XmlReadState_Interactive
);
...
...
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