From 10e1d4c074e56dd8e05379a72a12f0d7b87e63ce Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 25 Sep 2017 09:05:21 +0200 Subject: [PATCH 01/18] imdb: fix deprecated-warning in same way as in 0f8396bcaa6fcacefd5632b4a683f0f99780b81d Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/340bf07d475bef0bd1f94199232685c379f00e75 Author: vanhofen Date: 2017-09-25 (Mon, 25 Sep 2017) Origin message was: ------------------ - imdb: fix deprecated-warning in same way as in 0f8396bcaa6fcacefd5632b4a683f0f99780b81d --- src/gui/imdb.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/imdb.cpp b/src/gui/imdb.cpp index 3ce74cbfb..45d2c4480 100644 --- a/src/gui/imdb.cpp +++ b/src/gui/imdb.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -246,20 +247,20 @@ std::string CIMDB::googleIMDb(std::string s) void CIMDB::initMap( std::map& my ) { + string errMsg = ""; Json::Value root; - Json::Reader reader; std::ostringstream ss; std::ifstream fh(imdb_outfile.c_str(),std::ifstream::in); ss << fh.rdbuf(); std::string filedata = ss.str(); - bool parsedSuccess = reader.parse(filedata,root,false); + bool parsedSuccess = parseJsonFromString(filedata, &root, &errMsg); if(!parsedSuccess) { std::cout << "Failed to parse JSON\n"; - std::cout << reader.getFormattedErrorMessages() << std::endl; + std::cout << errMsg << std::endl; my["Response"] = "False"; // we fake a false response return; From bb80e50a84faab958f6e5f3217c56ffcb62e262c Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:50 +0200 Subject: [PATCH 02/18] rcinput: fix corrupted iterator on input device hot-unplug Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/ae06722b979b25ee926805395d96c24fc9c30ccc Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/driver/rcinput.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 0d19b46d1..35e983034 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -1302,7 +1302,10 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } } - for (std::vector::iterator i = indev.begin(); i != indev.end(); ++i) { + /* iterate backwards or the vector will be corrupted by the indev.erase(i) */ + std::vector::iterator i = indev.end(); + while (i != indev.begin()) { + --i; if (((*i).fd != -1) && (FD_ISSET((*i).fd, &rfds))) { uint64_t now_pressed = 0; t_input_event ev; @@ -1314,7 +1317,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 if (errno == ENODEV) { /* hot-unplugged? */ ::close((*i).fd); - indev.erase(i); + i = indev.erase(i); } continue; } From 5106c1e0f7def6e1a821872470152277c70281b0 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:50 +0200 Subject: [PATCH 03/18] rcinput: add hack to set rcdelay after device hotplug this fixes e.g. wrong repeat settings after lircd restart Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/dc9a9f90a47cd0963ca9ab00289ab41588dcc29a Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/driver/rcinput.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 35e983034..ef3852b79 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -75,6 +75,9 @@ static bool saved_orig_termio = false; static bool input_stopped = false; static struct timespec devinput_mtime = { 0, 0 }; +static unsigned int _start_ms = 0; +static unsigned int _repeat_ms = 0; + #ifdef RCDEBUG #define d_printf printf #else @@ -243,6 +246,7 @@ void CRCInput::open(bool recheck) indev.push_back(id); } closedir(dir); + setKeyRepeatDelay(0, 0); id.path = "/tmp/neutrino.input"; if (! checkpath(id)) { id.fd = ::open(id.path.c_str(), O_RDWR|O_NONBLOCK|O_CLOEXEC); @@ -1737,6 +1741,13 @@ int CRCInput::translate(int code) void CRCInput::setKeyRepeatDelay(unsigned int start_ms, unsigned int repeat_ms) { + if (start_ms == 0 && repeat_ms == 0) { + start_ms = _start_ms; + repeat_ms = _repeat_ms; + } else { + _start_ms = start_ms; + _repeat_ms = repeat_ms; + } for (std::vector::iterator it = indev.begin(); it != indev.end(); ++it) { int fd = (*it).fd; std::string path = (*it).path; From 13d333e3e12247a4615c03d475b8a52f2e31817a Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:50 +0200 Subject: [PATCH 04/18] add LUA_CFLAGS everywhere widget/menue.h is used Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/32e4947ec7b1bdd186c6271ce34f6b71b33f22cf Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/Makefile.am | 1 + src/daemonc/Makefile.am | 1 + src/driver/Makefile.am | 1 + src/driver/audiodec/Makefile.am | 1 + src/driver/pictureviewer/Makefile.am | 1 + src/gui/Makefile.am | 1 + src/gui/bedit/Makefile.am | 1 + src/gui/components/Makefile.am | 1 + src/gui/moviebrowser/Makefile.am | 1 + src/gui/widget/Makefile.am | 1 + src/nhttpd/tuxboxapi/Makefile.am | 1 + src/system/Makefile.am | 1 + src/zapit/src/Makefile.am | 1 + 13 files changed, 13 insertions(+) diff --git a/src/Makefile.am b/src/Makefile.am index 1f48eec83..77347b7d3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,6 +23,7 @@ AM_CPPFLAGS = \ @SIGC_CFLAGS@ \ @FREETYPE_CFLAGS@ \ @AVFORMAT_CFLAGS@ \ + @LUA_CFLAGS@ \ @HWLIB_CFLAGS@ if BOXTYPE_TRIPLE diff --git a/src/daemonc/Makefile.am b/src/daemonc/Makefile.am index c272b2dee..a4df3eae6 100644 --- a/src/daemonc/Makefile.am +++ b/src/daemonc/Makefile.am @@ -13,6 +13,7 @@ AM_CPPFLAGS += \ @SIGC_CFLAGS@ \ @FREETYPE_CFLAGS@ \ @AVFORMAT_CFLAGS@ \ + @LUA_CFLAGS@ \ @HWLIB_CFLAGS@ diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am index 37040c4b0..1daf88a02 100644 --- a/src/driver/Makefile.am +++ b/src/driver/Makefile.am @@ -15,6 +15,7 @@ AM_CPPFLAGS = \ @SIGC_CFLAGS@ \ @FREETYPE_CFLAGS@ \ @AVFORMAT_CFLAGS@ \ + @LUA_CFLAGS@ \ @HWLIB_CFLAGS@ noinst_LIBRARIES = libneutrino_driver.a libneutrino_driver_netfile.a diff --git a/src/driver/audiodec/Makefile.am b/src/driver/audiodec/Makefile.am index eccc74b27..ab579fcc1 100644 --- a/src/driver/audiodec/Makefile.am +++ b/src/driver/audiodec/Makefile.am @@ -11,6 +11,7 @@ AM_CPPFLAGS = \ @SIGC_CFLAGS@ \ @FREETYPE_CFLAGS@ \ @AVFORMAT_CFLAGS@ \ + @LUA_CFLAGS@ \ @HWLIB_CFLAGS@ noinst_LIBRARIES = libneutrino_driver_audiodec.a diff --git a/src/driver/pictureviewer/Makefile.am b/src/driver/pictureviewer/Makefile.am index bff7f879e..16bf123ca 100644 --- a/src/driver/pictureviewer/Makefile.am +++ b/src/driver/pictureviewer/Makefile.am @@ -9,6 +9,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/lib/libconfigfile \ @SIGC_CFLAGS@ \ @FREETYPE_CFLAGS@ \ + @LUA_CFLAGS@ \ @HWLIB_CFLAGS@ diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 5d45371d6..43afca4e4 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -38,6 +38,7 @@ AM_CPPFLAGS += \ @CURL_CFLAGS@ \ @FREETYPE_CFLAGS@ \ @AVFORMAT_CFLAGS@ \ + @LUA_CFLAGS@ \ @HWLIB_CFLAGS@ noinst_LIBRARIES = libtimerlist.a libneutrino_gui.a libneutrino_gui2.a diff --git a/src/gui/bedit/Makefile.am b/src/gui/bedit/Makefile.am index 5dd05af1e..269ac532a 100644 --- a/src/gui/bedit/Makefile.am +++ b/src/gui/bedit/Makefile.am @@ -11,6 +11,7 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/lib/xmltree \ @SIGC_CFLAGS@ \ @FREETYPE_CFLAGS@ \ + @LUA_CFLAGS@ \ @HWLIB_CFLAGS@ noinst_LIBRARIES = libneutrino_gui_bedit.a diff --git a/src/gui/components/Makefile.am b/src/gui/components/Makefile.am index e43158b13..3364ad773 100644 --- a/src/gui/components/Makefile.am +++ b/src/gui/components/Makefile.am @@ -11,6 +11,7 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/lib/xmltree \ @SIGC_CFLAGS@ \ @FREETYPE_CFLAGS@ \ + @LUA_CFLAGS@ \ @HWLIB_CFLAGS@ noinst_LIBRARIES = libneutrino_gui_components.a diff --git a/src/gui/moviebrowser/Makefile.am b/src/gui/moviebrowser/Makefile.am index 46379f2ca..438c3ac84 100644 --- a/src/gui/moviebrowser/Makefile.am +++ b/src/gui/moviebrowser/Makefile.am @@ -11,6 +11,7 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/lib/xmltree \ @SIGC_CFLAGS@ \ @FREETYPE_CFLAGS@ \ + @LUA_CFLAGS@ \ @HWLIB_CFLAGS@ noinst_LIBRARIES = libneutrino_gui_moviebrowser.a diff --git a/src/gui/widget/Makefile.am b/src/gui/widget/Makefile.am index 838ba162f..6a0c88bd5 100644 --- a/src/gui/widget/Makefile.am +++ b/src/gui/widget/Makefile.am @@ -10,6 +10,7 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/lib/libconfigfile \ @SIGC_CFLAGS@ \ @FREETYPE_CFLAGS@ \ + @LUA_CFLAGS@ \ @HWLIB_CFLAGS@ noinst_LIBRARIES = libneutrino_gui_widget.a libneutrino_gui_widget2.a diff --git a/src/nhttpd/tuxboxapi/Makefile.am b/src/nhttpd/tuxboxapi/Makefile.am index 2376c052c..9bae88869 100644 --- a/src/nhttpd/tuxboxapi/Makefile.am +++ b/src/nhttpd/tuxboxapi/Makefile.am @@ -16,6 +16,7 @@ AM_CPPFLAGS += \ @SIGC_CFLAGS@ \ @FREETYPE_CFLAGS@ \ @AVFORMAT_CFLAGS@ \ + @LUA_CFLAGS@ \ @HWLIB_CFLAGS@ noinst_LIBRARIES = libnhttpd_tuxboxapi.a diff --git a/src/system/Makefile.am b/src/system/Makefile.am index b8fdac6c1..3304ec953 100644 --- a/src/system/Makefile.am +++ b/src/system/Makefile.am @@ -20,6 +20,7 @@ AM_CPPFLAGS = \ @SIGC_CFLAGS@ \ @FREETYPE_CFLAGS@ \ @AVFORMAT_CFLAGS@ \ + @LUA_CFLAGS@ \ @HWLIB_CFLAGS@ noinst_LIBRARIES = libneutrino_system.a diff --git a/src/zapit/src/Makefile.am b/src/zapit/src/Makefile.am index 96e700284..1d185ae00 100644 --- a/src/zapit/src/Makefile.am +++ b/src/zapit/src/Makefile.am @@ -12,6 +12,7 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/lib/xmltree \ @FREETYPE_CFLAGS@ \ @SIGC_CFLAGS@ \ + @LUA_CFLAGS@ \ @HWLIB_CFLAGS@ noinst_LIBRARIES = libzapit.a From 0e185cdc08ef02641d1b34f005687f6fe37ecce6 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:50 +0200 Subject: [PATCH 05/18] add comments to suppres -Wimplicit-fallthrough warnings Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/0ea72b9d516d9138fdc5fd09dd0d7a8a9a0871e0 Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- lib/jsoncpp/jsoncpp.cpp | 1 + src/driver/netfile.cpp | 1 + src/driver/radiotext.cpp | 1 + src/driver/screenshot.cpp | 2 ++ src/gui/lua/lua_threads_copy.cpp | 1 + src/gui/motorcontrol.cpp | 2 ++ src/gui/screensetup.cpp | 1 + src/gui/widget/menue.cpp | 3 +++ src/neutrino.cpp | 1 + src/nhttpd/yhttpd_core/yhook.cpp | 2 +- src/system/ytparser.cpp | 1 + src/zapit/src/frontend.cpp | 5 ++++- 12 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/jsoncpp/jsoncpp.cpp b/lib/jsoncpp/jsoncpp.cpp index ce72ec1d8..59c98d5f7 100644 --- a/lib/jsoncpp/jsoncpp.cpp +++ b/lib/jsoncpp/jsoncpp.cpp @@ -1455,6 +1455,7 @@ bool OurReader::readToken(Token& token) { ok = readStringSingleQuote(); break; } // else continue + /* is a break missing here? or is this correct? */ case '/': token.type_ = tokenComment; ok = readComment(); diff --git a/src/driver/netfile.cpp b/src/driver/netfile.cpp index 12270fb93..198d87dfb 100644 --- a/src/driver/netfile.cpp +++ b/src/driver/netfile.cpp @@ -1027,6 +1027,7 @@ FILE *f_open(const char *filename, const char *acctype) /* create the correct url from the station number */ CRLFCut(url.host); sprintf(url.url, "http://classic.shoutcast.com/sbin/shoutcast-playlist.pls?rn=%s&file=filename.pls", url.host); + /* fall through */ case MODE_PLS: { char *ptr2, /*buf[4096], use local buf from function */ servers[25][1024]; diff --git a/src/driver/radiotext.cpp b/src/driver/radiotext.cpp index 773c51034..e73207964 100644 --- a/src/driver/radiotext.cpp +++ b/src/driver/radiotext.cpp @@ -289,6 +289,7 @@ if (i < 0) { fprintf(stderr, "RT %s: i < 0 (%d)\n", __FUNCTION__, i); break; } switch (val) { case 0x0a: // RT have_radiotext = true; + /* fall through */ case 0x46: // RTplus-Tags case 0xda: // RASS case 0x07: // PTY diff --git a/src/driver/screenshot.cpp b/src/driver/screenshot.cpp index 28366adc2..d44eac6ab 100644 --- a/src/driver/screenshot.cpp +++ b/src/driver/screenshot.cpp @@ -274,6 +274,7 @@ bool CScreenShot::SaveFile() break; default: printf("CScreenShot::SaveFile unsupported format %d, using jpeg\n", format); + /* fall through */ case FORMAT_JPG: ret = SaveJpg(); break; @@ -517,6 +518,7 @@ void CScreenShot::MakeFileName(const t_channel_id channel_id) break; default: printf("CScreenShot::MakeFileName unsupported format %d, using jpeg\n", format); + /* fall through */ case FORMAT_JPG: strcat(fname, ".jpg"); break; diff --git a/src/gui/lua/lua_threads_copy.cpp b/src/gui/lua/lua_threads_copy.cpp index a7d140018..6dba1651f 100644 --- a/src/gui/lua/lua_threads_copy.cpp +++ b/src/gui/lua/lua_threads_copy.cpp @@ -119,6 +119,7 @@ int CLLThread::llthread_copy_value(llthread_copy_state *state, int depth, int id lua_pushcfunction(state->to_L, fn); break; } + /* else fall through */ case LUA_TUSERDATA: case LUA_TTHREAD: default: diff --git a/src/gui/motorcontrol.cpp b/src/gui/motorcontrol.cpp index 1b9e38e36..7f3930a3c 100644 --- a/src/gui/motorcontrol.cpp +++ b/src/gui/motorcontrol.cpp @@ -350,7 +350,9 @@ void CMotorControl::motorStep(bool west) case STEP_MODE_AUTO: moving = 1; paintStatus(); + /* fall through */ default: + /* what is STEP_MODE_OFF supposed to do? */ g_Zapit->sendMotorCommand(0xE0, 0x31, cmd, 1, 40, 0); } } diff --git a/src/gui/screensetup.cpp b/src/gui/screensetup.cpp index 207020eab..5c1e29647 100644 --- a/src/gui/screensetup.cpp +++ b/src/gui/screensetup.cpp @@ -173,6 +173,7 @@ int CScreenSetup::exec(CMenuTarget* parent, const std::string &) ( g_settings.screen_EndY != y_coord[1] ) ) && (ShowMsg(LOCALE_VIDEOMENU_SCREENSETUP, LOCALE_MESSAGEBOX_DISCARD, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbCancel) == CMsgBox::mbrCancel)) break; + /* falls through */ case CRCInput::RC_timeout: loop = false; diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index b34aa4aa7..51e1829e4 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -820,6 +820,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) switch ( rv ) { case menu_return::RETURN_EXIT_ALL: retval = menu_return::RETURN_EXIT_ALL; + /* fall through */ case menu_return::RETURN_EXIT: msg = CRCInput::RC_timeout; break; @@ -911,6 +912,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) break; case CRCInput::RC_up: dir = -1; + /* fall through */ default: /* fallthrough or RC_down => dir = 1 */ pos += dir; if (pos < 0 || pos >= (int)items.size()) @@ -979,6 +981,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) switch ( rv ) { case menu_return::RETURN_EXIT_ALL: retval = menu_return::RETURN_EXIT_ALL; + /* fall through */ case menu_return::RETURN_EXIT: msg = CRCInput::RC_timeout; break; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index be8c2950f..22da37588 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1928,6 +1928,7 @@ void CNeutrinoApp::SetChannelMode(int newmode) break; default: newmode = LIST_MODE_PROV; + /* fall through */ case LIST_MODE_PROV: if(mode == mode_radio) bouquetList = RADIObouquetList; diff --git a/src/nhttpd/yhttpd_core/yhook.cpp b/src/nhttpd/yhttpd_core/yhook.cpp index 2d4a88d4d..57acb79b6 100644 --- a/src/nhttpd/yhttpd_core/yhook.cpp +++ b/src/nhttpd/yhttpd_core/yhook.cpp @@ -283,7 +283,7 @@ std::string CyhookHandler::BuildHeader(bool cache) { case HTTP_MOVED_PERMANENTLY: // Status HTTP_*_TEMPORARILY (redirection) result += string_printf("Location: %s\r\n", NewURL.c_str()); - // NO break HERE !!! + // fall through default: time_t timer = time(0); diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp index 6bd43c576..a2762f279 100644 --- a/src/system/ytparser.cpp +++ b/src/system/ytparser.cpp @@ -518,6 +518,7 @@ bool cYTFeedParser::ParseFeed(yt_feed_mode_t mode, std::string search, std::stri default: //trailer = "&time=today"; curfeed = "&chart=mostPopular"; + break; case MOST_POPULAR_ALL_TIME: curfeed = "&chart=mostPopular"; break; diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index 26482d2b1..95ad4e76c 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -435,6 +435,7 @@ fe_code_rate_t CFrontend::getCodeRate(const uint8_t fec_inner, delivery_system_t default: if (zapit_debug) printf("no valid fec for DVB-%c set.. assume auto\n", (delsys == DVB_S ? 'S' : (delsys == DVB_C ? 'C' : 'T'))); + /* fall through */ case fAuto: fec = FEC_AUTO; break; @@ -471,6 +472,7 @@ fe_code_rate_t CFrontend::getCodeRate(const uint8_t fec_inner, delivery_system_t default: if (zapit_debug) printf("no valid fec for DVB-S2 set.. !!\n"); + /* fall through */ case fAuto: fec = FEC_AUTO; break; @@ -786,6 +788,7 @@ void CFrontend::getXMLDelsysFEC(fe_code_rate_t xmlfec, delivery_system_t & delsy break; default: printf("[frontend] getXMLDelsysFEC: unknown FEC: %d !!!\n", xmlfec); + /* fall through */ case FEC_S2_AUTO: case FEC_AUTO: fec = FEC_AUTO; @@ -860,7 +863,7 @@ void CFrontend::getDelSys(delivery_system_t delsys, int f, int m, char *&fec, ch mod = (char *)"QPSK"; // AKA QAM_4 break; } - /* fallthrouh for FE_QAM... */ + /* fall through */ case QAM_AUTO: default: mod = (char *)"QAM_AUTO"; From 70522a9cbe22e827c08c072df1eff2faad908eaa Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:50 +0200 Subject: [PATCH 06/18] pictureviewer: fix build with gcc7 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/6f88e781cdcf6cb9ead85ef4d722defd77628fe6 Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/driver/pictureviewer/crw.cpp | 17 +++++++++-------- src/driver/pictureviewer/jpeg.cpp | 17 +++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/driver/pictureviewer/crw.cpp b/src/driver/pictureviewer/crw.cpp index e081aba57..1de75cdc7 100644 --- a/src/driver/pictureviewer/crw.cpp +++ b/src/driver/pictureviewer/crw.cpp @@ -173,7 +173,7 @@ int fh_crw_load(const char *filename,unsigned char **buffer,int* xp,int* /*yp*/) struct jpeg_decompress_struct *ciptr; struct r_crw_jpeg_error_mgr emgr; unsigned char *bp; - int px/*,py*/,c,x=*xp; + int px/*,py*/,c,x=*xp, ix; FILE *fh; JSAMPLE *lb; @@ -195,21 +195,22 @@ int fh_crw_load(const char *filename,unsigned char **buffer,int* xp,int* /*yp*/) jpeg_stdio_src(ciptr,fh); jpeg_read_header(ciptr,TRUE); ciptr->out_color_space=JCS_RGB; - if(x==(int)ciptr->image_width) + ix = (int)ciptr->image_width; + if (x == ix) ciptr->scale_denom=1; #if __cplusplus < 201103 - else if(abs(x*2 - ciptr->image_width) < 2) + else if (abs(x*2 - ix) < 2) ciptr->scale_denom=2; - else if(abs(x*4 - ciptr->image_width) < 4) + else if (abs(x*4 - ix) < 4) ciptr->scale_denom=4; - else if(abs(x*8 - ciptr->image_width) < 8) + else if (abs(x*8 - ix) < 8) ciptr->scale_denom=8; #else - else if(std::abs(x*2 - ciptr->image_width) < 2) + else if (std::abs(x*2 - ix) < 2) ciptr->scale_denom=2; - else if(std::abs(x*4 - ciptr->image_width) < 4) + else if (std::abs(x*4 - ix) < 4) ciptr->scale_denom=4; - else if(std::abs(x*8 - ciptr->image_width) < 8) + else if (std::abs(x*8 - ix) < 8) ciptr->scale_denom=8; #endif else diff --git a/src/driver/pictureviewer/jpeg.cpp b/src/driver/pictureviewer/jpeg.cpp index accb8a512..a61c91229 100644 --- a/src/driver/pictureviewer/jpeg.cpp +++ b/src/driver/pictureviewer/jpeg.cpp @@ -72,7 +72,7 @@ int fh_jpeg_load(const char *filename,unsigned char **buffer,int* x,int* y) struct jpeg_decompress_struct *ciptr; struct r_jpeg_error_mgr emgr; unsigned char *bp; - int px,py,c; + int px,py,c, ix; FILE *fh; JSAMPLE *lb; @@ -94,21 +94,22 @@ int fh_jpeg_load(const char *filename,unsigned char **buffer,int* x,int* y) jpeg_read_header(ciptr,TRUE); ciptr->out_color_space=JCS_RGB; ciptr->dct_method=JDCT_FASTEST; - if(*x==(int)ciptr->image_width) + ix = (int)ciptr->image_width; + if(*x == ix) ciptr->scale_denom=1; #if __cplusplus < 201103 - else if(abs(*x*2 - ciptr->image_width) < 2) + else if (abs(*x*2 - ix) < 2) ciptr->scale_denom=2; - else if(abs(*x*4 - ciptr->image_width) < 4) + else if (abs(*x*4 - ix) < 4) ciptr->scale_denom=4; - else if(abs(*x*8 - ciptr->image_width) < 8) + else if (abs(*x*8 - ix) < 8) ciptr->scale_denom=8; #else - else if(std::abs(*x*2 - ciptr->image_width) < 2) + else if (std::abs(*x*2 - ix) < 2) ciptr->scale_denom=2; - else if(std::abs(*x*4 - ciptr->image_width) < 4) + else if (std::abs(*x*4 - ix) < 4) ciptr->scale_denom=4; - else if(std::abs(*x*8 - ciptr->image_width) < 8) + else if (std::abs(*x*8 - ix) < 8) ciptr->scale_denom=8; #endif else From 1c9982f2c96ce457286eb3f4955b5766849ee540 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:51 +0200 Subject: [PATCH 07/18] neutrinoyparser: fix invalid logic in func_unmount_get_list Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e04eb24ff4d48ef3babfcc30ac185b7d94300b1d Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/nhttpd/tuxboxapi/neutrinoyparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp index 77a042619..1d6dcd143 100644 --- a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp @@ -806,7 +806,7 @@ std::string CNeutrinoYParser::func_unmount_get_list(CyhookHandler *, std::strin in >> ymount >> ylocal_dir >> yfstype; in.ignore(std::numeric_limits::max(), '\n'); yfstype = trim(yfstype); - if( (yfstype == "nfs") << (yfstype == "ftp") || (yfstype == "lufsd") ) + if( (yfstype == "nfs") || (yfstype == "ftp") || (yfstype == "lufsd") ) { mounts=ylocal_dir +" on "+ ymount + " ("+yfstype+")"; ysel = ((j==0) ? "checked=\"checked\"" : ""); From 5577e1bf3b20492ce91ff4a802133b522384a6ce Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:51 +0200 Subject: [PATCH 08/18] zapit: suppress one more implicit-fallthrough warning Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/28197b0ba2ba9d41b6d4e2b49e9331d2fab8f390 Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/zapit/src/scan.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zapit/src/scan.cpp b/src/zapit/src/scan.cpp index d078ed4b8..233d6bf5c 100644 --- a/src/zapit/src/scan.cpp +++ b/src/zapit/src/scan.cpp @@ -694,6 +694,7 @@ void CServiceScan::ChannelFound(uint8_t service_type, std::string providerName, case ST_NVOD_REFERENCE_SERVICE: case ST_NVOD_TIME_SHIFTED_SERVICE: CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_SERVICENAME, (void *) serviceName.c_str(), serviceName.length() + 1); + /* fall through */ case ST_DATA_BROADCAST_SERVICE: case ST_RCS_MAP: case ST_RCS_FLS: From 1c4ac9a0e2703a4f017e02173ed72b83b2874509 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:51 +0200 Subject: [PATCH 09/18] CMenuWidget: simplify menu_left_exit code, add missing break Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/3ae33950eb4a9afb1e000aeab381b2febdb5ee95 Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/gui/widget/menue.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 51e1829e4..6ab0266c6 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -949,16 +949,12 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) break; } case (CRCInput::RC_left): - { - if(hasItem() && selected > -1 && (int)items.size() > selected) { - CMenuItem* itemX = items[selected]; - if (!itemX->isMenueOptionChooser()) { - if (g_settings.menu_left_exit) - msg = CRCInput::RC_timeout; - break; - } - } + if (hasItem() && selected > -1 && (int)items.size() > selected) { + CMenuItem* itemX = items[selected]; + if (!itemX->isMenueOptionChooser() && g_settings.menu_left_exit) + msg = CRCInput::RC_timeout; } + break; case (CRCInput::RC_right): case (CRCInput::RC_ok): { From 564815c90dec1adb8881325ecb5952d879614bba Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:51 +0200 Subject: [PATCH 10/18] zapit: properly initialize arrays in scanbat and scansdt Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/cbccd82b9c32745ee05274c697192362d9e1f81c Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/zapit/src/scanbat.cpp | 2 +- src/zapit/src/scansdt.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zapit/src/scanbat.cpp b/src/zapit/src/scanbat.cpp index 49e731568..79e3a1b24 100644 --- a/src/zapit/src/scanbat.cpp +++ b/src/zapit/src/scanbat.cpp @@ -82,7 +82,7 @@ bool CBat::Read() int secdone[255]; int sectotal = -1; - memset(secdone, 0, 255); + memset(secdone, 0, sizeof(secdone)); cDemux * dmx = new cDemux(dmxnum); dmx->Open(DMX_PSI_CHANNEL); diff --git a/src/zapit/src/scansdt.cpp b/src/zapit/src/scansdt.cpp index 5ff2aa358..9114a0eea 100644 --- a/src/zapit/src/scansdt.cpp +++ b/src/zapit/src/scansdt.cpp @@ -68,7 +68,7 @@ bool CSdt::Read() int sectotal = -1; bool cable_hack_done = false; - memset(secdone, 0, 255); + memset(secdone, 0, sizeof(secdone)); cDemux * dmx = new cDemux(dmxnum); dmx->Open(DMX_PSI_CHANNEL); From 4a360cf8ac10e7b3cfb240d0c03309c3955c09b4 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:51 +0200 Subject: [PATCH 11/18] moviebrowser: fix format-string warnings Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/85c1a8e451e6356ec1237545f14284997d189655 Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/gui/moviebrowser/mb.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 64d4ecfc6..b9895f802 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -2586,8 +2586,8 @@ bool CMovieBrowser::onDelete(bool cursor_only) getSelectedFiles(filelist, movielist); - printf("CMovieBrowser::onDelete(%s) filelist size: %d\n", cursor_only ? "true" : "false", filelist.size()); - printf("CMovieBrowser::onDelete(%s) movielist size: %d\n", cursor_only ? "true" : "false", movielist.size()); + printf("CMovieBrowser::onDelete(%s) filelist size: %zd\n", cursor_only ? "true" : "false", filelist.size()); + printf("CMovieBrowser::onDelete(%s) movielist size: %zd\n", cursor_only ? "true" : "false", movielist.size()); if (cursor_only || (filelist.empty() || movielist.empty())) { @@ -2602,8 +2602,8 @@ bool CMovieBrowser::onDelete(bool cursor_only) filelist.push_back(m_movieSelectionHandler->file); movielist.push_back(m_movieSelectionHandler); - printf("CMovieBrowser::onDelete(%s) filelist size: %d\n", cursor_only ? "true" : "false", filelist.size()); - printf("CMovieBrowser::onDelete(%s) movielist size: %d\n", cursor_only ? "true" : "false", movielist.size()); + printf("CMovieBrowser::onDelete(%s) filelist size: %zd\n", cursor_only ? "true" : "false", filelist.size()); + printf("CMovieBrowser::onDelete(%s) movielist size: %zd\n", cursor_only ? "true" : "false", movielist.size()); } MI_MOVIE_LIST dellist; From e7cf2870cec5a73c25763ecf024f14b8810c0d71 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:51 +0200 Subject: [PATCH 12/18] audioplayer: fix buffer overflow Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/df74ee2d18862e52a0e709748a249f347413a434 Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/gui/audioplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 4c0616ff4..0201d3752 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -889,7 +889,7 @@ int CAudioPlayerGui::show() smsKey = m_SMSKeyInput.handleMsg(msg); //printf(" new key: %c", smsKey); /* show a hint box with current char (too slow at the moment?)*/ - char selectedKey[1]; + char selectedKey[2]; sprintf(selectedKey,"%c",smsKey); int x1=(g_settings.screen_EndX- g_settings.screen_StartX)/2 + g_settings.screen_StartX-50; int y1=(g_settings.screen_EndY- g_settings.screen_StartY)/2 + g_settings.screen_StartY; From df817f18f4f446a770dc4c958357afc8a596a975 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:51 +0200 Subject: [PATCH 13/18] subchannel_select: ensure buffer does not overflow Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/cd60b58cae3710b08ad8d6b351b48e852bb8f058 Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/gui/subchannel_select.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/subchannel_select.cpp b/src/gui/subchannel_select.cpp index 36867ce1c..b6d688180 100644 --- a/src/gui/subchannel_select.cpp +++ b/src/gui/subchannel_select.cpp @@ -108,6 +108,8 @@ int CSubChannelSelectMenu::getNVODMenu(CMenuWidget* menu) } count++; + if (count > 9999) + break; } if ( g_RemoteControl->are_subchannels ) { From 9aef1ca0783c4965a278f3f8623bd53271486143 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:51 +0200 Subject: [PATCH 14/18] rcinput: disable timer debug messages Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/3aebc6cf22de06bdc1a1066c0dd3fb6efd3a233c Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/driver/rcinput.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index ef3852b79..2cfafbc7f 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -473,7 +473,7 @@ int CRCInput::addTimer(uint64_t Interval, bool oneshot, bool correct_time ) _newtimer.correct_time = correct_time; -printf("adding timer %d (0x%llx, 0x%llx)\n", _newtimer.id, _newtimer.times_out, Interval); +//printf("adding timer %d (0x%" PRIx64 ", 0x%" PRIx64 ")\n", _newtimer.id, _newtimer.times_out, Interval); std::vector::iterator e; for ( e= timers.begin(); e!= timers.end(); ++e ) @@ -486,7 +486,7 @@ printf("adding timer %d (0x%llx, 0x%llx)\n", _newtimer.id, _newtimer.times_out, void CRCInput::killTimer(uint32_t &id) { -printf("killing timer %d\n", id); +//printf("killing timer %d\n", id); if(id == 0) return; From 98268eee3549044b5f603a71c0c30541ada91a05 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:51 +0200 Subject: [PATCH 15/18] netfile: avoid possible buffer overflows spotted by gcc7 * use strcpy instead of sprintf(x, "constant") or sprintf(x, "%s", str) * use strncpy and ensure termination where necessary * use snprintf instead of sprintf Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/207559800dac7f6f1c9428fc328b9cb222f7453d Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/driver/netfile.cpp | 59 ++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/src/driver/netfile.cpp b/src/driver/netfile.cpp index 198d87dfb..809b40605 100644 --- a/src/driver/netfile.cpp +++ b/src/driver/netfile.cpp @@ -2,7 +2,7 @@ | Neutrino-GUI - DBoxII-Project | | Copyright (C) 2004 by Sanaia -| Copyright (C) 2010-2013 Stefan Seyfried +| Copyright (C) 2010-2013, 2017 Stefan Seyfried | | netfile - remote file access mapper | @@ -140,6 +140,9 @@ known bugs: #undef fseek #endif +/* somewhat safe, 0-terminated sprintf and strcpy */ +#define SPRINTF(a, b...) snprintf(a, sizeof(a)-1, b) +#define STRCPY(a, b) { strncpy(a, b, sizeof(a)-1); a[sizeof(a)-1] = 0; } @@ -178,7 +181,7 @@ magic_t known_magic[] = char err_txt[2048]; /* human readable error message */ char redirect_url[2048]; /* new url if we've been redirected (HTTP 301/302) */ static int debug = 0; /* print debugging output or not */ -static char logfile[255]; /* redirect errors from stderr */ +static char logfile[256]; /* redirect errors from stderr */ static int retry_num = 2 /*10*/; /* number of retries for failed connections */ static int enable_metadata = 0; /* allow shoutcast meta data streaming */ static int got_opts = 0; /* is set to 1 if getOpts() was executed */ @@ -250,7 +253,7 @@ void getOpts() if((ptr = strstr(buf, "logfile="))) { - strcpy(logfile, strchr(ptr, '=') + 1); + STRCPY(logfile, strchr(ptr, '=') + 1); CRLFCut(logfile); freopen(logfile, "w", stderr); } @@ -288,7 +291,7 @@ int ConnectToServer(char *hostname, int port) if(fd == -1) { - strcpy(err_txt, strerror(errno)); + STRCPY(err_txt, strerror(errno)); return -1; } @@ -305,7 +308,7 @@ int ConnectToServer(char *hostname, int port) { if(errno != EINPROGRESS) { close(fd); - strcpy(err_txt, strerror(errno)); + STRCPY(err_txt, strerror(errno)); dprintf(stderr, "error connecting to %s: %s\n", hostname, err_txt); return -1; } @@ -318,7 +321,7 @@ int ConnectToServer(char *hostname, int port) int ret = poll(&pfd, 1, 5000); if(ret != 1) { - strcpy(err_txt, strerror(errno)); + STRCPY(err_txt, strerror(errno)); dprintf(stderr, "error connecting to %s: %s\n", hostname, err_txt); close(fd); return -1; @@ -339,7 +342,7 @@ int ConnectToServer(char *hostname, int port) int request_file(URL *url) { - char str[255], *ptr; + char str[256], *ptr; int slot; ID3 id3; memset(&id3, 0, sizeof(ID3)); @@ -386,18 +389,18 @@ int request_file(URL *url) if (url->logindata[0]) { - sprintf(str, "Authorization: Basic %s\r\n", url->logindata); + SPRINTF(str, "Authorization: Basic %s\r\n", url->logindata); dprintf(stderr, "> %s", str); send(url->fd, str, strlen(str), 0); } - snprintf(str, sizeof(str)-1, "Accept: */*\r\n"); + strcpy(str, "Accept: */*\r\n"); dprintf(stderr, "> %s", str); send(url->fd, str, strlen(str), 0); if(enable_metadata) { - snprintf(str, sizeof(str)-1, "Icy-MetaData: 1\r\n"); + strcpy(str, "Icy-MetaData: 1\r\n"); dprintf(stderr, "> %s", str); send(url->fd, str, strlen(str), 0); } @@ -464,32 +467,32 @@ int request_file(URL *url) int meta_int; CSTATE tmp; - sprintf(str, "GET %s HTTP/1.0\r\n", url->file); + SPRINTF(str, "GET %s HTTP/1.0\r\n", url->file); dprintf(stderr, "> %s", str); send(url->fd, str, strlen(str), 0); - sprintf(str, "Host: %s\r\n", url->host); + SPRINTF(str, "Host: %s\r\n", url->host); dprintf(stderr, "> %s", str); send(url->fd, str, strlen(str), 0); if(enable_metadata) { - sprintf(str, "icy-metadata: 1\r\n"); + strcpy(str, "icy-metadata: 1\r\n"); dprintf(stderr, "> %s", str); send(url->fd, str, strlen(str), 0); } - sprintf(str, "User-Agent: %s\r\n", "RealPlayer/4.0"); + SPRINTF(str, "User-Agent: %s\r\n", "RealPlayer/4.0"); dprintf(stderr, "> %s", str); send(url->fd, str, strlen(str), 0); if (url->logindata[0]) { - sprintf(str, "Authorization: Basic %s\r\n", url->logindata); + SPRINTF(str, "Authorization: Basic %s\r\n", url->logindata); dprintf(stderr, "> %s", str); send(url->fd, str, strlen(str), 0); } - sprintf(str, "\r\n"); /* end of headers to send */ + strcpy(str, "\r\n"); /* end of headers to send */ dprintf(stderr, "> %s", str); send(url->fd, str, strlen(str), 0); @@ -623,14 +626,14 @@ int parse_response(URL *url, void * /*opt*/, CSTATE *state) case 301: /* 'file moved' error */ case 302: /* 'file not found' error */ errno = ENOENT; - strcpy(err_txt, ptr); + STRCPY(err_txt, ptr); getHeaderStr("Location", redirect_url); return -1 * response; break; case 404: /* 'file not found' error */ errno = ENOENT; - strcpy(err_txt, ptr); + STRCPY(err_txt, ptr); return -1; break; @@ -831,7 +834,7 @@ FILE *f_open(const char *filename, const char *acctype) if(ptr) *ptr = 0; - sprintf(url.url, "%s", buf); + STRCPY(url.url, buf); } else return NULL; @@ -907,7 +910,7 @@ FILE *f_open(const char *filename, const char *acctype) /* no free cache slot ? return an error */ if(i == CACHEENTMAX) { - sprintf(err_txt, "no more free cache slots. Too many open files.\n"); + strcpy(err_txt, "no more free cache slots. Too many open files.\n"); return NULL; } @@ -993,9 +996,9 @@ FILE *f_open(const char *filename, const char *acctype) /* create either a shoutcast or an icecast query */ if(url.access_mode == MODE_SCAST) - sprintf(buf2, "http://classic.shoutcast.com/directory/?orderby=listeners&s=%s", url.host); + SPRINTF(buf2, "http://classic.shoutcast.com/directory/?orderby=listeners&s=%s", url.host); else - sprintf(buf2, "http://www.icecast.org/streamlist.php?search=%s", url.host); + SPRINTF(buf2, "http://www.icecast.org/streamlist.php?search=%s", url.host); //findme // ICECAST: it ain't that simple. Icecast doesn't work yet */ @@ -1004,7 +1007,7 @@ FILE *f_open(const char *filename, const char *acctype) if(!_fd) { - sprintf(err_txt, "%s database query failed\nfailed action: %s", + SPRINTF(err_txt, "%s database query failed\nfailed action: %s", ((url.access_mode == MODE_SCAST) ? "shoutcast" : "icecast"), buf2); return NULL; } @@ -1016,17 +1019,17 @@ FILE *f_open(const char *filename, const char *acctype) if(!ptr) { - sprintf(err_txt, "failed to find station number"); + strcpy(err_txt, "failed to find station number"); dprintf(stderr, "%s\n", buf2); return NULL; } - sprintf(url.host, "%d", atoi(ptr + 3)); + SPRINTF(url.host, "%d", atoi(ptr + 3)); } /* create the correct url from the station number */ CRLFCut(url.host); - sprintf(url.url, "http://classic.shoutcast.com/sbin/shoutcast-playlist.pls?rn=%s&file=filename.pls", url.host); + SPRINTF(url.url, "http://classic.shoutcast.com/sbin/shoutcast-playlist.pls?rn=%s&file=filename.pls", url.host); /* fall through */ case MODE_PLS: { @@ -1062,7 +1065,7 @@ FILE *f_open(const char *filename, const char *acctype) if(!ptr) { dprintf(stderr, "Ups! Playlist doesn't seem to contain any URL !\nbuffer:%s\n", buf); - sprintf(err_txt, "Ups! Playlist doesn't seem to contain any URL !"); + strcpy(err_txt, "Ups! Playlist doesn't seem to contain any URL !"); return NULL; } @@ -1089,7 +1092,7 @@ FILE *f_open(const char *filename, const char *acctype) const char* const chptr = strstr(servers[i], "://"); if(chptr) { - sprintf(url.url, "icy%s", chptr); + snprintf(url.url, sizeof(url.url)-1, "icy%s", chptr); fd = f_open(url.url, "r"); } } From 9ac3f7934facac8aced54400f926134d75e228fe Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:51 +0200 Subject: [PATCH 16/18] audioplayer: allow to add https:// urls from playlist Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/573ced113408f16dead5ac94334bcb4a2301c2f6 Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- src/gui/audioplayer.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 0201d3752..f427c249f 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -4,6 +4,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2002-2008 the tuxbox project contributors Copyright (C) 2008 Novell, Inc. Author: Stefan Seyfried + Copyright (C) 2011-2013,2015,2017 Stefan Seyfried Copyright (C) 2017 Sven Hoefer License: GPL @@ -1169,9 +1170,13 @@ void CAudioPlayerGui::processPlaylistUrl(const char *url, const char *name, cons if (line[0] != '#') { //printf("chunk: line = %s\n", line); - ptr = strstr(line, "http://"); - if (ptr != NULL) - { + const char *schemes[] = {"http://", "https://", NULL }; + const char **scheme = schemes; + while (*scheme) { + ptr = strstr(line, *scheme); + scheme++; + if (ptr == NULL) + continue; char *tmp; // strip \n and \r characters from url tmp = strchr(line, '\r'); @@ -1181,6 +1186,7 @@ void CAudioPlayerGui::processPlaylistUrl(const char *url, const char *name, cons if (tmp != NULL) *tmp = '\0'; addUrl2Playlist(ptr, name, logo, tim); + break; } } } From 059c5107fbd528ca35e972fe0ceeb3d7445ca820 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Sep 2017 11:25:52 +0200 Subject: [PATCH 17/18] radio-stations.xml: clean out nonworking entries Remove all entries that give plain 404 errors or where the host name cannot be resolved. Left in some where the playlist url redirects to unreachable hosts because that might be a temporary failure. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/c3b5af06a97159e13139f697980c773a6305c110 Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- data/inetradio/radio-stations.xml | 675 ------------------------------ 1 file changed, 675 deletions(-) diff --git a/data/inetradio/radio-stations.xml b/data/inetradio/radio-stations.xml index 629d9f353..065d7d55b 100644 --- a/data/inetradio/radio-stations.xml +++ b/data/inetradio/radio-stations.xml @@ -19,96 +19,6 @@ name="DRadio Wissen" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Date: Mon, 25 Sep 2017 11:25:52 +0200 Subject: [PATCH 18/18] radio-stations.xml: add some Radio BOB! streams Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/d07e45166efaf2e59abc82a3a7d387312ee013fc Author: Stefan Seyfried Date: 2017-09-25 (Mon, 25 Sep 2017) --- data/inetradio/radio-stations.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/data/inetradio/radio-stations.xml b/data/inetradio/radio-stations.xml index 065d7d55b..1f13e4d83 100644 --- a/data/inetradio/radio-stations.xml +++ b/data/inetradio/radio-stations.xml @@ -19,6 +19,31 @@ name="DRadio Wissen" /> + + + + + + + + + +