mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
eitd: use check empty() instead of size() or length()
This commit is contained in:
@@ -85,7 +85,7 @@ unsigned int getCountryIndex(const std::string &country)
|
|||||||
{
|
{
|
||||||
unsigned int ix = 0;
|
unsigned int ix = 0;
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(countryMutex);
|
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(countryMutex);
|
||||||
if (!countryVector.size()) {
|
if (countryVector.empty()) {
|
||||||
countryVector.push_back("DEU"); // 0
|
countryVector.push_back("DEU"); // 0
|
||||||
countryVector.push_back("FRA"); // 1
|
countryVector.push_back("FRA"); // 1
|
||||||
countryVector.push_back("ITA"); // 2
|
countryVector.push_back("ITA"); // 2
|
||||||
@@ -105,7 +105,7 @@ static std::map<std::string,unsigned int> componentMap;
|
|||||||
void SIcomponent::setComponent(const std::string &component_description)
|
void SIcomponent::setComponent(const std::string &component_description)
|
||||||
{
|
{
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(componentMutex);
|
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(componentMutex);
|
||||||
if (!componentVector.size()) {
|
if (componentVector.empty()) {
|
||||||
componentMap[""] = 0;
|
componentMap[""] = 0;
|
||||||
componentVector.push_back("");
|
componentVector.push_back("");
|
||||||
}
|
}
|
||||||
@@ -483,7 +483,7 @@ char SIevent::getFSK() const
|
|||||||
std::string SIevent::getName() const
|
std::string SIevent::getName() const
|
||||||
{
|
{
|
||||||
if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) {
|
if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) {
|
||||||
if (langData.size())
|
if (!langData.empty())
|
||||||
return langData.begin()->text[SILangData::langName];
|
return langData.begin()->text[SILangData::langName];
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
@@ -521,7 +521,7 @@ void SIevent::setName(unsigned int lang, const std::string &name)
|
|||||||
std::string SIevent::getText() const
|
std::string SIevent::getText() const
|
||||||
{
|
{
|
||||||
if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) {
|
if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) {
|
||||||
if (langData.size())
|
if (!langData.empty())
|
||||||
return langData.begin()->text[SILangData::langText];
|
return langData.begin()->text[SILangData::langText];
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -555,7 +555,7 @@ void SIevent::setText(unsigned int lang, const std::string &text)
|
|||||||
std::string SIevent::getExtendedText() const
|
std::string SIevent::getExtendedText() const
|
||||||
{
|
{
|
||||||
if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) {
|
if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) {
|
||||||
if (langData.size())
|
if (!langData.empty())
|
||||||
return langData.begin()->text[SILangData::langExtendedText];
|
return langData.begin()->text[SILangData::langExtendedText];
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -618,33 +618,33 @@ int SIevent::saveXML0(FILE *file) const
|
|||||||
int SIevent::saveXML2(FILE *file) const
|
int SIevent::saveXML2(FILE *file) const
|
||||||
{
|
{
|
||||||
for (std::list<SILangData>::const_iterator i = langData.begin(); i != langData.end(); ++i) {
|
for (std::list<SILangData>::const_iterator i = langData.begin(); i != langData.end(); ++i) {
|
||||||
if (i->text[SILangData::langName].length()) {
|
if (!i->text[SILangData::langName].empty()) {
|
||||||
fprintf(file, "\t\t\t<name lang=\"%s\" string=\"", langIndex[i->lang].c_str());
|
fprintf(file, "\t\t\t<name lang=\"%s\" string=\"", langIndex[i->lang].c_str());
|
||||||
saveStringToXMLfile(file, i->text[SILangData::langName].c_str());
|
saveStringToXMLfile(file, i->text[SILangData::langName].c_str());
|
||||||
fprintf(file, "\"/>\n");
|
fprintf(file, "\"/>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (std::list<SILangData>::const_iterator i = langData.begin(); i != langData.end(); ++i) {
|
for (std::list<SILangData>::const_iterator i = langData.begin(); i != langData.end(); ++i) {
|
||||||
if (i->text[SILangData::langText].length()) {
|
if (!i->text[SILangData::langText].empty()) {
|
||||||
fprintf(file, "\t\t\t<text lang=\"%s\" string=\"", langIndex[i->lang].c_str());
|
fprintf(file, "\t\t\t<text lang=\"%s\" string=\"", langIndex[i->lang].c_str());
|
||||||
saveStringToXMLfile(file, i->text[SILangData::langText].c_str());
|
saveStringToXMLfile(file, i->text[SILangData::langText].c_str());
|
||||||
fprintf(file, "\"/>\n");
|
fprintf(file, "\"/>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef USE_ITEM_DESCRIPTION
|
#ifdef USE_ITEM_DESCRIPTION
|
||||||
if(item.length()) {
|
if(!item.empty()) {
|
||||||
fprintf(file, "\t\t\t<item string=\"");
|
fprintf(file, "\t\t\t<item string=\"");
|
||||||
saveStringToXMLfile(file, item.c_str());
|
saveStringToXMLfile(file, item.c_str());
|
||||||
fprintf(file, "\"/>\n");
|
fprintf(file, "\"/>\n");
|
||||||
}
|
}
|
||||||
if(itemDescription.length()) {
|
if(!itemDescription.empty()) {
|
||||||
fprintf(file, "\t\t\t<item_description string=\"");
|
fprintf(file, "\t\t\t<item_description string=\"");
|
||||||
saveStringToXMLfile(file, itemDescription.c_str());
|
saveStringToXMLfile(file, itemDescription.c_str());
|
||||||
fprintf(file, "\"/>\n");
|
fprintf(file, "\"/>\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
for (std::list<SILangData>::const_iterator i = langData.begin(); i != langData.end(); ++i) {
|
for (std::list<SILangData>::const_iterator i = langData.begin(); i != langData.end(); ++i) {
|
||||||
if (i->text[SILangData::langExtendedText].length()) {
|
if (!i->text[SILangData::langExtendedText].empty()) {
|
||||||
fprintf(file, "\t\t\t<extended_text lang=\"%s\" string=\"", langIndex[i->lang].c_str());
|
fprintf(file, "\t\t\t<extended_text lang=\"%s\" string=\"", langIndex[i->lang].c_str());
|
||||||
saveStringToXMLfile(file, i->text[SILangData::langExtendedText].c_str());
|
saveStringToXMLfile(file, i->text[SILangData::langExtendedText].c_str());
|
||||||
fprintf(file, "\"/>\n");
|
fprintf(file, "\"/>\n");
|
||||||
@@ -674,9 +674,9 @@ void SIevent::dump(void) const
|
|||||||
printf("Service-ID: %hu\n", service_id);
|
printf("Service-ID: %hu\n", service_id);
|
||||||
printf("Event-ID: %hu\n", eventID);
|
printf("Event-ID: %hu\n", eventID);
|
||||||
#ifdef USE_ITEM_DESCRIPTION
|
#ifdef USE_ITEM_DESCRIPTION
|
||||||
if(item.length())
|
if(!item.empty())
|
||||||
printf("Item: %s\n", item.c_str());
|
printf("Item: %s\n", item.c_str());
|
||||||
if(itemDescription.length())
|
if(!itemDescription.empty())
|
||||||
printf("Item-Description: %s\n", itemDescription.c_str());
|
printf("Item-Description: %s\n", itemDescription.c_str());
|
||||||
#endif
|
#endif
|
||||||
for (std::list<SILangData>::const_iterator it = langData.begin(); it != langData.end(); ++it) {
|
for (std::list<SILangData>::const_iterator it = langData.begin(); it != langData.end(); ++it) {
|
||||||
@@ -687,13 +687,13 @@ void SIevent::dump(void) const
|
|||||||
|
|
||||||
std::string contentClassification, userClassification;
|
std::string contentClassification, userClassification;
|
||||||
classifications.get(contentClassification, userClassification);
|
classifications.get(contentClassification, userClassification);
|
||||||
if(contentClassification.length()) {
|
if(!contentClassification.empty()) {
|
||||||
printf("Content classification:");
|
printf("Content classification:");
|
||||||
for(unsigned i=0; i<contentClassification.length(); i++)
|
for(unsigned i=0; i<contentClassification.length(); i++)
|
||||||
printf(" 0x%02hhx", contentClassification[i]);
|
printf(" 0x%02hhx", contentClassification[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
if(userClassification.length()) {
|
if(!userClassification.empty()) {
|
||||||
printf("User classification:");
|
printf("User classification:");
|
||||||
for(unsigned i=0; i<userClassification.length(); i++)
|
for(unsigned i=0; i<userClassification.length(); i++)
|
||||||
printf(" 0x%02hhx", userClassification[i]);
|
printf(" 0x%02hhx", userClassification[i]);
|
||||||
|
@@ -52,7 +52,7 @@ unsigned int getLangIndex(const std::string &lang)
|
|||||||
{
|
{
|
||||||
unsigned int ix = 0;
|
unsigned int ix = 0;
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(langIndexMutex);
|
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(langIndexMutex);
|
||||||
if (!langIndex.size())
|
if (langIndex.empty())
|
||||||
langIndex.push_back(languageOFF);
|
langIndex.push_back(languageOFF);
|
||||||
for (std::vector<std::string>::iterator it = langIndex.begin(); it != langIndex.end(); ++it, ++ix)
|
for (std::vector<std::string>::iterator it = langIndex.begin(); it != langIndex.end(); ++it, ++ix)
|
||||||
if (*it == lang)
|
if (*it == lang)
|
||||||
@@ -101,7 +101,7 @@ void SIlanguage::filter(const std::list<SILangData>& s, SILangData::SILangDataIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retval.length() == 0) {
|
if (retval.empty()) {
|
||||||
// return all available languages
|
// return all available languages
|
||||||
if (s.begin() != s.end()) {
|
if (s.begin() != s.end()) {
|
||||||
for (std::list<SILangData>::const_iterator it = s.begin() ;
|
for (std::list<SILangData>::const_iterator it = s.begin() ;
|
||||||
|
@@ -140,9 +140,9 @@ public:
|
|||||||
printf("Service-ID: %hu\n", service_id);
|
printf("Service-ID: %hu\n", service_id);
|
||||||
printf("Service-Typ: %hhu\n", serviceTyp);
|
printf("Service-Typ: %hhu\n", serviceTyp);
|
||||||
#if 0 // unused
|
#if 0 // unused
|
||||||
if(providerName.length())
|
if(!providerName.empty())
|
||||||
printf("Provider-Name: %s\n", providerName.c_str());
|
printf("Provider-Name: %s\n", providerName.c_str());
|
||||||
if(serviceName.length())
|
if(!serviceName.empty())
|
||||||
printf("Service-Name: %s\n", serviceName.c_str());
|
printf("Service-Name: %s\n", serviceName.c_str());
|
||||||
#endif
|
#endif
|
||||||
for_each(nvods.begin(), nvods.end(), printSInvodReference());
|
for_each(nvods.begin(), nvods.end(), printSInvodReference());
|
||||||
|
@@ -352,12 +352,12 @@ xprintf("addEvent: ch %012" PRIx64 " running %d (%s) got_CN %d\n", evt.get_chann
|
|||||||
si->second->item = evt.item;
|
si->second->item = evt.item;
|
||||||
#endif
|
#endif
|
||||||
//si->second->vps = evt.vps;
|
//si->second->vps = evt.vps;
|
||||||
if ((evt.getExtendedText().length() > 0) && !evt.times.empty() &&
|
if ((!evt.getExtendedText().empty()) && !evt.times.empty() &&
|
||||||
(evt.times.begin()->startzeit < zeit + secondsExtendedTextCache))
|
(evt.times.begin()->startzeit < zeit + secondsExtendedTextCache))
|
||||||
si->second->setExtendedText(0 /*"OFF"*/,evt.getExtendedText());
|
si->second->setExtendedText(0 /*"OFF"*/,evt.getExtendedText());
|
||||||
if (evt.getText().length() > 0)
|
if (!evt.getText().empty())
|
||||||
si->second->setText(0 /*"OFF"*/,evt.getText());
|
si->second->setText(0 /*"OFF"*/,evt.getText());
|
||||||
if (evt.getName().length() > 0)
|
if (!evt.getName().empty())
|
||||||
si->second->setName(0 /*"OFF"*/,evt.getName());
|
si->second->setName(0 /*"OFF"*/,evt.getName());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -2293,7 +2293,7 @@ void CEitManager::getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEve
|
|||||||
// service Found
|
// service Found
|
||||||
readLockEvents();
|
readLockEvents();
|
||||||
int serviceIDfound = 0;
|
int serviceIDfound = 0;
|
||||||
if (search_text.length())
|
if (!search_text.empty())
|
||||||
std::transform(search_text.begin(), search_text.end(), search_text.begin(), tolower);
|
std::transform(search_text.begin(), search_text.end(), search_text.begin(), tolower);
|
||||||
|
|
||||||
for (MySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey::iterator e = mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.begin(); e != mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.end(); ++e)
|
for (MySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey::iterator e = mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.begin(); e != mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.end(); ++e)
|
||||||
|
@@ -426,7 +426,7 @@ void *insertEventsfromFile(void * data)
|
|||||||
node = node->xmlNextNode;
|
node = node->xmlNextNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contentClassification.size()) {
|
if (!contentClassification.empty()) {
|
||||||
ssize_t off = e.classifications.reserve(2 * contentClassification.size());
|
ssize_t off = e.classifications.reserve(2 * contentClassification.size());
|
||||||
if (off > -1)
|
if (off > -1)
|
||||||
for (unsigned i = 0; i < contentClassification.size(); i++)
|
for (unsigned i = 0; i < contentClassification.size(); i++)
|
||||||
|
Reference in New Issue
Block a user