diff --git a/lib/libcoolstream2/cnxtfb.h b/lib/libcoolstream2/cnxtfb.h index 4a51357a3..218c9f057 100644 --- a/lib/libcoolstream2/cnxtfb.h +++ b/lib/libcoolstream2/cnxtfb.h @@ -196,7 +196,9 @@ extern void cnxtfb_register_evnt_clbk(cnxtfb_notify pfnotify); #define FB_TEST_HW_ACCELERATION #define FBIOGET_CNXTFBHANDLE 0x4620 +#ifndef FBIO_WAITFORVSYNC #define FBIO_WAITFORVSYNC 0x4621 +#endif #define FBIO_STARTDISPLAY 0x4622 #define FBIO_STOPDISPLAY 0x4623 #define FBIO_SETBLENDMODE 0x4624 diff --git a/src/driver/framebuffer.cpp b/src/driver/framebuffer.cpp index b890a43f4..6060ddb39 100644 --- a/src/driver/framebuffer.cpp +++ b/src/driver/framebuffer.cpp @@ -1099,10 +1099,25 @@ bool CFrameBuffer::paintIcon(const std::string & filename, const int x, const in //printf("paintIcon: error while loading icon: %s\n", newname.c_str()); return false; } - read(lfd, &header, sizeof(struct rawHeader)); + + ssize_t s = read(lfd, &header, sizeof(struct rawHeader)); + if (s < 0) { + perror("read"); + return false; + } + + if (s < (ssize_t) sizeof(rawHeader)){ + printf("paintIcon: error while loading icon: %s, header too small\n", newname.c_str()); + return false; + } + tmpIcon.width = width = (header.width_hi << 8) | header.width_lo; tmpIcon.height = height = (header.height_hi << 8) | header.height_lo; + if (!width || !height) { + printf("paintIcon: error while loading icon: %s, wrong dimensions (%dHx%dW)\n", newname.c_str(), height, width); + return false; + } int dsize = width*height*sizeof(fb_pixel_t); @@ -1810,7 +1825,15 @@ void * CFrameBuffer::int_convertRGB2FB(unsigned char *rgbbuff, unsigned long x, { unsigned long i; unsigned int *fbbuff; - unsigned long count = x * y; + unsigned long count; + + if (!x || !y) { + printf("convertRGB2FB%s: Error: invalid dimensions (%luX x %luY)\n", + ((alpha) ? " (Alpha)" : ""), x, y); + return NULL; + } + + count = x * y; fbbuff = (unsigned int *) cs_malloc_uncached(count * sizeof(unsigned int)); if(fbbuff == NULL) { diff --git a/src/eitd/xmlutil.cpp b/src/eitd/xmlutil.cpp index 056235116..7dd9cdb8f 100644 --- a/src/eitd/xmlutil.cpp +++ b/src/eitd/xmlutil.cpp @@ -562,11 +562,10 @@ _done: write_indexxml_footer(indexfile); fclose(indexfile); - printf("[sectionsd] Writing Information finished\n"); - filename = (std::string)epgdir + "/index.xml"; - rename(tmpname.c_str(), filename.c_str()); + sync(); + printf("[sectionsd] Writing Information finished\n"); return ; } diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index 25ae70796..85cd00890 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -101,6 +101,7 @@ CUserMenu::~CUserMenu() bool CUserMenu::showUserMenu(neutrino_msg_t msg) { int button = -1; + int dummy = 0; unsigned ums = g_settings.usermenu.size(); for (unsigned int i = 0; i < ums; i++) if (g_settings.usermenu[i]->key == msg) { @@ -236,7 +237,7 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg) break; case SNeutrinoSettings::ITEM_EPG_MISC: { - int dummy = g_Sectionsd->getIsScanningActive(); + dummy = g_Sectionsd->getIsScanningActive(); keyhelper.get(&key,&icon); // new CMenuOptionChooser(LOCALE_VIDEOMENU_VIDEOMODE, &g_settings.video_Mode, VIDEOMENU_VIDEOMODE_OPTIONS, VIDEOMENU_VIDEOMODE_OPTION_COUNT, true, this, CRCInput::RC_nokey, "", true); menu_item = new CMenuOptionChooser(LOCALE_MAINMENU_PAUSESECTIONSD, &dummy, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this , key, icon ); diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp index 0e8811611..afe4ba795 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp @@ -227,7 +227,7 @@ t_channel_id CNeutrinoAPI::ChannelNameToChannelId(std::string search_channel_nam //------------------------------------------------------------------------- // Get functions //------------------------------------------------------------------------- - +#if 0 /* unused funktion*/ bool CNeutrinoAPI::GetStreamInfo(int bitInfo[10]) { char /* *key,*/ *tmpptr, buf[100]; @@ -261,7 +261,7 @@ bool CNeutrinoAPI::GetStreamInfo(int bitInfo[10]) return true; } - +#endif //------------------------------------------------------------------------- bool CNeutrinoAPI::GetChannelEvents(void) diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h index a98a7b5bf..4d504eae0 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h @@ -53,7 +53,9 @@ class CNeutrinoAPI // get functions to collect data bool GetChannelEvents(void); +#if 0 /* unused funktion*/ bool GetStreamInfo(int bitinfo[10]); +#endif std::string GetServiceName(t_channel_id channel_id); CZapitClient::BouquetChannelList *GetBouquet(unsigned int BouquetNr, int Mode); CZapitClient::BouquetChannelList *GetChannelList(int Mode); diff --git a/src/system/flashtool.cpp b/src/system/flashtool.cpp index 66d7b9c8f..5f669d1c3 100644 --- a/src/system/flashtool.cpp +++ b/src/system/flashtool.cpp @@ -165,7 +165,7 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra int globalProgressBegin = 0; if(g_settings.epg_save) - CNeutrinoApp::getInstance()->saveEpg(false); + CNeutrinoApp::getInstance()->saveEpg(true); if(statusViewer) statusViewer->showLocalStatus(0); diff --git a/src/system/sysload.cpp b/src/system/sysload.cpp index 5338adcc9..341a8c189 100644 --- a/src/system/sysload.cpp +++ b/src/system/sysload.cpp @@ -62,8 +62,11 @@ void *cSysLoad::Run(void *arg) while (getline(in, line)) { unsigned long _stat_user, _stat_nice, _stat_system, _stat_idle; if (4 == sscanf(line.c_str(), "cpu %lu %lu %lu %lu", &_stat_user, &_stat_nice, &_stat_system, &_stat_idle)) { + unsigned long _stat_total = _stat_user + _stat_nice + _stat_system + _stat_idle; if (stat_total) { - unsigned long div = _stat_user + _stat_nice + _stat_system + _stat_idle - stat_total; + unsigned long div = _stat_total - stat_total; + if (!div) // prevent division by zero if previous stat_total is equal to new. + break; caller->data_last = (int)(1000 - 1000 * (_stat_idle - stat_idle) / div); if (caller->data_avail < caller->data_size) { caller->data[caller->data_avail++] = caller->data_last; @@ -73,7 +76,7 @@ void *cSysLoad::Run(void *arg) } } stat_idle = _stat_idle; - stat_total = _stat_user + _stat_nice + _stat_system + _stat_idle; + stat_total = _stat_total; break; } }