diff --git a/Makefile.am b/Makefile.am index 124c3de4b..21074e14e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1577,6 +1577,7 @@ endif if ENABLE_EXPAT libplaylist_plugins_a_SOURCES += \ + src/lib/expat/StreamExpatParser.cxx \ src/lib/expat/ExpatParser.cxx src/lib/expat/ExpatParser.hxx \ src/playlist/plugins/XspfPlaylistPlugin.cxx \ src/playlist/plugins/XspfPlaylistPlugin.hxx \ diff --git a/src/lib/expat/ExpatParser.cxx b/src/lib/expat/ExpatParser.cxx index 5417f0c37..75e4291a3 100644 --- a/src/lib/expat/ExpatParser.cxx +++ b/src/lib/expat/ExpatParser.cxx @@ -19,7 +19,6 @@ #include "config.h" #include "ExpatParser.hxx" -#include "input/InputStream.hxx" #include "util/ASCII.hxx" #include @@ -31,23 +30,6 @@ ExpatParser::Parse(const char *data, size_t length, bool is_final) throw ExpatError(parser); } -void -ExpatParser::Parse(InputStream &is) -{ - assert(is.IsReady()); - - while (true) { - char buffer[4096]; - size_t nbytes = is.LockRead(buffer, sizeof(buffer)); - if (nbytes == 0) - break; - - Parse(buffer, nbytes, false); - } - - Parse("", 0, true); -} - const char * ExpatParser::GetAttribute(const XML_Char **atts, const char *name) diff --git a/src/lib/expat/StreamExpatParser.cxx b/src/lib/expat/StreamExpatParser.cxx new file mode 100644 index 000000000..2119b6969 --- /dev/null +++ b/src/lib/expat/StreamExpatParser.cxx @@ -0,0 +1,39 @@ +/* + * Copyright 2003-2017 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" +#include "ExpatParser.hxx" +#include "input/InputStream.hxx" + +void +ExpatParser::Parse(InputStream &is) +{ + assert(is.IsReady()); + + while (true) { + char buffer[4096]; + size_t nbytes = is.LockRead(buffer, sizeof(buffer)); + if (nbytes == 0) + break; + + Parse(buffer, nbytes, false); + } + + Parse("", 0, true); +}