diff --git a/lib/libupnpclient/UPNPDevice.cpp b/lib/libupnpclient/UPNPDevice.cpp index 6611b21ed..ae251881b 100644 --- a/lib/libupnpclient/UPNPDevice.cpp +++ b/lib/libupnpclient/UPNPDevice.cpp @@ -179,7 +179,7 @@ CUPnPDevice::CUPnPDevice(std::string url) if (!strcmp(node->GetType(),"URLBase")) { urlbase = std::string(node->GetData()); - if ((urlbase.length() > 0) && (urlbase[urlbase.length()-1] == '/')) + if ((!urlbase.empty() ) && (urlbase[urlbase.length()-1] == '/')) urlbase.erase(urlbase.length()-1); } diff --git a/lib/libupnpclient/UPNPSocket.cpp b/lib/libupnpclient/UPNPSocket.cpp index 5c3bcbe6e..fcc55d43a 100644 --- a/lib/libupnpclient/UPNPSocket.cpp +++ b/lib/libupnpclient/UPNPSocket.cpp @@ -136,7 +136,7 @@ std::vector CUPnPSocket::Discover(std::string service) if (!strcasecmp(location.c_str(), "location:")) { line.erase(0, 9); - while ((line.length() > 0 )&& ((line[0] == ' ') || (line[0] == '\t'))) + while ((!line.empty()) && ((line[0] == ' ') || (line[0] == '\t'))) line.erase(0, 1); if (line.substr(0,7) == "http://") { diff --git a/src/driver/lcdd.cpp b/src/driver/lcdd.cpp index 0eb6dd0f6..5c5e3711d 100644 --- a/src/driver/lcdd.cpp +++ b/src/driver/lcdd.cpp @@ -466,8 +466,8 @@ void CLCD::showTextScreen(const std::string & big, const std::string & small, co cname[namelines] = splitString(title, LCD_COLS, fonts.channelname, dumb, big_utf8); title = removeLeadingSpaces(title.substr(cname[namelines].length())); namelines++; - } while (title.length() > 0 && namelines < maxnamelines); - if (title.length() == 0) + } while (!title.empty() && namelines < maxnamelines); + if (title.empty()) break; dumb = !dumb; // retry with dumb splitting; if (!dumb) // second retry -> get out; @@ -491,11 +491,11 @@ void CLCD::showTextScreen(const std::string & big, const std::string & small, co title = removeLeadingSpaces(title.substr(event[eventlines].length())); /* DrDish TV appends a 0x0a to the EPG title. We could strip it in sectionsd... ...instead, strip all control characters at the end of the text for now */ - if (event[eventlines].length() > 0 && event[eventlines].at(event[eventlines].length() - 1) < ' ') + if (!event[eventlines].empty() && event[eventlines].at(event[eventlines].length() - 1) < ' ') event[eventlines].erase(event[eventlines].length() - 1); eventlines++; - } while (title.length() >0 && eventlines < maxeventlines); - if (title.length() == 0) + } while (!title.empty() && eventlines < maxeventlines); + if (title.empty()) break; dumb = !dumb; // retry with dumb splitting; if (!dumb) // second retry -> get out; diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 4d9b59ceb..366798745 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -611,7 +611,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start } // Show genre information - if (epgData.contentClassification.length()> 0) + if (!epgData.contentClassification.empty()) processTextToArray(std::string(g_Locale->getText(LOCALE_EPGVIEWER_GENRE)) + ": " + GetGenre(epgData.contentClassification[0])); // UTF-8 // processTextToArray( epgData.userClassification.c_str() ); diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 8187a5fc2..d4f9aa7d5 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -767,7 +767,7 @@ void CNeutrinoEventList::paintItem(unsigned int pos, t_channel_id channel_idI) g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->RenderString(x+5, ypos+ fheight1+3, fwidth1a, datetime1_str, color); int seit = ( evtlist[curpos].startTime - time(NULL) ) / 60; - if ( (seit> 0) && (seit<100) && (duration_str.length()!=0) ) + if ( (seit> 0) && (seit<100) && (!duration_str.empty()) ) { char beginnt[100]; snprintf(beginnt, sizeof(beginnt), "%s %d %s", g_Locale->getText(LOCALE_WORD_IN), seit, unit_short_minute); diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 8b258c500..3c892e21a 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -1196,7 +1196,7 @@ void CFileBrowser::paintItem(unsigned int pos) colwidth3 = fnt_item->getRenderWidth("222.222G"); colwidth1 = width - 35 - colwidth2 - colwidth3 - 10; - if ( actual_file->Name.length() > 0 ) + if ( !actual_file->Name.empty() ) { if (curr == selected) CVFD::getInstance()->showMenuText(0, FILESYSTEM_ENCODING_TO_UTF8_STRING(actual_file->getFileName()).c_str(), -1, true); // UTF-8 diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 42706d2f4..7fda90c7f 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -528,7 +528,7 @@ bool CMoviePlayerGui::SelectFile() CFile *file = NULL; filelist = filebrowser->getSelectedFiles(); filelist_it = filelist.end(); - if (filelist.size() > 0) { + if (!filelist.empty()) { filelist_it = filelist.begin(); file = &(*filelist_it); } @@ -852,7 +852,7 @@ void CMoviePlayerGui::PlayFileLoop(void) } else if (msg == (neutrino_msg_t) g_settings.mpkey_stop) { playstate = CMoviePlayerGui::STOPPED; ClearQueue(); - } else if ((filelist.size() > 0 && msg == (neutrino_msg_t) CRCInput::RC_right)) { + } else if ((!filelist.empty() && msg == (neutrino_msg_t) CRCInput::RC_right)) { if (filelist_it < (filelist.end() - 1)) { ++filelist_it; playstate = CMoviePlayerGui::STOPPED; @@ -885,7 +885,7 @@ void CMoviePlayerGui::PlayFileLoop(void) updateLcd(); if (timeshift == TSHIFT_MODE_OFF) callInfoViewer(); - } else if (filelist.size() > 0) { + } else if (!filelist.empty()) { EnableClockAndMute(false); CFileBrowser playlist; CFile *pfile = NULL; @@ -1065,7 +1065,7 @@ void CMoviePlayerGui::PlayFileLoop(void) if (position >= 300000 || (duration < 300000 && (position > (duration /2)))) makeScreenShot(true); - if (at_eof && filelist.size() > 0) { + if (at_eof && !filelist.empty()) { if (filelist_it != filelist.end() && repeat_mode != REPEAT_TRACK) ++filelist_it; @@ -1097,7 +1097,7 @@ void CMoviePlayerGui::PlayFileEnd(bool restore) stopped = true; printf("%s: stopped\n", __func__); - if (filelist.size() > 0 && filelist_it != filelist.end()) { + if (!filelist.empty() && filelist_it != filelist.end()) { pretty_name.clear(); prepareFile(&(*filelist_it)); } diff --git a/src/gui/themes.cpp b/src/gui/themes.cpp index 2e9016372..e37e066a9 100644 --- a/src/gui/themes.cpp +++ b/src/gui/themes.cpp @@ -176,7 +176,7 @@ int CThemes::Show() int res = themes.exec(NULL, ""); - if (file_name.length() > 0) { + if (!file_name.empty()) { saveFile((char*)((std::string)THEMEDIR_VAR + file_name + FILE_PREFIX).c_str()); } diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index 44b2cd736..c487c66f7 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -528,7 +528,7 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active) continue; case SNeutrinoSettings::ITEM_AUDIO_SELECT: if(loc == NONEXISTANT_LOCALE && !text) { - if (g_RemoteControl->current_PIDs.APIDs.size() > 0) + if (!g_RemoteControl->current_PIDs.APIDs.empty()) text = g_RemoteControl->current_PIDs.APIDs[ g_RemoteControl->current_PIDs.PIDs.selected_apid].desc; } else diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 4f35d4568..d880dc90f 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -1402,7 +1402,7 @@ void CControlAPI::EpgSearchCGI(CyhookHandler *hh, bool xml_forat ) hh->printf("\t\t%s\n",ZapitTools::UTF8_to_UTF8XML(epg.info2.c_str()).c_str()); if (CEitManager::getInstance()->getEPGid(eventIterator->eventID, eventIterator->startTime, &longepg)) { hh->printf("\t\t%u\n", longepg.fsk); - if (longepg.contentClassification.length()> 0){ + if (!longepg.contentClassification.empty()){ genere = GetGenre(longepg.contentClassification[0]); genere = ZapitTools::UTF8_to_UTF8XML(genere.c_str()); hh->printf("\t\t%s\n", genere.c_str()); @@ -1436,7 +1436,7 @@ void CControlAPI::EpgSearchCGI(CyhookHandler *hh, bool xml_forat ) hh->WriteLn(epg.info2); if (CEitManager::getInstance()->getEPGid(eventIterator->eventID, eventIterator->startTime, &longepg)) { hh->printf("fsk:%u\n", longepg.fsk); - if (longepg.contentClassification.length()> 0){ + if (!longepg.contentClassification.empty()){ genere = GetGenre(longepg.contentClassification[0]); genere = ZapitTools::UTF8_to_UTF8XML(genere.c_str()); hh->WriteLn(genere); diff --git a/src/nhttpd/yhttpd_core/yrequest.cpp b/src/nhttpd/yhttpd_core/yrequest.cpp index 679b5c1ce..9c0dbb449 100644 --- a/src/nhttpd/yhttpd_core/yrequest.cpp +++ b/src/nhttpd/yhttpd_core/yrequest.cpp @@ -534,7 +534,7 @@ unsigned int CWebserverRequest::HandlePostBoundary(std::string boundary, } log_level_printf(2," read file (already:%d all:%d)\n", _readbytes, content_len); } - while((_readbytes < content_len) && (tmp_line.length() != 0)); + while((_readbytes < content_len) && (!tmp_line.empty())); content_len -= _readbytes; close(fd); log_level_printf(2," read file End\n"); diff --git a/src/nhttpd/yhttpd_mods/mod_sendfile.cpp b/src/nhttpd/yhttpd_mods/mod_sendfile.cpp index 4807370b0..22d97b1ae 100644 --- a/src/nhttpd/yhttpd_mods/mod_sendfile.cpp +++ b/src/nhttpd/yhttpd_mods/mod_sendfile.cpp @@ -202,7 +202,7 @@ std::string CmodSendfile::GetFileName(CyhookHandler *hh, std::string path, std:: //----------------------------------------------------------------------------- int CmodSendfile::OpenFile(CyhookHandler *, std::string fullfilename) { int fd = -1; - if (fullfilename.length() > 0) { + if (!fullfilename.empty()) { fd = open(fullfilename.c_str(), O_RDONLY | O_LARGEFILE); if (fd <= 0) { aprintf("cannot open file %s: ", fullfilename.c_str()); diff --git a/src/nhttpd/yhttpd_mods/mod_yparser.cpp b/src/nhttpd/yhttpd_mods/mod_yparser.cpp index 95c68297b..44221f20c 100644 --- a/src/nhttpd/yhttpd_mods/mod_yparser.cpp +++ b/src/nhttpd/yhttpd_mods/mod_yparser.cpp @@ -181,7 +181,7 @@ void CyParser::cgi(CyhookHandler *hh) { yresult = cgi_file_parsing(hh, htmlfilename, ydebug); } else printf("[CyParser] Y-cgi:no parameter given\n"); - if (yresult.length() <= 0) + if (yresult.empty()) hh->SetError(HTTP_NOT_IMPLEMENTED, HANDLED_NOT_IMPLEMENTED); else hh->addResult(yresult, HANDLED_READY); @@ -249,7 +249,7 @@ void CyParser::ParseAndSendFile(CyhookHandler *hh) { } // parsing given file yresult += cgi_file_parsing(hh, hh->UrlData["path"]+hh->UrlData["filename"], ydebug); - if (yresult.length() <= 0) + if (yresult.empty()) hh->SetError(HTTP_NOT_IMPLEMENTED, HANDLED_NOT_IMPLEMENTED); else { hh->addResult(yresult, HANDLED_READY); @@ -582,7 +582,7 @@ std::string CyParser::YWeb_cgi_include_block(std::string filename, blockname.c_str()); } pthread_mutex_unlock(&yParser_mutex); - if (yfile.length() != 0) { + if (!yfile.empty()) { std::string t = "start-block~" + blockname; std::string::size_type start, end; if ((start = yfile.find(t)) != std::string::npos) { diff --git a/src/system/ytcache.cpp b/src/system/ytcache.cpp index d0273f5ec..0463d8531 100644 --- a/src/system/ytcache.cpp +++ b/src/system/ytcache.cpp @@ -307,7 +307,7 @@ void cYTCache::cancelAll(MI_MOVIE_INFO::miSource source) { OpenThreads::ScopedLock m_lock(mutex); cancelled = false; - if (pending.size() > 0) { + if (!pending.empty()) { if (pthread_create(&thread, NULL, downloadThread, this)) { perror("pthread_create"); return; @@ -344,7 +344,7 @@ std::vector cYTCache::getPending(MI_MOVIE_INFO::miSource source, for (std::vector::iterator it = pending.begin(); it != pending.end(); ++it) if ((*it).source == source) res.push_back(*it); - if (res.size() > 0 && pending.front().source == source) { + if (!res.empty() && pending.front().source == source) { if (p_dltotal) *p_dltotal = dltotal; if (p_dlnow)