eitd: use check empty() instead of size() or length()

Origin commit data
------------------
Branch: ni/coolstream
Commit: 8e4af0b619
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2015-01-01 (Thu, 01 Jan 2015)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2015-01-01 19:02:41 +01:00
parent 667d5e5006
commit 85c00e412d
5 changed files with 23 additions and 23 deletions

View File

@@ -85,7 +85,7 @@ unsigned int getCountryIndex(const std::string &country)
{
unsigned int ix = 0;
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(countryMutex);
if (!countryVector.size()) {
if (countryVector.empty()) {
countryVector.push_back("DEU"); // 0
countryVector.push_back("FRA"); // 1
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)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(componentMutex);
if (!componentVector.size()) {
if (componentVector.empty()) {
componentMap[""] = 0;
componentVector.push_back("");
}
@@ -483,7 +483,7 @@ char SIevent::getFSK() const
std::string SIevent::getName() const
{
if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) {
if (langData.size())
if (!langData.empty())
return langData.begin()->text[SILangData::langName];
return "";
} else {
@@ -521,7 +521,7 @@ void SIevent::setName(unsigned int lang, const std::string &name)
std::string SIevent::getText() const
{
if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) {
if (langData.size())
if (!langData.empty())
return langData.begin()->text[SILangData::langText];
return "";
}
@@ -555,7 +555,7 @@ void SIevent::setText(unsigned int lang, const std::string &text)
std::string SIevent::getExtendedText() const
{
if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) {
if (langData.size())
if (!langData.empty())
return langData.begin()->text[SILangData::langExtendedText];
return "";
}
@@ -618,33 +618,33 @@ int SIevent::saveXML0(FILE *file) const
int SIevent::saveXML2(FILE *file) const
{
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());
saveStringToXMLfile(file, i->text[SILangData::langName].c_str());
fprintf(file, "\"/>\n");
}
}
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());
saveStringToXMLfile(file, i->text[SILangData::langText].c_str());
fprintf(file, "\"/>\n");
}
}
#ifdef USE_ITEM_DESCRIPTION
if(item.length()) {
if(!item.empty()) {
fprintf(file, "\t\t\t<item string=\"");
saveStringToXMLfile(file, item.c_str());
fprintf(file, "\"/>\n");
}
if(itemDescription.length()) {
if(!itemDescription.empty()) {
fprintf(file, "\t\t\t<item_description string=\"");
saveStringToXMLfile(file, itemDescription.c_str());
fprintf(file, "\"/>\n");
}
#endif
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());
saveStringToXMLfile(file, i->text[SILangData::langExtendedText].c_str());
fprintf(file, "\"/>\n");
@@ -674,9 +674,9 @@ void SIevent::dump(void) const
printf("Service-ID: %hu\n", service_id);
printf("Event-ID: %hu\n", eventID);
#ifdef USE_ITEM_DESCRIPTION
if(item.length())
if(!item.empty())
printf("Item: %s\n", item.c_str());
if(itemDescription.length())
if(!itemDescription.empty())
printf("Item-Description: %s\n", itemDescription.c_str());
#endif
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;
classifications.get(contentClassification, userClassification);
if(contentClassification.length()) {
if(!contentClassification.empty()) {
printf("Content classification:");
for(unsigned i=0; i<contentClassification.length(); i++)
printf(" 0x%02hhx", contentClassification[i]);
printf("\n");
}
if(userClassification.length()) {
if(!userClassification.empty()) {
printf("User classification:");
for(unsigned i=0; i<userClassification.length(); i++)
printf(" 0x%02hhx", userClassification[i]);