mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-13 16:33:42 +02:00
neutrino use check empty() instead of length() or size()
This commit is contained in:
@@ -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;
|
||||
|
@@ -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() );
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -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));
|
||||
}
|
||||
|
@@ -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());
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -1402,7 +1402,7 @@ void CControlAPI::EpgSearchCGI(CyhookHandler *hh, bool xml_forat )
|
||||
hh->printf("\t\t<info2>%s</info2>\n",ZapitTools::UTF8_to_UTF8XML(epg.info2.c_str()).c_str());
|
||||
if (CEitManager::getInstance()->getEPGid(eventIterator->eventID, eventIterator->startTime, &longepg)) {
|
||||
hh->printf("\t\t<fsk>%u</fsk>\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<genre>%s</genre>\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);
|
||||
|
@@ -534,7 +534,7 @@ unsigned int CWebserverRequest::HandlePostBoundary(std::string boundary,
|
||||
}
|
||||
log_level_printf(2,"<POST Boundary> 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,"<POST Boundary> read file End\n");
|
||||
|
@@ -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());
|
||||
|
@@ -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) {
|
||||
|
@@ -307,7 +307,7 @@ void cYTCache::cancelAll(MI_MOVIE_INFO::miSource source)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> 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<MI_MOVIE_INFO> cYTCache::getPending(MI_MOVIE_INFO::miSource source,
|
||||
for (std::vector<MI_MOVIE_INFO>::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)
|
||||
|
Reference in New Issue
Block a user