lib/expat/ExpatParser: move InputStream overload to separate source file
Eliminate one unnecessary dependency for debug programs which don't need the InputStream API.
This commit is contained in:
parent
64dc5212f9
commit
860aa9d6d0
@ -1577,6 +1577,7 @@ endif
|
|||||||
|
|
||||||
if ENABLE_EXPAT
|
if ENABLE_EXPAT
|
||||||
libplaylist_plugins_a_SOURCES += \
|
libplaylist_plugins_a_SOURCES += \
|
||||||
|
src/lib/expat/StreamExpatParser.cxx \
|
||||||
src/lib/expat/ExpatParser.cxx src/lib/expat/ExpatParser.hxx \
|
src/lib/expat/ExpatParser.cxx src/lib/expat/ExpatParser.hxx \
|
||||||
src/playlist/plugins/XspfPlaylistPlugin.cxx \
|
src/playlist/plugins/XspfPlaylistPlugin.cxx \
|
||||||
src/playlist/plugins/XspfPlaylistPlugin.hxx \
|
src/playlist/plugins/XspfPlaylistPlugin.hxx \
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "ExpatParser.hxx"
|
#include "ExpatParser.hxx"
|
||||||
#include "input/InputStream.hxx"
|
|
||||||
#include "util/ASCII.hxx"
|
#include "util/ASCII.hxx"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -31,23 +30,6 @@ ExpatParser::Parse(const char *data, size_t length, bool is_final)
|
|||||||
throw ExpatError(parser);
|
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 *
|
const char *
|
||||||
ExpatParser::GetAttribute(const XML_Char **atts,
|
ExpatParser::GetAttribute(const XML_Char **atts,
|
||||||
const char *name)
|
const char *name)
|
||||||
|
39
src/lib/expat/StreamExpatParser.cxx
Normal file
39
src/lib/expat/StreamExpatParser.cxx
Normal file
@ -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);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user