xmlinterface use const char instand char

Origin commit data
------------------
Commit: 8227a01592
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2015-03-20 (Fri, 20 Mar 2015)
This commit is contained in:
Jacek Jendrzej
2015-03-20 12:05:22 +01:00
parent c5bd495ac6
commit 3f53a4b636
9 changed files with 50 additions and 50 deletions

View File

@@ -47,7 +47,7 @@
unsigned long xmlGetNumericAttribute(const xmlNodePtr node, const char *name, const int base)
{
char *ptr = xmlGetAttribute(node, name);
const char *ptr = xmlGetAttribute(node, name);
if (!ptr)
return 0;
@@ -57,7 +57,7 @@ unsigned long xmlGetNumericAttribute(const xmlNodePtr node, const char *name, co
long xmlGetSignedNumericAttribute(const xmlNodePtr node, const char *name, const int base)
{
char *ptr = xmlGetAttribute(node, name);
const char *ptr = xmlGetAttribute(node, name);
if (!ptr)
return 0;

View File

@@ -41,8 +41,8 @@
#ifdef USE_LIBXML
#include <libxml/parser.h>
#define xmlNextNode next
inline char* xmlGetAttribute (xmlNodePtr cur, const char * s) { return (char *)xmlGetProp(cur, (const xmlChar *)s); };
inline char* xmlGetName (xmlNodePtr cur) { return (char *)(cur->name); };
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); };
#else /* use libxmltree */
#include "xmltree.h"
@@ -52,9 +52,9 @@ typedef XMLTreeNode* xmlNodePtr;
#define xmlNextNode GetNext()
inline xmlNodePtr xmlDocGetRootElement(xmlDocPtr doc) { return doc->RootNode(); }
inline void xmlFreeDoc (xmlDocPtr doc) { delete doc; }
inline char* xmlGetAttribute (xmlNodePtr cur, const char *s) { return cur->GetAttributeValue(s); }
inline char* xmlGetName (xmlNodePtr cur) { return cur->GetType(); }
inline char* xmlGetData (xmlNodePtr cur) { return cur->GetData(); }
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* xmlGetData (xmlNodePtr cur) { return cur->GetData(); }
#endif /* USE_LIBXML */

View File

@@ -347,7 +347,7 @@ void *insertEventsfromFile(void * data)
node = event->xmlChildrenNode;
while ((node = xmlGetNextOccurence(node, "name"))) {
char *s = xmlGetAttribute(node, "string");
const char *s = xmlGetAttribute(node, "string");
if (s)
e.setName(ZapitTools::UTF8_to_Latin1(xmlGetAttribute(node, "lang")), s);
node = node->xmlNextNode;
@@ -355,7 +355,7 @@ void *insertEventsfromFile(void * data)
node = event->xmlChildrenNode;
while ((node = xmlGetNextOccurence(node, "text"))) {
char *s = xmlGetAttribute(node, "string");
const char *s = xmlGetAttribute(node, "string");
if (s)
e.setText(ZapitTools::UTF8_to_Latin1(xmlGetAttribute(node, "lang")), s);
node = node->xmlNextNode;
@@ -363,7 +363,7 @@ void *insertEventsfromFile(void * data)
node = event->xmlChildrenNode;
while ((node = xmlGetNextOccurence(node, "item"))) {
#ifdef USE_ITEM_DESCRIPTION
char *s = xmlGetAttribute(node, "string");
const char *s = xmlGetAttribute(node, "string");
if (s)
e.item = s;
#endif
@@ -373,7 +373,7 @@ void *insertEventsfromFile(void * data)
node = event->xmlChildrenNode;
while ((node = xmlGetNextOccurence(node, "item_description"))) {
#ifdef USE_ITEM_DESCRIPTION
char *s = xmlGetAttribute(node, "string");
const char *s = xmlGetAttribute(node, "string");
if (s)
e.itemDescription = s;
#endif
@@ -381,8 +381,8 @@ void *insertEventsfromFile(void * data)
}
node = event->xmlChildrenNode;
while ((node = xmlGetNextOccurence(node, "extended_text"))) {
char *l = xmlGetAttribute(node, "lang");
char *s = xmlGetAttribute(node, "string");
const char *l = xmlGetAttribute(node, "lang");
const char *s = xmlGetAttribute(node, "string");
if (l && s)
e.appendExtendedText(ZapitTools::UTF8_to_Latin1(l), s);
node = node->xmlNextNode;
@@ -397,10 +397,10 @@ void *insertEventsfromFile(void * data)
node = event->xmlChildrenNode;
while ((node = xmlGetNextOccurence(node, "content"))) {
char cl = xmlGetNumericAttribute(node, "class", 16);
const char cl = xmlGetNumericAttribute(node, "class", 16);
contentClassification += cl;
cl = xmlGetNumericAttribute(node, "user", 16);
userClassification += cl;
const char cl2 = xmlGetNumericAttribute(node, "user", 16);
userClassification += cl2;
node = node->xmlNextNode;
}
@@ -410,7 +410,7 @@ void *insertEventsfromFile(void * data)
c.streamContent = xmlGetNumericAttribute(node, "stream_content", 16);
c.componentType = xmlGetNumericAttribute(node, "type", 16);
c.componentTag = xmlGetNumericAttribute(node, "tag", 16);
char *s = xmlGetAttribute(node, "text");
const char *s = xmlGetAttribute(node, "text");
if (s)
c.setComponent(s);
//e.components.insert(c);
@@ -420,7 +420,7 @@ void *insertEventsfromFile(void * data)
node = event->xmlChildrenNode;
while ((node = xmlGetNextOccurence(node, "parental_rating"))) {
char *s = xmlGetAttribute(node, "country");
const char *s = xmlGetAttribute(node, "country");
if (s)
#if 0
e.ratings.insert(SIparentalRating(ZapitTools::UTF8_to_Latin1(s),
@@ -438,7 +438,7 @@ void *insertEventsfromFile(void * data)
l.transportStreamId = xmlGetNumericAttribute(node, "transport_stream_id", 16);
l.originalNetworkId = xmlGetNumericAttribute(node, "original_network_id", 16);
l.serviceId = xmlGetNumericAttribute(node, "service_id", 16);
char *s = xmlGetAttribute(node, "linkage_descriptor");
const char *s = xmlGetAttribute(node, "linkage_descriptor");
if (s)
l.name = s;
e.linkage_descs.insert(e.linkage_descs.end(), l);

View File

@@ -1133,9 +1133,9 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag,
neutrino_msg_data_t data;
g_RCInput->getMsg(&msg, &data, 0);
while (element && msg != CRCInput::RC_home) {
char *ptr = NULL;
char *name = NULL;
char *url = NULL;
const char *ptr = NULL;
const char *name = NULL;
const char *url = NULL;
time_t bitrate = 0;
bool skip = true;
listPos++;
@@ -1148,7 +1148,7 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag,
#endif // LCD_UPDATE
if (usechild) {
char *type = NULL;
const char *type = NULL;
xmlNodePtr child = element->xmlChildrenNode;
while (child) {
if (strcmp(xmlGetName(child), nametag) == 0)

View File

@@ -439,7 +439,7 @@ printf("CFileBrowser::readDir_sc: read done, size %d\n", (int)answer.size());
xmlDocPtr answer_parser = parseXml(answer.c_str());
if (answer_parser != NULL) {
char *ptr;
const char *ptr = NULL;
unsigned char xml_decode = 0;
xmlNodePtr element = xmlDocGetRootElement(answer_parser);
@@ -458,7 +458,7 @@ printf("CFileBrowser::readDir_sc: read done, size %d\n", (int)answer.size());
file.Time = 0;
flist->push_back(file);
} else {
char * tunein_base = NULL;
const char * tunein_base = NULL;
if (xml_decode == 1) {
CFile file;

View File

@@ -252,7 +252,7 @@ bool cYTFeedParser::saveToFile(const char * name, std::string str)
std::string cYTFeedParser::getXmlName(xmlNodePtr node)
{
std::string result;
char * name = xmlGetName(node);
const char * name = xmlGetName(node);
if (name)
result = name;
return result;
@@ -261,7 +261,7 @@ std::string cYTFeedParser::getXmlName(xmlNodePtr node)
std::string cYTFeedParser::getXmlAttr(xmlNodePtr node, const char * attr)
{
std::string result;
char * value = xmlGetAttribute(node, attr);
const char * value = xmlGetAttribute(node, attr);
if (value)
result = value;
return result;
@@ -270,7 +270,7 @@ std::string cYTFeedParser::getXmlAttr(xmlNodePtr node, const char * attr)
std::string cYTFeedParser::getXmlData(xmlNodePtr node)
{
std::string result;
char * value = xmlGetData(node);
const char * value = xmlGetData(node);
if (value)
result = value;
return result;

View File

@@ -109,7 +109,7 @@ class CServiceManager
static void CopyFile(char * from, char * to);
bool InitSatPosition(t_satellite_position position, char * name = NULL, bool force = false, delivery_system_t delsys = DVB_S, uint16_t nid = 0);
bool InitSatPosition(t_satellite_position position, const char * name = NULL, bool force = false, delivery_system_t delsys = DVB_S, uint16_t nid = 0);
bool LoadServices(bool only_current);
void SaveServices(bool tocopy, bool if_changed = false, bool no_deleted = false);
void SaveMotorPositions();

View File

@@ -43,7 +43,7 @@ extern CBouquetManager *g_bouquetManager;
#define GET_ATTR(node, name, fmt, arg) \
do { \
char * ptr = xmlGetAttribute(node, name); \
const char * ptr = xmlGetAttribute(node, name); \
if ((ptr == NULL) || (sscanf(ptr, fmt, &arg) <= 0)) \
arg = 0; \
} \
@@ -395,16 +395,16 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
INFO("reading bouquets from %s", fname);
while ((search = xmlGetNextOccurence(search, "Bouquet")) != NULL) {
char * name = xmlGetAttribute(search, "name");
const char * name = xmlGetAttribute(search, "name");
if(name == NULL)
name = const_cast<char*>("Unknown");
CZapitBouquet* newBouquet = addBouquet(name, bUser);
// per default in contructor: newBouquet->BqID = 0; //set to default, override if bqID exists
GET_ATTR(search, "bqID", SCANF_BOUQUET_ID_TYPE, newBouquet->BqID);
char* hidden = xmlGetAttribute(search, "hidden");
char* locked = xmlGetAttribute(search, "locked");
char* scanepg = xmlGetAttribute(search, "epg");
const char* hidden = xmlGetAttribute(search, "hidden");
const char* locked = xmlGetAttribute(search, "locked");
const char* scanepg = xmlGetAttribute(search, "epg");
newBouquet->bHidden = hidden ? (strcmp(hidden, "1") == 0) : false;
newBouquet->bLocked = locked ? (strcmp(locked, "1") == 0) : false;
newBouquet->bFav = (strcmp(name, "favorites") == 0);
@@ -416,10 +416,10 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
if (name)
name2 = name;
std::string uname;
char *uName = xmlGetAttribute(channel_node, "un");
const char *uName = xmlGetAttribute(channel_node, "un");
if (uName)
uname = uName;
char *url = xmlGetAttribute(channel_node, "u");
const char *url = xmlGetAttribute(channel_node, "u");
GET_ATTR(channel_node, "i", SCANF_SERVICE_ID_TYPE, service_id);
GET_ATTR(channel_node, "on", SCANF_ORIGINAL_NETWORK_ID_TYPE, original_network_id);
GET_ATTR(channel_node, "s", SCANF_SATELLITE_POSITION_TYPE, satellitePosition);

View File

@@ -462,7 +462,7 @@ void CServiceManager::ParseChannels(xmlNodePtr node, const t_transport_stream_id
flags = CZapitChannel::UPDATED;
t_channel_id chid = CREATE_CHANNEL_ID64;
char *ptr = xmlGetAttribute(node, "action");
const char *ptr = xmlGetAttribute(node, "action");
bool remove = ptr ? (!strcmp(ptr, "remove") || !strcmp(ptr, "replace")) : false;
bool add = ptr ? (!strcmp(ptr, "add") || !strcmp(ptr, "replace")) : true;
if (remove) {
@@ -541,12 +541,12 @@ void CServiceManager::FindTransponder(xmlNodePtr search)
std::string delivery_name = xmlGetName(search);
if (delivery_name == "cable") {
char *name = xmlGetAttribute(search, "name");
const char *name = xmlGetAttribute(search, "name");
satellitePosition = GetSatellitePosition(name);
delsys = ALL_CABLE;
}
else if (delivery_name == "terrestrial") {
char *name = xmlGetAttribute(search, "name");
const char *name = xmlGetAttribute(search, "name");
satellitePosition = GetSatellitePosition(name);
delsys = ALL_TERR;
}
@@ -560,7 +560,7 @@ void CServiceManager::FindTransponder(xmlNodePtr search)
}
#if 0
//t_satellite_position satellitePosition = xmlGetSignedNumericAttribute(search, "position", 10);
char * name = xmlGetAttribute(search, "name");
const char * name = xmlGetAttribute(search, "name");
t_satellite_position satellitePosition = GetSatellitePosition(name);
#endif
DBG("going to parse dvb-%c provider %s\n", xmlGetName(search)[0], xmlGetAttribute(search, "name"));
@@ -797,7 +797,7 @@ void CServiceManager::SaveMotorPositions()
}
#endif
bool CServiceManager::InitSatPosition(t_satellite_position position, char * name, bool force, delivery_system_t delsys, uint16_t nid)
bool CServiceManager::InitSatPosition(t_satellite_position position, const char * name, bool force, delivery_system_t delsys, uint16_t nid)
{
if(force || (satellitePositions.find(position) == satellitePositions.end())) {
satellitePositions[position].position = position;
@@ -833,15 +833,15 @@ bool CServiceManager::LoadScanXml(delivery_system_t delsys)
std::string delivery_name = xmlGetName(search);
if (delivery_name == "sat") {
position = xmlGetSignedNumericAttribute(search, "position", 10);
char * name = xmlGetAttribute(search, "name");
const char * name = xmlGetAttribute(search, "name");
InitSatPosition(position, name, false, ALL_SAT);
} else if (delivery_name == "terrestrial") {
char * name = xmlGetAttribute(search, "name");
const char * name = xmlGetAttribute(search, "name");
position = fake_pos++;
position &= 0x0EFF;
InitSatPosition(position, name, false, ALL_TERR);
} else if(delivery_name == "cable") {
char * name = xmlGetAttribute(search, "name");
const char * name = xmlGetAttribute(search, "name");
position = fake_pos++;
InitSatPosition(position, name, false, ALL_CABLE, xmlGetNumericAttribute(search, "nid", 0));
} else {
@@ -910,7 +910,7 @@ bool CServiceManager::LoadServices(bool only_current)
if (parser != NULL) {
xmlNodePtr search = xmlDocGetRootElement(parser)->xmlChildrenNode;
while (search) {
char * name = xmlGetAttribute(search, "name");
const char * name = xmlGetAttribute(search, "name");
t_satellite_position position;
std::string delivery_name = xmlGetName(search);
if (delivery_name == "sat") {
@@ -947,9 +947,9 @@ bool CServiceManager::LoadServices(bool only_current)
xmlNodePtr l1 = l0->xmlChildrenNode;
if (l1) {
while ((xmlGetNextOccurence(l1, "webtv"))) {
char *title = xmlGetAttribute(l1, "title");
char *url = xmlGetAttribute(l1, "url");
char *desc = xmlGetAttribute(l1, "description");
const char *title = xmlGetAttribute(l1, "title");
const char *url = xmlGetAttribute(l1, "url");
const char *desc = xmlGetAttribute(l1, "description");
if (title && url) {
t_channel_id chid = create_channel_id64(0, 0, 0, 0, 0, url);
CZapitChannel * channel = new CZapitChannel(title, chid, url, desc);
@@ -1299,8 +1299,8 @@ bool CServiceManager::LoadProviderMap()
replace.original_network_id = xmlGetNumericAttribute(node, "on", 16);
replace.frequency = xmlGetNumericAttribute(node, "frq", 0);
char * name = xmlGetAttribute(node, "name");
char * newname = xmlGetAttribute(node, "newname");
const char * name = xmlGetAttribute(node, "name");
const char * newname = xmlGetAttribute(node, "newname");
if(name)
replace.name = name;
if(newname)