Project "Tuxbox-GIT: apps": The branch, master has been updated via 7a67c5a67d90674771736d0f07f9873d9c41d0e7 (commit) via 826bc80d4ac1db1e2a7b3f31cd3932d5a0ba1cf6 (commit) from 488b2b49a03eaf1bef874d38ac97b7f8078c14eb (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 7a67c5a67d90674771736d0f07f9873d9c41d0e7 Author: GetAway <get-a...@t-online.de> Date: Tue May 19 10:58:11 2015 +0200 small fix localtime_r and gmtime_r Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp index 9a0b796..0b53b32 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp @@ -271,12 +271,14 @@ std::string CyhookHandler::BuildHeader(bool cache) gmtime_r(&x_time, <); lt.tm_mday+=1; x_time = mktime(<); - strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime_r(&x_time, <)); + gmtime_r(&x_time, <); + strftime(timeStr, sizeof(timeStr), RFC1123FMT, <); result += string_printf("Expires: %s\r\n", timeStr); } result += "Server: " WEBSERVERNAME "\r\n"; // actual date - strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime_r(&timer, <)); + gmtime_r(&timer, <); + strftime(timeStr, sizeof(timeStr), RFC1123FMT, <); result += string_printf("Date: %s\r\n", timeStr); // connection type #ifdef Y_CONFIG_FEATURE_KEEP_ALIVE @@ -297,7 +299,8 @@ std::string CyhookHandler::BuildHeader(bool cache) if(LastModified != (time_t)-1) mod_time = LastModified; - strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime_r(&mod_time, <)); + gmtime_r(&mod_time, <); + strftime(timeStr, sizeof(timeStr), RFC1123FMT, <); result += string_printf("Last-Modified: %s\r\nContent-Length: %ld\r\n", timeStr, GetContentLength()); } result += "\r\n"; // End of Header diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp index 2d439f7..e725f38 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp @@ -212,7 +212,8 @@ void CmodCache::yshowCacheInfo(CyhookHandler *hh) TCache *item = &((*i).second); char timeStr[80]; struct tm lt; - strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime_r(&item->created, <) ); + gmtime_r(&item->created, <); + strftime(timeStr, sizeof(timeStr), RFC1123FMT, < ); yresult += string_printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>" \ "<td><a href=\"/y/cache-clear?url=%s\">url</a> " \ "<a href=\"/y/cache-clear?category=%s\">category</a></td></tr>\n", diff --git a/tuxbox/neutrino/daemons/sectionsd/SIsections.cpp b/tuxbox/neutrino/daemons/sectionsd/SIsections.cpp index ef7be8f..4a5420a 100644 --- a/tuxbox/neutrino/daemons/sectionsd/SIsections.cpp +++ b/tuxbox/neutrino/daemons/sectionsd/SIsections.cpp @@ -167,8 +167,8 @@ void SIsectionEIT::parsePDCDescriptor(const char *buf, SIevent &e, unsigned maxl { const struct descr_pdc_header *s = (struct descr_pdc_header *)buf; time_t now = time(NULL); - struct tm tm_r; - struct tm t = *localtime_r(&now, &tm_r); // this initializes the time zone in 't' + struct tm t; + localtime_r(&now, &t); // this initializes the time zone in 't' t.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting int month = t.tm_mon; t.tm_mon = ((s->pil1 >> 3) & 0x0F) - 1; commit 826bc80d4ac1db1e2a7b3f31cd3932d5a0ba1cf6 Author: GetAway <get-a...@t-online.de> Date: Tue May 19 10:56:46 2015 +0200 neutrino: use thread-safe localtime_r and gmtime_r Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/src/driver/lcdd.cpp b/tuxbox/neutrino/src/driver/lcdd.cpp index 2266bcd..fa42e22 100644 --- a/tuxbox/neutrino/src/driver/lcdd.cpp +++ b/tuxbox/neutrino/src/driver/lcdd.cpp @@ -642,18 +642,18 @@ void CLCD::showTime() { if (showclock) { - char timestr[21]; + char timestr[20]; struct timeval tm; - struct tm * t; + struct tm lt; gettimeofday(&tm, NULL); - t = localtime(&tm.tv_sec); + localtime_r(&tm.tv_sec, <); if (mode == MODE_STANDBY) { display.draw_fill_rect(-1, -1, LCD_COLS, 64, CLCDDisplay::PIXEL_OFF); // clear lcd - ShowNewClock(&display, t->tm_hour, t->tm_min, t->tm_sec, t->tm_wday, t->tm_mday, t->tm_mon, CNeutrinoApp::getInstance()->recordingstatus); + ShowNewClock(&display, lt.tm_hour, lt.tm_min, lt.tm_sec, lt.tm_wday, lt.tm_mday, lt.tm_mon, CNeutrinoApp::getInstance()->recordingstatus); } else { @@ -664,7 +664,7 @@ void CLCD::showTime() } else { - strftime((char*) ×tr, 20, "%H:%M", t); + strftime(timestr, sizeof(timestr), "%H:%M", <); clearClock = 1; } diff --git a/tuxbox/neutrino/src/driver/radiotext.cpp b/tuxbox/neutrino/src/driver/radiotext.cpp index 210a496..a225a39 100644 --- a/tuxbox/neutrino/src/driver/radiotext.cpp +++ b/tuxbox/neutrino/src/driver/radiotext.cpp @@ -614,13 +614,13 @@ fprintf(stderr, "MEC=0x%02x DSN=0x%02x PSN=0x%02x MEL=%02d STATUS=0x%02x MFL=%02 if (rtp_itoggle) { if (S_Verbose >= 1) { - struct tm tm_store; - struct tm *ts = localtime_r(&RTP_Starttime, &tm_store); + struct tm ts; + localtime_r(&RTP_Starttime, &ts); if (rtp_idiffs > 0) printf(" StartTime : %02d:%02d:%02d (last Title elapsed = %d s)\n", - ts->tm_hour, ts->tm_min, ts->tm_sec, rtp_idiffs); + ts.tm_hour, ts.tm_min, ts.tm_sec, rtp_idiffs); else - printf(" StartTime : %02d:%02d:%02d\n", ts->tm_hour, ts->tm_min, ts->tm_sec); + printf(" StartTime : %02d:%02d:%02d\n", ts.tm_hour, ts.tm_min, ts.tm_sec); printf(" RTp-Title : %s\n RTp-Artist: %s\n", RTP_Title, RTP_Artist); } RTP_ItemToggle = mtext[10] & 0x10; diff --git a/tuxbox/neutrino/src/driver/vcrcontrol.cpp b/tuxbox/neutrino/src/driver/vcrcontrol.cpp index 61a99d7..9134307 100644 --- a/tuxbox/neutrino/src/driver/vcrcontrol.cpp +++ b/tuxbox/neutrino/src/driver/vcrcontrol.cpp @@ -835,7 +835,7 @@ bool CVCRControl::CFileDevice::Record(const t_channel_id channel_id, int mode, c // Create filename for recording pos = Directory.size(); strcpy(filename, Directory.c_str()); - + if ((pos == 0) || (filename[pos - 1] != '/')) { @@ -843,9 +843,7 @@ bool CVCRControl::CFileDevice::Record(const t_channel_id channel_id, int mode, c pos++; filename[pos] = '\0'; } - - time_t t = time(NULL); - + // %C == channel, %T == title, %I == info1, %d == date, %t == time if (FilenameTemplate.empty()) FilenameTemplate = "%C_%T_%d_%t"; @@ -870,10 +868,13 @@ bool CVCRControl::CFileDevice::Record(const t_channel_id channel_id, int mode, c appendEPGInfo(buf, 255, epgid); StrSearchReplace(expandedTemplate, "%I", buf); - strftime(buf,11,"%Y-%m-%d",localtime(&t)); + time_t t = time(NULL); + struct tm tm; + localtime_r(&t, &tm); + strftime(buf,11,"%Y-%m-%d", &tm); StrSearchReplace(expandedTemplate, "%d", buf); - strftime(buf,7,"%H%M%S",localtime(&t)); + strftime(buf,7,"%H%M%S", &tm); StrSearchReplace(expandedTemplate, "%t", buf); //printf("[CFileDevice] filename: %s, expandedTemplate: %s\n",filename,expandedTemplate.c_str()); diff --git a/tuxbox/neutrino/src/gui/channellist.cpp b/tuxbox/neutrino/src/gui/channellist.cpp index 927a928..b0b03fe 100644 --- a/tuxbox/neutrino/src/gui/channellist.cpp +++ b/tuxbox/neutrino/src/gui/channellist.cpp @@ -1092,14 +1092,15 @@ void CChannelList::paintDetails(unsigned int index) char cNoch[50] = {0}; // UTF-8 char cSeit[50] = {0}; // UTF-8 - struct tm *pStartZeit = localtime(&p_event->startTime); + struct tm pStartZeit; + localtime_r(&p_event->startTime, &pStartZeit); unsigned seit = ( time(NULL) - p_event->startTime + 30) / 60; if (displayNext) { snprintf(cNoch, sizeof(cNoch), "(%d min)", p_event->duration / 60); - snprintf(cSeit, sizeof(cSeit), g_Locale->getText(LOCALE_CHANNELLIST_START), pStartZeit->tm_hour, pStartZeit->tm_min); + snprintf(cSeit, sizeof(cSeit), g_Locale->getText(LOCALE_CHANNELLIST_START), pStartZeit.tm_hour, pStartZeit.tm_min); } else { - snprintf(cSeit, sizeof(cSeit), g_Locale->getText(LOCALE_CHANNELLIST_SINCE), pStartZeit->tm_hour, pStartZeit->tm_min); + snprintf(cSeit, sizeof(cSeit), g_Locale->getText(LOCALE_CHANNELLIST_SINCE), pStartZeit.tm_hour, pStartZeit.tm_min); int noch = (p_event->duration / 60) - seit; if ((noch< 0) || (noch>=10000)) noch= 0; @@ -1222,8 +1223,9 @@ void CChannelList::paintDetails(unsigned int index) CSectionsdClient::CurrentNextInfo CurrentNext; g_Sectionsd->getCurrentNextServiceKey(chanlist[index]->channel_id, CurrentNext); if (!(CurrentNext.next_name.empty())) { - struct tm *pStartZeit = localtime (& CurrentNext.next_zeit.startzeit); - snprintf(cFrom, sizeof(cFrom), "%s %02d:%02d",g_Locale->getText(LOCALE_WORD_FROM),pStartZeit->tm_hour, pStartZeit->tm_min ); + struct tm pStartZeit; + localtime_r(&CurrentNext.next_zeit.startzeit, &pStartZeit); + snprintf(cFrom, sizeof(cFrom), "%s %02d:%02d",g_Locale->getText(LOCALE_WORD_FROM),pStartZeit.tm_hour, pStartZeit.tm_min ); snprintf(buf, sizeof(buf), "%s", Latin1_to_UTF8(CurrentNext.next_name).c_str()); int from_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(cFrom, true); // UTF-8 @@ -1385,9 +1387,10 @@ void CChannelList::paintItem(int pos) { if(displayNext) { - struct tm *pStartZeit = localtime(&p_event->startTime); + struct tm pStartZeit; + localtime_r(&p_event->startTime, &pStartZeit); - snprintf((char*) tmp, sizeof(tmp), "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min); + snprintf((char*) tmp, sizeof(tmp), "%02d:%02d", pStartZeit.tm_hour, pStartZeit.tm_min); g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x + 5 + numwidth + 6, ypos + xtheight, width - numwidth - 20 - 12 - prg_offset, tmp, tcolor, 0, true); } else @@ -1467,12 +1470,13 @@ void CChannelList::paintHead() char timestr[10]; char provstr[20]; time_t now = time(NULL); - struct tm *tm = localtime(&now); + struct tm tm; + localtime_r(&now, &tm); bool gotTime = g_Sectionsd->getIsTimeSet(); if(gotTime){ - strftime(timestr, 10, "%H:%M", tm); + strftime(timestr, 10, "%H:%M", &tm); timestr_len = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(timestr, true); // UTF-8 timestr_offset = timestr_len + 10; } @@ -1641,8 +1645,9 @@ void CChannelList::paint_events(int index) { if (e->eventID) { - struct tm *tmStartZeit = localtime(&e->startTime); - strftime(startTime, sizeof(startTime), "%H:%M", tmStartZeit ); + struct tm tmStartZeit; + localtime_r(&e->startTime, &tmStartZeit); + strftime(startTime, sizeof(startTime), "%H:%M", &tmStartZeit ); //printf("%s %s\n", startTime, e->description.c_str()); startTimeWidth = eventStartTimeWidth; g_Font[eventFont]->RenderString(x+ width+5, y+ theight+ pig_height + i*ffheight, startTimeWidth, startTime, /*(g_settings.colored_events_channellist == 2) ? COL_COLORED_EVENTS_CHANNELLIST :*/ COL_MENUCONTENTINACTIVE, 0, true); diff --git a/tuxbox/neutrino/src/gui/drive_setup.cpp b/tuxbox/neutrino/src/gui/drive_setup.cpp index 0bf5300..691e940 100644 --- a/tuxbox/neutrino/src/gui/drive_setup.cpp +++ b/tuxbox/neutrino/src/gui/drive_setup.cpp @@ -4564,9 +4564,11 @@ bool CDriveSetup::isIdeInterfaceActive() // returns current time string string CDriveSetup::getTimeStamp() { - time_t now = time(0); char ret[22]; - strftime(ret, 22, "%d.%m.%Y - %H:%M:%S", localtime(&now)); + time_t now = time(0); + struct tm lt; + localtime_r(&now, <); + strftime(ret, sizeof(ret), "%d.%m.%Y - %H:%M:%S", <); return (string)ret; } diff --git a/tuxbox/neutrino/src/gui/epgplus.cpp b/tuxbox/neutrino/src/gui/epgplus.cpp index 2b3c5fb..c330f2d 100644 --- a/tuxbox/neutrino/src/gui/epgplus.cpp +++ b/tuxbox/neutrino/src/gui/epgplus.cpp @@ -909,7 +909,8 @@ int EpgPlus::exec(CChannelList* _channelList, int selectedChannelIndex, CBouquet is_visible = true; time_t currentTime = time(NULL); - tm tmStartTime = *localtime(¤tTime); + struct tm tmStartTime; + localtime_r(¤tTime, &tmStartTime); tmStartTime.tm_sec = 0; tmStartTime.tm_min = int(tmStartTime.tm_min/15) * 15; @@ -1493,9 +1494,10 @@ void EpgPlus::paintChannelEntry(int position) std::string EpgPlus::getTimeString(const time_t& time, const std::string& format) { char tmpstr[256]; - struct tm *tmStartTime = localtime(&time); + struct tm tmStartTime; + localtime_r(&time, &tmStartTime); - strftime(tmpstr, sizeof(tmpstr), format.c_str(), tmStartTime ); + strftime(tmpstr, sizeof(tmpstr), format.c_str(), &tmStartTime ); // TODO: check scope of tmpstr! return tmpstr; } diff --git a/tuxbox/neutrino/src/gui/epgview.cpp b/tuxbox/neutrino/src/gui/epgview.cpp index 4da1704..f1ed2c5 100644 --- a/tuxbox/neutrino/src/gui/epgview.cpp +++ b/tuxbox/neutrino/src/gui/epgview.cpp @@ -901,18 +901,20 @@ void CEpgData::GetEPGData(const t_channel_id channel_id, unsigned long long id, reformatExtendedEvents("Presenter", g_Locale->getText(LOCALE_EPGEXTENDED_PRESENTER), false, epgData); } - struct tm *pStartZeit = localtime(&(epgData.epg_times).startzeit); + struct tm pStartZeit; + localtime_r(&epgData.epg_times.startzeit, &pStartZeit); char temp[11] = {0}; - strftime( temp, sizeof(temp), "%d.%m.%Y", pStartZeit); - epg_date = g_Locale->getText(CLocaleManager::getWeekday(pStartZeit)); + strftime( temp, sizeof(temp), "%d.%m.%Y", &pStartZeit); + epg_date = g_Locale->getText(CLocaleManager::getWeekday(&pStartZeit)); epg_date += ". "; epg_date += temp; - strftime( temp, sizeof(temp), "%H:%M", pStartZeit); + strftime( temp, sizeof(temp), "%H:%M", &pStartZeit); epg_start= temp; long int uiEndTime((epgData.epg_times).startzeit+ (epgData.epg_times).dauer); - struct tm *pEndeZeit = localtime((time_t*)&uiEndTime); - strftime( temp, sizeof(temp), "%H:%M", pEndeZeit); + struct tm pEndeZeit; + localtime_r((time_t*)&uiEndTime, &pEndeZeit); + strftime( temp, sizeof(temp), "%H:%M", &pEndeZeit); epg_end= temp; epg_done= -1; @@ -963,7 +965,7 @@ void CEpgData::GetPrevNextEPGData( unsigned long long id, time_t* startzeit ) void CEpgData::FollowScreenings(const time_t startzeit) { CChannelEventList::iterator e; - struct tm *tmStartZeit; + struct tm tmStartZeit; std::string screening_dates, screening_nodual; int flag = SCREENING_AFTER; char tmpstr[256] = {0}; @@ -972,17 +974,17 @@ void CEpgData::FollowScreenings(const time_t startzeit) for (e = followlist.begin(); e != followlist.end(); ++e) { - tmStartZeit = localtime(&(e->startTime)); + localtime_r(&e->startTime, &tmStartZeit); - screening_dates = g_Locale->getText(CLocaleManager::getWeekday(tmStartZeit)); + screening_dates = g_Locale->getText(CLocaleManager::getWeekday(&tmStartZeit)); screening_dates += '.'; - strftime(tmpstr, sizeof(tmpstr), " %d.", tmStartZeit ); + strftime(tmpstr, sizeof(tmpstr), " %d.", &tmStartZeit ); screening_dates += tmpstr; - screening_dates += g_Locale->getText(CLocaleManager::getMonth(tmStartZeit)); + screening_dates += g_Locale->getText(CLocaleManager::getMonth(&tmStartZeit)); - strftime(tmpstr, sizeof(tmpstr), ". %H:%M ", tmStartZeit ); + strftime(tmpstr, sizeof(tmpstr), ". %H:%M ", &tmStartZeit ); screening_dates += tmpstr; flag = (e->startTime <= startzeit) ? SCREENING_BEFORE : SCREENING_AFTER; diff --git a/tuxbox/neutrino/src/gui/eventlist.cpp b/tuxbox/neutrino/src/gui/eventlist.cpp index 10f09c6..8b8f4a0 100644 --- a/tuxbox/neutrino/src/gui/eventlist.cpp +++ b/tuxbox/neutrino/src/gui/eventlist.cpp @@ -676,13 +676,14 @@ void EventList::paintItem(unsigned int pos) if (evtlist[curpos].eventID != 0) { char tmpstr[256]; - struct tm *tmStartZeit = localtime(&evtlist[curpos].startTime); + struct tm tmStartZeit; + localtime_r(&evtlist[curpos].startTime, &tmStartZeit); - strftime(tmpstr, sizeof(tmpstr), ". %H:%M, ", tmStartZeit ); - datetime1_str = (std::string)g_Locale->getText(CLocaleManager::getWeekday(tmStartZeit)) + tmpstr; + strftime(tmpstr, sizeof(tmpstr), ". %H:%M, ", &tmStartZeit ); + datetime1_str = (std::string)g_Locale->getText(CLocaleManager::getWeekday(&tmStartZeit)) + tmpstr; - strftime(tmpstr, sizeof(tmpstr), " %d. ", tmStartZeit ); - datetime2_str = (std::string)tmpstr + g_Locale->getText(CLocaleManager::getMonth(tmStartZeit)) + '.'; + strftime(tmpstr, sizeof(tmpstr), " %d. ", &tmStartZeit ); + datetime2_str = (std::string)tmpstr + g_Locale->getText(CLocaleManager::getMonth(&tmStartZeit)) + '.'; if (m_showSearchResults) // show the channel if we made a event search only (which could be made through all channels) { diff --git a/tuxbox/neutrino/src/gui/filebrowser.cpp b/tuxbox/neutrino/src/gui/filebrowser.cpp index 4351daf..fc402ee 100644 --- a/tuxbox/neutrino/src/gui/filebrowser.cpp +++ b/tuxbox/neutrino/src/gui/filebrowser.cpp @@ -1296,7 +1296,9 @@ void CFileBrowser::paintItem(unsigned int pos) char timestring[18]; time_t rawtime; rawtime = actual_file->Time; - strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&rawtime)); + struct tm tm; + gmtime_r(&rawtime, &tm); + strftime(timestring, sizeof(timestring), "%d-%m-%Y %H:%M", &tm); /* right align directory time */ int time_w = fnt_item->getRenderWidth(timestring); fnt_item->RenderString(x + width - time_w - 25, ypos+ fheight, time_w, timestring, color); diff --git a/tuxbox/neutrino/src/gui/infoviewer.cpp b/tuxbox/neutrino/src/gui/infoviewer.cpp index f6a836b..0c8fe07 100644 --- a/tuxbox/neutrino/src/gui/infoviewer.cpp +++ b/tuxbox/neutrino/src/gui/infoviewer.cpp @@ -220,9 +220,11 @@ void CInfoViewer::paintTime( bool show_dot, bool firstPaint ) char timestr[10]; struct timeval tm; + struct tm lt; gettimeofday(&tm, NULL); - strftime((char*) ×tr, 10, "%H:%M", localtime(&tm.tv_sec) ); + localtime_r(&tm.tv_sec, <); + strftime(timestr, sizeof(timestr), "%H:%M", <); if ( ( !firstPaint ) && ( strcmp( timestr, old_timestr ) == 0 ) ) { @@ -1725,6 +1727,7 @@ void CInfoViewer::show_Data(bool calledFromEvent) #endif time_t jetzt=time(NULL); + struct tm pStartZeit; if (info_CurrentNext.flags & CSectionsdClient::epgflags::has_current) { int seit = (abs(jetzt - info_CurrentNext.current_zeit.startzeit) + 30) / 60; @@ -1742,8 +1745,8 @@ void CInfoViewer::show_Data(bool calledFromEvent) else sprintf((char*)&runningRest, "%d +%d min", info_CurrentNext.current_zeit.dauer / 60, -rest); } - struct tm *pStartZeit = localtime(&info_CurrentNext.current_zeit.startzeit); - sprintf((char*)&runningStart, "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min); + localtime_r(&info_CurrentNext.current_zeit.startzeit, &pStartZeit); + sprintf((char*)&runningStart, "%02d:%02d", pStartZeit.tm_hour, pStartZeit.tm_min); } else last_curr_id = 0; @@ -1751,8 +1754,8 @@ void CInfoViewer::show_Data(bool calledFromEvent) { unsigned dauer = info_CurrentNext.next_zeit.dauer / 60; sprintf((char*)&nextDuration, "%d min", dauer); - struct tm *pStartZeit = localtime(&info_CurrentNext.next_zeit.startzeit); - sprintf((char*)&nextStart, "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min); + localtime_r(&info_CurrentNext.next_zeit.startzeit, &pStartZeit); + sprintf((char*)&nextStart, "%02d:%02d", pStartZeit.tm_hour, pStartZeit.tm_min); } else last_next_id = 0; @@ -2085,8 +2088,9 @@ void CInfoViewer::showEpgInfo() //message on event change { char nextStart[10]; int mode = CNeutrinoApp::getInstance()->getMode(); - struct tm *pnStartZeit = localtime(&info_CurrentNext.next_zeit.startzeit); - sprintf((char*)&nextStart, "%02d:%02d", pnStartZeit->tm_hour, pnStartZeit->tm_min); + struct tm pnStartZeit; + localtime_r(&info_CurrentNext.next_zeit.startzeit, &pnStartZeit); + sprintf((char*)&nextStart, "%02d:%02d", pnStartZeit.tm_hour, pnStartZeit.tm_min); /* show epg info only if we in TV- or Radio mode and current event is not the same like before */ if ((eventname != info_CurrentNext.current_name) && (mode != 0)) diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp index 7f9036d..96d7a95 100644 --- a/tuxbox/neutrino/src/gui/moviebrowser.cpp +++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp @@ -3396,7 +3396,7 @@ bool CMovieBrowser::getMovieInfoItem(MI_MOVIE_INFO& movie_info, MB_INFO_ITEM ite char str_tmp[MAX_STR_TMP]; bool result = true; *item_string=""; - tm* tm_tmp; + struct tm tm_tmp; char text[20]; int i=0; @@ -3458,13 +3458,13 @@ bool CMovieBrowser::getMovieInfoItem(MI_MOVIE_INFO& movie_info, MB_INFO_ITEM ite *item_string = str_tmp; break; case MB_INFO_PREVPLAYDATE: // = 12, - tm_tmp = localtime(&movie_info.dateOfLastPlay); - snprintf(str_tmp,MAX_STR_TMP,"%02d.%02d.%02d",tm_tmp->tm_mday,(tm_tmp->tm_mon)+ 1, tm_tmp->tm_year >= 100 ? tm_tmp->tm_year-100 : tm_tmp->tm_year); + localtime_r(&movie_info.dateOfLastPlay, &tm_tmp); + snprintf(str_tmp,MAX_STR_TMP,"%02d.%02d.%02d",tm_tmp.tm_mday,(tm_tmp.tm_mon)+ 1, tm_tmp.tm_year >= 100 ? tm_tmp.tm_year-100 : tm_tmp.tm_year); *item_string = str_tmp; break; case MB_INFO_RECORDDATE: // = 13, - tm_tmp = localtime(&movie_info.file.Time); - snprintf(str_tmp,MAX_STR_TMP,"%02d.%02d.%02d",tm_tmp->tm_mday,(tm_tmp->tm_mon) + 1,tm_tmp->tm_year >= 100 ? tm_tmp->tm_year-100 : tm_tmp->tm_year); + localtime_r(&movie_info.file.Time, &tm_tmp); + snprintf(str_tmp,MAX_STR_TMP,"%02d.%02d.%02d",tm_tmp.tm_mday,(tm_tmp.tm_mon) + 1,tm_tmp.tm_year >= 100 ? tm_tmp.tm_year-100 : tm_tmp.tm_year); *item_string = str_tmp; break; case MB_INFO_PRODDATE: // = 14, diff --git a/tuxbox/neutrino/src/gui/movieinfo.cpp b/tuxbox/neutrino/src/gui/movieinfo.cpp index c7c20b7..42537f4 100644 --- a/tuxbox/neutrino/src/gui/movieinfo.cpp +++ b/tuxbox/neutrino/src/gui/movieinfo.cpp @@ -493,7 +493,7 @@ void CMovieInfo::showMovieInfo(const char* filename) void CMovieInfo::showMovieInfo(MI_MOVIE_INFO& movie_info) { std::string print_buffer; - tm* date_tm; + struct tm date_tm; char date_char[100]; // prepare print buffer print_buffer = movie_info.epgInfo1; @@ -609,14 +609,14 @@ void CMovieInfo::showMovieInfo(MI_MOVIE_INFO& movie_info) print_buffer += "\n\n"; print_buffer += g_Locale->getText(LOCALE_MOVIEBROWSER_INFO_PREVPLAYDATE); print_buffer += ": "; - date_tm = localtime(&movie_info.dateOfLastPlay); - snprintf(date_char, 12,"%02d.%02d.%04d",date_tm->tm_mday,date_tm->tm_mon+1,date_tm->tm_year +1900); + localtime_r(&movie_info.dateOfLastPlay, &date_tm); + snprintf(date_char, 12,"%02d.%02d.%04d",date_tm.tm_mday,date_tm.tm_mon+1,date_tm.tm_year +1900); print_buffer += date_char; print_buffer += "\n"; print_buffer += g_Locale->getText(LOCALE_MOVIEBROWSER_INFO_RECORDDATE); print_buffer += ": "; - date_tm = localtime(&movie_info.file.Time); - snprintf(date_char, 12,"%02d.%02d.%04d",date_tm->tm_mday,date_tm->tm_mon+1,date_tm->tm_year +1900); + localtime_r(&movie_info.file.Time, &date_tm); + snprintf(date_char, 12,"%02d.%02d.%04d",date_tm.tm_mday,date_tm.tm_mon+1,date_tm.tm_year +1900); print_buffer += date_char; if(movie_info.file.Size != 0 ) { diff --git a/tuxbox/neutrino/src/gui/movieplayer2.cpp b/tuxbox/neutrino/src/gui/movieplayer2.cpp index 19a9a07..5f54380 100644 --- a/tuxbox/neutrino/src/gui/movieplayer2.cpp +++ b/tuxbox/neutrino/src/gui/movieplayer2.cpp @@ -1076,7 +1076,9 @@ ReceiveStreamThread(void *arg) skipvalue[0] = '+'; o = 1; } - strftime(&skipvalue[o], 9, "%T", gmtime(&s)); + struct tm tm; + gmtime_r(&s, &tm); + strftime(&skipvalue[o], 9, "%T", &tm); counter = 0; skipurl = baseurl; skipurl += "requests/status.xml?command=seek&val="; diff --git a/tuxbox/neutrino/src/gui/pictureviewer.cpp b/tuxbox/neutrino/src/gui/pictureviewer.cpp index a95024e..3a595c3 100644 --- a/tuxbox/neutrino/src/gui/pictureviewer.cpp +++ b/tuxbox/neutrino/src/gui/pictureviewer.cpp @@ -554,7 +554,9 @@ void CPictureViewerGui::paintItem(int pos) tmp += playlist[liststart+pos].Type; tmp += ')'; char timestring[18]; - strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&playlist[liststart+pos].Date)); + struct tm tm; + gmtime_r(&playlist[liststart+pos].Date, &tm); + strftime(timestring, sizeof(timestring), "%d-%m-%Y %H:%M", &tm); int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(timestring); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10,ypos+fheight, width-30 - w, tmp, color, fheight, true); // UTF-8 g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+width-20-w,ypos+fheight, w, timestring, color, fheight); @@ -667,7 +669,9 @@ void CPictureViewerGui::view(unsigned int index, bool unscaled) CLCD::getInstance()->showMenuText(0, playlist[index].Name.c_str(), -1, true); // UTF-8 char timestring[19]; - strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&playlist[index].Date)); + struct tm tm; + gmtime_r(&playlist[index].Date, &tm); + strftime(timestring, sizeof(timestring), "%d-%m-%Y %H:%M", &tm); CLCD::getInstance()->showMenuText(1, timestring); if(m_state == MENU) diff --git a/tuxbox/neutrino/src/gui/subchannel_select.cpp b/tuxbox/neutrino/src/gui/subchannel_select.cpp index 16c347a..db58e4a 100644 --- a/tuxbox/neutrino/src/gui/subchannel_select.cpp +++ b/tuxbox/neutrino/src/gui/subchannel_select.cpp @@ -77,14 +77,14 @@ int CSubChannelSelectMenu::doMenu() { char nvod_time_a[50], nvod_time_e[50], nvod_time_x[50]; char nvod_s[100]; - struct tm *tmZeit; + struct tm tmZeit; - tmZeit = localtime(&e->startzeit); - sprintf(nvod_time_a, "%02d:%02d", tmZeit->tm_hour, tmZeit->tm_min); + localtime_r(&e->startzeit, &tmZeit); + sprintf(nvod_time_a, "%02d:%02d", tmZeit.tm_hour, tmZeit.tm_min); time_t endtime = e->startzeit + e->dauer; - tmZeit = localtime(&endtime); - sprintf(nvod_time_e, "%02d:%02d", tmZeit->tm_hour, tmZeit->tm_min); + localtime_r(&endtime, &tmZeit); + sprintf(nvod_time_e, "%02d:%02d", tmZeit.tm_hour, tmZeit.tm_min); time_t jetzt = time(NULL); if (e->startzeit > jetzt) diff --git a/tuxbox/neutrino/src/gui/timeosd.cpp b/tuxbox/neutrino/src/gui/timeosd.cpp index 1af084e..8cae6cd 100644 --- a/tuxbox/neutrino/src/gui/timeosd.cpp +++ b/tuxbox/neutrino/src/gui/timeosd.cpp @@ -82,7 +82,9 @@ void CTimeOSD::update() } if(tDisplayTime < 0) tDisplayTime=0; - strftime(cDisplayTime, 9, "%T", gmtime(&tDisplayTime)); + struct tm tm; + gmtime_r(&tDisplayTime, &tm); + strftime(cDisplayTime, 9, "%T", &tm); frameBuffer->paintBoxRel(m_xend - m_width - 10, m_y , m_width + 10 , m_height, color, RADIUS_MID); g_Font[TIMEOSD_FONT]->RenderString(m_xend - m_width - 5,m_y + m_height, m_width+5, cDisplayTime, color); diff --git a/tuxbox/neutrino/src/gui/timerlist.cpp b/tuxbox/neutrino/src/gui/timerlist.cpp index fa4ab60..94a5d16 100644 --- a/tuxbox/neutrino/src/gui/timerlist.cpp +++ b/tuxbox/neutrino/src/gui/timerlist.cpp @@ -109,10 +109,11 @@ public: if(type == CTimerd::TIMER_RECORD) { *stopTime=(time(NULL)/60)*60; - struct tm *tmTime2 = localtime(stopTime); - sprintf( display, "%02d.%02d.%04d %02d:%02d", tmTime2->tm_mday, tmTime2->tm_mon+1, - tmTime2->tm_year+1900, - tmTime2->tm_hour, tmTime2->tm_min); + struct tm tmTime2; + localtime_r(stopTime, &tmTime2); + sprintf( display, "%02d.%02d.%04d %02d:%02d", tmTime2.tm_mday, tmTime2.tm_mon+1, + tmTime2.tm_year+1900, + tmTime2.tm_hour, tmTime2.tm_min); m1->setActive(true); m6->setActive((g_settings.recording_type == RECORDING_FILE)); } @@ -594,12 +595,14 @@ void CTimerList::paintItem(int pos) if(liststart+pos<timerlist.size()) { CTimerd::responseGetTimer & timer = timerlist[liststart+pos]; - char zAlarmTime[25] = {0}; - struct tm *alarmTime = localtime(&(timer.alarmTime)); - strftime(zAlarmTime,20,"%d.%m. %H:%M",alarmTime); - char zStopTime[25] = {0}; - struct tm *stopTime = localtime(&(timer.stopTime)); - strftime(zStopTime,20,"%d.%m. %H:%M",stopTime); + char zAlarmTime[20]; + struct tm alarmTime; + localtime_r(&timer.alarmTime, &alarmTime); + strftime(zAlarmTime, sizeof(zAlarmTime), "%d.%m. %H:%M", &alarmTime); + char zStopTime[20]; + struct tm stopTime; + localtime_r(&timer.stopTime, &stopTime); + strftime(zStopTime,sizeof(zStopTime), "%d.%m. %H:%M", &stopTime); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10, ypos+fheight, time_width, zAlarmTime, color, fheight, true); // UTF-8 if(timer.stopTime != 0) { @@ -1158,14 +1161,15 @@ bool askUserOnTimerConflict(time_t announceTime, time_t stopTime) std::string timerbuf = g_Locale->getText(LOCALE_TIMERLIST_OVERLAPPING_TIMER1); timerbuf += "\n"; - char rec[25] = {0}; - struct tm *recTime = localtime(&announceTime); - strftime(rec,20,"%d.%m. %H:%M",recTime); + char rec[20]; + struct tm recTime; + localtime_r(&announceTime, &recTime); + strftime(rec, sizeof(rec), "%d.%m. %H:%M", &recTime); timerbuf += rec; - recTime = localtime(&stopTime); + localtime_r(&stopTime, &recTime); if(stopTime > announceTime) { - strftime(rec,20,"- %d.%m. %H:%M",recTime); + strftime(rec, sizeof(rec), "- %d.%m. %H:%M", &recTime); timerbuf += rec; } @@ -1175,15 +1179,17 @@ bool askUserOnTimerConflict(time_t announceTime, time_t stopTime) for (CTimerd::TimerList::iterator it = overlappingTimers.begin(); it != overlappingTimers.end(); ++it) { - char at[25] = {0}; - struct tm *annTime = localtime(&(it->alarmTime)); - strftime(at,20,"%d.%m. %H:%M",annTime); + char at[20]; + struct tm annTime; + localtime_r(&it->alarmTime, &annTime); + strftime(at, sizeof(at), "%d.%m. %H:%M", &annTime); timerbuf += at; timerbuf += " - "; - char st[25] = {0}; - struct tm *sTime = localtime(&(it->stopTime)); - strftime(st,20,"%d.%m. %H:%M",sTime); + char st[20]; + struct tm sTime; + localtime_r(&it->stopTime, &sTime); + strftime(st, sizeof(st), "%d.%m. %H:%M", &sTime); timerbuf += st; timerbuf += " -> "; timerbuf += CTimerList::convertTimerType2String(it->eventType); diff --git a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp index 9adfc5a..74c6bdc 100644 --- a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp +++ b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp @@ -486,10 +486,11 @@ CDateInput::~CDateInput() } void CDateInput::onBeforeExec() { - 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); + struct tm tmTime; + localtime_r(time, &tmTime); + 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); } void CDateInput::onAfterExec() @@ -528,10 +529,11 @@ void CDateInput::onAfterExec() if(tmTime.tm_sec<0) tmTime.tm_sec=0; *time=mktime(&tmTime); - struct tm *tmTime2 = localtime(time); - snprintf(value, 20, "%02d.%02d.%04d %02d:%02d", tmTime2->tm_mday, tmTime2->tm_mon+1, - tmTime2->tm_year+1900, - tmTime2->tm_hour, tmTime2->tm_min); + struct tm tmTime2; + localtime_r(time, &tmTime2); + snprintf(value, 20, "%02d.%02d.%04d %02d:%02d", tmTime2.tm_mday, tmTime2.tm_mon+1, + tmTime2.tm_year+1900, + tmTime2.tm_hour, tmTime2.tm_min); } //-----------------------------#################################------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: .../neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp | 9 +++- .../daemons/nhttpd/yhttpd_mods/mod_cache.cpp | 3 +- tuxbox/neutrino/daemons/sectionsd/SIsections.cpp | 4 +- tuxbox/neutrino/src/driver/lcdd.cpp | 10 ++-- tuxbox/neutrino/src/driver/radiotext.cpp | 8 ++-- tuxbox/neutrino/src/driver/vcrcontrol.cpp | 13 +++--- tuxbox/neutrino/src/gui/channellist.cpp | 27 +++++++----- tuxbox/neutrino/src/gui/drive_setup.cpp | 6 ++- tuxbox/neutrino/src/gui/epgplus.cpp | 8 ++- tuxbox/neutrino/src/gui/epgview.cpp | 26 ++++++----- tuxbox/neutrino/src/gui/eventlist.cpp | 11 +++-- tuxbox/neutrino/src/gui/filebrowser.cpp | 4 +- tuxbox/neutrino/src/gui/infoviewer.cpp | 18 +++++--- tuxbox/neutrino/src/gui/moviebrowser.cpp | 10 ++-- tuxbox/neutrino/src/gui/movieinfo.cpp | 10 ++-- tuxbox/neutrino/src/gui/movieplayer2.cpp | 4 +- tuxbox/neutrino/src/gui/pictureviewer.cpp | 8 +++- tuxbox/neutrino/src/gui/subchannel_select.cpp | 10 ++-- tuxbox/neutrino/src/gui/timeosd.cpp | 4 +- tuxbox/neutrino/src/gui/timerlist.cpp | 48 +++++++++++--------- tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp | 18 ++++--- 21 files changed, 149 insertions(+), 110 deletions(-) -- Tuxbox-GIT: apps ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Tuxbox-cvs-commits mailing list Tuxbox-cvs-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tuxbox-cvs-commits