Project "Tuxbox-GIT: apps": The branch, master has been updated via 8f9abfa8c0b426b42231f8ede21d3a434ec12e65 (commit) via 8d7215d40fa907d95568e6852d54b21af02ea8a0 (commit) via 155e42daa74ea4e5e1ca4ab789430c0056f904dc (commit) via 35e42b607dd140eb2a990be519b093af6c99f776 (commit) via 2ccff82fe9c1f58060487e74c0e29049d848368c (commit) via 74a24e3364a44c5d17f21bf1560ba056a4e571e4 (commit) via ec1bb8bcdd17a86ff34df8694dbd5221e36031a1 (commit) via ae16f57cc525556d829511166b2ca058a6ddcc62 (commit) via bd7b8acdcb425b48d278c893bf709ccc0cbd9359 (commit) via bc5228d81bb23518a182db94c6df0287bc3fdfd9 (commit) via 27260ea172d037de57fa691c5c670ddfe85cf897 (commit) via ad2ecda9e11da3ca2cb6f38e4229a214d58568bd (commit) via adf6297278c2de1f7758e98151e2bfb9fcf8bb90 (commit) via a726e172299ec8521db9f8d636dc7aa7420a9ed7 (commit) via 02873f78090484613c7e632844dbbca8cc1ea7a8 (commit) from 8cade3ffa8084dba2171ab4cabb90065fb692659 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8f9abfa8c0b426b42231f8ede21d3a434ec12e65 Author: Christian Schuett <gaucho...@hotmail.com> Date: Sun Nov 2 20:53:20 2014 +0100 nhttpd controlapi: allow zapping to subchannels based on idea by Moritz Venn <moritz.v...@freaque.net> Signed-off-by: Christian Schuett <gaucho...@hotmail.com> Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/daemons/nhttpd/doc/nhttpd_controlapi.html b/tuxbox/neutrino/daemons/nhttpd/doc/nhttpd_controlapi.html index 62cdf55..3a7748e 100644 --- a/tuxbox/neutrino/daemons/nhttpd/doc/nhttpd_controlapi.html +++ b/tuxbox/neutrino/daemons/nhttpd/doc/nhttpd_controlapi.html @@ -800,6 +800,20 @@ Beispiel:<br> >>>http://dbox/control/zapto?name=Das%20Erste<br> ok <br> </div> +<br> +<b>Parameter:</b> subchannel=<channel_id> (64 bit, hexidecimal value)<br> +<b>Rueckgabe:</b><br> +<br> +Zappt auf den angegebenen Unterkanal.<br> +Als Rueckgabe ist im Erfolgsfall ok zu erwarten.<br> +<br> +<b>Rueckgabe-Format:</b> ok / error<br> +<div class="example"> +Beispiel:<br> +<br> +>>>http://dbox/control/zapto?subchannel=1008500d4<br> +ok <br> +</div> <!-- *********************************************************** --> <div class="title1"><a name="setmode"></a>7. Radio/TV, Record Mode</div> diff --git a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp index f2a7188..d6f825b 100644 --- a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp @@ -1428,7 +1428,8 @@ void CControlAPI::ZaptoCGI(CyhookHandler *hh) CSectionsdClient::LinkageDescriptorList desc; CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo; bool has_current_next = NeutrinoAPI->Sectionsd->getCurrentNextServiceKey(current_channel, currentNextInfo); - if (has_current_next && NeutrinoAPI->Sectionsd->getLinkageDescriptorsUniqueKey(currentNextInfo.current_uniqueKey, desc)) + if (has_current_next && currentNextInfo.flags & CSectionsdClient::epgflags::current_has_linkagedescriptors && + NeutrinoAPI->Sectionsd->getLinkageDescriptorsUniqueKey(currentNextInfo.current_uniqueKey, desc)) { for(unsigned int i=0;i< desc.size();i++) { @@ -1454,6 +1455,19 @@ void CControlAPI::ZaptoCGI(CyhookHandler *hh) else hh->SendError(); } + else if (!hh->ParamList["subchannel"].empty()) + { + t_channel_id current_channel = NeutrinoAPI->Zapit->getCurrentServiceID(); + CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo; + bool has_current_next = NeutrinoAPI->Sectionsd->getCurrentNextServiceKey(current_channel, currentNextInfo); + if (has_current_next && currentNextInfo.flags & CSectionsdClient::epgflags::current_has_linkagedescriptors) + { + NeutrinoAPI->ZapToSubService(hh->ParamList["subchannel"].c_str()); + hh->SendOk(); + } + else + hh->SendError(); + } else { NeutrinoAPI->ZapTo(hh->ParamList["1"].c_str()); commit 8d7215d40fa907d95568e6852d54b21af02ea8a0 Author: Christian Schuett <gaucho...@hotmail.com> Date: Sun Nov 2 17:27:15 2014 +0100 nhttpd helper: pass std::string by reference if possible Signed-off-by: Christian Schuett <gaucho...@hotmail.com> Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.cpp index 471eb23..8e17c03 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.cpp @@ -92,7 +92,7 @@ std::string string_printf(const char *fmt, ...) // ySplitString: spit string "str" in two strings "left" and "right" at // one of the chars in "delimiter" returns true if delimiter found //------------------------------------------------------------------------- -bool ySplitString(std::string str, std::string delimiter, std::string& left, std::string& right) +bool ySplitString(const std::string &str, const std::string &delimiter, std::string &left, std::string &right) { std::string::size_type pos; if ((pos = str.find_first_of(delimiter)) != std::string::npos) @@ -111,7 +111,7 @@ bool ySplitString(std::string str, std::string delimiter, std::string& left, std // ySplitString: spit string "str" in two strings "left" and "right" at // one of the chars in "delimiter" returns true if delimiter found //------------------------------------------------------------------------- -bool ySplitStringExact(std::string str, std::string delimiter, std::string& left, std::string& right) +bool ySplitStringExact(const std::string &str, const std::string &delimiter, std::string &left, std::string &right) { std::string::size_type pos; if ((pos = str.find(delimiter)) != std::string::npos) @@ -130,7 +130,7 @@ bool ySplitStringExact(std::string str, std::string delimiter, std::string& left // ySplitStringRight: spit string "str" in two strings "left" and "right" at // one of the chars in "delimiter" returns true if delimiter found //------------------------------------------------------------------------- -bool ySplitStringLast(std::string str, std::string delimiter, std::string& left, std::string& right) +bool ySplitStringLast(const std::string &str, const std::string &delimiter, std::string &left, std::string &right) { std::string::size_type pos; if ((pos = str.find_last_of(delimiter)) != std::string::npos) @@ -148,7 +148,7 @@ bool ySplitStringLast(std::string str, std::string delimiter, std::string& left, //------------------------------------------------------------------------- // ySplitStringVector: spit string "str" and build vector of strings //------------------------------------------------------------------------- -CStringArray ySplitStringVector(std::string str, std::string delimiter) +CStringArray ySplitStringVector(const std::string &str, const std::string &delimiter) { std::string left, right, rest; bool found; @@ -203,7 +203,7 @@ bool nocase_compare (char c1, char c2) //----------------------------------------------------------------------------- // Decode URLEncoded std::string //----------------------------------------------------------------------------- -std::string decodeString(std::string encodedString) +std::string decodeString(const std::string &encodedString) { const char *string = encodedString.c_str(); unsigned int count=0; @@ -239,7 +239,7 @@ std::string decodeString(std::string encodedString) //----------------------------------------------------------------------------- // HTMLEncode std::string //----------------------------------------------------------------------------- -std::string encodeString(std::string decodedString) +std::string encodeString(const std::string &decodedString) { unsigned int len = sizeof(char) * decodedString.length()*5 + 1; std::string result( len, '\0' ); @@ -279,7 +279,7 @@ std::string string_tolower(std::string str) //----------------------------------------------------------------------------- // write string to a file //----------------------------------------------------------------------------- -bool write_to_file(std::string filename, std::string content) +bool write_to_file(const std::string &filename, const std::string &content) { FILE *fd = NULL; if((fd = fopen(filename.c_str(),"w")) != NULL) // open file diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.h b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.h index 2d570ac..2b22c66 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.h +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.h @@ -21,8 +21,8 @@ void correctTime(struct tm *zt); //----------------------------------------------------------------------------- std::string itoa(unsigned int conv); std::string itoh(unsigned int conv); -std::string decodeString(std::string encodedString); -std::string encodeString(std::string decodedString); +std::string decodeString(const std::string &encodedString); +std::string encodeString(const std::string &decodedString); std::string string_tolower(std::string str); //----------------------------------------------------------------------------- @@ -31,12 +31,12 @@ std::string string_tolower(std::string str); std::string trim(std::string const& source, char const* delims = " \t\r\n"); void replace(std::string &str, const std::string &find_what, const std::string &replace_with); std::string string_printf(const char *fmt, ...); -bool ySplitString(std::string str, std::string delimiter, std::string& left, std::string& right); -bool ySplitStringExact(std::string str, std::string delimiter, std::string& left, std::string& right); -bool ySplitStringLast(std::string str, std::string delimiter, std::string& left, std::string& right); -CStringArray ySplitStringVector(std::string str, std::string delimiter); +bool ySplitString(const std::string &str, const std::string &delimiter, std::string &left, std::string &right); +bool ySplitStringExact(const std::string &str, const std::string &delimiter, std::string &left, std::string &right); +bool ySplitStringLast(const std::string &str, const std::string &delimiter, std::string &left, std::string &right); +CStringArray ySplitStringVector(const std::string &str, const std::string &delimiter); bool nocase_compare (char c1, char c2); std::string timeString(time_t time); -bool write_to_file(std::string filename, std::string content); +bool write_to_file(const std::string &filename, const std::string &content); #endif /* __yhttpd_helper_h__ */ commit 155e42daa74ea4e5e1ca4ab789430c0056f904dc Author: GetAway <get-a...@t-online.de> Date: Sat Nov 1 19:13:18 2014 +0100 tuxmaild: fix mail header parsing version bump 1.51C Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/plugins/tuxmail/daemon/tuxmaild.c b/tuxbox/plugins/tuxmail/daemon/tuxmaild.c index 5069113..06af926 100644 --- a/tuxbox/plugins/tuxmail/daemon/tuxmaild.c +++ b/tuxbox/plugins/tuxmail/daemon/tuxmaild.c @@ -829,7 +829,7 @@ int DecodeHeader(char *encodedstring) { char *ptrS, *ptrE; - if((ptrS = strstr(encodedstring, "?B?"))) + if((ptrS = strstr(encodedstring, "?B?")) || (ptrS = strstr(encodedstring, "?b?"))) { ptrS += 3; @@ -840,7 +840,7 @@ int DecodeHeader(char *encodedstring) return ptrE+2 - encodedstring; } } - else if((ptrS = strstr(encodedstring, "?Q?"))) + else if((ptrS = strstr(encodedstring, "?Q?")) || (ptrS = strstr(encodedstring, "?q?"))) { ptrS += 3; @@ -4800,7 +4800,7 @@ void SigHandler(int signal) int main(int argc, char **argv) { - char cvs_revision[] = "$Revision: 1.51B $"; + char cvs_revision[] = "$Revision: 1.51C $"; int param, nodelay = 0, account, mailstatus, unread_mailstatus; pthread_t thread_id; void *thread_result = 0; commit 35e42b607dd140eb2a990be519b093af6c99f776 Author: Christian Schuett <gaucho...@hotmail.com> Date: Fri Oct 31 18:12:37 2014 +0100 Neutrino: check emptiness of strings with empty() Signed-off-by: Christian Schuett <gaucho...@hotmail.com> Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp index cdaeadd..f2a7188 100644 --- a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp @@ -51,7 +51,7 @@ CControlAPI::CControlAPI(CNeutrinoAPI *_NeutrinoAPI) //----------------------------------------------------------------------------- void CControlAPI::init(CyhookHandler *hh) { - if(PLUGIN_DIRS[0] == "") + if(PLUGIN_DIRS[0].empty()) { // given in nhttpd.conf PLUGIN_DIRS[0]=hh->WebserverConfigList["PublicDocumentRoot"]; PLUGIN_DIRS[0].append("/scripts"); @@ -226,7 +226,7 @@ void CControlAPI::Execute(CyhookHandler *hh) else if(std::string(yCgiCallList[index].mime_type) == "") // decide in function ; else if(std::string(yCgiCallList[index].mime_type) == "+xml") // Parameter xml? - if (hh->ParamList["xml"] != "") + if (!hh->ParamList["xml"].empty()) hh->SetHeader(HTTP_OK, "text/xml; charset=iso-8859-1"); else hh->SetHeader(HTTP_OK, "text/html; charset=iso-8859-1"); @@ -264,7 +264,7 @@ void CControlAPI::TimerCGI(CyhookHandler *hh) NeutrinoAPI->Timerd->removeTimerEvent(removeId); hh->SendOk(); } - else if(hh->ParamList["get"] != "") + else if(!hh->ParamList["get"].empty()) { int pre=0,post=0; NeutrinoAPI->Timerd->getRecordingSafety(pre,post); @@ -807,11 +807,11 @@ void CControlAPI::RCEmCGI(CyhookHandler *hh) } unsigned int repeat = 1; unsigned int delay = 250; - if (hh->ParamList["delay"] != "") + if (!hh->ParamList["delay"].empty()) delay = atoi(hh->ParamList["delay"].c_str()); - if (hh->ParamList["duration"] != "") + if (!hh->ParamList["duration"].empty()) repeat = atoi(hh->ParamList["duration"].c_str())*1000/delay; - if (hh->ParamList["repeat"] != "") + if (!hh->ParamList["repeat"].empty()) repeat = atoi(hh->ParamList["repeat"].c_str()); int evd = open(EVENTDEV, O_RDWR); @@ -973,7 +973,7 @@ void CControlAPI::VolumeCGI(CyhookHandler *hh) { hh->Write((char *) (NeutrinoAPI->Controld->getMute() ? "1" : "0")); // mute } - else if(hh->ParamList["1"]!="") + else if(!hh->ParamList["1"].empty()) { //set volume char vol = atol( hh->ParamList["1"].c_str() ); NeutrinoAPI->Controld->setVolume(vol); @@ -1198,7 +1198,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) } } } - else if (hh->ParamList["eventid"] != "") + else if (!hh->ParamList["eventid"].empty()) { //special epg query unsigned long long epgid; @@ -1211,9 +1211,9 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) hh->WriteLn(epg.info2); } } - else if (hh->ParamList["eventid2fsk"] != "") + else if (!hh->ParamList["eventid2fsk"].empty()) { - if (hh->ParamList["starttime"] != "") + if (!hh->ParamList["starttime"].empty()) { unsigned long long epgid; time_t starttime; @@ -1442,7 +1442,7 @@ void CControlAPI::ZaptoCGI(CyhookHandler *hh) } } } - else if (hh->ParamList["name"] != "") + else if (!hh->ParamList["name"].empty()) { t_channel_id channel_id; channel_id = NeutrinoAPI->ChannelNameToChannelId(hh->ParamList["name"]); @@ -1472,7 +1472,7 @@ void CControlAPI::StartPluginCGI(CyhookHandler *hh) std::string pluginname; if (!(hh->ParamList.empty())) { - if (hh->ParamList["name"] != "") + if (!hh->ParamList["name"].empty()) { pluginname = hh->ParamList["name"]; //pluginname=decodeString(pluginname); @@ -1517,21 +1517,21 @@ void CControlAPI::LCDAction(CyhookHandler *hh) return; } - if (hh->ParamList["lock"] != "") + if (!hh->ParamList["lock"].empty()) if(sscanf( hh->ParamList["lock"].c_str(), "%d", &tval)) NeutrinoAPI->LcdAPI->LockDisplay(tval); else error=1; - if (hh->ParamList["clear"] != "") + if (!hh->ParamList["clear"].empty()) if(sscanf( hh->ParamList["clear"].c_str(), "%d", &tval)) if(tval) NeutrinoAPI->LcdAPI->Clear(); else error=1; - if (hh->ParamList["png"] != "") + if (!hh->ParamList["png"].empty()) if(! NeutrinoAPI->LcdAPI->ShowPng((char*)hh->ParamList["png"].c_str())) error=1; - if (hh->ParamList["raw"] != "") + if (!hh->ParamList["raw"].empty()) { char *sptr=strdup((char*)hh->ParamList["raw"].c_str()),*pptr; int loop=4; @@ -1550,44 +1550,44 @@ void CControlAPI::LCDAction(CyhookHandler *hh) if(sptr) free(sptr); } - if (hh->ParamList["line"] != "") + if (!hh->ParamList["line"].empty()) if(sscanf( hh->ParamList["line"].c_str(), "%d,%d,%d,%d,%d",&x1,&y1,&x2,&y2,&coll)==5) NeutrinoAPI->LcdAPI->DrawLine(x1,y1,x2,y2,coll); else error=1; - if (hh->ParamList["rect"] != "") + if (!hh->ParamList["rect"].empty()) if(sscanf( hh->ParamList["rect"].c_str(), "%d,%d,%d,%d,%d,%d",&x1,&y1,&x2,&y2,&coll,&colf)==6) NeutrinoAPI->LcdAPI->DrawRect(x1,y1,x2,y2,coll,colf); else error=1; - if (hh->ParamList["xpos"] != "") + if (!hh->ParamList["xpos"].empty()) if(sscanf( hh->ParamList["xpos"].c_str(), "%d", &tval)) xpos=tval; else error=1; - if (hh->ParamList["ypos"] != "") + if (!hh->ParamList["ypos"].empty()) if(sscanf( hh->ParamList["ypos"].c_str(), "%d", &tval)) ypos=tval; else error=1; - if (hh->ParamList["size"] != "") + if (!hh->ParamList["size"].empty()) if(sscanf( hh->ParamList["size"].c_str(), "%d", &tval)) size=tval; else error=1; - if (hh->ParamList["color"] != "") + if (!hh->ParamList["color"].empty()) if(sscanf( hh->ParamList["color"].c_str(), "%d", &tval)) color=tval; else error=1; - if (hh->ParamList["font"] != "") + if (!hh->ParamList["font"].empty()) if(sscanf( hh->ParamList["font"].c_str(), "%d", &tval) && tval>=0 && tval<3) font=tval; else error=1; - if (hh->ParamList["text"] != "") + if (!hh->ParamList["text"].empty()) NeutrinoAPI->LcdAPI->DrawText(xpos, ypos, size, color, font, (char*)hh->ParamList["text"].c_str()); - if (hh->ParamList["update"] != "") + if (!hh->ParamList["update"].empty()) if(sscanf( hh->ParamList["update"].c_str(), "%d", &tval)) if(tval) NeutrinoAPI->LcdAPI->Update(); @@ -2194,7 +2194,7 @@ void CControlAPI::YWebCGI(CyhookHandler *hh) { bool status=true; int para; - if (hh->ParamList["video_stream_pids"] != "") + if (!hh->ParamList["video_stream_pids"].empty()) { para=0; sscanf( hh->ParamList["video_stream_pids"].c_str(), "%d", ¶); @@ -2221,7 +2221,7 @@ void CControlAPI::YWeb_SendVideoStreamingPids(CyhookHandler *hh, int apid_no) apid_idx=apid_no; if(!pids.APIDs.empty()) apid = pids.APIDs[apid_idx].pid; - if(hh->ParamList["no_commas"] != "") + if(!hh->ParamList["no_commas"].empty()) { hh->printf("0x%04x 0x%04x 0x%04x",pids.PIDs.pmtpid,pids.PIDs.vpid,apid); if (pids.PIDs.pcrpid != 0 && pids.PIDs.pcrpid != pids.PIDs.vpid) @@ -2316,17 +2316,17 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) int alHour=0; // if alarm given then in parameters im time_t format - if(hh->ParamList["alarm"] != "") + if(!hh->ParamList["alarm"].empty()) { alarmTimeT = atoi(hh->ParamList["alarm"].c_str()); - if(hh->ParamList["stop"] != "") + if(!hh->ParamList["stop"].empty()) stopTimeT = atoi(hh->ParamList["stop"].c_str()); - if(hh->ParamList["announce"] != "") + if(!hh->ParamList["announce"].empty()) announceTimeT = atoi(hh->ParamList["announce"].c_str()); else announceTimeT = alarmTimeT; } - else if(hh->ParamList["alDate"] != "") //given formatted + else if(!hh->ParamList["alDate"].empty()) //given formatted { // Alarm Date - Format exact! DD.MM.YYYY tnull = time(NULL); @@ -2339,7 +2339,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) } // Alarm Time - Format exact! HH:MM - if(hh->ParamList["alTime"] != "") + if(!hh->ParamList["alTime"].empty()) sscanf(hh->ParamList["alTime"].c_str(),"%2d.%2d",&(alarmTime->tm_hour), &(alarmTime->tm_min)); alHour = alarmTime->tm_hour; correctTime(alarmTime); @@ -2348,11 +2348,11 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) struct tm *stopTime = localtime(&alarmTimeT); stopTime->tm_sec = 0; // Stop Time - Format exact! HH:MM - if(hh->ParamList["stTime"] != "") + if(!hh->ParamList["stTime"].empty()) sscanf(hh->ParamList["stTime"].c_str(),"%2d.%2d",&(stopTime->tm_hour), &(stopTime->tm_min)); // Stop Date - Format exact! DD.MM.YYYY - if(hh->ParamList["stDate"] != "") + if(!hh->ParamList["stDate"].empty()) if(sscanf(hh->ParamList["stDate"].c_str(),"%2d.%2d.%4d",&(stopTime->tm_mday), &(stopTime->tm_mon), &(stopTime->tm_year)) == 3) { stopTime->tm_mon -= 1; @@ -2360,7 +2360,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) } correctTime(stopTime); stopTimeT = mktime(stopTime); - if(hh->ParamList["stDate"] == "" && alHour > stopTime->tm_hour) + if(hh->ParamList["stDate"].empty() && alHour > stopTime->tm_hour) stopTimeT += 24* 60 * 60; // add 1 Day } else // alarm/stop time given in pieces @@ -2368,15 +2368,15 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) // alarm time time_t now = time(NULL); struct tm *alarmTime=localtime(&now); - if(hh->ParamList["ad"] != "") + if(!hh->ParamList["ad"].empty()) alarmTime->tm_mday = atoi(hh->ParamList["ad"].c_str()); - if(hh->ParamList["amo"] != "") + if(!hh->ParamList["amo"].empty()) alarmTime->tm_mon = atoi(hh->ParamList["amo"].c_str())-1; - if(hh->ParamList["ay"] != "") + if(!hh->ParamList["ay"].empty()) alarmTime->tm_year = atoi(hh->ParamList["ay"].c_str())-1900; - if(hh->ParamList["ah"] != "") + if(!hh->ParamList["ah"].empty()) alarmTime->tm_hour = atoi(hh->ParamList["ah"].c_str()); - if(hh->ParamList["ami"] != "") + if(!hh->ParamList["ami"].empty()) alarmTime->tm_min = atoi(hh->ParamList["ami"].c_str()); alarmTime->tm_sec = 0; correctTime(alarmTime); @@ -2385,15 +2385,15 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) // stop time struct tm *stopTime = alarmTime; - if(hh->ParamList["sd"] != "") + if(!hh->ParamList["sd"].empty()) stopTime->tm_mday = atoi(hh->ParamList["sd"].c_str()); - if(hh->ParamList["smo"] != "") + if(!hh->ParamList["smo"].empty()) stopTime->tm_mon = atoi(hh->ParamList["smo"].c_str())-1; - if(hh->ParamList["sy"] != "") + if(!hh->ParamList["sy"].empty()) stopTime->tm_year = atoi(hh->ParamList["sy"].c_str())-1900; - if(hh->ParamList["sh"] != "") + if(!hh->ParamList["sh"].empty()) stopTime->tm_hour = atoi(hh->ParamList["sh"].c_str()); - if(hh->ParamList["smi"] != "") + if(!hh->ParamList["smi"].empty()) stopTime->tm_min = atoi(hh->ParamList["smi"].c_str()); stopTime->tm_sec = 0; correctTime(stopTime); @@ -2404,22 +2404,22 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) announceTimeT -= 60; CTimerd::CTimerEventTypes type; - if(hh->ParamList["type"] != "") + if(!hh->ParamList["type"].empty()) type = (CTimerd::CTimerEventTypes) atoi(hh->ParamList["type"].c_str()); else // default is: record type = CTimerd::TIMER_RECORD; // repeat - if(hh->ParamList["repcount"] != "") + if(!hh->ParamList["repcount"].empty()) { repCount = atoi(hh->ParamList["repcount"].c_str()); } CTimerd::CTimerEventRepeat rep; - if(hh->ParamList["rep"] != "") + if(!hh->ParamList["rep"].empty()) rep = (CTimerd::CTimerEventRepeat) atoi(hh->ParamList["rep"].c_str()); else // default: no repeat rep = (CTimerd::CTimerEventRepeat)0; - if(((int)rep) >= ((int)CTimerd::TIMERREPEAT_WEEKDAYS) && hh->ParamList["wd"] != "") + if(((int)rep) >= ((int)CTimerd::TIMERREPEAT_WEEKDAYS) && !hh->ParamList["wd"].empty()) NeutrinoAPI->Timerd->getWeekdaysFromStr((int*)&rep, hh->ParamList["wd"].c_str()); // apids @@ -2457,7 +2457,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) eventinfo.recordingSafety = (hh->ParamList["rs"] == "1"); // channel by Id or name - if(hh->ParamList["channel_id"] != "") + if(!hh->ParamList["channel_id"].empty()) sscanf(hh->ParamList["channel_id"].c_str(), SCANF_CHANNEL_ID_TYPE, &eventinfo.channel_id); @@ -2477,7 +2477,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) data= &eventinfo; else if (type==CTimerd::TIMER_RECORD) { - if(_rec_dir == "") + if(_rec_dir.empty()) { // get Default Recordingdir CConfigFile *Config = new CConfigFile(','); @@ -2508,7 +2508,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) // update or add timer if(hh->ParamList["update"]=="1") { - if(hh->ParamList["id"] != "") + if(!hh->ParamList["id"].empty()) { unsigned modyId = atoi(hh->ParamList["id"].c_str()); if(type == CTimerd::TIMER_RECORD) @@ -2551,7 +2551,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) //------------------------------------------------------------------------- void CControlAPI::setBouquetCGI(CyhookHandler *hh) { - if (hh->ParamList["selected"] != "") { + if (!hh->ParamList["selected"].empty()) { int selected = atoi(hh->ParamList["selected"].c_str()); if(hh->ParamList["action"].compare("hide") == 0) NeutrinoAPI->Zapit->setBouquetHidden(selected - 1,true); @@ -2576,7 +2576,7 @@ void CControlAPI::saveBouquetCGI(CyhookHandler *hh) //------------------------------------------------------------------------- void CControlAPI::moveBouquetCGI(CyhookHandler *hh) { - if (hh->ParamList["selected"] != "" && ( + if (!hh->ParamList["selected"].empty() && ( hh->ParamList["action"] == "up" || hh->ParamList["action"] == "down")) { @@ -2598,7 +2598,7 @@ void CControlAPI::deleteBouquetCGI(CyhookHandler *hh) { int selected = -1; - if (hh->ParamList["selected"] != "") { + if (!hh->ParamList["selected"].empty()) { selected = atoi(hh->ParamList["selected"].c_str()); NeutrinoAPI->Zapit->deleteBouquet(selected - 1); hh->SendOk(); @@ -2624,9 +2624,9 @@ void CControlAPI::addBouquetCGI(CyhookHandler *hh) //------------------------------------------------------------------------- void CControlAPI::renameBouquetCGI(CyhookHandler *hh) { - if (hh->ParamList["selected"] != "") + if (!hh->ParamList["selected"].empty()) { - if (hh->ParamList["nameto"] != "") + if (!hh->ParamList["nameto"].empty()) { if (NeutrinoAPI->Zapit->existsBouquet((hh->ParamList["nameto"]).c_str()) == -1) { @@ -2667,7 +2667,7 @@ void CControlAPI::changeBouquetCGI(CyhookHandler *hh) NeutrinoAPI->Zapit->renumChannellist(); NeutrinoAPI->UpdateBouquets(); - if(hh->ParamList["redirect"] != "") + if(!hh->ParamList["redirect"].empty()) hh->SendRewrite(hh->ParamList["redirect"]); else hh->SendOk(); @@ -2695,7 +2695,7 @@ void CControlAPI::build_live_url(CyhookHandler *hh) int apid=0,apid_no=0,apid_idx=0; pids.PIDs.vpid=0; - if(hh->ParamList["audio_no"] !="") + if(!hh->ParamList["audio_no"].empty()) apid_no = atoi(hh->ParamList["audio_no"].c_str()); NeutrinoAPI->Zapit->getPIDS(pids); @@ -2722,14 +2722,14 @@ void CControlAPI::build_live_url(CyhookHandler *hh) hh->SendError(); // build url std::string url = ""; - if(hh->ParamList["host"] !="") + if(!hh->ParamList["host"].empty()) url = "http://"+hh->ParamList["host"]; else url = "http://"+hh->HeaderList["Host"]; url += (mode == CZapitClient::MODE_TV) ? ":31339/0," : ":31338/"; url += xpids; // response url - if(hh->ParamList["vlc_link"] !="") + if(!hh->ParamList["vlc_link"].empty()) { write_to_file("/tmp/vlc.m3u", url); hh->SendRedirect("/tmp/vlc.m3u"); diff --git a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/neutrinoyparser.cpp b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/neutrinoyparser.cpp index 38542af..ef59fbe 100644 --- a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/neutrinoyparser.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/neutrinoyparser.cpp @@ -157,7 +157,7 @@ std::string CNeutrinoYParser::func_mount_get_list(CyhookHandler */*hh*/, std::s yip = Config->getString("network_nfs_ip_"+ynr,""); ydir = Config->getString("network_nfs_dir_"+ynr,""); ylocal_dir = Config->getString("network_nfs_local_dir_"+ynr,""); - if(ydir != "") + if(!ydir.empty()) ydir="("+ydir+")"; yresult += string_printf("<input type='radio' name='R1' value='%d' %s />%d %s - %s %s %s<br/>", @@ -201,7 +201,7 @@ std::string CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler */*hh unsigned int nr=1; ySplitString(para," ",nr_str, do_show_hidden); - if(nr_str != "") + if(!nr_str.empty()) nr = atoi(nr_str.c_str()); for (unsigned int i = 0; i < NeutrinoAPI->BouquetList.size();i++) @@ -268,7 +268,7 @@ std::string CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler */*hh int mode = CZapitClient::MODE_CURRENT; ySplitString(para," ",abouquet, achannel_id); - if(abouquet != "") + if(!abouquet.empty()) bnumber = atoi(abouquet.c_str()); if(bnumber != 0) //Bouquet View @@ -300,7 +300,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: CZapitClient::BouquetChannelList *channellist; ySplitString(para," ",abnumber, tmp); - if(abnumber != "") + if(!abnumber.empty()) BouquetNr = atoi(abnumber.c_str()); if (BouquetNr > 0) channellist = NeutrinoAPI->GetBouquet(BouquetNr, CZapitClient::MODE_CURRENT); @@ -317,7 +317,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: std::string timestr; bool have_logos = false; - if(hh->WebserverConfigList["TUXBOX_LOGOS_URL"] != "") + if(!hh->WebserverConfigList["TUXBOX_LOGOS_URL"].empty()) have_logos = true; CZapitClient::BouquetChannelList::iterator channel = channellist->begin(); for (; channel != channellist->end(); ++channel) @@ -482,7 +482,7 @@ std::string CNeutrinoYParser::func_get_video_pids(CyhookHandler */*hh*/, std::s int apid=0,apid_no=0,apid_idx=0; pids.PIDs.vpid=0; - if(para != "") + if(!para.empty()) apid_no = atoi(para.c_str()); NeutrinoAPI->Zapit->getPIDS(pids); @@ -641,7 +641,7 @@ std::string CNeutrinoYParser::func_get_partition_list(CyhookHandler */*hh*/, st in >> ymtd >> dummy >> dummy; //format: mtd# start end "name " in.getline(ytmp, 200); // Rest of line is the mtd description yname = ytmp; - if((j>0) && (ymtd != ""))// iggnore first line + if((j>0) && !ymtd.empty())// iggnore first line { ysel = ((j==1) ? "checked=\"checked\"" : ""); yresult += string_printf("<input type='radio' name='R1' value='%d' %s title='%s' />%d %s<br/>", @@ -860,7 +860,7 @@ std::string CNeutrinoYParser::func_set_timer_form(CyhookHandler *hh, std::strin if(cmd != "new") { // init timerid - if(stimerid != "") + if(!stimerid.empty()) timerId = (unsigned)atoi(stimerid.c_str()); NeutrinoAPI->Timerd->getTimer(timer, timerId); @@ -1004,7 +1004,7 @@ std::string CNeutrinoYParser::func_bouquet_editor_main(CyhookHandler *hh, std:: if (hh->ParamList["saved"] == "1") hh->ParamList["have_saved"]="true"; - if (hh->ParamList["selected"] != "") + if (!hh->ParamList["selected"].empty()) selected = atoi(hh->ParamList["selected"].c_str()); // List of all bouquets diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd.cpp index a8197c7..285c3b0 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd.cpp @@ -221,7 +221,7 @@ bool Cyhttpd::Configure() std::string groupname= ConfigList["server.group_name"]; // get user data - if(username != "") + if(!username.empty()) { if((pwd = getpwnam(username.c_str())) == NULL) { @@ -230,7 +230,7 @@ bool Cyhttpd::Configure() } } // get group data - if(groupname != "") + if(!groupname.empty()) { if((grp = getgrnam(groupname.c_str())) == NULL) { @@ -259,7 +259,7 @@ bool Cyhttpd::Configure() } #endif #ifdef Y_CONFIG_FEATURE_HTTPD_USER - if(username != "" && pwd != NULL && grp != NULL) + if(!username.empty() && pwd != NULL && grp != NULL) { log_level_printf(2, "set user and groups\n"); @@ -267,7 +267,7 @@ bool Cyhttpd::Configure() setgid(grp->gr_gid); setgroups(0, NULL); // set user group - if(groupname != "") + if(!groupname.empty()) initgroups(username.c_str(), grp->gr_gid); // set user if(setuid(pwd->pw_uid) == -1) @@ -433,11 +433,11 @@ void Cyhttpd::ReadConfig(void) Config->setBool("webserver.threading", OrgConfig.getBool("THREADS", true)); Config->setInt32("WebsiteMain.port",OrgConfig.getInt32("Port", HTTPD_STANDARD_PORT)); Config->setString("WebsiteMain.directory", OrgConfig.getString("PrivatDocRoot", PRIVATEDOCUMENTROOT)); - if(OrgConfig.getString("PublicDocRoot", "") != "") + if(!OrgConfig.getString("PublicDocRoot", "").empty()) Config->setString("WebsiteMain.override_directory", OrgConfig.getString("PublicDocRoot", PRIVATEDOCUMENTROOT)); - if(OrgConfig.getString("HostedDocRoot", "") != "") + if(!OrgConfig.getString("HostedDocRoot", "").empty()) Config->setString("WebsiteMain.special_locations", "/hosted/="+OrgConfig.getString("HostedDocRoot", PRIVATEDOCUMENTROOT)); - if(OrgConfig.getString("HostedDocRoot", "") != "") + if(!OrgConfig.getString("HostedDocRoot", "").empty()) Config->setString("Tuxbox.HostedDocumentRoot", OrgConfig.getString("HostedDocRoot", PRIVATEDOCUMENTROOT)); // mod_auth Config->setString("mod_auth.username", OrgConfig.getString("AuthUser", AUTHUSER)); diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yrequest.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yrequest.cpp index 35de525..d861516 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yrequest.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yrequest.cpp @@ -61,7 +61,7 @@ bool CWebserverRequest::HandleRequest(void) start_line = Connection->sock->ReceiveLine(); if(!Connection->sock->isValid) return false; - if(start_line == "") // Socket empty + if(start_line.empty()) // Socket empty { log_level_printf(1,"HandleRequest: End of line not found\n"); Connection->Response.SendError(HTTP_INTERNAL_SERVER_ERROR); @@ -89,7 +89,7 @@ bool CWebserverRequest::HandleRequest(void) return false; } - if(tmp_line == "") + if(tmp_line.empty()) { Connection->Response.SendError(HTTP_INTERNAL_SERVER_ERROR); return false; @@ -272,7 +272,7 @@ bool CWebserverRequest::HandlePost() do { tmp_line = Connection->sock->ReceiveLine(); - if(tmp_line == "") // Socket empty + if(tmp_line.empty()) // Socket empty { log_level_printf(1,"HandleRequest: (Header) End of line not found: %s\n", strerror(errno)); Connection->Response.SendError(HTTP_INTERNAL_SERVER_ERROR); @@ -285,7 +285,7 @@ bool CWebserverRequest::HandlePost() // read meesage body unsigned int content_len = 0; - if(HeaderList["Content-Length"] != "") + if(!HeaderList["Content-Length"].empty()) content_len = atoi( HeaderList["Content-Length"].c_str() ); // Get Rest of Request from Socket diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/ysocket.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/ysocket.cpp index ba69d9c..93e1ba6 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/ysocket.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/ysocket.cpp @@ -115,12 +115,12 @@ bool CySocket::initSSL(void) aprintf("ySocket:SSL Error: Create SSL_CTX_new : %s\n", ERR_error_string(ERR_get_error(), NULL) ); return false; } - if(SSL_pemfile == "") + if(SSL_pemfile.empty()) { aprintf("ySocket:SSL Error: no pemfile given\n"); return false; } - if(SSL_CA_file != "") // have a CA? + if(!SSL_CA_file.empty()) // have a CA? if(1 != SSL_CTX_load_verify_locations(SSL_ctx, SSL_CA_file.c_str(), NULL)) { aprintf("ySocket:SSL Error: %s CA-File:%s\n",ERR_error_string(ERR_get_error(), NULL), SSL_CA_file.c_str()); diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_auth.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_auth.cpp index 41682da..9a900bb 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_auth.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_auth.cpp @@ -18,7 +18,7 @@ THandleStatus CmAuth::Hook_PrepareResponse(CyhookHandler *hh) if(authenticate) { if( (hh->UrlData["clientaddr"]).find(IADDR_LOCAL)>0 && - (no_auth_client == "" || + (no_auth_client.empty() || (hh->UrlData["clientaddr"]).find(no_auth_client)>0)) // dont check local calls or calls from NoAuthClient { if (!CheckAuth(hh)) @@ -53,7 +53,7 @@ THandleStatus CmAuth::Hook_ReadConfig(CConfigFile *Config, CStringList &ConfigLi //----------------------------------------------------------------------------- bool CmAuth::CheckAuth(CyhookHandler *hh) { - if (hh->HeaderList["Authorization"] == "") + if (hh->HeaderList["Authorization"].empty()) return false; std::string encodet = hh->HeaderList["Authorization"].substr(6,hh->HeaderList["Authorization"].length() - 6); std::string decodet = decodeBase64(encodet.c_str()); diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp index 9bbefca..e54f4aa 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp @@ -40,7 +40,7 @@ THandleStatus CmodCache::Hook_PrepareResponse(CyhookHandler *hh) // Check if modified time_t if_modified_since = (time_t)-1; - if(hh->HeaderList["If-Modified-Since"] != "") // Have If-Modified-Since Requested by Browser? + if(!hh->HeaderList["If-Modified-Since"].empty()) // Have If-Modified-Since Requested by Browser? { struct tm mod; if(strptime(hh->HeaderList["If-Modified-Since"].c_str(), RFC1123FMT, &mod) != NULL) @@ -235,12 +235,12 @@ void CmodCache::yshowCacheInfo(CyhookHandler *hh) void CmodCache::yCacheClear(CyhookHandler *hh) { std::string result=""; - if(hh->ParamList["category"] != "") + if(!hh->ParamList["category"].empty()) { RemoveCategoryFromCache(hh->ParamList["category"]); result = string_printf("Category (%s) removed from cache.</br>", hh->ParamList["category"].c_str()); } - else if(hh->ParamList["url"] != "") + else if(!hh->ParamList["url"].empty()) { RemoveURLFromCache(hh->ParamList["url"]); result = string_printf("URL (%s) removed from cache.</br>", hh->ParamList["url"].c_str()); diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp index c3b53b1..87468f7 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp @@ -72,7 +72,7 @@ THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) int filed; log_level_printf(4,"mod_sendfile prepare hook start url:%s\n",hh->UrlData["fullurl"].c_str()); std::string mime = sendfileTypes[hh->UrlData["fileext"]]; - if(mime != "" || (hh->WebserverConfigList["mod_sendfile.sendAll"] == "true") && hh->UrlData["fileext"] != "yhtm") + if(!mime.empty() || (hh->WebserverConfigList["mod_sendfile.sendAll"] == "true") && hh->UrlData["fileext"] != "yhtm") { //TODO: Check allowed directories / actually in GetFileName // build filename @@ -94,7 +94,7 @@ THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) // check If-Modified-Since time_t if_modified_since = (time_t)-1; - if(hh->HeaderList["If-Modified-Since"] != "") + if(!hh->HeaderList["If-Modified-Since"].empty()) { struct tm mod; if(strptime(hh->HeaderList["If-Modified-Since"].c_str(), RFC1123FMT, &mod) != NULL) diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_weblog.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_weblog.cpp index cf27273..63db846 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_weblog.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_weblog.cpp @@ -67,7 +67,7 @@ THandleStatus CmWebLog::Hook_ReadConfig(CConfigFile *Config, CStringList &/*Conf //----------------------------------------------------------------------------- bool CmWebLog::OpenLogFile() { - if(WebLogFilename == "") + if(WebLogFilename.empty()) return false; if(WebLogFile == NULL) { diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp index 837e6ad..198eb71 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp @@ -52,7 +52,7 @@ CyParser::~CyParser(void) //----------------------------------------------------------------------------- void CyParser::init(CyhookHandler *hh) { - if(HTML_DIRS[0] == "") + if(HTML_DIRS[0].empty()) { CyParser::HTML_DIRS[0]=hh->WebserverConfigList["PublicDocumentRoot"]; HTML_DIRS[1]=hh->WebserverConfigList["PrivatDocumentRoot"]; @@ -137,7 +137,7 @@ void CyParser::Execute(CyhookHandler *hh) if(std::string(yCgiCallList[index].mime_type) == "") // set by self ; else if(std::string(yCgiCallList[index].mime_type) == "+xml") // Parameter xml? - if (hh->ParamList["xml"] != "") + if (!hh->ParamList["xml"].empty()) hh->SetHeader(HTTP_OK, "text/xml"); else hh->SetHeader(HTTP_OK, "text/plain"); @@ -167,14 +167,14 @@ void CyParser::cgi(CyhookHandler *hh) if (!hh->ParamList.empty()) { - if (hh->ParamList["tmpl"] != "") // for GET and POST + if (!hh->ParamList["tmpl"].empty()) // for GET and POST htmlfilename = hh->ParamList["tmpl"]; else htmlfilename = hh->ParamList["1"]; - if (hh->ParamList["debug"] != "") // switch debug on + if (!hh->ParamList["debug"].empty()) // switch debug on ydebug = true; - if (hh->ParamList["execute"] != "") // execute done first! + if (!hh->ParamList["execute"].empty()) // execute done first! { ycmd = hh->ParamList["execute"]; ycmd = YPARSER_ESCAPE_START + ycmd + YPARSER_ESCAPE_END; @@ -182,7 +182,7 @@ void CyParser::cgi(CyhookHandler *hh) yresult = cgi_cmd_parsing(hh, ycmd, ydebug); // parsing engine } // parsing given file - if(htmlfilename != "") + if (!htmlfilename.empty()) yresult = cgi_file_parsing(hh, htmlfilename, ydebug); } else @@ -243,9 +243,9 @@ void CyParser::ParseAndSendFile(CyhookHandler *hh) hh->SetHeader(HTTP_OK, "text/html"); if (hh->Method == M_HEAD) return; - if (hh->ParamList["debug"] != "") // switch debug on + if (!hh->ParamList["debug"].empty()) // switch debug on ydebug = true; - if (hh->ParamList["execute"] != "") // execute done first! + if (!hh->ParamList["execute"].empty()) // execute done first! { ycmd = hh->ParamList["execute"]; ycmd = YPARSER_ESCAPE_START + ycmd + YPARSER_ESCAPE_END; @@ -382,7 +382,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) if(ySplitString(ycmd_name,"~",if_value,if_then)) { ySplitString(if_then,"~",if_then,if_else); - yresult = (if_value == "") ? if_then : if_else; + yresult = (if_value.empty()) ? if_then : if_else; } } else if(ycmd_type == "if-equal") @@ -451,7 +451,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) { ySplitString(tmp,";",varname, ydefault); yresult = YWeb_cgi_get_ini(hh, filename, varname, yaccess); - if(yresult == "" && ydefault != "") + if(yresult.empty() && !ydefault.empty()) yresult = ydefault; } else @@ -525,7 +525,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) else yresult = "ycgi-type unknown"; } - else if (hh->ParamList[ycmd] != "") + else if (!hh->ParamList[ycmd].empty()) { if((hh->ParamList[ycmd]).find("script") == std::string::npos) yresult = hh->ParamList[ycmd]; @@ -543,7 +543,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) std::string CyParser::YWeb_cgi_get_ini(CyhookHandler */*hh*/, std::string filename, std::string varname, std::string yaccess) { std::string result; - if((yaccess == "open") || (yaccess == "")) + if((yaccess == "open") || yaccess.empty()) { yConfig->clear(); yConfig->loadConfig(filename); @@ -559,13 +559,13 @@ std::string CyParser::YWeb_cgi_get_ini(CyhookHandler */*hh*/, std::string filen void CyParser::YWeb_cgi_set_ini(CyhookHandler */*hh*/, std::string filename, std::string varname, std::string varvalue, std::string yaccess) { std::string result; - if((yaccess == "open") || (yaccess == "")) + if((yaccess == "open") || yaccess.empty()) { yConfig->clear(); yConfig->loadConfig(filename); } yConfig->setString(varname, varvalue); - if((yaccess == "save") || (yaccess == "")) + if((yaccess == "save") || yaccess.empty()) yConfig->saveConfig(filename); } @@ -767,7 +767,7 @@ std::string CyParser::func_do_reload_httpd_config(CyhookHandler */*hh*/, std::s //------------------------------------------------------------------------- std::string CyParser::func_change_httpd(CyhookHandler *hh, std::string para) { - if(para != "" && access(para.c_str(), 4) == 0) + if(!para.empty() && access(para.c_str(), 4) == 0) { hh->status = HANDLED_ABORT; int err = execvp(para.c_str(), NULL); // no return if successful diff --git a/tuxbox/neutrino/src/driver/rcinput.cpp b/tuxbox/neutrino/src/driver/rcinput.cpp index eb2c466..4a5b6dc 100644 --- a/tuxbox/neutrino/src/driver/rcinput.cpp +++ b/tuxbox/neutrino/src/driver/rcinput.cpp @@ -525,13 +525,13 @@ void CRCInput::load_conf(bool initialize) { if (keyaction != CRCInput::RC_nokey) { if (debug_user_translate) { - if (data == "") + if (data.empty()) printf("[rcinput] Binding %s[%c] -> %s\n", keyword.c_str(), modint2ch(modifier), argument.c_str()); else printf("[rcinput] Binding %s[%c] -> %s(%s)\n", keyword.c_str(), modint2ch(modifier), action.c_str(), data.c_str()); } user_translate_table[modifier][keycode] = (neutrino_msg_t) keyaction; - if (data != "") + if (!data.empty()) { char *data_str = (char *) malloc((data.length()+1)*sizeof(char)); strcpy(data_str, data.c_str()); diff --git a/tuxbox/neutrino/src/gui/epgplus.cpp b/tuxbox/neutrino/src/gui/epgplus.cpp index 0b3fd63..97eeafc 100644 --- a/tuxbox/neutrino/src/gui/epgplus.cpp +++ b/tuxbox/neutrino/src/gui/epgplus.cpp @@ -1622,7 +1622,7 @@ int EpgPlus::MenuTargetAddRecordTimer::exec(CMenuTarget*, const std::string&) epgPlus->paint(); recDir = recDirs.get_selected_dir(); } - if (recDir != "" || RECORDING_FILE != g_settings.recording_type) + if (!recDir.empty() || RECORDING_FILE != g_settings.recording_type) { if (timerdclient.addRecordTimerEvent(epgPlus->selectedChannelEntry->channel->channel_id, (*It)->channelEvent.startTime, diff --git a/tuxbox/neutrino/src/gui/epgview.cpp b/tuxbox/neutrino/src/gui/epgview.cpp index e7ea041..4da1704 100644 --- a/tuxbox/neutrino/src/gui/epgview.cpp +++ b/tuxbox/neutrino/src/gui/epgview.cpp @@ -501,7 +501,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_ text2 = epgData.title.substr(text1.length()+ 1, uint(-1) ); } - if (text2!="") + if (!text2.empty()) toph = 2* topboxheight; else toph = topboxheight; @@ -740,13 +740,13 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_ recDir = recDirs.get_selected_dir(); } - if ((recDir == "") && (RECORDING_FILE == g_settings.recording_type)) + if (recDir.empty() && (RECORDING_FILE == g_settings.recording_type)) { printf("set zapto timer failed, no record directory...\n"); ShowLocalizedMessage(LOCALE_TIMER_EVENTRECORD_TITLE, LOCALE_EPGLIST_ERROR_NO_RECORDDIR_MSG, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_ERROR); } - if ((recDir != "") || (RECORDING_FILE != g_settings.recording_type)) + if (!recDir.empty() || (RECORDING_FILE != g_settings.recording_type)) { if (timerdclient.addRecordTimerEvent(channel_id, epgData.epg_times.startzeit, diff --git a/tuxbox/neutrino/src/gui/esound.cpp b/tuxbox/neutrino/src/gui/esound.cpp index fb3ff09..b2ba48a 100644 --- a/tuxbox/neutrino/src/gui/esound.cpp +++ b/tuxbox/neutrino/src/gui/esound.cpp @@ -137,7 +137,7 @@ int CEsoundGui::exec(CMenuTarget* parent, const std::string &) } } - if (tmp == "") + if (tmp.empty()) { printf("[esound.cpp] %s in %s or %s not found, returning...", esound_start_script.c_str(), esound_start_path1.c_str(), esound_start_path2.c_str()); return menu_return::RETURN_EXIT_ALL; diff --git a/tuxbox/neutrino/src/gui/eventlist.cpp b/tuxbox/neutrino/src/gui/eventlist.cpp index ec90cd5..fa78f29 100644 --- a/tuxbox/neutrino/src/gui/eventlist.cpp +++ b/tuxbox/neutrino/src/gui/eventlist.cpp @@ -419,13 +419,13 @@ int EventList::exec(const t_channel_id channel_id, const std::string& channelnam recDir = recDirs.get_selected_dir(); } - if ((recDir == "") && (RECORDING_FILE == g_settings.recording_type)) + if (recDir.empty() && (RECORDING_FILE == g_settings.recording_type)) { printf("set zapto timer failed, no record directory...\n"); ShowLocalizedMessage(LOCALE_TIMER_EVENTRECORD_TITLE, LOCALE_EPGLIST_ERROR_NO_RECORDDIR_MSG, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_ERROR); } - if ((recDir != "") || (RECORDING_FILE != g_settings.recording_type)) + if (!recDir.empty() || (RECORDING_FILE != g_settings.recording_type)) { // if (Timer.addRecordTimerEvent(channel_id, if (Timer.addRecordTimerEvent(evtlist[selected].get_channel_id(), @@ -1175,7 +1175,7 @@ int CEventFinderMenu::exec(CMenuTarget* parent, const std::string &actionkey) if(parent != NULL) parent->hide(); - if(actionkey == "") + if(actionkey.empty()) { res = showMenu(); } diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp index 3467f76..1904de3 100644 --- a/tuxbox/neutrino/src/gui/moviebrowser.cpp +++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp @@ -1920,7 +1920,7 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) source = m_movieSelectionHandler->file.Name; CDirChooser dir(&dest,"/mnt/","/hdd"); dir.exec(NULL,""); - if(dest != "") + if(!dest.empty()) { dest += "/"; dest += m_movieSelectionHandler->file.getFileName(); @@ -1939,7 +1939,7 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) source = m_movieSelectionHandler->file.Name; CDirChooser dir(&dest,"/mnt/","/hdd"); dir.exec(NULL,""); - if(dest != "") + if(!dest.empty()) { dest += "/"; dest += m_movieSelectionHandler->file.getFileName(); @@ -2507,10 +2507,8 @@ void CMovieBrowser::updateDir(void) // check if there is a record dir and if we should use it for(int i = 0; i < MAX_RECORDING_DIR; i++) { - if(g_settings.recording_dir[i] != "" ) - { + if(!g_settings.recording_dir[i].empty()) addDir(g_settings.recording_dir[i],&m_settings.storageDirRecUsed[i]); - } } for(int i = 0; i < MB_MAX_DIRS; i++) @@ -3170,7 +3168,7 @@ bool CMovieBrowser::showMenu(MI_MOVIE_INFO* /*movie_info*/) CMenuOptionChooser* chooserRec[MAX_RECORDING_DIR]; for(i = 0; i < MAX_RECORDING_DIR; i++) { - if(g_settings.recording_dir[i] != "" && + if(!g_settings.recording_dir[i].empty() && g_settings.recording_dir[i] != g_settings.streaming_moviedir) { chooserRec[i] = new CMenuOptionChooser(g_settings.recording_dir[i].c_str() , &m_settings.storageDirRecUsed[i] , MESSAGEBOX_YES_NO_OPTIONS, MESSAGEBOX_YES_NO_OPTIONS_COUNT, true); @@ -3849,7 +3847,7 @@ int CDirMenu::exec(CMenuTarget* parent, const std::string & actionKey) { int returnval = menu_return::RETURN_REPAINT; - if(actionKey == "") + if(actionKey.empty()) { if(parent) parent->hide(); diff --git a/tuxbox/neutrino/src/gui/movieplayer2.cpp b/tuxbox/neutrino/src/gui/movieplayer2.cpp index 3951f19..57e5e1d 100644 --- a/tuxbox/neutrino/src/gui/movieplayer2.cpp +++ b/tuxbox/neutrino/src/gui/movieplayer2.cpp @@ -2753,7 +2753,7 @@ CMoviePlayerGui::PlayStream(int streamtype) else if (streamtype == STREAMTYPE_LOCAL) { INFO("STREAMTYPE_LOCAL '%s'\n", startfilename.c_str()); - if (startfilename != "") + if (!startfilename.empty()) { CFile file; struct stat s; diff --git a/tuxbox/neutrino/src/gui/widget/dirchooser.cpp b/tuxbox/neutrino/src/gui/widget/dirchooser.cpp index 50a8c65..8582903 100755 --- a/tuxbox/neutrino/src/gui/widget/dirchooser.cpp +++ b/tuxbox/neutrino/src/gui/widget/dirchooser.cpp @@ -234,7 +234,7 @@ int CRecDirChooser::exec(CMenuTarget* parent, const std::string & actionKey) else if (strcmp(key, "dirChooser") == 0) { selectedDir = -1; - if(g_settings.recording_dir[0] != "") + if(!g_settings.recording_dir[0].empty()) { dir = g_settings.recording_dir[0]; } @@ -248,7 +248,7 @@ int CRecDirChooser::exec(CMenuTarget* parent, const std::string & actionKey) { dir = ""; } - if(dir == "" ) + if(dir.empty()) { result = menu_return::RETURN_REPAINT; } @@ -257,7 +257,7 @@ int CRecDirChooser::exec(CMenuTarget* parent, const std::string & actionKey) { dir = ""; result = CMenuWidget::exec(parent, actionKey); - if(dir != "") + if(!dir.empty()) { if (localDir) { diff --git a/tuxbox/neutrino/src/gui/widget/menue.cpp b/tuxbox/neutrino/src/gui/widget/menue.cpp index 914a166..8a6cc27 100644 --- a/tuxbox/neutrino/src/gui/widget/menue.cpp +++ b/tuxbox/neutrino/src/gui/widget/menue.cpp @@ -1366,7 +1366,7 @@ int CLockedMenuForwarder::exec(CMenuTarget* parent) int CMenuSelectorTarget::exec(CMenuTarget* /*parent*/, const std::string & actionKey) { // printf("CMenuSelector: %s\n", actionKey.c_str()); - if (actionKey != "") + if (!actionKey.empty()) *m_select = atoi(actionKey.c_str()); else *m_select = -1; diff --git a/tuxbox/neutrino/src/neutrino.cpp b/tuxbox/neutrino/src/neutrino.cpp index efd383f..93996a5 100644 --- a/tuxbox/neutrino/src/neutrino.cpp +++ b/tuxbox/neutrino/src/neutrino.cpp @@ -1756,7 +1756,7 @@ bool CNeutrinoApp::doGuiRecord(char * preselectedDir, bool addTimer, char * file refreshGui = true; recDir = recDirs.get_selected_dir(); //printf("dir : %s\n",recDir.c_str()); - if( recDir != "") + if (!recDir.empty()) { int nfs_nr = getNFSIDOfDir(recDir.c_str()); if(nfs_nr != -1) commit 2ccff82fe9c1f58060487e74c0e29049d848368c Author: Christian Schuett <gaucho...@hotmail.com> Date: Wed Oct 29 21:14:04 2014 +0100 Neutrino: use empty() instead of length() if possible Signed-off-by: Christian Schuett <gaucho...@hotmail.com> Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/dvb/zapit/src/controld.cpp b/dvb/zapit/src/controld.cpp index 96f0c6c..ed64fa2 100644 --- a/dvb/zapit/src/controld.cpp +++ b/dvb/zapit/src/controld.cpp @@ -273,7 +273,7 @@ void setup_tv_vcr(tv_vcr_format &v2, std::string &line) { void setup_scalar(switchvalue &s, std::string &str) { nuke_leading_whitespace(str); - if (str.length() > 0) { + if (!str.empty()) { int n; sscanf(str.c_str(), "%d", &n); s = (switchvalue) n; diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yrequest.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yrequest.cpp index c4813e1..35de525 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yrequest.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yrequest.cpp @@ -562,7 +562,7 @@ unsigned int CWebserverRequest::HandlePostBoundary(std::string boundary, unsigne } 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"); diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp index 07be8b9..c3b53b1 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp @@ -192,7 +192,7 @@ int CmodSendfile::OpenFile(CyhookHandler */*hh*/, std::string fullfilename) { int fd= -1; std::string tmpstring; - if(fullfilename.length() > 0) + if (!fullfilename.empty()) { fd = open( fullfilename.c_str(), O_RDONLY ); if (fd<=0) diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp index 4f1c9e0..837e6ad 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp @@ -187,7 +187,7 @@ void CyParser::cgi(CyhookHandler *hh) } 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); @@ -254,7 +254,7 @@ void CyParser::ParseAndSendFile(CyhookHandler *hh) } // parsing given file yresult += cgi_file_parsing(hh, hh->UrlData["filename"], ydebug); - if (yresult.length()<=0) + if (yresult.empty()) hh->SetError(HTTP_NOT_IMPLEMENTED, HANDLED_NOT_IMPLEMENTED); else { @@ -612,7 +612,7 @@ std::string CyParser::YWeb_cgi_include_block(std::string filename, std::string log_level_printf(6, "include-block: (%s) from file\n", 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; diff --git a/tuxbox/neutrino/daemons/sectionsd/SIbouquets.hpp b/tuxbox/neutrino/daemons/sectionsd/SIbouquets.hpp index 42b8414..d3c89a3 100644 --- a/tuxbox/neutrino/daemons/sectionsd/SIbouquets.hpp +++ b/tuxbox/neutrino/daemons/sectionsd/SIbouquets.hpp @@ -122,7 +122,7 @@ public: printf("Transport-Stream-ID: %hu\n", transport_stream_id); printf("Service-ID: %hu\n", service_id); printf("Service-Typ: %hhu\n", serviceTyp); - if(bouquetName.length()) + if (!bouquetName.empty()) printf("Bouquet-Name: %s\n", bouquetName.c_str()); } }; diff --git a/tuxbox/neutrino/daemons/sectionsd/SIevents.cpp b/tuxbox/neutrino/daemons/sectionsd/SIevents.cpp index 15cc153..ff4a644 100644 --- a/tuxbox/neutrino/daemons/sectionsd/SIevents.cpp +++ b/tuxbox/neutrino/daemons/sectionsd/SIevents.cpp @@ -162,7 +162,7 @@ int SIevent::saveXML2(FILE *file) const i = langName.begin() ; i != langName.end() ; ++i) { - if (i->second.length()) { + if (!i->second.empty()) { fprintf(file, "\t\t\t<name lang=\"%s\" string=\"", i->first.c_str()); saveStringToXMLfile(file, i->second.c_str()); fprintf(file, "\"/>\n"); @@ -172,18 +172,18 @@ int SIevent::saveXML2(FILE *file) const i = langText.begin() ; i != langText.end() ; ++i) { - if (i->second.length()) { + if (!i->second.empty()) { fprintf(file, "\t\t\t<text lang=\"%s\" string=\"", i->first.c_str()); saveStringToXMLfile(file, i->second.c_str()); fprintf(file, "\"/>\n"); } } - 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"); @@ -192,7 +192,7 @@ int SIevent::saveXML2(FILE *file) const i = langExtendedText.begin() ; i != langExtendedText.end() ; ++i) { - if (i->second.length()) { + if (!i->second.empty()) { fprintf(file, "\t\t\t<extended_text lang=\"%s\" string=\"", i->first.c_str()); saveStringToXMLfile(file, i->second.c_str()); fprintf(file, "\"/>\n"); @@ -291,9 +291,9 @@ void SIevent::dump(void) const if (service_id) printf("Service-ID: %hu\n", service_id); printf("Event-ID: %hu\n", eventID); - 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()); for (std::map<std::string, std::string>::const_iterator it = langName.begin() ; @@ -306,13 +306,13 @@ void SIevent::dump(void) const it != langExtendedText.end() ; ++it) printf("Extended-Text (%s): %s\n", it->first.c_str(), it->second.c_str()); - 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]); diff --git a/tuxbox/neutrino/daemons/sectionsd/SIevents.hpp b/tuxbox/neutrino/daemons/sectionsd/SIevents.hpp index 6d046ff..6125550 100644 --- a/tuxbox/neutrino/daemons/sectionsd/SIevents.hpp +++ b/tuxbox/neutrino/daemons/sectionsd/SIevents.hpp @@ -151,7 +151,7 @@ public: void dump(void) const { printf("Linakge Type: 0x%02hhx\n", linkageType); - if (name.length()) + if (!name.empty()) printf("Name: %s\n", name.c_str()); printf("Transport Stream Id: 0x%04hhx\n", transportStreamId); printf("Original Network Id: 0x%04hhx\n", originalNetworkId); @@ -234,7 +234,7 @@ class SIcomponent { (component != c.component); } void dump(void) const { - if(component.length()) + if (!component.empty()) printf("Component: %s\n", component.c_str()); printf("Stream Content: 0x%02hhx\n", streamContent); printf("Component type: 0x%02hhx\n", componentType); @@ -494,8 +494,8 @@ struct saveSIeventXMLwithServiceName : public std::unary_function<SIevent, void> void operator() (const SIevent &e) { SIservices::iterator k=s->find(SIservice(e.service_id, e.original_network_id, e.transport_stream_id)); if(k!=s->end()) { - if(k->serviceName.length()) - e.saveXML(f, k->serviceName.c_str()); + if(!k->serviceName.empty()) + e.saveXML(f, k->serviceName.c_str()); } else e.saveXML(f); diff --git a/tuxbox/neutrino/daemons/sectionsd/SIlanguage.cpp b/tuxbox/neutrino/daemons/sectionsd/SIlanguage.cpp index 6781469..e2f504d 100644 --- a/tuxbox/neutrino/daemons/sectionsd/SIlanguage.cpp +++ b/tuxbox/neutrino/daemons/sectionsd/SIlanguage.cpp @@ -62,7 +62,7 @@ void SIlanguage::filter(const std::map<std::string, std::string>& s, int max, st } } - if (retval.length() == 0) { + if (retval.empty()) { // return all available languages if (s.begin() != s.end()) { for (std::map<std::string, std::string>::const_iterator it = s.begin() ; diff --git a/tuxbox/neutrino/daemons/sectionsd/SIsections.cpp b/tuxbox/neutrino/daemons/sectionsd/SIsections.cpp index 0b467ce..2c8629c 100644 --- a/tuxbox/neutrino/daemons/sectionsd/SIsections.cpp +++ b/tuxbox/neutrino/daemons/sectionsd/SIsections.cpp @@ -278,7 +278,7 @@ void SIsectionEIT::parseExtendedEventDescriptor(const char *buf, SIevent &e, uns } items+=1+*items; } -// if (0 != e.itemDescription.length()) { +// if (!e.itemDescription.empty()) { // printf("Item Description: %s\n", e.itemDescription.c_str()); // printf("Item: %s\n", e.item.c_str()); // } diff --git a/tuxbox/neutrino/daemons/sectionsd/SIservices.hpp b/tuxbox/neutrino/daemons/sectionsd/SIservices.hpp index 6b7c80e..3dc9935 100644 --- a/tuxbox/neutrino/daemons/sectionsd/SIservices.hpp +++ b/tuxbox/neutrino/daemons/sectionsd/SIservices.hpp @@ -180,9 +180,9 @@ public: printf("Original-Network-ID: %hu\n", original_network_id); printf("Service-ID: %hu\n", service_id); printf("Service-Typ: %hhu\n", serviceTyp); - if(providerName.length()) + if (!providerName.empty()) printf("Provider-Name: %s\n", providerName.c_str()); - if(serviceName.length()) + if (!serviceName.empty()) printf("Service-Name: %s\n", serviceName.c_str()); for_each(nvods.begin(), nvods.end(), printSInvodReference()); printf("\n"); diff --git a/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp b/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp index be06626..1d074a4 100644 --- a/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp +++ b/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp @@ -787,12 +787,12 @@ static void addEvent(const SIevent &evt, const time_t zeit, bool cn = false) si->second->itemDescription = evt.itemDescription; si->second->item = evt.item; si->second->vps = evt.vps; - if ((evt.getExtendedText().length() > 0) && + if (!evt.getExtendedText().empty() && (evt.times.begin()->startzeit < zeit + secondsExtendedTextCache)) si->second->setExtendedText("OFF",evt.getExtendedText().c_str()); - if (evt.getText().length() > 0) + if (!evt.getText().empty()) si->second->setText("OFF",evt.getText().c_str()); - if (evt.getName().length() > 0) + if (!evt.getName().empty()) si->second->setName("OFF",evt.getName().c_str()); } else { @@ -2418,7 +2418,8 @@ static void sendAllEvents(int connfd, t_channel_id serviceUniqueKey, bool oldFor readLockEvents(); int serviceIDfound = 0; - if (search_text.length()) std::transform(search_text.begin(), search_text.end(), search_text.begin(), tolower); + if (!search_text.empty()) + std::transform(search_text.begin(), search_text.end(), search_text.begin(), tolower); for (MySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey::iterator e = mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.begin(); e != mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.end(); ++e) { if ((*e)->get_channel_id() == serviceUniqueKey) @@ -6102,7 +6103,7 @@ static void write_bouquet_xml_node(FILE *fd, t_bouquet_id bouquet_id) MySIbouquetsOrderUniqueKey::iterator s = mySIbouquetsOrderUniqueKey.begin(); while ((!found) && (s != mySIbouquetsOrderUniqueKey.end())) { - if ((s->second->bouquet_id == bouquet_id) && (s->second->bouquetName.length() != 0)) + if ((s->second->bouquet_id == bouquet_id) && !s->second->bouquetName.empty()) found = true; else s++; diff --git a/tuxbox/neutrino/src/driver/lcdd.cpp b/tuxbox/neutrino/src/driver/lcdd.cpp index 1a18f61..39f3548 100644 --- a/tuxbox/neutrino/src/driver/lcdd.cpp +++ b/tuxbox/neutrino/src/driver/lcdd.cpp @@ -469,8 +469,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; @@ -494,11 +494,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/tuxbox/neutrino/src/gui/audioplayer.cpp b/tuxbox/neutrino/src/gui/audioplayer.cpp index 16aa8ee..eb84e00 100644 --- a/tuxbox/neutrino/src/gui/audioplayer.cpp +++ b/tuxbox/neutrino/src/gui/audioplayer.cpp @@ -2787,7 +2787,7 @@ std::string CAudioPlayerGui::absPath2Rel(const std::string& fromDir, const std::string& absFilename) { std::string res = ""; - int length = fromDir.length() < absFilename.length() ? fromDir.length() : absFilename.length(); + int length = std::min(fromDir.length(), absFilename.length()); int lastSlash = 0; // find common prefix for both paths // fromDir: /foo/bar/angle/1 (length: 16) diff --git a/tuxbox/neutrino/src/gui/channellist.cpp b/tuxbox/neutrino/src/gui/channellist.cpp index 8d0ca3d..927a928 100644 --- a/tuxbox/neutrino/src/gui/channellist.cpp +++ b/tuxbox/neutrino/src/gui/channellist.cpp @@ -188,7 +188,7 @@ void CChannelList::updateEvents(void) if (listmaxshow) { for (uint count=0; (count<listmaxshow) && (liststart+count<chanlist.size()); count++){ // search only for channels whose current event is over - if (1 || /*(chanlist[liststart+count]->nextEvent.text.length() == 0) ||*/ + if (1 || /*chanlist[liststart+count]->nextEvent.text.empty() ||*/ ((long)(chanlist[liststart+count]->nextEvent.startTime) < atime)) { CChannelEventList events = g_Sectionsd->getEventsServiceKey(chanlist[liststart+count]->channel_id); @@ -213,7 +213,7 @@ void CChannelList::updateEvents(void) if (p_requested_channels != NULL) { for (uint count=0; (count<listmaxshow) && (liststart+count<chanlist.size()); count++){ // search only for channels whose current event is over - if ((chanlist[liststart+count]->currentEvent.text.length() == 0) || + if (chanlist[liststart+count]->currentEvent.text.empty() || ((long)(chanlist[liststart+count]->currentEvent.startTime + chanlist[liststart+count]->currentEvent.duration) < atime)) { chanlist[liststart+count]->currentEvent = CChannelEvent(); // clear old event diff --git a/tuxbox/neutrino/src/gui/drive_setup.cpp b/tuxbox/neutrino/src/gui/drive_setup.cpp index 31a0522..4f67985 100644 --- a/tuxbox/neutrino/src/gui/drive_setup.cpp +++ b/tuxbox/neutrino/src/gui/drive_setup.cpp @@ -912,7 +912,7 @@ string CDriveSetup::getPartEntryString(string& partname) s_entry += char(32); s_entry += s_size; - if (s_mountpoint.length() == 0) // no active partition mounted + if (s_mountpoint.empty()) // no active partition mounted s_entry = g_Locale->getText(LOCALE_DRIVE_SETUP_PARTITION_NOT_ACTIVE); if (!isActivePartition(p_name)) // no active partition found diff --git a/tuxbox/neutrino/src/gui/epgview.cpp b/tuxbox/neutrino/src/gui/epgview.cpp index 012c502..e7ea041 100644 --- a/tuxbox/neutrino/src/gui/epgview.cpp +++ b/tuxbox/neutrino/src/gui/epgview.cpp @@ -593,7 +593,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_ } // 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/tuxbox/neutrino/src/gui/eventlist.cpp b/tuxbox/neutrino/src/gui/eventlist.cpp index 8cbcf8e..ec90cd5 100644 --- a/tuxbox/neutrino/src/gui/eventlist.cpp +++ b/tuxbox/neutrino/src/gui/eventlist.cpp @@ -699,7 +699,7 @@ void EventList::paintItem(unsigned int pos) g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->RenderString(x+5+fwidth1, ypos+ fheight2+3, width-fwidth1-10- 20, datetime2_str, color, 0, true); // UTF-8 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]; sprintf((char*) &beginnt, "in %d min", seit); diff --git a/tuxbox/neutrino/src/gui/filebrowser.cpp b/tuxbox/neutrino/src/gui/filebrowser.cpp index ef37131..55e7dd4 100644 --- a/tuxbox/neutrino/src/gui/filebrowser.cpp +++ b/tuxbox/neutrino/src/gui/filebrowser.cpp @@ -365,7 +365,7 @@ void CFileBrowser::ChangeDir(const std::string & filename, int selection) { newpath=filename; } - if(m_Mode != ModeSC && (newpath.rfind('/') != newpath.length()-1 || newpath.length() == 0)) + if(m_Mode != ModeSC && (newpath.rfind('/') != newpath.length()-1 || newpath.empty())) { newpath += '/'; } @@ -1195,7 +1195,7 @@ void CFileBrowser::paintItem(unsigned int pos) frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, c_rad_small); - if ( actual_file->Name.length() > 0 ) + if (!actual_file->Name.empty()) { std::string FileName = FILESYSTEM_ENCODING_TO_UTF8_STRING(actual_file->getFileName()); @@ -1419,7 +1419,7 @@ void CFileBrowser::paint() { liststart = (selected/listmaxshow)*listmaxshow; -// if (filelist[0].Name.length() != 0) +// if (!filelist[0].Name.empty()) // frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_HELP, x+ width- 30, y+ 5 ); CLCD::getInstance()->setMode(CLCD::MODE_MENU_UTF8, g_Locale->getText(LOCALE_FILEBROWSER_HEAD)); diff --git a/tuxbox/neutrino/src/gui/imageinfo.cpp b/tuxbox/neutrino/src/gui/imageinfo.cpp index 327ef95..748ebfa 100644 --- a/tuxbox/neutrino/src/gui/imageinfo.cpp +++ b/tuxbox/neutrino/src/gui/imageinfo.cpp @@ -215,13 +215,13 @@ void CImageInfo::paintSupport(int y_startposition) clearContentBox(); //paint comment lines only if present in /.version - if (comment1.length()) + if (!comment1.empty()) { paintContent(font_info, xpos, y_startposition, comment1.c_str()); y_startposition += sheight; } - if (comment2.length()) + if (!comment2.empty()) { paintContent(font_info, xpos, y_startposition, comment2.c_str()); y_startposition += iheight+5; @@ -591,14 +591,14 @@ void CImageInfo::paint() //paint creator, cvslevel, info, comment only if present in /.version ypos += iheight; - if (creator.length()) + if (!creator.empty()) { paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_CREATOR), COL_MENUCONTENTINACTIVE); paintLine(xpos + x_offset_large, font_info, creator.c_str()); } ypos += iheight; - if (cvstime.length()) + if (!cvstime.empty()) { paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_CVSLEVEL), COL_MENUCONTENTINACTIVE); paintLine(xpos + x_offset_large, font_info, cvstime.c_str()); diff --git a/tuxbox/neutrino/src/gui/infoviewer.cpp b/tuxbox/neutrino/src/gui/infoviewer.cpp index 0cf4ffb..f6a836b 100644 --- a/tuxbox/neutrino/src/gui/infoviewer.cpp +++ b/tuxbox/neutrino/src/gui/infoviewer.cpp @@ -2094,7 +2094,7 @@ void CInfoViewer::showEpgInfo() //message on event change eventname = info_CurrentNext.current_name; if (g_settings.infobar_show == EPGINFO_SIMPLE_MESSAGE) { - if (eventname.length() != 0) + if (!eventname.empty()) { std::string event = eventname + "\n" + g_Locale->getText(LOCALE_INFOVIEWER_MESSAGE_TO) + nextStart; std::string event_message = ZapitTools::Latin1_to_UTF8(event.c_str()); diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp index 48d4ef1..3467f76 100644 --- a/tuxbox/neutrino/src/gui/moviebrowser.cpp +++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp @@ -954,7 +954,7 @@ int CMovieBrowser::exec(const char* path, const int playstate) if (path != NULL) m_selectedDir = path; - else if(g_settings.streaming_moviedir.length() > 0) + else if (!g_settings.streaming_moviedir.empty()) m_selectedDir = g_settings.streaming_moviedir; else m_selectedDir = "/"; @@ -2891,7 +2891,7 @@ bool CMovieBrowser::addDir(std::string& dirname, int* used) newdir.name = dirname; if(newdir.name.rfind('/') != newdir.name.length()-1 || - newdir.name.length() == 0 || + newdir.name.empty() || newdir.name == VLC_URI) { newdir.name += '/'; diff --git a/tuxbox/neutrino/src/gui/movieplayer.cpp b/tuxbox/neutrino/src/gui/movieplayer.cpp index 4bc7317..14cb876 100644 --- a/tuxbox/neutrino/src/gui/movieplayer.cpp +++ b/tuxbox/neutrino/src/gui/movieplayer.cpp @@ -346,7 +346,7 @@ CMoviePlayerGui::CMoviePlayerGui() frameBuffer = CFrameBuffer::getInstance(); bookmarkmanager=0; - if(g_settings.streaming_moviedir.length() != 0) + if(!g_settings.streaming_moviedir.empty()) Path_local = g_settings.streaming_moviedir; else Path_local = "/"; @@ -718,7 +718,7 @@ int VlcGetStreamTime() std::string response = ""; CURLcode httpres = sendGetRequest(positionurl, response); //printf("[movieplayer.cpp] httpres=%d, response.length()=%d, stream_length = %s\n",httpres,response.length(),response.c_str()); - if(httpres == 0 && response.length() > 0) { + if(httpres == 0 && !response.empty()) { xmlDocPtr answer_parser = parseXml(response.c_str()); if (answer_parser != NULL) { xmlNodePtr element = xmlDocGetRootElement(answer_parser); @@ -750,7 +750,7 @@ int VlcGetStreamLength() std::string response = ""; CURLcode httpres = sendGetRequest(positionurl, response); //printf("[movieplayer.cpp] httpres=%d, response.length()=%d, stream_length = %s\n",httpres,response.length(),response.c_str()); - if(httpres == 0 && response.length() > 0) { + if(httpres == 0 && !response.empty()) { xmlDocPtr answer_parser = parseXml(response.c_str()); if (answer_parser != NULL) { xmlNodePtr element = xmlDocGetRootElement(answer_parser); @@ -2764,7 +2764,7 @@ void *mp_playFileMain(void *filename) if(filename != NULL) //Only one file selected { fname = (const char *)filename; - if (fname.length()) { + if (!fname.empty()) { //-- check for file type -- //------------------------- if( mp_probe(fname.c_str(), ctx) ) @@ -4688,7 +4688,7 @@ void CMoviePlayerGui::showFileInfoVLC() std::string response = ""; CURLcode httpres = sendGetRequest(url, response); - if (httpres == 0 && response.length() > 0) + if (httpres == 0 && !response.empty()) { xmlDocPtr answer_parser = parseXml(response.c_str()); if (answer_parser != NULL) diff --git a/tuxbox/neutrino/src/gui/movieplayer2.cpp b/tuxbox/neutrino/src/gui/movieplayer2.cpp index 54e7d3e..3951f19 100644 --- a/tuxbox/neutrino/src/gui/movieplayer2.cpp +++ b/tuxbox/neutrino/src/gui/movieplayer2.cpp @@ -301,7 +301,7 @@ CMoviePlayerGui::CMoviePlayerGui() frameBuffer = CFrameBuffer::getInstance(); bookmarkmanager=0; - if (g_settings.streaming_moviedir.length() != 0) + if (!g_settings.streaming_moviedir.empty()) Path_local = g_settings.streaming_moviedir; else Path_local = "/"; @@ -822,7 +822,7 @@ int VlcGetStatus(const char *attribute) std::string response = ""; CURLcode httpres = sendGetRequest(positionurl, response); //printf("[movieplayer.cpp] httpres=%d, response.length()=%d, resp='%s'\n",httpres,response.length(),response.c_str()); - if (httpres == 0 && response.length() > 0) + if (httpres == 0 && !response.empty()) { xmlDocPtr answer_parser = parseXml(response.c_str()); if (answer_parser != NULL) @@ -3678,7 +3678,7 @@ void CMoviePlayerGui::showFileInfoVLC() std::string response = ""; CURLcode httpres = sendGetRequest(url, response); - if (httpres == 0 && response.length() > 0) + if (httpres == 0 && !response.empty()) { xmlDocPtr answer_parser = parseXml(response.c_str()); if (answer_parser != NULL) diff --git a/tuxbox/neutrino/src/gui/network_setup.cpp b/tuxbox/neutrino/src/gui/network_setup.cpp index 8f4eaad..2749514 100644 --- a/tuxbox/neutrino/src/gui/network_setup.cpp +++ b/tuxbox/neutrino/src/gui/network_setup.cpp @@ -476,7 +476,7 @@ void CNetworkSetup::testNetworkSettings() testsite.replace( 0, testsite.find("www",0), "" ); //use default testdomain if testsite missing - if (testsite.length() == 0) + if (testsite.empty()) testsite = defaultsite; if (networkConfig->inet_static) { diff --git a/tuxbox/neutrino/src/gui/themes.cpp b/tuxbox/neutrino/src/gui/themes.cpp index 000d152..8c2f6ab 100644 --- a/tuxbox/neutrino/src/gui/themes.cpp +++ b/tuxbox/neutrino/src/gui/themes.cpp @@ -185,7 +185,7 @@ int CThemes::Show() int res = themes.exec(NULL, ""); selected = themes.getSelected(); - if (file_name.length() > 0) { + if (!file_name.empty()) { saveFile((char*)((std::string)USERDIR + file_name + FILE_SUFFIX).c_str()); } diff --git a/tuxbox/neutrino/src/gui/update.cpp b/tuxbox/neutrino/src/gui/update.cpp index 15a0445..38e1700 100644 --- a/tuxbox/neutrino/src/gui/update.cpp +++ b/tuxbox/neutrino/src/gui/update.cpp @@ -152,7 +152,7 @@ bool CFlashUpdate::selectHttpImage(void) while (urlFile >> url) { // add update url from .version if exists, then seek back to start - if (updateURL.length() > 0 && !update_prefix_tried) + if (!updateURL.empty() && !update_prefix_tried) { url = updateURL + url; urlFile.seekg(0, std::ios::beg); commit 74a24e3364a44c5d17f21bf1560ba056a4e571e4 Author: Christian Schuett <gaucho...@hotmail.com> Date: Wed Oct 29 20:46:26 2014 +0100 sectionsd: show maximum events in status information based on patch by [CST] Focus <focus....@gmail.com> in Coolstream Git Signed-off-by: Christian Schuett <gaucho...@hotmail.com> Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp b/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp index 3f9c428..be06626 100644 --- a/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp +++ b/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp @@ -2617,7 +2617,8 @@ static void commandDumpStatusInformation(int connfd, char* /*data*/, const unsig "%sCurrent time: %s" "Hours to cache: %ld\n" "Hours to cache extended text: %ld\n" - "Events are old %ldmin after their end time\n" + "Events to cache: %u\n" + "Events are old %ld min after their end time\n" "Number of cached services: %u\n" "Number of cached nvod-services: %u\n" "Number of cached events: %u\n" @@ -2635,7 +2636,7 @@ static void commandDumpStatusInformation(int connfd, char* /*data*/, const unsig #endif , ctime_r(&zeit, tbuf), - secondsToCache / (60*60L), secondsExtendedTextCache / (60*60L), oldEventsAre / 60, anzServices, anzNVODservices, anzEvents, anzNVODevents, anzMetaServices, + secondsToCache / (60*60L), secondsExtendedTextCache / (60*60L), max_events, oldEventsAre / 60, anzServices, anzNVODservices, anzEvents, anzNVODevents, anzMetaServices, // resourceUsage.ru_maxrss, resourceUsage.ru_ixrss, resourceUsage.ru_idrss, resourceUsage.ru_isrss, speicherinfo.uordblks, speicherinfo.uordblks / 1024, speicherinfo.arena, speicherinfo.arena / 1024 commit ec1bb8bcdd17a86ff34df8694dbd5221e36031a1 Author: Christian Schuett <gaucho...@hotmail.com> Date: Mon Oct 13 18:05:07 2014 +0200 Neutrino CIntInput: fill input and output char arrays properly also avoid adding too many input fields and remove duplicate code Signed-off-by: Christian Schuett <gaucho...@hotmail.com> Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp index 3d3be9f..9adfc5a 100644 --- a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp +++ b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp @@ -459,10 +459,7 @@ CDateInput::CDateInput(const neutrino_locale_t Name, time_t* Time, const neutrin { time=Time; value= new char[20]; - struct tm *tmTime = localtime(time); - snprintf(value, 20, "%02d.%02d.%04d %02d:%02d", tmTime->tm_mday, tmTime->tm_mon+1, - tmTime->tm_year+1900, - tmTime->tm_hour, tmTime->tm_min); + onBeforeExec(); addInputField( new CExtendedInput_Item_Char("0123") ); addInputField( new CExtendedInput_Item_Char("0123456789") ); @@ -567,7 +564,7 @@ void CMACInput::onBeforeExec() if (value[0] == 0) /* strcmp(value, "") == 0 */ { strcpy(value, "00:00:00:00:00:00"); - printf("[neutrino] value-before(2): %s\n", value); + //printf("[neutrino] value-before(2): %s\n", value); return; } int _mac[6]; @@ -625,16 +622,9 @@ CIntInput::CIntInput(const neutrino_locale_t Name, int& Value, const unsigned in m_size = Size; else m_size = MAX_CINTINPUT_SIZE-1; - if (*myValue == 0) - { - sprintf(myValueStringInput,"%-7d",0); - sprintf(myValueStringOutput,"%7d",0); - } else { - sprintf(myValueStringInput,"%-*d",m_size,*myValue); - sprintf(myValueStringOutput,"%*d",m_size,*myValue); - } + onBeforeExec(); - for (unsigned int i=0;i<Size;i++) + for (unsigned int i=0;i<m_size;i++) { addInputField( new CExtendedInput_Item_Char("0123456789 ") ); } @@ -644,14 +634,8 @@ CIntInput::CIntInput(const neutrino_locale_t Name, int& Value, const unsigned in void CIntInput::onBeforeExec() { - if (*myValue == 0) - { - sprintf(myValueStringInput,"%-7d",0); - sprintf(myValueStringOutput,"%7d",0); - } else { - sprintf(myValueStringInput,"%-*d",m_size,*myValue); - sprintf(myValueStringOutput,"%*d",m_size,*myValue); - } + sprintf(myValueStringInput,"%-*d",m_size,*myValue); + sprintf(myValueStringOutput,"%d",*myValue); } void CIntInput::onAfterExec() commit ae16f57cc525556d829511166b2ca058a6ddcc62 Author: FlatTV <fla...@gmx.de> Date: Sun Oct 5 13:55:00 2014 +0200 add global helper my_system and use it first for .start .end scripts and for execute ether-wake. This is a port from Neutrino-HD. Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/dvb/zapit/src/controld.cpp b/dvb/zapit/src/controld.cpp index 7c90eed..96f0c6c 100644 --- a/dvb/zapit/src/controld.cpp +++ b/dvb/zapit/src/controld.cpp @@ -519,17 +519,6 @@ void setvideooutput(CControld::video_format format, bool bSaveSettings) } #endif -void execute_start_file(const char *filename) -{ - struct stat statbuf; - if (stat(filename, &statbuf) == 0) { - printf("[controld] executing %s\n", filename); - int result = system(filename); - if (result) - printf("[controld] %s failed with return code = %d\n", filename, result); - } -} - #ifdef HAVE_DBOX_HARDWARE void routeVideo(int v1, int a1, int v2, int a2, diff --git a/tuxbox/neutrino/src/gui/audioplayer.cpp b/tuxbox/neutrino/src/gui/audioplayer.cpp index fedef56..16aa8ee 100644 --- a/tuxbox/neutrino/src/gui/audioplayer.cpp +++ b/tuxbox/neutrino/src/gui/audioplayer.cpp @@ -68,6 +68,7 @@ #include <gui/widget/stringinput_ext.h> #include <system/settings.h> +#include <system/helper.h> #include <xmltree/xmlinterface.h> #ifdef ENABLE_LIRC @@ -317,9 +318,9 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &) irs.Send(); #endif - puts("[audioplayer.cpp] executing " AUDIOPLAYER_START_SCRIPT "."); - if (system(AUDIOPLAYER_START_SCRIPT) != 0) - perror("Datei " AUDIOPLAYER_START_SCRIPT " fehlt.Bitte erstellen, wenn gebraucht.\nFile " AUDIOPLAYER_START_SCRIPT " not found. Please create if needed.\n"); + puts("[audioplayer.cpp] executing " AUDIOPLAYER_START_SCRIPT "."); + if (my_system(AUDIOPLAYER_START_SCRIPT) != 0) + perror(AUDIOPLAYER_START_SCRIPT " failed"); #ifdef HAVE_DBOX_HARDWARE // disable iec aka digi out @@ -357,9 +358,9 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &) irs2.Send(); #endif - puts("[audioplayer.cpp] executing " AUDIOPLAYER_END_SCRIPT "."); - if (system(AUDIOPLAYER_END_SCRIPT) != 0) - perror("Datei " AUDIOPLAYER_END_SCRIPT " fehlt. Bitte erstellen, wenn gebraucht.\nFile " AUDIOPLAYER_END_SCRIPT " not found. Please create if needed.\n"); + puts("[audioplayer.cpp] executing " AUDIOPLAYER_END_SCRIPT "."); + if (my_system(AUDIOPLAYER_END_SCRIPT) != 0) + perror(AUDIOPLAYER_END_SCRIPT " failed"); // Start Sectionsd g_Sectionsd->setPauseScanning(false); diff --git a/tuxbox/neutrino/src/gui/drive_setup.cpp b/tuxbox/neutrino/src/gui/drive_setup.cpp index d854580..31a0522 100644 --- a/tuxbox/neutrino/src/gui/drive_setup.cpp +++ b/tuxbox/neutrino/src/gui/drive_setup.cpp @@ -58,6 +58,7 @@ TODO: #include <zapit/client/zapittools.h> #include <system/debug.h> +#include <system/helper.h> #include <fstream> #include <iostream> @@ -1696,8 +1697,8 @@ bool CDriveSetup::unmountPartition(const int& device_num /*MASTER||SLAVE||MMCARD char user_script[64]; snprintf(user_script, 64, "%s/before_unmount_%d_%d.sh", CONFIGDIR, device_num, part_number); user_script[63] = '\0'; /* ensure termination... */ - if((access(user_script, F_OK) ==0)) - CNeutrinoApp::getInstance()->execute_start_file(user_script); + if (my_system(user_script) != 0) + perror(user_script); if((access(partname.c_str(), R_OK) !=0) || (!isActivePartition(partname))) // exit if no available { @@ -4380,8 +4381,8 @@ bool CDriveSetup::mountPartition(const int& device_num /*MASTER||SLAVE*/, const d_settings.drive_partition_mountpoint[device_num][part_number] = "none"; //executing user script if available after swapon - if((access(user_script, F_OK) ==0)) - CNeutrinoApp::getInstance()->execute_start_file(user_script); + if (my_system(user_script) != 0) + perror(user_script); return true; } @@ -4396,8 +4397,8 @@ bool CDriveSetup::mountPartition(const int& device_num /*MASTER||SLAVE*/, const d_settings.drive_partition_mountpoint[device_num][part_number] = "none"; //executing user script if available after swapon - if((access(user_script, F_OK) ==0)) - CNeutrinoApp::getInstance()->execute_start_file(user_script); + if (my_system(user_script) != 0) + perror(user_script); return true; } @@ -4487,8 +4488,8 @@ bool CDriveSetup::mountPartition(const int& device_num /*MASTER||SLAVE*/, const } //executing user script if available after mounting - if((access(user_script, F_OK) ==0)) - CNeutrinoApp::getInstance()->execute_start_file(user_script); + if (my_system(user_script) != 0) + perror(user_script); return true; } diff --git a/tuxbox/neutrino/src/gui/esound.cpp b/tuxbox/neutrino/src/gui/esound.cpp index 7932e1c..fb3ff09 100644 --- a/tuxbox/neutrino/src/gui/esound.cpp +++ b/tuxbox/neutrino/src/gui/esound.cpp @@ -63,6 +63,7 @@ #include <gui/widget/stringinput_ext.h> #include <system/settings.h> +#include <system/helper.h> #ifdef ENABLE_LIRC #include <irsend/irsend.h> @@ -201,9 +202,9 @@ int CEsoundGui::exec(CMenuTarget* parent, const std::string &) irs.Send(); #endif - puts("[esound.cpp] executing " ESOUNDSERVER_START_SCRIPT "."); - if (system(ESOUNDSERVER_START_SCRIPT) != 0) - perror("Datei " ESOUNDSERVER_START_SCRIPT " fehlt.Bitte erstellen, wenn gebraucht.\nFile " ESOUNDSERVER_START_SCRIPT " not found. Please create if needed.\n"); + puts("[esound.cpp] executing " ESOUNDSERVER_START_SCRIPT "."); + if (my_system(ESOUNDSERVER_START_SCRIPT) != 0) + perror(ESOUNDSERVER_START_SCRIPT " failed"); #ifdef HAVE_DBOX_HARDWARE // disable iec aka digi out @@ -247,9 +248,9 @@ int CEsoundGui::exec(CMenuTarget* parent, const std::string &) irs2.Send(); #endif - puts("[esound.cpp] executing " ESOUNDSERVER_END_SCRIPT "."); - if (system(ESOUNDSERVER_END_SCRIPT) != 0) - perror("Datei " ESOUNDSERVER_END_SCRIPT " fehlt. Bitte erstellen, wenn gebraucht.\nFile " ESOUNDSERVER_END_SCRIPT " not found. Please create if needed.\n"); + puts("[esound.cpp] executing " ESOUNDSERVER_END_SCRIPT "."); + if (my_system(ESOUNDSERVER_END_SCRIPT) != 0) + perror(ESOUNDSERVER_END_SCRIPT " failed"); // Start Sectionsd g_Sectionsd->setPauseScanning(false); diff --git a/tuxbox/neutrino/src/gui/movieplayer.cpp b/tuxbox/neutrino/src/gui/movieplayer.cpp index 010a014..4bc7317 100644 --- a/tuxbox/neutrino/src/gui/movieplayer.cpp +++ b/tuxbox/neutrino/src/gui/movieplayer.cpp @@ -455,8 +455,8 @@ CMoviePlayerGui::exec (CMenuTarget * parent, const std::string & actionKey) } puts("[movieplayer.cpp] executing " MOVIEPLAYER_START_SCRIPT "."); - if (system(MOVIEPLAYER_START_SCRIPT) != 0) - perror("Datei " MOVIEPLAYER_START_SCRIPT " fehlt. Bitte erstellen, wenn gebraucht.\nFile " MOVIEPLAYER_START_SCRIPT " not found. Please create if needed.\n"); + if (my_system(MOVIEPLAYER_START_SCRIPT) != 0) + perror(MOVIEPLAYER_START_SCRIPT " failed"); // Stop or restart sectionsd according to configuration if (g_settings.streaming_stopsectionsd == CNeutrinoApp::SECTIONSD_STOP) @@ -555,8 +555,8 @@ CMoviePlayerGui::exec (CMenuTarget * parent, const std::string & actionKey) } puts("[movieplayer.cpp] executing " MOVIEPLAYER_END_SCRIPT "."); - if (system(MOVIEPLAYER_END_SCRIPT) != 0) - perror("Datei " MOVIEPLAYER_END_SCRIPT " fehlt. Bitte erstellen, wenn gebraucht.\nFile " MOVIEPLAYER_END_SCRIPT " not found. Please create if needed.\n"); + if (my_system(MOVIEPLAYER_END_SCRIPT) != 0) + perror(MOVIEPLAYER_END_SCRIPT " failed"); // Start sectionsd if stopped or restarted if (g_settings.streaming_stopsectionsd == CNeutrinoApp::SECTIONSD_STOP) diff --git a/tuxbox/neutrino/src/gui/movieplayer2.cpp b/tuxbox/neutrino/src/gui/movieplayer2.cpp index d5bcd80..54e7d3e 100644 --- a/tuxbox/neutrino/src/gui/movieplayer2.cpp +++ b/tuxbox/neutrino/src/gui/movieplayer2.cpp @@ -427,7 +427,8 @@ CMoviePlayerGui::exec(CMenuTarget *parent, const std::string &actionKey) CHintBox *startBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, "Starte Movieplayer..."); startBox->paint(); INFO("executing %s\n", MOVIEPLAYER_START_SCRIPT); - system(MOVIEPLAYER_START_SCRIPT); + if (my_system(MOVIEPLAYER_START_SCRIPT) != 0) + perror(MOVIEPLAYER_START_SCRIPT " failed"); startBox->hide(); delete startBox; @@ -531,7 +532,8 @@ CMoviePlayerGui::exec(CMenuTarget *parent, const std::string &actionKey) } INFO("executing %s\n", MOVIEPLAYER_END_SCRIPT); - system(MOVIEPLAYER_END_SCRIPT); + if (my_system(MOVIEPLAYER_END_SCRIPT) != 0) + perror(MOVIEPLAYER_END_SCRIPT " failed"); // Start sectionsd if stopped or restarted if (g_settings.streaming_stopsectionsd == CNeutrinoApp::SECTIONSD_STOP) diff --git a/tuxbox/neutrino/src/gui/pictureviewer.cpp b/tuxbox/neutrino/src/gui/pictureviewer.cpp index 1a9a514..877c19a 100644 --- a/tuxbox/neutrino/src/gui/pictureviewer.cpp +++ b/tuxbox/neutrino/src/gui/pictureviewer.cpp @@ -65,6 +65,7 @@ #include <gui/widget/stringinput.h> #include <system/settings.h> +#include <system/helper.h> #include <algorithm> #include <sys/stat.h> @@ -118,7 +119,6 @@ CPictureViewerGui::~CPictureViewerGui() //------------------------------------------------------------------------ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/) { - struct stat sFileInfo; selected = 0; width = w_max (710, 30); height = h_max (570, 0); @@ -151,13 +151,10 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & /*actionKey parent->hide(); } - if ( stat(PICTUREVIEWER_START_SCRIPT, &sFileInfo) == 0 ) - { - puts("[pictureviewer.cpp] executing " PICTUREVIEWER_START_SCRIPT "."); - if (system(PICTUREVIEWER_START_SCRIPT) != 0) - perror("Datei " PICTUREVIEWER_START_SCRIPT " fehlt.Bitte erstellen, wenn gebraucht.\nFile " PICTUREVIEWER_START_SCRIPT " not found. Please create if needed.\n"); - } - + puts("[pictureviewer.cpp] executing " PICTUREVIEWER_START_SCRIPT "."); + if (my_system(PICTUREVIEWER_START_SCRIPT) != 0) + perror(PICTUREVIEWER_START_SCRIPT " failed"); + // tell neutrino we're in pic_mode CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_pic ); // remember last mode @@ -177,12 +174,9 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & /*actionKey // free picviewer mem m_viewer->Cleanup(); - if ( stat(PICTUREVIEWER_END_SCRIPT, &sFileInfo) == 0) - { - puts("[pictureviewer.cpp] executing " PICTUREVIEWER_END_SCRIPT "."); - if (system(PICTUREVIEWER_END_SCRIPT) != 0) - perror("Datei " PICTUREVIEWER_END_SCRIPT " fehlt.Bitte erstellen, wenn gebraucht.\nFile " PICTUREVIEWER_END_SCRIPT " not found. Please create if needed.\n"); - } + puts("[pictureviewer.cpp] executing " PICTUREVIEWER_END_SCRIPT "."); + if (my_system(PICTUREVIEWER_END_SCRIPT) != 0) + perror(PICTUREVIEWER_END_SCRIPT " failed"); // Start Sectionsd g_Sectionsd->setPauseScanning(false); diff --git a/tuxbox/neutrino/src/gui/scan.cpp b/tuxbox/neutrino/src/gui/scan.cpp index ef3afc5..c6d6cdd 100644 --- a/tuxbox/neutrino/src/gui/scan.cpp +++ b/tuxbox/neutrino/src/gui/scan.cpp @@ -48,6 +48,7 @@ #include "gui/widget/hintbox.h" #include <system/settings.h> +#include <system/helper.h> #include <global.h> #include <neutrino.h> @@ -145,8 +146,8 @@ printf("[neutrino] TP_scan %d TP_freq %s TP_rate %s TP_fec %d TP_pol %d TP_mod % g_Controld->setVideoFormat(g_settings.video_backgroundFormat); puts("[scan.cpp] executing " SCAN_START_SCRIPT "."); - if (system(SCAN_START_SCRIPT) != 0) - perror("Datei " SCAN_START_SCRIPT " fehlt. Bitte erstellen, wenn gebraucht.\nFile " SCAN_START_SCRIPT " not found. Please create if needed.\n"); + if (my_system(SCAN_START_SCRIPT) != 0) + perror(SCAN_START_SCRIPT " failed"); g_Sectionsd->Restart(); g_Sectionsd->RegisterNeutrino(); @@ -216,8 +217,8 @@ printf("[neutrino] TP_scan %d TP_freq %s TP_rate %s TP_fec %d TP_pol %d TP_mod % hide(); puts("[scan.cpp] executing " SCAN_END_SCRIPT "."); - if (system(SCAN_END_SCRIPT) != 0) - perror("Datei " SCAN_END_SCRIPT " fehlt. Bitte erstellen, wenn gebraucht.\nFile " SCAN_END_SCRIPT " not found. Please create if needed.\n"); + if (my_system(SCAN_END_SCRIPT) != 0) + perror(SCAN_END_SCRIPT " failed"); g_Sectionsd->setPauseScanning(false); diff --git a/tuxbox/neutrino/src/neutrino.cpp b/tuxbox/neutrino/src/neutrino.cpp index 6a1ebcb..efd383f 100644 --- a/tuxbox/neutrino/src/neutrino.cpp +++ b/tuxbox/neutrino/src/neutrino.cpp @@ -113,6 +113,7 @@ #include <system/settings.h> #include <system/debug.h> #include <system/flashtool.h> +#include <system/helper.h> #ifdef ENABLE_GUI_MOUNT #include <system/fsmounter.h> #endif @@ -144,7 +145,7 @@ CVCRControl::CDevice * recordingdevice = NULL; #define NEUTRINO_ZAPTO_TIMER_SCRIPT CONFIGDIR "/zapto.timer" #define NEUTRINO_RECORDING_TIMER_SCRIPT CONFIGDIR "/recording.timer" #define NEUTRINO_RECORDING_START_SCRIPT CONFIGDIR "/recording.start" -#define NEUTRINO_RECORDING_ENDED_SCRIPT CONFIGDIR "/recording.end" +#define NEUTRINO_RECORDING_END_SCRIPT CONFIGDIR "/recording.end" #define NEUTRINO_ENTER_STANDBY_SCRIPT CONFIGDIR "/standby.on" #define NEUTRINO_LEAVE_STANDBY_SCRIPT CONFIGDIR "/standby.off" #define NEUTRINO_INIT_END_SCRIPT CONFIGDIR "/init.end" @@ -173,30 +174,6 @@ static void initGlobals(void) g_PluginList = NULL; } -bool CNeutrinoApp::execute_start_file(const char *filename, const bool blocking, const bool verbose) -/* returns true if execution of a script was successfully */ -{ - std::string command = filename; - struct stat statbuf; - if (stat(filename, &statbuf) == 0) { - if (false == blocking) - command += " &"; - if (verbose) - printf("[neutrino] executing %s\n", command.c_str()); - int result = system(command.c_str()); - if (result !=0 ) { - printf("[neutrino] %s failed with return code = %d...\n", filename, WEXITSTATUS(result)); - return false; - } - } - else - { - printf("[neutrino] no file %s was found\n", filename); - return false; - } - return true; -} - int CNeutrinoApp::execute_sys_command(const char *command) /* returns exit code after executed system command */ { @@ -1740,7 +1717,9 @@ bool CNeutrinoApp::doGuiRecord(char * preselectedDir, bool addTimer, char * file { if(recordingstatus == 1) { - execute_start_file(NEUTRINO_RECORDING_START_SCRIPT); + puts("[neutrino.cpp] executing " NEUTRINO_RECORDING_START_SCRIPT "."); + if (my_system(NEUTRINO_RECORDING_START_SCRIPT) != 0) + perror(NEUTRINO_RECORDING_START_SCRIPT " failed"); eventinfo.channel_id = g_Zapit->getCurrentServiceID(); CEPGData epgData; @@ -2251,7 +2230,9 @@ int CNeutrinoApp::run(int argc, char **argv) // shutdown counter SHTDCNT::getInstance()->init(); - execute_start_file(NEUTRINO_INIT_END_SCRIPT, false); + puts("[neutrino.cpp] executing " NEUTRINO_INIT_END_SCRIPT "."); + if (my_system(NEUTRINO_INIT_END_SCRIPT) != 0) + perror(NEUTRINO_INIT_END_SCRIPT " failed"); RealRun(CPersonalizeGui::getInstance()->getWidget(0)/**main**/); @@ -2831,7 +2812,10 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t m, neutrino_msg_data_t data) standbyAfterRecord = true; standbyMode(false); } - execute_start_file(NEUTRINO_RECORDING_START_SCRIPT); + puts("[neutrino.cpp] executing " NEUTRINO_RECORDING_START_SCRIPT "."); + if (my_system(NEUTRINO_RECORDING_START_SCRIPT) != 0) + perror(NEUTRINO_RECORDING_START_SCRIPT " failed"); + /* set nextRecordingInfo to current event (replace other scheduled recording if available) */ /* @@ -2871,7 +2855,9 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t m, neutrino_msg_data_t data) if (recordingstatus == 0) { - execute_start_file(NEUTRINO_RECORDING_ENDED_SCRIPT); + puts("[neutrino.cpp] executing " NEUTRINO_RECORDING_END_SCRIPT "."); + if (my_system(NEUTRINO_RECORDING_END_SCRIPT) != 0) + perror(NEUTRINO_RECORDING_END_SCRIPT " failed"); } } else if(nextRecordingInfo!=NULL) @@ -2932,7 +2918,11 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t m, neutrino_msg_data_t data) else if( msg == NeutrinoMessages::ANNOUNCE_ZAPTO) { CTimerd::RecordingInfo * eventinfo = (CTimerd::RecordingInfo *) data; - execute_start_file(NEUTRINO_ZAPTO_TIMER_SCRIPT); + + puts("[neutrino.cpp] executing " NEUTRINO_ZAPTO_TIMER_SCRIPT "."); + if (my_system(NEUTRINO_ZAPTO_TIMER_SCRIPT) != 0) + perror(NEUTRINO_ZAPTO_TIMER_SCRIPT " failed"); + if( mode == mode_standby ) { // WAKEUP @@ -2979,12 +2969,13 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t m, neutrino_msg_data_t data) standbyAfterRecord = true; standbyMode(false); } - execute_start_file(NEUTRINO_RECORDING_TIMER_SCRIPT); + puts("[neutrino.cpp] executing " NEUTRINO_RECORDING_TIMER_SCRIPT "."); + if (my_system(NEUTRINO_RECORDING_TIMER_SCRIPT) != 0) + perror(NEUTRINO_RECORDING_TIMER_SCRIPT " failed"); + if( g_settings.recording_server_wakeup ) { - std::string command = "ether-wake "; - command += g_settings.recording_server_mac; - if(system(command.c_str()) != 0) + if (my_system(2, "ether-wake", g_settings.recording_server_mac) != 0) perror("ether-wake failed"); } if (g_settings.recording_type == RECORDING_FILE) @@ -2995,9 +2986,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t m, neutrino_msg_data_t data) if (strcmp(g_settings.network_nfs_local_dir[i],recDir) == 0) { printf("[neutrino] waking up %s (%s)\n",g_settings.network_nfs_ip[i].c_str(),recDir); - std::string command = "ether-wake "; - command += g_settings.network_nfs_mac[i]; - if(system(command.c_str()) != 0) + if (my_system(2, "ether-wake", g_settings.network_nfs_mac[i]) != 0) perror("ether-wake failed"); break; } @@ -3750,7 +3739,9 @@ void CNeutrinoApp::standbyMode( bool bOnOff ) CLCD::getInstance()->setMode(CLCD::MODE_STANDBY); g_Controld->videoPowerDown(true); - execute_start_file(NEUTRINO_ENTER_STANDBY_SCRIPT); + puts("[neutrino.cpp] executing " NEUTRINO_ENTER_STANDBY_SCRIPT "."); + if (my_system(NEUTRINO_ENTER_STANDBY_SCRIPT) != 0) + perror(NEUTRINO_ENTER_STANDBY_SCRIPT " failed"); if (g_settings.standby_save_power) { @@ -3799,7 +3790,9 @@ void CNeutrinoApp::standbyMode( bool bOnOff ) } g_Controld->videoPowerDown(false); - execute_start_file(NEUTRINO_LEAVE_STANDBY_SCRIPT); + puts("[neutrino.cpp] executing " NEUTRINO_LEAVE_STANDBY_SCRIPT "."); + if (my_system(NEUTRINO_LEAVE_STANDBY_SCRIPT) != 0) + perror(NEUTRINO_LEAVE_STANDBY_SCRIPT " failed"); #ifdef ENABLE_LIRC if (!standbyAfterRecord) diff --git a/tuxbox/neutrino/src/neutrino.h b/tuxbox/neutrino/src/neutrino.h index b5d0c03..fba89c7 100644 --- a/tuxbox/neutrino/src/neutrino.h +++ b/tuxbox/neutrino/src/neutrino.h @@ -315,7 +315,6 @@ class CNeutrinoApp : public CMenuTarget, CChangeObserver void SendSectionsdConfig(void); void setupRecordingDevice(void); - bool execute_start_file(const char *filename, const bool blocking = true, const bool verbose = false); int execute_sys_command(const char *command); CConfigFile* getConfigFile() {return &configfile;}; diff --git a/tuxbox/neutrino/src/system/flashtool.cpp b/tuxbox/neutrino/src/system/flashtool.cpp index 6686086..79e1eea 100644 --- a/tuxbox/neutrino/src/system/flashtool.cpp +++ b/tuxbox/neutrino/src/system/flashtool.cpp @@ -24,6 +24,7 @@ #endif #include <system/flashtool.h> +#include <system/helper.h> #include <stdio.h> #include <unistd.h> @@ -45,6 +46,7 @@ #include <global.h> #define LOCAL_MOUNT_DIR "/tmp/checkimage" +#define FLASHTOOL_START_SCRIPT CONFIGDIR "/flash.start" CFlashTool::CFlashTool() { @@ -264,6 +266,10 @@ bool CFlashTool::erase(int globalProgressEnd) return false; } + puts("[flashtool.cpp] executing " FLASHTOOL_START_SCRIPT "."); + if (my_system(FLASHTOOL_START_SCRIPT) != 0) + perror(FLASHTOOL_START_SCRIPT " failed"); + if(statusViewer) { globalProgressBegin = statusViewer->getGlobalStatus(); diff --git a/tuxbox/neutrino/src/system/helper.cpp b/tuxbox/neutrino/src/system/helper.cpp index 9dbe8df..6bd2bcb 100644 --- a/tuxbox/neutrino/src/system/helper.cpp +++ b/tuxbox/neutrino/src/system/helper.cpp @@ -24,6 +24,12 @@ */ +#include <errno.h> +#include <unistd.h> +#include <sys/wait.h> +#include <sys/stat.h> +#include <stdarg.h> + #include "helper.h" void StrSearchReplace( std::string &s, const std::string &to_find, const std::string& repl_with ) @@ -40,3 +46,77 @@ void StrSearchReplace( std::string &s, const std::string &to_find, const std::st location = s.find(to_find, location); } } + +bool file_exists(const char *filename) +{ + struct stat stat_buf; + if(::stat(filename, &stat_buf) == 0) + { + return true; + } else + { + return false; + } +} + +//use for script with full path +int my_system(const char * cmd) +{ + if (!file_exists(cmd)) + return -1; + + return my_system(1, cmd); +} + +int my_system(int argc, const char *arg, ...) +{ + int i = 0, ret = 0, childExit = 0; +#define ARGV_MAX 64 + /* static right now but could be made dynamic if necessary */ + int argv_max = ARGV_MAX; + const char *argv[ARGV_MAX]; + va_list args; + argv[0] = arg; + va_start(args, arg); + + while(++i < argc) + { + if (i == argv_max) + { + fprintf(stderr, "my_system: too many arguments!\n"); + return -1; + } + argv[i] = va_arg(args, const char *); + } + argv[i] = NULL; /* sentinel */ + //fprintf(stderr,"%s:", __func__);for(i=0;argv[i];i++)fprintf(stderr," '%s'",argv[i]);fprintf(stderr,"\n"); + + pid_t pid; + int maxfd = getdtablesize();// sysconf(_SC_OPEN_MAX); + switch (pid = vfork()) + { + case -1: /* can't vfork */ + perror("vfork"); + ret = -errno; + break; + case 0: /* child process */ + for(i = 3; i < maxfd; i++) + close(i); + if (setsid() == -1) + perror("my_system setsid"); + if (execvp(argv[0], (char * const *)argv)) + { + ret = -errno; + if (errno != ENOENT) /* don't complain if argv[0] only does not exist */ + fprintf(stderr, "ERROR: my_system \"%s\": %m\n", argv[0]); + } + _exit(ret); // terminate c h i l d proces s only + default: /* parent returns to calling process */ + waitpid(pid, &childExit, 0); + if (WEXITSTATUS(childExit) != 0) + ret = (signed char)WEXITSTATUS(childExit); + break; + } + va_end(args); + return ret; +} diff --git a/tuxbox/neutrino/src/system/helper.h b/tuxbox/neutrino/src/system/helper.h index b04a524..5fd8de4 100644 --- a/tuxbox/neutrino/src/system/helper.h +++ b/tuxbox/neutrino/src/system/helper.h @@ -29,4 +29,9 @@ void StrSearchReplace( std::string &s, const std::string &to_find, const std::string& repl_with ); +int my_system(const char * cmd); +int my_system(int argc, const char *arg, ...); /* argc is number of arguments including command */ + +bool file_exists(const char *filename); + #endif commit bd7b8acdcb425b48d278c893bf709ccc0cbd9359 Author: Christian Schuett <gaucho...@hotmail.com> Date: Sat Oct 4 17:04:20 2014 +0200 Neutrino moviebrowser: show 3 dashes in footer if filter is not set Signed-off-by: Christian Schuett <gaucho...@hotmail.com> Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp index 050c925..48d4ef1 100644 --- a/tuxbox/neutrino/src/gui/moviebrowser.cpp +++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp @@ -560,7 +560,7 @@ void CMovieBrowser::initGlobalSettings(void) m_settings.sorting.item = MB_INFO_TITLE; m_settings.filter.item = MB_INFO_MAX_NUMBER; - m_settings.filter.optionString = "-"; + m_settings.filter.optionString = "---"; m_settings.filter.optionVar = 0; m_settings.parentalLockAge = MI_PARENTAL_OVER18; @@ -731,7 +731,7 @@ bool CMovieBrowser::loadSettings(MB_SETTINGS* settings) settings->sorting.direction = (MB_DIRECTION)configfile.getInt32("mb_sorting_direction", MB_DIRECTION_UP); settings->filter.item = (MB_INFO_ITEM)configfile.getInt32("mb_filter_item", MB_INFO_INFO1); - settings->filter.optionString = configfile.getString("mb_filter_optionString", "-"); + settings->filter.optionString = configfile.getString("mb_filter_optionString", "---"); settings->filter.optionVar = configfile.getInt32("mb_filter_optionVar", 0); settings->parentalLockAge = (MI_PARENTAL_LOCKAGE)configfile.getInt32("mb_parentalLockAge", MI_PARENTAL_OVER18); @@ -2120,7 +2120,7 @@ bool CMovieBrowser::onButtonPressFilterList(neutrino_msg_t msg) if(selected_line == 0) { m_settings.filter.item = MB_INFO_MAX_NUMBER; - m_settings.filter.optionString = "-"; + m_settings.filter.optionString = "---"; m_settings.filter.optionVar = 0; refreshFilterList(); m_pcFilter->setSelectedLine(0); commit bc5228d81bb23518a182db94c6df0287bc3fdfd9 Author: Christian Schuett <gaucho...@hotmail.com> Date: Sat Oct 4 14:56:56 2014 +0200 Neutrino movieplayer: show dashes in bookmark menu if value is not set Signed-off-by: Christian Schuett <gaucho...@hotmail.com> Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp index a07773f..050c925 100644 --- a/tuxbox/neutrino/src/gui/moviebrowser.cpp +++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp @@ -3697,11 +3697,16 @@ const char * CSelectedMenu::getTargetValue() { if (value) { - char tmp[16]; - sprintf(tmp, "%d", *value / 60); - value_string = tmp; - value_string += " "; - value_string += g_Locale->getText(LOCALE_WORD_MINUTES_SHORT); + if (*value > 0) + { + char tmp[16]; + sprintf(tmp, "%d", *value / 60); + value_string = tmp; + value_string += " "; + value_string += g_Locale->getText(LOCALE_WORD_MINUTES_SHORT); + } + else + value_string = "---"; return value_string.c_str(); } return NULL; commit 27260ea172d037de57fa691c5c670ddfe85cf897 Author: Christian Schuett <gaucho...@hotmail.com> Date: Fri Oct 3 22:04:02 2014 +0200 Neutrino moviebrowser: use locales in start pos selection menu Signed-off-by: Christian Schuett <gaucho...@hotmail.com> Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp index 405e37a..a07773f 100644 --- a/tuxbox/neutrino/src/gui/moviebrowser.cpp +++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp @@ -3302,10 +3302,12 @@ int CMovieBrowser::showStartPosSelectionMenu(void) // P2 bool sep_added = false; if(m_movieSelectionHandler == NULL) return(result); - - char start_pos[13]; snprintf(start_pos, 12,"%3d min",m_movieSelectionHandler->bookmarks.start/60); - char play_pos[13]; snprintf(play_pos, 12,"%3d min",m_movieSelectionHandler->bookmarks.lastPlayStop/60); - + + char start_pos[13]; + snprintf(start_pos, 13, "%3d %s", m_movieSelectionHandler->bookmarks.start / 60, g_Locale->getText(LOCALE_WORD_MINUTES_SHORT)); + char play_pos[13]; + snprintf(play_pos, 13, "%3d %s", m_movieSelectionHandler->bookmarks.lastPlayStop / 60, g_Locale->getText(LOCALE_WORD_MINUTES_SHORT)); + char book[MI_MOVIE_BOOK_USER_MAX][20]; char menu_nr_str[5]; @@ -3352,8 +3354,8 @@ int CMovieBrowser::showStartPosSelectionMenu(void) // P2 position[menu_nr] = m_movieSelectionHandler->bookmarks.user[i].pos; else position[menu_nr] = m_movieSelectionHandler->bookmarks.user[i].pos + m_movieSelectionHandler->bookmarks.user[i].length; - - snprintf(book[i], 19,"%5d min",position[menu_nr]/60); + + snprintf(book[i], 20, "%5d %s", position[menu_nr] / 60, g_Locale->getText(LOCALE_WORD_MINUTES_SHORT)); sprintf(menu_nr_str, "%d", menu_nr); startPosItem = new CMenuForwarder(m_movieSelectionHandler->bookmarks.user[i].name.c_str(), true, book[i], &startPosChanger, menu_nr_str); startPosItem->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true); commit ad2ecda9e11da3ca2cb6f38e4229a214d58568bd Author: Christian Schuett <gaucho...@hotmail.com> Date: Fri Oct 3 21:17:00 2014 +0200 Neutrino movieplayer: show current values in bookmark menu Signed-off-by: Christian Schuett <gaucho...@hotmail.com> Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/data/locale/deutsch.locale b/tuxbox/neutrino/data/locale/deutsch.locale index 7d07f57..3e1ab5f 100644 --- a/tuxbox/neutrino/data/locale/deutsch.locale +++ b/tuxbox/neutrino/data/locale/deutsch.locale @@ -807,7 +807,7 @@ motorcontrol.switch_step_drive_mode Switch Step/Drive Mode (b) motorcontrol.user_menue Benutzermenü moviebrowser.book_clear_all Lösche alle moviebrowser.book_head Markierungen -moviebrowser.book_lastmoviestop letzter Wiedergabestop: +moviebrowser.book_lastmoviestop Letzter Wiedergabestopp: moviebrowser.book_movieend Filmende: moviebrowser.book_moviestart Filmanfang: moviebrowser.book_name Name: @@ -815,7 +815,7 @@ moviebrowser.book_new Neue Markierung moviebrowser.book_position Position: moviebrowser.book_type Sprung (<0 zurück, >0 vor): moviebrowser.book_type_backward Wiederholung -moviebrowser.book_type_forward überspringen +moviebrowser.book_type_forward Ãberspringen moviebrowser.browser_frame_high Anzeigehöhe oberes Fenster [Punkte] moviebrowser.browser_row_head Spalten Einstellungen moviebrowser.browser_row_item Spalteninfo @@ -954,7 +954,7 @@ movieplayer.pleasewait Bitte warten Sie.\nDie Verbindung zum Streamingserver wir movieplayer.plugin Plugin movieplayer.resync Resync movieplayer.toomanybookmarks Sie haben bereits zu viele Bookmarks angelegt.\nEs muà erst ein anderes gelöscht werden. -movieplayer.tshelp1 Stop +movieplayer.tshelp1 Stopp movieplayer.tshelp10 ca. 10 Minuten zurück movieplayer.tshelp11 ca. 10 Minuten vor movieplayer.tshelp12 Hilfe: http://www.giggo.de/dbox2/movieplayer.html @@ -979,7 +979,7 @@ movieplayer.tshelp9 ca. 5 Minuten vor movieplayer.tsplayback TS Abspielen movieplayer.tsplayback_pc TS Abspielen mit PIN movieplayer.vcdplayback (S)VCD -movieplayer.vlchelp1 Stop +movieplayer.vlchelp1 Stopp movieplayer.vlchelp10 ca. 10 Minuten zurück movieplayer.vlchelp11 ca. 10 Minuten vor movieplayer.vlchelp12 Hilfe: http://www.giggo.de/dbox2/movieplayer.html diff --git a/tuxbox/neutrino/data/locale/english.locale b/tuxbox/neutrino/data/locale/english.locale index 630a336..2970d98 100644 --- a/tuxbox/neutrino/data/locale/english.locale +++ b/tuxbox/neutrino/data/locale/english.locale @@ -815,7 +815,7 @@ moviebrowser.book_new New Bookmark moviebrowser.book_position Position: moviebrowser.book_type Jump (<0 back, >0 for): moviebrowser.book_type_backward Repeat -moviebrowser.book_type_forward jump over +moviebrowser.book_type_forward Jump over moviebrowser.browser_frame_high Browser hight [Pixel] moviebrowser.browser_row_head Row settings moviebrowser.browser_row_item Row item diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp index 6f80ddd..405e37a 100644 --- a/tuxbox/neutrino/src/gui/moviebrowser.cpp +++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp @@ -3691,6 +3691,24 @@ bool CBookItemMenuForwarderNotifier::changeNotify(const neutrino_locale_t, void* ************************************************************************/ +const char * CSelectedMenu::getTargetValue() +{ + if (value) + { + char tmp[16]; + sprintf(tmp, "%d", *value / 60); + value_string = tmp; + value_string += " "; + value_string += g_Locale->getText(LOCALE_WORD_MINUTES_SHORT); + return value_string.c_str(); + } + return NULL; +} + +/************************************************************************ + +************************************************************************/ + CMenuSelector::CMenuSelector(const char * OptionName, const bool Active , char * OptionValue, int* ReturnInt ,int ReturnIntValue ) : CMenuItem() { optionValueString = NULL; diff --git a/tuxbox/neutrino/src/gui/moviebrowser.h b/tuxbox/neutrino/src/gui/moviebrowser.h index a5be223..f3173a4 100644 --- a/tuxbox/neutrino/src/gui/moviebrowser.h +++ b/tuxbox/neutrino/src/gui/moviebrowser.h @@ -412,10 +412,14 @@ class CMovieHelp : public CMenuTarget // CLass to verifiy a menu was selected by the user. There might be better ways to do so. class CSelectedMenu : public CMenuTarget { + private: + std::string value_string; public: bool selected; - CSelectedMenu(void){selected = false;}; + int* value; + CSelectedMenu(void){selected = false; value = NULL;}; inline int exec(CMenuTarget* /*parent*/, const std::string & /*actionKey*/){selected = true; return menu_return::RETURN_EXIT;}; + const char * getTargetValue(); }; diff --git a/tuxbox/neutrino/src/gui/movieplayer.cpp b/tuxbox/neutrino/src/gui/movieplayer.cpp index 575ca8f..010a014 100644 --- a/tuxbox/neutrino/src/gui/movieplayer.cpp +++ b/tuxbox/neutrino/src/gui/movieplayer.cpp @@ -3214,18 +3214,19 @@ void CMoviePlayerGui::PlayFile (int parental) new_bookmark.length = 0; // very dirty usage of the menue, but it works and I already spent to much time with it, feel free to make it better ;-) - #define BOOKMARK_START_MENU_MAX_ITEMS 6 + #define BOOKMARK_START_MENU_MAX_ITEMS 7 CSelectedMenu cSelectedMenuBookStart[BOOKMARK_START_MENU_MAX_ITEMS]; CMenuWidget bookStartMenu(LOCALE_MOVIEBROWSER_BOOK_NEW, NEUTRINO_ICON_STREAMING); bookStartMenu.addItem(GenericMenuSeparator); - bookStartMenu.addItem( new CMenuForwarder (LOCALE_MOVIEPLAYER_HEAD, true,NULL,&cSelectedMenuBookStart[0])); + bookStartMenu.addItem(new CMenuForwarder(LOCALE_MOVIEPLAYER_HEAD, true, NULL, &cSelectedMenuBookStart[0])); bookStartMenu.addItem(GenericMenuSeparatorLine); - bookStartMenu.addItem( new CMenuForwarder (LOCALE_MOVIEBROWSER_HEAD, true,NULL,&cSelectedMenuBookStart[1])); - bookStartMenu.addItem( new CMenuForwarder (LOCALE_MOVIEBROWSER_BOOK_TYPE_FORWARD, true,NULL,&cSelectedMenuBookStart[2])); - bookStartMenu.addItem( new CMenuForwarder (LOCALE_MOVIEBROWSER_BOOK_TYPE_BACKWARD, true,NULL,&cSelectedMenuBookStart[3])); - bookStartMenu.addItem( new CMenuForwarder (LOCALE_MOVIEBROWSER_BOOK_MOVIESTART, true,NULL,&cSelectedMenuBookStart[4])); - bookStartMenu.addItem( new CMenuForwarder (LOCALE_MOVIEBROWSER_BOOK_MOVIEEND, true,NULL,&cSelectedMenuBookStart[5])); + bookStartMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, &cSelectedMenuBookStart[1])); + bookStartMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_TYPE_FORWARD, true, NULL, &cSelectedMenuBookStart[2])); + bookStartMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_TYPE_BACKWARD, true, NULL, &cSelectedMenuBookStart[3])); + bookStartMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_MOVIESTART, true, NULL, &cSelectedMenuBookStart[4])); + bookStartMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_MOVIEEND, true, NULL, &cSelectedMenuBookStart[5])); + bookStartMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_LASTMOVIESTOP, false, NULL, &cSelectedMenuBookStart[6])); #endif /* ENABLE_MOVIEBROWSER */ CTimeOSD FileTime; @@ -3426,6 +3427,20 @@ void CMoviePlayerGui::PlayFile (int parental) // get the movie info handle (to be used for e.g. bookmark handling) p_movie_info = CMovieBrowser::getInstance()->getCurrentMovieInfo(); + // get bookmark handles for bookmark menu + if (p_movie_info) + { + cSelectedMenuBookStart[4].value = &(p_movie_info->bookmarks.start); + cSelectedMenuBookStart[5].value = &(p_movie_info->bookmarks.end); + cSelectedMenuBookStart[6].value = &(p_movie_info->bookmarks.lastPlayStop); + } + else + { + cSelectedMenuBookStart[4].value = NULL; + cSelectedMenuBookStart[5].value = NULL; + cSelectedMenuBookStart[6].value = NULL; + } + // get the start position for the movie int currentStartPos = CMovieBrowser::getInstance()->getCurrentStartPos(); off_t secondoffset = (g_settings.streaming_use_reclength && p_movie_info != NULL && p_movie_info->rec_length) ? ((file->Size / p_movie_info->rec_length) / SIZE_TS_PKT) * SIZE_TS_PKT : SECONDOFFSET; commit adf6297278c2de1f7758e98151e2bfb9fcf8bb90 Author: Christian Schuett <gaucho...@hotmail.com> Date: Fri Oct 3 21:14:16 2014 +0200 Neutrino CFile: add isDir() and isReg() and use it if possible based on patch by [CST] Focus <focus....@gmail.com> in Coolstream Git Signed-off-by: Christian Schuett <gaucho...@hotmail.com> Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/src/driver/file.cpp b/tuxbox/neutrino/src/driver/file.cpp index e31c08c..3a8742c 100644 --- a/tuxbox/neutrino/src/driver/file.cpp +++ b/tuxbox/neutrino/src/driver/file.cpp @@ -70,6 +70,16 @@ CFile::CFile() { } +bool CFile::isDir(void) +{ + return S_ISDIR(Mode); +} + +bool CFile::isReg(void) +{ + return S_ISREG(Mode); +} + CFile::FileType CFile::getType(void) const { if(S_ISDIR(Mode)) diff --git a/tuxbox/neutrino/src/driver/file.h b/tuxbox/neutrino/src/driver/file.h index 75de80c..e014983 100644 --- a/tuxbox/neutrino/src/driver/file.h +++ b/tuxbox/neutrino/src/driver/file.h @@ -70,6 +70,9 @@ public: std::string getFileName(void) const; std::string getPath(void) const; + bool isDir(void); + bool isReg(void); + CFile(); off_t Size; std::string Name; diff --git a/tuxbox/neutrino/src/gui/filebrowser.cpp b/tuxbox/neutrino/src/gui/filebrowser.cpp index 611bcd2..ef37131 100644 --- a/tuxbox/neutrino/src/gui/filebrowser.cpp +++ b/tuxbox/neutrino/src/gui/filebrowser.cpp @@ -380,14 +380,14 @@ void CFileBrowser::ChangeDir(const std::string & filename, int selection) CFileList::iterator file = allfiles.begin(); for(; file != allfiles.end() ; ++file) { - if(Filter != NULL && (!S_ISDIR(file->Mode)) && use_filter) + if(Filter != NULL && !file->isDir() && use_filter) { if(!Filter->matchFilter(file->Name)) { continue; } } - if(Dir_Mode && (!S_ISDIR(file->Mode))) + if(Dir_Mode && !file->isDir()) { continue; } @@ -797,7 +797,7 @@ bool CFileBrowser::exec(const char * const dirname) { if(filelist[selected].getFileName() != "..") { - if( (S_ISDIR(filelist[selected].Mode) && Dirs_Selectable) || !S_ISDIR(filelist[selected].Mode) ) + if( (filelist[selected].isDir() && Dirs_Selectable) || !filelist[selected].isDir() ) { filelist[selected].Marked = !filelist[selected].Marked; paintItem(selected - liststart); @@ -844,7 +844,7 @@ bool CFileBrowser::exec(const char * const dirname) { if (!(filelist.empty())) { - if (S_ISDIR(filelist[selected].Mode)) + if (filelist[selected].isDir()) { #ifdef ENABLE_INTERNETRADIO if (m_Mode == ModeSC) { @@ -866,7 +866,7 @@ bool CFileBrowser::exec(const char * const dirname) if (m_Mode == ModeSC) { for(unsigned int i = 0; i < filelist.size();i++) { - if (S_ISDIR(filelist[i].Mode) && filelist[i].getFileName() == "..") { + if (filelist[i].isDir() && filelist[i].getFileName() == "..") { ChangeDir(filelist[i].Url); break; } @@ -982,7 +982,7 @@ bool CFileBrowser::exec(const char * const dirname) std::string filename = filelist[selected].Name; if ( filename.length() > 1 ) { - if((!Multi_Select) && S_ISDIR(filelist[selected].Mode) && !Dir_Mode) + if(!Multi_Select && filelist[selected].isDir() && !Dir_Mode) { #ifdef ENABLE_INTERNETRADIO if (m_Mode == ModeSC) @@ -1051,7 +1051,7 @@ bool CFileBrowser::exec(const char * const dirname) for(unsigned int i = 0; i < filelist.size();i++) if(filelist[i].Marked) { - if(S_ISDIR(filelist[i].Mode)) { + if(filelist[i].isDir()) { if (!progress) { progress = new CProgressWindow(); progress->setTitle(LOCALE_FILEBROWSER_SCAN); @@ -1128,14 +1128,14 @@ void CFileBrowser::addRecursiveDir(CFileList * re_filelist, std::string rpath, b std::string basename = tmplist[i].Name.substr(tmplist[i].Name.rfind('/')+1); if( basename != ".." ) { - if(Filter != NULL && (!S_ISDIR(tmplist[i].Mode)) && use_filter) + if(Filter != NULL && !tmplist[i].isDir() && use_filter) { if(!Filter->matchFilter(tmplist[i].Name)) { continue; } } - if(!S_ISDIR(tmplist[i].Mode)) + if(!tmplist[i].isDir()) re_filelist->push_back(tmplist[i]); else addRecursiveDir(re_filelist,tmplist[i].Name, false, progress); @@ -1186,7 +1186,7 @@ void CFileBrowser::paintItem(unsigned int pos) bgcolor = (liststart + pos == selected) ? COL_MENUCONTENTSELECTED_PLUS_2 : COL_MENUCONTENT_PLUS_2; } - if (g_settings.filebrowser_showrights == 0 && S_ISREG(actual_file->Mode)) + if (g_settings.filebrowser_showrights == 0 && actual_file->isReg()) colwidth2 = 0; else colwidth2 = fnt_item->getRenderWidth("rwxrwxrwx"); @@ -1241,7 +1241,7 @@ void CFileBrowser::paintItem(unsigned int pos) } fnt_item->RenderString(x + 35, ypos + fheight, colwidth1, &f_name[0], color, 0, true); // UTF-8 - if( S_ISREG(actual_file->Mode) ) + if (actual_file->isReg()) { if (g_settings.filebrowser_showrights != 0) { @@ -1291,7 +1291,7 @@ void CFileBrowser::paintItem(unsigned int pos) fnt_item->RenderString(x + width - sz_w - 25, ypos+ fheight, sz_w, tmpstr, color); } - if( S_ISDIR(actual_file->Mode) ) + if (actual_file->isDir()) { char timestring[18]; time_t rawtime; diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp index 1a078a9..6f80ddd 100644 --- a/tuxbox/neutrino/src/gui/moviebrowser.cpp +++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp @@ -2587,7 +2587,7 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname) m_movieInfo.clearMovieInfo(&movieInfo); // refresh structure for(unsigned int i = 0; i < flist.size(); i++) { - if( S_ISDIR(flist[i].Mode)) + if (flist[i].isDir()) { flist[i].Name += '/'; //TRACE("[mb] Dir: '%s'\r\n",movieInfo.file.Name.c_str()); diff --git a/tuxbox/neutrino/src/gui/update.cpp b/tuxbox/neutrino/src/gui/update.cpp index 08e57b1..15a0445 100644 --- a/tuxbox/neutrino/src/gui/update.cpp +++ b/tuxbox/neutrino/src/gui/update.cpp @@ -308,7 +308,7 @@ bool CFlashUpdate::checkVersion4Update() UpdatesBrowser.ChangeDir(gTmpPath); for (CFileList::iterator file = UpdatesBrowser.filelist.begin(); file != UpdatesBrowser.filelist.end(); ++file) { - if (!(S_ISDIR(file->Mode))) + if (!file->isDir()) { if (CFileSelected == NULL) CFileSelected = &(*file); commit a726e172299ec8521db9f8d636dc7aa7420a9ed7 Author: Christian Schuett <gaucho...@hotmail.com> Date: Fri Oct 3 21:00:05 2014 +0200 Neutrino locales: fix filebrowser.sort.namedirsfirst based on patch by [CST] Focus <focus....@gmail.com> in Coolstream Git Signed-off-by: Christian Schuett <gaucho...@hotmail.com> Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/data/locale/deutsch.locale b/tuxbox/neutrino/data/locale/deutsch.locale index 459ef9b..7d07f57 100644 --- a/tuxbox/neutrino/data/locale/deutsch.locale +++ b/tuxbox/neutrino/data/locale/deutsch.locale @@ -458,8 +458,8 @@ filebrowser.scan Durchsuche Verzeichnisse filebrowser.select Auswählen filebrowser.showrights Dateirechte anzeigen filebrowser.sort.date (Datum) -filebrowser.sort.name (Dateiname) -filebrowser.sort.namedirsfirst (Dateiname2) +filebrowser.sort.name (Name) +filebrowser.sort.namedirsfirst (Verz., Datei) filebrowser.sort.size (GröÃe) filebrowser.sort.type (Typ) filesystem.is.utf8 Dateisystem diff --git a/tuxbox/neutrino/data/locale/english.locale b/tuxbox/neutrino/data/locale/english.locale index 8d6f200..630a336 100644 --- a/tuxbox/neutrino/data/locale/english.locale +++ b/tuxbox/neutrino/data/locale/english.locale @@ -458,9 +458,9 @@ filebrowser.scan Scanning folder filebrowser.select Select filebrowser.showrights Show File Permissions filebrowser.sort.date (date) -filebrowser.sort.name (filename) -filebrowser.sort.namedirsfirst (filename2) -filebrowser.sort.size (Size) +filebrowser.sort.name (name) +filebrowser.sort.namedirsfirst (dir., files) +filebrowser.sort.size (size) filebrowser.sort.type (type) filesystem.is.utf8 file system filesystem.is.utf8.option.iso8859.1 ISO-8859-1 commit 02873f78090484613c7e632844dbbca8cc1ea7a8 Author: Christian Schuett <gaucho...@hotmail.com> Date: Fri Oct 3 20:57:41 2014 +0200 Neutrino hintboxes: use hide() in dtor based on patch by [CST] Focus <focus....@gmail.com> in Coolstream Git Signed-off-by: Christian Schuett <gaucho...@hotmail.com> Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/src/gui/widget/hintbox.cpp b/tuxbox/neutrino/src/gui/widget/hintbox.cpp index 48f7324..19e1274 100644 --- a/tuxbox/neutrino/src/gui/widget/hintbox.cpp +++ b/tuxbox/neutrino/src/gui/widget/hintbox.cpp @@ -122,11 +122,7 @@ CHintBox::CHintBox(const neutrino_locale_t Caption, const char * const Text, con CHintBox::~CHintBox(void) { - if (window != NULL) - { - delete window; - window = NULL; - } + hide(); free(message); } diff --git a/tuxbox/neutrino/src/gui/widget/hintboxext.cpp b/tuxbox/neutrino/src/gui/widget/hintboxext.cpp index 66ee7e0..96867d9 100644 --- a/tuxbox/neutrino/src/gui/widget/hintboxext.cpp +++ b/tuxbox/neutrino/src/gui/widget/hintboxext.cpp @@ -74,11 +74,7 @@ CHintBoxExt::CHintBoxExt(const neutrino_locale_t Caption, ContentLines& lines, c CHintBoxExt::~CHintBoxExt(void) { - if (m_window != NULL) - { - delete m_window; - m_window = NULL; - } + hide(); if (m_message != NULL) { free(m_message); ----------------------------------------------------------------------- Summary of changes: dvb/zapit/src/controld.cpp | 13 +-- .../daemons/nhttpd/doc/nhttpd_controlapi.html | 14 ++ .../daemons/nhttpd/tuxboxapi/controlapi.cpp | 138 +++++++++++--------- .../daemons/nhttpd/tuxboxapi/neutrinoyparser.cpp | 18 ++-- tuxbox/neutrino/daemons/nhttpd/yhttpd.cpp | 14 +- .../neutrino/daemons/nhttpd/yhttpd_core/helper.cpp | 14 +- .../neutrino/daemons/nhttpd/yhttpd_core/helper.h | 14 +- .../daemons/nhttpd/yhttpd_core/yrequest.cpp | 10 +- .../daemons/nhttpd/yhttpd_core/ysocket.cpp | 4 +- .../daemons/nhttpd/yhttpd_mods/mod_auth.cpp | 4 +- .../daemons/nhttpd/yhttpd_mods/mod_cache.cpp | 6 +- .../daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp | 6 +- .../daemons/nhttpd/yhttpd_mods/mod_weblog.cpp | 2 +- .../daemons/nhttpd/yhttpd_mods/mod_yparser.cpp | 36 +++--- tuxbox/neutrino/daemons/sectionsd/SIbouquets.hpp | 2 +- tuxbox/neutrino/daemons/sectionsd/SIevents.cpp | 18 ++-- tuxbox/neutrino/daemons/sectionsd/SIevents.hpp | 8 +- tuxbox/neutrino/daemons/sectionsd/SIlanguage.cpp | 2 +- tuxbox/neutrino/daemons/sectionsd/SIsections.cpp | 2 +- tuxbox/neutrino/daemons/sectionsd/SIservices.hpp | 4 +- tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp | 16 ++- tuxbox/neutrino/data/locale/deutsch.locale | 12 +- tuxbox/neutrino/data/locale/english.locale | 8 +- tuxbox/neutrino/src/driver/file.cpp | 10 ++ tuxbox/neutrino/src/driver/file.h | 3 + tuxbox/neutrino/src/driver/lcdd.cpp | 10 +- tuxbox/neutrino/src/driver/rcinput.cpp | 4 +- tuxbox/neutrino/src/gui/audioplayer.cpp | 15 +- tuxbox/neutrino/src/gui/channellist.cpp | 4 +- tuxbox/neutrino/src/gui/drive_setup.cpp | 19 ++-- tuxbox/neutrino/src/gui/epgplus.cpp | 2 +- tuxbox/neutrino/src/gui/epgview.cpp | 8 +- tuxbox/neutrino/src/gui/esound.cpp | 15 +- tuxbox/neutrino/src/gui/eventlist.cpp | 8 +- tuxbox/neutrino/src/gui/filebrowser.cpp | 30 ++-- tuxbox/neutrino/src/gui/imageinfo.cpp | 8 +- tuxbox/neutrino/src/gui/infoviewer.cpp | 2 +- tuxbox/neutrino/src/gui/moviebrowser.cpp | 61 ++++++--- tuxbox/neutrino/src/gui/moviebrowser.h | 6 +- tuxbox/neutrino/src/gui/movieplayer.cpp | 47 +++++--- tuxbox/neutrino/src/gui/movieplayer2.cpp | 14 +- tuxbox/neutrino/src/gui/network_setup.cpp | 2 +- tuxbox/neutrino/src/gui/pictureviewer.cpp | 22 +-- tuxbox/neutrino/src/gui/scan.cpp | 9 +- tuxbox/neutrino/src/gui/themes.cpp | 2 +- tuxbox/neutrino/src/gui/update.cpp | 4 +- tuxbox/neutrino/src/gui/widget/dirchooser.cpp | 6 +- tuxbox/neutrino/src/gui/widget/hintbox.cpp | 6 +- tuxbox/neutrino/src/gui/widget/hintboxext.cpp | 6 +- tuxbox/neutrino/src/gui/widget/menue.cpp | 2 +- tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp | 28 +--- tuxbox/neutrino/src/neutrino.cpp | 73 +++++------ tuxbox/neutrino/src/neutrino.h | 1 - tuxbox/neutrino/src/system/flashtool.cpp | 6 + tuxbox/neutrino/src/system/helper.cpp | 80 +++++++++++ tuxbox/neutrino/src/system/helper.h | 5 + tuxbox/plugins/tuxmail/daemon/tuxmaild.c | 6 +- 57 files changed, 511 insertions(+), 378 deletions(-) -- Tuxbox-GIT: apps
------------------------------------------------------------------------------
_______________________________________________ Tuxbox-cvs-commits mailing list Tuxbox-cvs-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tuxbox-cvs-commits