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
619ceae9
Commit
619ceae9
authored
Oct 14, 2013
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 14, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite: Support resuming and value reporting for whitespace nodes in Misc.
parent
146ff491
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
15 deletions
+44
-15
reader.c
dlls/xmllite/reader.c
+35
-15
reader.c
dlls/xmllite/tests/reader.c
+9
-0
No files found.
dlls/xmllite/reader.c
View file @
619ceae9
...
...
@@ -68,7 +68,8 @@ typedef enum
XmlReadResumeState_CDATA
,
XmlReadResumeState_Comment
,
XmlReadResumeState_STag
,
XmlReadResumeState_CharData
XmlReadResumeState_CharData
,
XmlReadResumeState_Whitespace
}
XmlReaderResumeState
;
/* saved pointer index to resume from particular input position */
...
...
@@ -962,11 +963,11 @@ static inline BOOL is_wchar_space(WCHAR ch)
static
int
reader_skipspaces
(
xmlreader
*
reader
)
{
encoded_buffer
*
buffer
=
&
reader
->
input
->
buffer
->
utf16
;
const
WCHAR
*
ptr
=
reader_get_ptr
(
reader
),
*
start
=
ptr
;
const
WCHAR
*
ptr
=
reader_get_ptr
(
reader
);
UINT
start
=
reader_get_cur
(
reader
);
while
(
is_wchar_space
(
*
ptr
))
{
buffer
->
cur
++
;
if
(
*
ptr
==
'\r'
)
reader
->
pos
=
0
;
else
if
(
*
ptr
==
'\n'
)
...
...
@@ -976,10 +977,12 @@ static int reader_skipspaces(xmlreader *reader)
}
else
reader
->
pos
++
;
ptr
++
;
buffer
->
cur
++
;
ptr
=
reader_get_ptr
(
reader
);
}
return
ptr
-
start
;
return
reader_get_cur
(
reader
)
-
start
;
}
/* [26] VersionNum ::= '1.' [0-9]+ */
...
...
@@ -1488,19 +1491,34 @@ static HRESULT reader_parse_pi(xmlreader *reader)
/* This one is used to parse significant whitespace nodes, like in Misc production */
static
HRESULT
reader_parse_whitespace
(
xmlreader
*
reader
)
{
WCHAR
*
start
,
*
ptr
;
switch
(
reader
->
resumestate
)
{
case
XmlReadResumeState_Initial
:
reader_shrink
(
reader
);
reader
->
resumestate
=
XmlReadResumeState_Whitespace
;
reader
->
resume
[
XmlReadResume_Body
]
=
reader_get_cur
(
reader
);
reader
->
nodetype
=
XmlNodeType_Whitespace
;
reader_set_strvalue
(
reader
,
StringValue_LocalName
,
&
strval_empty
);
reader_set_strvalue
(
reader
,
StringValue_QualifiedName
,
&
strval_empty
);
reader_set_strvalue
(
reader
,
StringValue_Value
,
&
strval_empty
);
case
XmlReadResumeState_Whitespace
:
{
strval
value
;
UINT
start
;
reader_shrink
(
reader
);
start
=
reader_get_ptr
(
reader
)
;
reader_skipspaces
(
reader
);
if
(
is_reader_pending
(
reader
))
return
S_OK
;
reader_skipspaces
(
reader
);
ptr
=
reader_get_ptr
(
reader
);
TRACE
(
"%s
\n
"
,
debugstr_wn
(
start
,
ptr
-
start
));
start
=
reader
->
resume
[
XmlReadResume_Body
];
reader_init_strvalue
(
start
,
reader_get_cur
(
reader
)
-
start
,
&
value
);
reader_set_strvalue
(
reader
,
StringValue_Value
,
&
value
);
TRACE
(
"%s
\n
"
,
debug_strval
(
reader
,
&
value
));
reader
->
resumestate
=
XmlReadResumeState_Initial
;
}
default:
;
}
reader
->
nodetype
=
XmlNodeType_Whitespace
;
reader_set_strvalue
(
reader
,
StringValue_LocalName
,
&
strval_empty
);
reader_set_strvalue
(
reader
,
StringValue_QualifiedName
,
&
strval_empty
);
reader_set_strvalue
(
reader
,
StringValue_Value
,
&
strval_empty
);
return
S_OK
;
}
...
...
@@ -1522,6 +1540,8 @@ static HRESULT reader_parse_misc(xmlreader *reader)
return
reader_parse_pi
(
reader
);
case
XmlReadResumeState_Comment
:
return
reader_parse_comment
(
reader
);
case
XmlReadResumeState_Whitespace
:
return
reader_parse_whitespace
(
reader
);
default:
ERR
(
"unknown resume state %d
\n
"
,
reader
->
resumestate
);
}
...
...
dlls/xmllite/tests/reader.c
View file @
619ceae9
...
...
@@ -1000,6 +1000,15 @@ static void test_read_full(void)
ok
(
test
->
types
[
i
]
!=
XmlNodeType_None
,
"%d: unexpected end of test data
\n
"
,
i
);
if
(
test
->
types
[
i
]
==
XmlNodeType_None
)
break
;
ok
(
type
==
test
->
types
[
i
],
"%d: got wrong type %d, expected %d
\n
"
,
i
,
type
,
test
->
types
[
i
]);
if
(
type
==
XmlNodeType_Whitespace
)
{
const
WCHAR
*
ptr
;
UINT
len
=
0
;
hr
=
IXmlReader_GetValue
(
reader
,
&
ptr
,
&
len
);
ok
(
hr
==
S_OK
,
"%d: GetValue failed 0x%08x
\n
"
,
i
,
hr
);
ok
(
len
>
0
,
"%d: wrong value length %d
\n
"
,
i
,
len
);
}
hr
=
IXmlReader_Read
(
reader
,
&
type
);
i
++
;
}
...
...
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