add pugixml

Origin commit data
------------------
Commit: 422c91d117
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2015-04-27 (Mon, 27 Apr 2015)
This commit is contained in:
Jacek Jendrzej
2015-04-27 22:26:45 +02:00
parent 750df64a9c
commit 787fc5ebda
16 changed files with 236 additions and 111 deletions

View File

@@ -135,6 +135,17 @@ if test "$enable_giflib" = "yes"; then
AC_DEFINE(ENABLE_GIFLIB,1,[use giflib instead of libungif]) AC_DEFINE(ENABLE_GIFLIB,1,[use giflib instead of libungif])
fi fi
### USE_PUGIXML
AC_ARG_ENABLE(pugixml,
AS_HELP_STRING(--enable-pugixml,use pugixml instead of xmltree),
,[enable_pugixml=no])
AM_CONDITIONAL(USE_PUGIXML,test "$enable_pugixml" = "yes")
if test "$enable_pugixml" = "yes"; then
AC_DEFINE(USE_PUGIXML,1,[use pugixml instead of xmltree])
fi
# FLAC - Free Lossless Audio Codec # FLAC - Free Lossless Audio Codec
AC_ARG_ENABLE(flac, AC_ARG_ENABLE(flac,
AS_HELP_STRING(--enable-flac,include FLAC support), AS_HELP_STRING(--enable-flac,include FLAC support),

View File

@@ -177,7 +177,7 @@ CUPnPDevice::CUPnPDevice(std::string url)
if (strcmp(xmlGetName(root),"root")) if (strcmp(xmlGetName(root),"root"))
throw std::runtime_error(std::string("XML: no root")); throw std::runtime_error(std::string("XML: no root"));
for (node = root->xmlChildrenNode; node; node=node->xmlNextNode) for (node = xmlChildrenNode(root); node; node=xmlNextNode(node))
{ {
if (!strcmp(xmlGetName(node),"URLBase")) if (!strcmp(xmlGetName(node),"URLBase"))
{ {
@@ -188,19 +188,19 @@ CUPnPDevice::CUPnPDevice(std::string url)
} }
node = root->xmlChildrenNode; node = xmlChildrenNode(root);
if (!node) if (!node)
throw std::runtime_error(std::string("XML: no root child")); throw std::runtime_error(std::string("XML: no root child"));
while (strcmp(xmlGetName(node),"device")) while (strcmp(xmlGetName(node),"device"))
{ {
node = node->xmlNextNode; node = xmlNextNode(node);
if (!node) if (!node)
throw std::runtime_error(std::string("XML: no device")); throw std::runtime_error(std::string("XML: no device"));
} }
device = node; device = node;
for (node=device->xmlChildrenNode; node; node=node->xmlNextNode) for (node=xmlChildrenNode(device); node; node=xmlNextNode(node))
{ {
if (!strcmp(xmlGetName(node),"deviceType")) if (!strcmp(xmlGetName(node),"deviceType"))
devicetype = std::string(xmlGetData(node)?xmlGetData(node):""); devicetype = std::string(xmlGetData(node)?xmlGetData(node):"");
@@ -237,7 +237,7 @@ CUPnPDevice::CUPnPDevice(std::string url)
if (!strcmp(xmlGetName(node),"iconList")) if (!strcmp(xmlGetName(node),"iconList"))
{ {
for (icon=node->xmlChildrenNode; icon; icon=icon->xmlNextNode) for (icon=xmlChildrenNode(node); icon; icon=xmlNextNode(icon))
{ {
bool foundm = false; bool foundm = false;
bool foundw = false; bool foundw = false;
@@ -247,7 +247,7 @@ CUPnPDevice::CUPnPDevice(std::string url)
if (strcmp(xmlGetName(icon),"icon")) if (strcmp(xmlGetName(icon),"icon"))
throw std::runtime_error(std::string("XML: no icon")); throw std::runtime_error(std::string("XML: no icon"));
for (snode=icon->xmlChildrenNode; snode; snode=snode->xmlNextNode) for (snode=xmlChildrenNode(icon); snode; snode=xmlNextNode(snode))
{ {
if (!strcmp(xmlGetName(snode),"mimetype")) if (!strcmp(xmlGetName(snode),"mimetype"))
{ {
@@ -292,7 +292,7 @@ CUPnPDevice::CUPnPDevice(std::string url)
if (!strcmp(xmlGetName(node),"serviceList")) if (!strcmp(xmlGetName(node),"serviceList"))
{ {
servicefound = true; servicefound = true;
for (service=node->xmlChildrenNode; service; service=service->xmlNextNode) for (service=xmlChildrenNode(node); service; service=xmlNextNode(service))
{ {
bool foundc = false; bool foundc = false;
bool founde = false; bool founde = false;
@@ -300,7 +300,7 @@ CUPnPDevice::CUPnPDevice(std::string url)
if (strcmp(xmlGetName(service),"service")) if (strcmp(xmlGetName(service),"service"))
throw std::runtime_error(std::string("XML: no service")); throw std::runtime_error(std::string("XML: no service"));
for (snode=service->xmlChildrenNode; snode; snode=snode->xmlNextNode) for (snode=xmlChildrenNode(service); snode; snode=xmlNextNode(snode))
{ {
if (!strcmp(xmlGetName(snode),"serviceType")) if (!strcmp(xmlGetName(snode),"serviceType"))
{ {

View File

@@ -112,7 +112,7 @@ std::list<UPnPAttribute> CUPnPService::SendSOAP(std::string action, std::list<UP
if (envelope != "Envelope") if (envelope != "Envelope")
throw std::runtime_error(std::string("XML: no envelope")); throw std::runtime_error(std::string("XML: no envelope"));
node = root->xmlChildrenNode; node = xmlChildrenNode(root);
if (!node) if (!node)
throw std::runtime_error(std::string("XML: no envelope child")); throw std::runtime_error(std::string("XML: no envelope child"));
@@ -124,7 +124,7 @@ std::list<UPnPAttribute> CUPnPService::SendSOAP(std::string action, std::list<UP
if (soapbody != "Body") if (soapbody != "Body")
throw std::runtime_error(std::string("XML: no soap body")); throw std::runtime_error(std::string("XML: no soap body"));
node = node->xmlChildrenNode; node = xmlChildrenNode(node);
if (!node) if (!node)
throw std::runtime_error(std::string("XML: no soap body child")); throw std::runtime_error(std::string("XML: no soap body child"));
@@ -138,13 +138,13 @@ std::list<UPnPAttribute> CUPnPService::SendSOAP(std::string action, std::list<UP
std::string faultstring, upnpcode, upnpdesc, errstr; std::string faultstring, upnpcode, upnpdesc, errstr;
if (soapresponse != "Fault") if (soapresponse != "Fault")
throw std::runtime_error(std::string("XML: http error without soap fault: ")+rcode); throw std::runtime_error(std::string("XML: http error without soap fault: ")+rcode);
for (node=node->xmlChildrenNode; node; node=node->xmlNextNode) for (node=xmlChildrenNode(node); node; node=xmlNextNode(node))
{ {
if (!strcmp(xmlGetName(node),"detail")) if (!strcmp(xmlGetName(node),"detail"))
{ {
snode=node->xmlChildrenNode; snode=xmlChildrenNode(node);
if (snode) if (snode)
for (snode=snode->xmlChildrenNode; snode; snode=snode->xmlNextNode) for (snode=xmlChildrenNode(snode); snode; snode=xmlNextNode(snode))
{ {
errstr=xmlGetName(snode); errstr=xmlGetName(snode);
pos = errstr.find(":"); pos = errstr.find(":");
@@ -168,7 +168,7 @@ std::list<UPnPAttribute> CUPnPService::SendSOAP(std::string action, std::list<UP
if (soapresponse != action + "Response") if (soapresponse != action + "Response")
throw std::runtime_error(std::string("XML: no soap response")); throw std::runtime_error(std::string("XML: no soap response"));
for (node=node->xmlChildrenNode; node; node=node->xmlNextNode) for (node=xmlChildrenNode(node); node; node=xmlNextNode(node))
results.push_back(UPnPAttribute(xmlGetName(node), xmlGetData(node))); results.push_back(UPnPAttribute(xmlGetName(node), xmlGetData(node)));
xmlFreeDoc(parser); xmlFreeDoc(parser);

View File

@@ -1,11 +1,18 @@
AM_CPPFLAGS = \ AM_CPPFLAGS = \
-I$(top_builddir) \ -I$(top_builddir) \
-I$(top_srcdir) \ -I$(top_srcdir)
-I$(srcdir)/xmltok
if USE_PUGIXML
else
AM_CPPFLAGS += -I$(srcdir)/xmltok
endif
AM_CXXFLAGS = -fno-rtti -fno-exceptions AM_CXXFLAGS = -fno-rtti -fno-exceptions
noinst_LIBRARIES = libtuxbox-xmltree.a noinst_LIBRARIES = libtuxbox-xmltree.a
libtuxbox_xmltree_a_SOURCES = \ libtuxbox_xmltree_a_SOURCES = xmlinterface.cpp
hashtab.c xmlparse.cpp xmlrole.c xmltok.c xmltree.cpp xmlinterface.cpp if USE_PUGIXML
else
libtuxbox_xmltree_a_SOURCES += hashtab.c xmlparse.cpp xmlrole.c xmltok.c xmltree.cpp
endif

View File

@@ -68,17 +68,46 @@ long xmlGetSignedNumericAttribute(const xmlNodePtr node, const char *name, const
xmlNodePtr xmlGetNextOccurence(xmlNodePtr cur, const char * s) xmlNodePtr xmlGetNextOccurence(xmlNodePtr cur, const char * s)
{ {
while ((cur != NULL) && (strcmp(xmlGetName(cur), s) != 0)) while ((cur != NULL) && (strcmp(xmlGetName(cur), s) != 0))
cur = cur->xmlNextNode; cur = xmlNextNode(cur);
return cur; return cur;
} }
#if USE_PUGIXML
std::string to_utf8(unsigned int cp)
{
std::string result;
int count;
if (cp < 0x0080)
count = 1;
else if (cp < 0x0800)
count = 2;
else if (cp < 0x10000)
count = 3;
else if (cp <= 0x10FFFF)
count = 4;
else
return result;
result.resize(count);
for (int i = count-1; i > 0; --i)
{
result[i] = (char) (0x80 | (cp & 0x3F));
cp >>= 6;
}
for (int i = 0; i < count; ++i)
cp |= (1 << (7-i));
result[0] = (char) cp;
return result;
}
#endif
std::string Unicode_Character_to_UTF8(const int character) std::string Unicode_Character_to_UTF8(const int character)
{ {
#ifdef USE_LIBXML #ifdef USE_LIBXML
xmlChar buf[5]; xmlChar buf[5];
int length = xmlCopyChar(4, buf, character); int length = xmlCopyChar(4, buf, character);
return std::string((char*)buf, length); return std::string((char*)buf, length);
#elif (defined( USE_PUGIXML ) )
return to_utf8(character);
#else /* USE_LIBXML */ #else /* USE_LIBXML */
char buf[XML_UTF8_ENCODE_MAX]; char buf[XML_UTF8_ENCODE_MAX];
int length = XmlUtf8Encode(character, buf); int length = XmlUtf8Encode(character, buf);
@@ -124,7 +153,7 @@ std::string convert_UTF8_To_UTF8_XML(const char* s)
} }
#ifdef USE_LIBXML #ifdef USE_LIBXML
xmlDocPtr parseXml(const char * data) xmlDocPtr parseXml(const char * data,char *)
{ {
xmlDocPtr doc; xmlDocPtr doc;
xmlNodePtr cur; xmlNodePtr cur;
@@ -150,7 +179,7 @@ xmlDocPtr parseXml(const char * data)
} }
} }
xmlDocPtr parseXmlFile(const char * filename, bool warning_by_nonexistence /* = true */) xmlDocPtr parseXmlFile(const char * filename, bool warning_by_nonexistence /* = true */,char *)
{ {
xmlDocPtr doc; xmlDocPtr doc;
xmlNodePtr cur; xmlNodePtr cur;
@@ -175,6 +204,46 @@ xmlDocPtr parseXmlFile(const char * filename, bool warning_by_nonexistence /* =
return doc; return doc;
} }
} }
#elif (defined( USE_PUGIXML ) )
xmlDocPtr parseXml(const char * data,const char* /*encoding*/)
{
pugi::xml_document* tree_parser = new pugi::xml_document();
if (!tree_parser->load_string(data))
{
delete tree_parser;
return NULL;
}
if (!tree_parser->root())
{
printf("Error: No Root Node\n");
delete tree_parser;
return NULL;
}
return tree_parser;
}
xmlDocPtr parseXmlFile(const char * filename, bool,const char* /*encoding*/)
{
pugi::xml_document* tree_parser = new pugi::xml_document();
if (!tree_parser->load_file(filename))
{
delete tree_parser;
return NULL;
}
if (!tree_parser->root())
{
printf("Error: No Root Node\n");
delete tree_parser;
return NULL;
}
return tree_parser;
}
#else /* USE_LIBXML */ #else /* USE_LIBXML */
xmlDocPtr parseXml(const char * data,const char *encoding) xmlDocPtr parseXml(const char * data,const char *encoding)
{ {

View File

@@ -43,18 +43,42 @@
#define xmlNextNode next #define xmlNextNode next
inline const char* xmlGetAttribute (xmlNodePtr cur, const char * s) { return (const char *)xmlGetProp(cur, (const xmlChar *)s); }; inline const char* xmlGetAttribute (xmlNodePtr cur, const char * s) { return (const char *)xmlGetProp(cur, (const xmlChar *)s); };
inline const char* xmlGetName (xmlNodePtr cur) { return (const char *)(cur->name); }; inline const char* xmlGetName (xmlNodePtr cur) { return (const char *)(cur->name); };
/* ------------------------------------------------ USE_PUGIXML ------------------------------------------------*/
#elif (defined( USE_PUGIXML ) )
#include <pugixml.hpp>
typedef pugi::xml_document *xmlDocPtr;
typedef pugi::xml_node xmlNodePtr;
inline void xmlFreeDoc (xmlDocPtr doc) { delete doc; }
inline const char* xmlGetName (const xmlNodePtr cur) { return cur.name(); }
inline xmlNodePtr xmlNextNode (xmlNodePtr cur) { return cur.next_sibling(); }
inline xmlNodePtr xmlChildrenNode (xmlNodePtr cur) { return cur.first_child(); }
inline const char* xmlGetData (xmlNodePtr cur) { return cur.child_value(); }
inline const char* xmlGetAttribute (const xmlNodePtr cur, const char *s)
{
if(cur.attribute(s))
return cur.attribute(s).value();
else
return NULL;
}
inline xmlNodePtr xmlDocGetRootElement(xmlDocPtr doc)
{
xmlNodePtr firstNode = doc->root().first_child();
return firstNode;
}
/* ------------------------------------------------ END of USE_PUGIXML ------------------------------------------------*/
#else /* use libxmltree */ #else /* use libxmltree */
#include "xmltree.h" #include "xmltree.h"
typedef XMLTreeParser* xmlDocPtr; typedef XMLTreeParser* xmlDocPtr;
typedef XMLTreeNode* xmlNodePtr; typedef XMLTreeNode* xmlNodePtr;
#define xmlChildrenNode GetChild() inline xmlNodePtr xmlChildrenNode (xmlNodePtr cur) { return cur->GetChild(); }
#define xmlNextNode GetNext() inline xmlNodePtr xmlNextNode (xmlNodePtr cur) { return cur->GetNext(); }
inline xmlNodePtr xmlDocGetRootElement(xmlDocPtr doc) { return doc->RootNode(); } inline xmlNodePtr xmlDocGetRootElement (xmlDocPtr doc) { return doc->RootNode(); }
inline void xmlFreeDoc (xmlDocPtr doc) { delete doc; } inline void xmlFreeDoc (xmlDocPtr doc) { delete doc; }
inline const char* xmlGetAttribute (xmlNodePtr cur, const char *s) { return cur->GetAttributeValue(s); } inline const char* xmlGetAttribute (xmlNodePtr cur, const char *s) { return cur->GetAttributeValue(s); }
inline const char* xmlGetName (xmlNodePtr cur) { return cur->GetType(); } inline const char* xmlGetName (xmlNodePtr cur) { return cur->GetType(); }
inline const char* xmlGetData (xmlNodePtr cur) { return cur->GetData(); } inline const char* xmlGetData (xmlNodePtr cur) { return cur->GetData(); }
#endif /* USE_LIBXML */ #endif /* USE_LIBXML */

View File

@@ -36,6 +36,10 @@ SUBDIRS += lcddisplay
AM_CPPFLAGS += -I$(top_srcdir)/lib/libtriple AM_CPPFLAGS += -I$(top_srcdir)/lib/libtriple
endif endif
if USE_PUGIXML
PUGIXML_LIBS = -lpugixml
endif
if USE_TREMOR if USE_TREMOR
VORBISLIBS = @VORBISIDEC_LIBS@ VORBISLIBS = @VORBISIDEC_LIBS@
else else
@@ -115,6 +119,7 @@ neutrino_LDADD = \
@AVCODEC_LIBS@ \ @AVCODEC_LIBS@ \
$(ADEC_LIBS) \ $(ADEC_LIBS) \
@SIGC_LIBS@ \ @SIGC_LIBS@ \
$(PUGIXML_LIBS) \
-ldvbsi++ \ -ldvbsi++ \
-ljpeg \ -ljpeg \
-lOpenThreads \ -lOpenThreads \

View File

@@ -207,7 +207,7 @@ bool readEPGFilter(void)
epg_filter_is_whitelist = true; epg_filter_is_whitelist = true;
if (xmlGetNumericAttribute(filter, "except_current_next", 10) == 1) if (xmlGetNumericAttribute(filter, "except_current_next", 10) == 1)
epg_filter_except_current_next = true; epg_filter_except_current_next = true;
filter = filter->xmlChildrenNode; filter = xmlChildrenNode(filter);
while (filter) { while (filter) {
@@ -219,7 +219,7 @@ bool readEPGFilter(void)
else else
addEPGFilter(onid, tsid, sid); addEPGFilter(onid, tsid, sid);
filter = filter->xmlNextNode; filter = xmlNextNode(filter);
} }
} }
xmlFreeDoc(filter_parser); xmlFreeDoc(filter_parser);
@@ -239,7 +239,7 @@ void readDVBTimeFilter(void)
dprintf("Reading DVBTimeFilters\n"); dprintf("Reading DVBTimeFilters\n");
xmlNodePtr filter = xmlDocGetRootElement(filter_parser); xmlNodePtr filter = xmlDocGetRootElement(filter_parser);
filter = filter->xmlChildrenNode; filter = xmlChildrenNode(filter);
while (filter) { while (filter) {
@@ -248,7 +248,7 @@ void readDVBTimeFilter(void)
sid = xmlGetNumericAttribute(filter, "serviceID", 16); sid = xmlGetNumericAttribute(filter, "serviceID", 16);
addNoDVBTimelist(onid, tsid, sid); addNoDVBTimelist(onid, tsid, sid);
filter = filter->xmlNextNode; filter = xmlNextNode(filter);
} }
xmlFreeDoc(filter_parser); xmlFreeDoc(filter_parser);
} }
@@ -268,7 +268,7 @@ void deleteOldfileEvents(const char *epgdir)
if (filter_parser != NULL) if (filter_parser != NULL)
{ {
xmlNodePtr filter = xmlDocGetRootElement(filter_parser); xmlNodePtr filter = xmlDocGetRootElement(filter_parser);
filter = filter->xmlChildrenNode; filter = xmlChildrenNode(filter);
while (filter) { while (filter) {
const char * name = xmlGetAttribute(filter, "name"); const char * name = xmlGetAttribute(filter, "name");
@@ -278,7 +278,7 @@ void deleteOldfileEvents(const char *epgdir)
file +="/"; file +="/";
file +=filename; file +=filename;
unlink(file.c_str()); unlink(file.c_str());
filter = filter->xmlNextNode; filter = xmlNextNode(filter);
} }
} }
xmlFreeDoc(filter_parser); xmlFreeDoc(filter_parser);
@@ -290,9 +290,9 @@ void *insertEventsfromFile(void * data)
set_threadname(__func__); set_threadname(__func__);
reader_ready=false; reader_ready=false;
xmlDocPtr event_parser = NULL; xmlDocPtr event_parser = NULL;
xmlNodePtr eventfile = NULL; xmlNodePtr eventfile;
xmlNodePtr service = NULL; xmlNodePtr service;
xmlNodePtr event = NULL; xmlNodePtr event;
t_original_network_id onid = 0; t_original_network_id onid = 0;
t_transport_stream_id tsid = 0; t_transport_stream_id tsid = 0;
t_service_id sid = 0; t_service_id sid = 0;
@@ -313,7 +313,8 @@ void *insertEventsfromFile(void * data)
printdate_ms(stdout); printdate_ms(stdout);
printf("[sectionsd] Reading Information from file %s:\n", indexname.c_str()); printf("[sectionsd] Reading Information from file %s:\n", indexname.c_str());
eventfile = xmlDocGetRootElement(index_parser)->xmlChildrenNode; eventfile = xmlDocGetRootElement(index_parser);
eventfile = xmlChildrenNode(eventfile);
while (eventfile) { while (eventfile) {
const char * name = xmlGetAttribute(eventfile, "name"); const char * name = xmlGetAttribute(eventfile, "name");
@@ -323,17 +324,18 @@ void *insertEventsfromFile(void * data)
epgname = epg_dir + filename; epgname = epg_dir + filename;
if (!(event_parser = parseXmlFile(epgname.c_str()))) { if (!(event_parser = parseXmlFile(epgname.c_str()))) {
dprintf("unable to open %s for reading\n", epgname.c_str()); dprintf("unable to open %s for reading\n", epgname.c_str());
eventfile = eventfile->xmlNextNode; eventfile = xmlNextNode(eventfile);
continue; continue;
} }
service = xmlDocGetRootElement(event_parser)->xmlChildrenNode; service = xmlDocGetRootElement(event_parser);
service = xmlChildrenNode(service);
while (service) { while (service) {
onid = xmlGetNumericAttribute(service, "original_network_id", 16); onid = xmlGetNumericAttribute(service, "original_network_id", 16);
tsid = xmlGetNumericAttribute(service, "transport_stream_id", 16); tsid = xmlGetNumericAttribute(service, "transport_stream_id", 16);
sid = xmlGetNumericAttribute(service, "service_id", 16); sid = xmlGetNumericAttribute(service, "service_id", 16);
event = service->xmlChildrenNode; event = xmlChildrenNode(service);
while (event) { while (event) {
SIevent e(onid,tsid,sid,xmlGetNumericAttribute(event, "id", 16)); SIevent e(onid,tsid,sid,xmlGetNumericAttribute(event, "id", 16));
@@ -345,66 +347,66 @@ void *insertEventsfromFile(void * data)
xmlNodePtr node; xmlNodePtr node;
node = event->xmlChildrenNode; node = xmlChildrenNode(event);
while ((node = xmlGetNextOccurence(node, "name"))) { while ((node = xmlGetNextOccurence(node, "name"))) {
const char *s = xmlGetAttribute(node, "string"); const char *s = xmlGetAttribute(node, "string");
if (s) if (s)
e.setName(ZapitTools::UTF8_to_Latin1(xmlGetAttribute(node, "lang")), s); e.setName(ZapitTools::UTF8_to_Latin1(xmlGetAttribute(node, "lang")), s);
node = node->xmlNextNode; node = xmlNextNode(node);
} }
node = event->xmlChildrenNode; node = xmlChildrenNode(event);
while ((node = xmlGetNextOccurence(node, "text"))) { while ((node = xmlGetNextOccurence(node, "text"))) {
const char *s = xmlGetAttribute(node, "string"); const char *s = xmlGetAttribute(node, "string");
if (s) if (s)
e.setText(ZapitTools::UTF8_to_Latin1(xmlGetAttribute(node, "lang")), s); e.setText(ZapitTools::UTF8_to_Latin1(xmlGetAttribute(node, "lang")), s);
node = node->xmlNextNode; node = xmlNextNode(node);
} }
node = event->xmlChildrenNode; node = xmlChildrenNode(event);
while ((node = xmlGetNextOccurence(node, "item"))) { while ((node = xmlGetNextOccurence(node, "item"))) {
#ifdef USE_ITEM_DESCRIPTION #ifdef USE_ITEM_DESCRIPTION
const char *s = xmlGetAttribute(node, "string"); const char *s = xmlGetAttribute(node, "string");
if (s) if (s)
e.item = s; e.item = s;
#endif #endif
node = node->xmlNextNode; node = xmlNextNode(node);
} }
node = event->xmlChildrenNode; node = xmlChildrenNode(event);
while ((node = xmlGetNextOccurence(node, "item_description"))) { while ((node = xmlGetNextOccurence(node, "item_description"))) {
#ifdef USE_ITEM_DESCRIPTION #ifdef USE_ITEM_DESCRIPTION
const char *s = xmlGetAttribute(node, "string"); const char *s = xmlGetAttribute(node, "string");
if (s) if (s)
e.itemDescription = s; e.itemDescription = s;
#endif #endif
node = node->xmlNextNode; node = xmlNextNode(node);
} }
node = event->xmlChildrenNode; node = xmlChildrenNode(event);
while ((node = xmlGetNextOccurence(node, "extended_text"))) { while ((node = xmlGetNextOccurence(node, "extended_text"))) {
const char *l = xmlGetAttribute(node, "lang"); const char *l = xmlGetAttribute(node, "lang");
const char *s = xmlGetAttribute(node, "string"); const char *s = xmlGetAttribute(node, "string");
if (l && s) if (l && s)
e.appendExtendedText(ZapitTools::UTF8_to_Latin1(l), s); e.appendExtendedText(ZapitTools::UTF8_to_Latin1(l), s);
node = node->xmlNextNode; node = xmlNextNode(node);
} }
node = event->xmlChildrenNode; node = xmlChildrenNode(event);
while ((node = xmlGetNextOccurence(node, "time"))) { while ((node = xmlGetNextOccurence(node, "time"))) {
e.times.insert(SItime(xmlGetNumericAttribute(node, "start_time", 10), e.times.insert(SItime(xmlGetNumericAttribute(node, "start_time", 10),
xmlGetNumericAttribute(node, "duration", 10))); xmlGetNumericAttribute(node, "duration", 10)));
node = node->xmlNextNode; node = xmlNextNode(node);
} }
node = event->xmlChildrenNode; node = xmlChildrenNode(event);
while ((node = xmlGetNextOccurence(node, "content"))) { while ((node = xmlGetNextOccurence(node, "content"))) {
const char cl = xmlGetNumericAttribute(node, "class", 16); const char cl = xmlGetNumericAttribute(node, "class", 16);
contentClassification += cl; contentClassification += cl;
const char cl2 = xmlGetNumericAttribute(node, "user", 16); const char cl2 = xmlGetNumericAttribute(node, "user", 16);
userClassification += cl2; userClassification += cl2;
node = node->xmlNextNode; node = xmlNextNode(node);
} }
node = event->xmlChildrenNode; node = xmlChildrenNode(event);
while ((node = xmlGetNextOccurence(node, "component"))) { while ((node = xmlGetNextOccurence(node, "component"))) {
SIcomponent c; SIcomponent c;
c.streamContent = xmlGetNumericAttribute(node, "stream_content", 16); c.streamContent = xmlGetNumericAttribute(node, "stream_content", 16);
@@ -415,10 +417,10 @@ void *insertEventsfromFile(void * data)
c.setComponent(s); c.setComponent(s);
//e.components.insert(c); //e.components.insert(c);
e.components.push_back(c); e.components.push_back(c);
node = node->xmlNextNode; node = xmlNextNode(node);
} }
node = event->xmlChildrenNode; node = xmlChildrenNode(event);
while ((node = xmlGetNextOccurence(node, "parental_rating"))) { while ((node = xmlGetNextOccurence(node, "parental_rating"))) {
const char *s = xmlGetAttribute(node, "country"); const char *s = xmlGetAttribute(node, "country");
if (s) if (s)
@@ -428,10 +430,10 @@ void *insertEventsfromFile(void * data)
#endif #endif
e.ratings.push_back(SIparentalRating(ZapitTools::UTF8_to_Latin1(s), e.ratings.push_back(SIparentalRating(ZapitTools::UTF8_to_Latin1(s),
(unsigned char) xmlGetNumericAttribute(node, "rating", 10))); (unsigned char) xmlGetNumericAttribute(node, "rating", 10)));
node = node->xmlNextNode; node = xmlNextNode(node);
} }
node = event->xmlChildrenNode; node = xmlChildrenNode(event);
while ((node = xmlGetNextOccurence(node, "linkage"))) { while ((node = xmlGetNextOccurence(node, "linkage"))) {
SIlinkage l; SIlinkage l;
l.linkageType = xmlGetNumericAttribute(node, "type", 16); l.linkageType = xmlGetNumericAttribute(node, "type", 16);
@@ -442,7 +444,7 @@ void *insertEventsfromFile(void * data)
if (s) if (s)
l.name = s; l.name = s;
e.linkage_descs.insert(e.linkage_descs.end(), l); e.linkage_descs.insert(e.linkage_descs.end(), l);
node = node->xmlNextNode; node = xmlNextNode(node);
} }
if (!contentClassification.empty()) { if (!contentClassification.empty()) {
@@ -459,14 +461,14 @@ void *insertEventsfromFile(void * data)
addEvent(e, 0); addEvent(e, 0);
ev_count++; ev_count++;
event = event->xmlNextNode; event = xmlNextNode(event);
} }
service = service->xmlNextNode; service = xmlNextNode(service);
} }
xmlFreeDoc(event_parser); xmlFreeDoc(event_parser);
eventfile = eventfile->xmlNextNode; eventfile = xmlNextNode(eventfile);
} }
xmlFreeDoc(index_parser); xmlFreeDoc(index_parser);

View File

@@ -1114,7 +1114,7 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag,
if (answer_parser != NULL) { if (answer_parser != NULL) {
xmlNodePtr element = xmlDocGetRootElement(answer_parser); xmlNodePtr element = xmlDocGetRootElement(answer_parser);
element = element->xmlChildrenNode; element = xmlChildrenNode(element);
xmlNodePtr element_tmp = element; xmlNodePtr element_tmp = element;
if (element == NULL) { if (element == NULL) {
printf("[openFilebrowser] No valid XML File.\n"); printf("[openFilebrowser] No valid XML File.\n");
@@ -1124,7 +1124,7 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag,
// count # of entries // count # of entries
while (element) { while (element) {
maxProgress++; maxProgress++;
element = element->xmlNextNode; element = xmlNextNode(element);
} }
element = element_tmp; element = element_tmp;
long listPos = -1; long listPos = -1;
@@ -1150,7 +1150,7 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag,
if (usechild) { if (usechild) {
const char *type = NULL; const char *type = NULL;
xmlNodePtr child = element->xmlChildrenNode; xmlNodePtr child = xmlChildrenNode(element);
while (child) { while (child) {
if (strcmp(xmlGetName(child), nametag) == 0) if (strcmp(xmlGetName(child), nametag) == 0)
name = xmlGetData(child); name = xmlGetData(child);
@@ -1163,7 +1163,7 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag,
if (ptr) if (ptr)
bitrate = atoi(ptr); bitrate = atoi(ptr);
} }
child = child->xmlNextNode; child = xmlNextNode(child);
} }
if(type){ if(type){
if (strcmp("audio/mpeg", type) == 0) skip = false; if (strcmp("audio/mpeg", type) == 0) skip = false;
@@ -1190,7 +1190,7 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag,
else else
addUrl2Playlist(url, name, bitrate); addUrl2Playlist(url, name, bitrate);
} }
element = element->xmlNextNode; element = xmlNextNode(element);
g_RCInput->getMsg(&msg, &data, 0); g_RCInput->getMsg(&msg, &data, 0);
} }

View File

@@ -448,7 +448,7 @@ printf("CFileBrowser::readDir_sc: read done, size %d\n", (int)answer.size());
xml_decode = 1; xml_decode = 1;
else if (strcmp(xmlGetName(element), "stationlist") == 0) else if (strcmp(xmlGetName(element), "stationlist") == 0)
xml_decode = 2; xml_decode = 2;
element = element->xmlChildrenNode; element = xmlChildrenNode(element);
if (element == NULL) { if (element == NULL) {
printf("[FileBrowser] SC: Directory cannot be read.\n"); printf("[FileBrowser] SC: Directory cannot be read.\n");
@@ -523,7 +523,7 @@ printf("CFileBrowser::readDir_sc: read done, size %d\n", (int)answer.size());
} }
} }
} }
element = element->xmlNextNode; element = xmlNextNode(element);
} }
} }
xmlFreeDoc(answer_parser); xmlFreeDoc(answer_parser);

View File

@@ -139,7 +139,8 @@ CMenuOptionStringChooser* COsdLangSetup::getTzItems()
{ {
tzSelect = new CMenuOptionStringChooser(LOCALE_MAINSETTINGS_TIMEZONE, &g_settings.timezone, true, tzNotifier, CRCInput::RC_green, NULL, true); tzSelect = new CMenuOptionStringChooser(LOCALE_MAINSETTINGS_TIMEZONE, &g_settings.timezone, true, tzNotifier, CRCInput::RC_green, NULL, true);
tzSelect->setHint("", LOCALE_MENU_HINT_TIMEZONE); tzSelect->setHint("", LOCALE_MENU_HINT_TIMEZONE);
xmlNodePtr search = xmlDocGetRootElement(parser)->xmlChildrenNode; xmlNodePtr search = xmlDocGetRootElement(parser);
search = xmlChildrenNode(search);
bool found = false; bool found = false;
while (search) while (search)
@@ -163,7 +164,7 @@ CMenuOptionStringChooser* COsdLangSetup::getTzItems()
} }
} }
} }
search = search->xmlNextNode; search = xmlNextNode(search);
} }
if (!found) if (!found)

View File

@@ -250,7 +250,7 @@ std::vector<UPnPEntry> *CUpnpBrowserGui::decodeResult(std::string result)
} }
entries = new std::vector<UPnPEntry>; entries = new std::vector<UPnPEntry>;
for (node=root->xmlChildrenNode; node; node=node->xmlNextNode) for (node=xmlChildrenNode(root); node; node=xmlNextNode(node))
{ {
bool isdir; bool isdir;
std::string title, artist = "", album = "", albumArtURI = "", id, children; std::string title, artist = "", album = "", albumArtURI = "", id, children;
@@ -260,7 +260,7 @@ std::vector<UPnPEntry> *CUpnpBrowserGui::decodeResult(std::string result)
{ {
std::vector<UPnPResource> resources; std::vector<UPnPResource> resources;
isdir=true; isdir=true;
for (snode=node->xmlChildrenNode; snode; snode=snode->xmlNextNode) for (snode=xmlChildrenNode(node); snode; snode=xmlNextNode(snode))
{ {
type=xmlGetName(snode); type=xmlGetName(snode);
p = strchr(type,':'); p = strchr(type,':');
@@ -294,7 +294,7 @@ std::vector<UPnPEntry> *CUpnpBrowserGui::decodeResult(std::string result)
std::string protocol, prot, network, mime, additional; std::string protocol, prot, network, mime, additional;
CFile::FileType ftype = CFile::FILE_UNKNOWN; CFile::FileType ftype = CFile::FILE_UNKNOWN;
isdir=false; isdir=false;
for (snode=node->xmlChildrenNode; snode; snode=snode->xmlNextNode) for (snode=xmlChildrenNode(node); snode; snode=xmlNextNode(snode))
{ {
std::string duration, url, size; std::string duration, url, size;
unsigned int i; unsigned int i;

View File

@@ -452,7 +452,8 @@ bool CTZChangeNotifier::changeNotify(const neutrino_locale_t, void * Data)
xmlDocPtr parser = parseXmlFile("/etc/timezone.xml"); xmlDocPtr parser = parseXmlFile("/etc/timezone.xml");
if (parser != NULL) { if (parser != NULL) {
xmlNodePtr search = xmlDocGetRootElement(parser)->xmlChildrenNode; xmlNodePtr search = xmlDocGetRootElement(parser);
search = xmlChildrenNode(search);
while (search) { while (search) {
if (!strcmp(xmlGetName(search), "zone")) { if (!strcmp(xmlGetName(search), "zone")) {
const char *nptr = xmlGetAttribute(search, "name"); const char *nptr = xmlGetAttribute(search, "name");
@@ -468,7 +469,7 @@ bool CTZChangeNotifier::changeNotify(const neutrino_locale_t, void * Data)
break; break;
} }
} }
search = search->xmlNextNode; search = xmlNextNode(search);
} }
xmlFreeDoc(parser); xmlFreeDoc(parser);
} }

View File

@@ -290,7 +290,8 @@ bool cYTFeedParser::parseFeedXml(std::string &answer)
prev.clear(); prev.clear();
total.clear(); total.clear();
start.clear(); start.clear();
xmlNodePtr entry = xmlDocGetRootElement(answer_parser)->xmlChildrenNode; xmlNodePtr entry = xmlDocGetRootElement(answer_parser);
entry = xmlChildrenNode(entry);
while (entry) { while (entry) {
std::string name = getXmlName(entry); std::string name = getXmlName(entry);
#ifdef DEBUG_PARSER #ifdef DEBUG_PARSER
@@ -314,10 +315,10 @@ bool cYTFeedParser::parseFeedXml(std::string &answer)
} }
} }
else if (name != "entry") { else if (name != "entry") {
entry = entry->xmlNextNode; entry = xmlNextNode(entry);
continue; continue;
} }
xmlNodePtr node = entry->xmlChildrenNode; xmlNodePtr node = xmlChildrenNode(entry);
cYTVideoInfo vinfo; cYTVideoInfo vinfo;
std::string thumbnail; std::string thumbnail;
while (node) { while (node) {
@@ -335,7 +336,7 @@ bool cYTFeedParser::parseFeedXml(std::string &answer)
vinfo.published = getXmlData(node).substr(0, 10); vinfo.published = getXmlData(node).substr(0, 10);
} }
else if (name == "author") { else if (name == "author") {
xmlNodePtr author = node->xmlChildrenNode; xmlNodePtr author = xmlChildrenNode(node);
while(author) { while(author) {
name = getXmlName(author); name = getXmlName(author);
if (name == "name") { if (name == "name") {
@@ -344,11 +345,11 @@ bool cYTFeedParser::parseFeedXml(std::string &answer)
#endif #endif
vinfo.author = getXmlData(author); vinfo.author = getXmlData(author);
} }
author = author->xmlNextNode; author = xmlNextNode(author);
} }
} }
else if (name == "media:group") { else if (name == "media:group") {
xmlNodePtr media = node->xmlChildrenNode; xmlNodePtr media = xmlChildrenNode(node);
while (media) { while (media) {
name = getXmlName(media); name = getXmlName(media);
if (name == "media:description") { if (name == "media:description") {
@@ -388,10 +389,10 @@ bool cYTFeedParser::parseFeedXml(std::string &answer)
else if (name == "media:title") { else if (name == "media:title") {
} }
#endif #endif
media = media->xmlNextNode; media = xmlNextNode(media);
} }
} }
node = node->xmlNextNode; node = xmlNextNode(node);
} }
if (!vinfo.id.empty()) { if (!vinfo.id.empty()) {
/* save first one, if wanted not found */ /* save first one, if wanted not found */
@@ -400,7 +401,7 @@ bool cYTFeedParser::parseFeedXml(std::string &answer)
vinfo.ret = false; vinfo.ret = false;
videos.push_back(vinfo); videos.push_back(vinfo);
} }
entry = entry->xmlNextNode; entry = xmlNextNode(entry);
} }
xmlFreeDoc(answer_parser); xmlFreeDoc(answer_parser);

View File

@@ -382,7 +382,7 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
return; return;
xmlNodePtr root = xmlDocGetRootElement(parser); xmlNodePtr root = xmlDocGetRootElement(parser);
xmlNodePtr search = root->xmlChildrenNode; xmlNodePtr search = xmlChildrenNode(root);
xmlNodePtr channel_node; xmlNodePtr channel_node;
if (search) { if (search) {
@@ -409,7 +409,7 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
newBouquet->bLocked = locked ? (strcmp(locked, "1") == 0) : false; newBouquet->bLocked = locked ? (strcmp(locked, "1") == 0) : false;
newBouquet->bFav = (strcmp(name, "favorites") == 0); newBouquet->bFav = (strcmp(name, "favorites") == 0);
newBouquet->bScanEpg = scanepg ? (strcmp(scanepg, "1") == 0) : false; newBouquet->bScanEpg = scanepg ? (strcmp(scanepg, "1") == 0) : false;
channel_node = search->xmlChildrenNode; channel_node = xmlChildrenNode(search);
while ((channel_node = xmlGetNextOccurence(channel_node, "S")) != NULL) { while ((channel_node = xmlGetNextOccurence(channel_node, "S")) != NULL) {
std::string name2; std::string name2;
name = xmlGetAttribute(channel_node, "n"); name = xmlGetAttribute(channel_node, "n");
@@ -464,7 +464,7 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
CServiceManager::getInstance()->SetServicesChanged(false); CServiceManager::getInstance()->SetServicesChanged(false);
} }
channel_node = channel_node->xmlNextNode; channel_node = xmlNextNode(channel_node);
if(!bUser) { if(!bUser) {
/* set satellite position for provider bouquets. /* set satellite position for provider bouquets.
reset position to 0, if position not match - means mixed bouquet */ reset position to 0, if position not match - means mixed bouquet */
@@ -476,7 +476,7 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
} }
if(!bUser) if(!bUser)
newBouquet->sortBouquet(); newBouquet->sortBouquet();
search = search->xmlNextNode; search = xmlNextNode(search);
} }
INFO("total: %d bouquets", (int)Bouquets.size()); INFO("total: %d bouquets", (int)Bouquets.size());
} }

View File

@@ -422,10 +422,10 @@ void CServiceManager::ParseTransponders(xmlNodePtr node, t_satellite_position sa
t.dump("[zapit] duplicate in all transponders:"); t.dump("[zapit] duplicate in all transponders:");
/* read channels that belong to the current transponder */ /* read channels that belong to the current transponder */
ParseChannels(node->xmlChildrenNode, transport_stream_id, original_network_id, satellitePosition, freq, feparams.polarization, delsys); ParseChannels(xmlChildrenNode(node), transport_stream_id, original_network_id, satellitePosition, freq, feparams.polarization, delsys);
/* hop to next transponder */ /* hop to next transponder */
node = node->xmlNextNode; node = xmlNextNode(node);
} }
UpdateSatTransponders(satellitePosition); UpdateSatTransponders(satellitePosition);
return; return;
@@ -465,6 +465,7 @@ void CServiceManager::ParseChannels(xmlNodePtr node, const t_transport_stream_id
const char *ptr = xmlGetAttribute(node, "action"); const char *ptr = xmlGetAttribute(node, "action");
bool remove = ptr ? (!strcmp(ptr, "remove") || !strcmp(ptr, "replace")) : false; bool remove = ptr ? (!strcmp(ptr, "remove") || !strcmp(ptr, "replace")) : false;
bool add = ptr ? (!strcmp(ptr, "add") || !strcmp(ptr, "replace")) : true; bool add = ptr ? (!strcmp(ptr, "add") || !strcmp(ptr, "replace")) : true;
if (remove) { if (remove) {
int result = allchans.erase(chid); int result = allchans.erase(chid);
printf("[getservices]: %s '%s' (sid=0x%x): %s", add ? "replacing" : "removing", printf("[getservices]: %s '%s' (sid=0x%x): %s", add ? "replacing" : "removing",
@@ -474,7 +475,7 @@ void CServiceManager::ParseChannels(xmlNodePtr node, const t_transport_stream_id
add = false;//dont replace not existing channel add = false;//dont replace not existing channel
} }
if(!add) { if(!add) {
node = node->xmlNextNode; node = xmlNextNode(node);
continue; continue;
} }
audio_map_set_t * pidmap = CZapit::getInstance()->GetSavedPids(chid); audio_map_set_t * pidmap = CZapit::getInstance()->GetSavedPids(chid);
@@ -527,7 +528,7 @@ void CServiceManager::ParseChannels(xmlNodePtr node, const t_transport_stream_id
channel->type = vtype; channel->type = vtype;
} }
} }
node = node->xmlNextNode; node = xmlNextNode(node);
} }
return; return;
} }
@@ -555,7 +556,7 @@ void CServiceManager::FindTransponder(xmlNodePtr search)
delsys = ALL_SAT; delsys = ALL_SAT;
} }
else { else {
search = search->xmlNextNode; search = xmlNextNode(search);
continue; continue;
} }
#if 0 #if 0
@@ -564,9 +565,9 @@ void CServiceManager::FindTransponder(xmlNodePtr search)
t_satellite_position satellitePosition = GetSatellitePosition(name); t_satellite_position satellitePosition = GetSatellitePosition(name);
#endif #endif
DBG("going to parse dvb-%c provider %s\n", xmlGetName(search)[0], xmlGetAttribute(search, "name")); DBG("going to parse dvb-%c provider %s\n", xmlGetName(search)[0], xmlGetAttribute(search, "name"));
ParseTransponders(search->xmlChildrenNode, satellitePosition, delsys); ParseTransponders(xmlChildrenNode(search), satellitePosition, delsys);
newfound++; newfound++;
search = search->xmlNextNode; search = xmlNextNode(search);
} }
} }
@@ -577,7 +578,7 @@ void CServiceManager::ParseSatTransponders(delivery_system_t delsys, xmlNodePtr
fake_tid = fake_nid = 0; fake_tid = fake_nid = 0;
satelliteTransponders[satellitePosition].clear(); satelliteTransponders[satellitePosition].clear();
xmlNodePtr tps = search->xmlChildrenNode; xmlNodePtr tps = xmlChildrenNode(search);
while ((tps = xmlGetNextOccurence(tps, "transponder")) != NULL) { while ((tps = xmlGetNextOccurence(tps, "transponder")) != NULL) {
memset(&feparams, 0x00, sizeof(FrontendParameters)); memset(&feparams, 0x00, sizeof(FrontendParameters));
@@ -730,7 +731,7 @@ void CServiceManager::ParseSatTransponders(delivery_system_t delsys, xmlNodePtr
fake_nid ++; fake_tid ++; fake_nid ++; fake_tid ++;
tps = tps->xmlNextNode; tps = xmlNextNode(tps);
} }
} }
@@ -828,7 +829,8 @@ bool CServiceManager::LoadScanXml(delivery_system_t delsys)
/* fake position for non-satellite */ /* fake position for non-satellite */
t_satellite_position position = 0; t_satellite_position position = 0;
xmlNodePtr search = xmlDocGetRootElement(scanInputParser)->xmlChildrenNode; xmlNodePtr search = xmlDocGetRootElement(scanInputParser);
search = xmlChildrenNode(search);
while (search) { while (search) {
std::string delivery_name = xmlGetName(search); std::string delivery_name = xmlGetName(search);
if (delivery_name == "sat") { if (delivery_name == "sat") {
@@ -848,7 +850,7 @@ bool CServiceManager::LoadScanXml(delivery_system_t delsys)
} }
ParseSatTransponders(delsys, search, position); ParseSatTransponders(delsys, search, position);
search = search->xmlNextNode; search = xmlNextNode(search);
} }
delete scanInputParser; delete scanInputParser;
scanInputParser = NULL; scanInputParser = NULL;
@@ -908,7 +910,8 @@ bool CServiceManager::LoadServices(bool only_current)
parser = parseXmlFile(SERVICES_XML); parser = parseXmlFile(SERVICES_XML);
if (parser != NULL) { if (parser != NULL) {
xmlNodePtr search = xmlDocGetRootElement(parser)->xmlChildrenNode; xmlNodePtr search = xmlDocGetRootElement(parser);
search = xmlChildrenNode(search);
while (search) { while (search) {
const char * name = xmlGetAttribute(search, "name"); const char * name = xmlGetAttribute(search, "name");
t_satellite_position position; t_satellite_position position;
@@ -929,9 +932,9 @@ bool CServiceManager::LoadServices(bool only_current)
} else { } else {
} }
search = search->xmlNextNode; search = xmlNextNode(search);
} }
FindTransponder(xmlDocGetRootElement(parser)->xmlChildrenNode); FindTransponder(xmlChildrenNode(xmlDocGetRootElement(parser)));
xmlFreeDoc(parser); xmlFreeDoc(parser);
} }
@@ -944,7 +947,7 @@ bool CServiceManager::LoadServices(bool only_current)
continue; continue;
xmlNodePtr l0 = xmlDocGetRootElement(parser); xmlNodePtr l0 = xmlDocGetRootElement(parser);
xmlNodePtr l1 = l0->xmlChildrenNode; xmlNodePtr l1 = xmlChildrenNode(l0);
if (l1) { if (l1) {
while ((xmlGetNextOccurence(l1, "webtv"))) { while ((xmlGetNextOccurence(l1, "webtv"))) {
const char *title = xmlGetAttribute(l1, "title"); const char *title = xmlGetAttribute(l1, "title");
@@ -957,7 +960,7 @@ bool CServiceManager::LoadServices(bool only_current)
channel->flags = CZapitChannel::UPDATED; channel->flags = CZapitChannel::UPDATED;
} }
l1 = l1->xmlNextNode; l1 = xmlNextNode(l1);
} }
} }
xmlFreeDoc(parser); xmlFreeDoc(parser);
@@ -987,7 +990,7 @@ do_current:
if (CZapit::getInstance()->scanSDT() && (parser = parseXmlFile(CURRENTSERVICES_XML))) { if (CZapit::getInstance()->scanSDT() && (parser = parseXmlFile(CURRENTSERVICES_XML))) {
newfound = 0; newfound = 0;
printf("[getservices] " CURRENTSERVICES_XML " found.\n"); printf("[getservices] " CURRENTSERVICES_XML " found.\n");
FindTransponder(xmlDocGetRootElement(parser)->xmlChildrenNode); FindTransponder(xmlChildrenNode(xmlDocGetRootElement(parser)));
xmlFreeDoc(parser); xmlFreeDoc(parser);
unlink(CURRENTSERVICES_XML); unlink(CURRENTSERVICES_XML);
if(newfound) { if(newfound) {
@@ -999,7 +1002,7 @@ do_current:
if(!only_current) { if(!only_current) {
parser = parseXmlFile(MYSERVICES_XML); parser = parseXmlFile(MYSERVICES_XML);
if (parser != NULL) { if (parser != NULL) {
FindTransponder(xmlDocGetRootElement(parser)->xmlChildrenNode); FindTransponder(xmlChildrenNode(xmlDocGetRootElement(parser)));
xmlFreeDoc(parser); xmlFreeDoc(parser);
} }
} }
@@ -1292,7 +1295,8 @@ bool CServiceManager::LoadProviderMap()
replace_map.clear(); replace_map.clear();
parser = parseXmlFile(PROVIDER_MAP_XML); parser = parseXmlFile(PROVIDER_MAP_XML);
if (parser != NULL) { if (parser != NULL) {
xmlNodePtr node = xmlDocGetRootElement(parser)->xmlChildrenNode; xmlNodePtr node = xmlDocGetRootElement(parser);
node = xmlChildrenNode(node);
while ((node = xmlGetNextOccurence(node, "TS")) != NULL) { while ((node = xmlGetNextOccurence(node, "TS")) != NULL) {
provider_replace replace; provider_replace replace;
replace.transport_stream_id = xmlGetNumericAttribute(node, "id", 16); replace.transport_stream_id = xmlGetNumericAttribute(node, "id", 16);
@@ -1310,7 +1314,7 @@ bool CServiceManager::LoadProviderMap()
replace.transport_stream_id, replace.original_network_id, replace.transport_stream_id, replace.original_network_id,
replace.frequency, replace.name.c_str(), replace.newname.c_str()); replace.frequency, replace.name.c_str(), replace.newname.c_str());
replace_map.push_back(replace); replace_map.push_back(replace);
node = node->xmlNextNode; node = xmlNextNode(node);
} }
xmlFreeDoc(parser); xmlFreeDoc(parser);
return true; return true;