Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Иван Мажукин
mpd
Commits
12b139be
Commit
12b139be
authored
Jan 09, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ExpatParser: add Parse() overload with buffer
parent
2ed1c222
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
9 deletions
+22
-9
Expat.cxx
src/Expat.cxx
+14
-9
Expat.hxx
src/Expat.hxx
+8
-0
No files found.
src/Expat.cxx
View file @
12b139be
...
...
@@ -37,6 +37,18 @@ ExpatParser::SetError(Error &error)
}
bool
ExpatParser
::
Parse
(
const
char
*
data
,
size_t
length
,
bool
is_final
,
Error
&
error
)
{
bool
success
=
XML_Parse
(
parser
,
data
,
length
,
is_final
)
==
XML_STATUS_OK
;
if
(
!
success
)
SetError
(
error
);
return
success
;
}
bool
ExpatParser
::
Parse
(
InputStream
&
is
,
Error
&
error
)
{
assert
(
is
.
ready
);
...
...
@@ -47,21 +59,14 @@ ExpatParser::Parse(InputStream &is, Error &error)
if
(
nbytes
==
0
)
break
;
if
(
XML_Parse
(
parser
,
buffer
,
nbytes
,
false
)
!=
XML_STATUS_OK
)
{
SetError
(
error
);
if
(
!
Parse
(
buffer
,
nbytes
,
false
,
error
))
return
false
;
}
}
if
(
error
.
IsDefined
())
return
false
;
if
(
XML_Parse
(
parser
,
""
,
0
,
true
)
!=
XML_STATUS_OK
)
{
SetError
(
error
);
return
false
;
}
return
true
;
return
Parse
(
""
,
0
,
true
,
error
);
}
const
char
*
...
...
src/Expat.hxx
View file @
12b139be
...
...
@@ -50,6 +50,9 @@ public:
XML_SetCharacterDataHandler
(
parser
,
charhndl
);
}
bool
Parse
(
const
char
*
data
,
size_t
length
,
bool
is_final
,
Error
&
error
);
bool
Parse
(
InputStream
&
is
,
Error
&
error
);
gcc_pure
...
...
@@ -73,6 +76,11 @@ public:
parser
.
SetCharacterDataHandler
(
CharacterData
);
}
bool
Parse
(
const
char
*
data
,
size_t
length
,
bool
is_final
,
Error
&
error
)
{
return
parser
.
Parse
(
data
,
length
,
is_final
,
error
);
}
bool
Parse
(
InputStream
&
is
,
Error
&
error
)
{
return
parser
.
Parse
(
is
,
error
);
}
...
...
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