optimize code

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@198 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
satbaby
2010-01-21 08:59:47 +00:00
parent 44bbd4f5c6
commit 895a6fcbe3
2 changed files with 16 additions and 15 deletions

View File

@@ -157,10 +157,11 @@ void CChannelList::updateEvents(void)
CChannelEventList events; CChannelEventList events;
if (displayNext) { if (displayNext) {
if (chanlist.size()) { size_t chanlist_size = chanlist.size();
if (chanlist_size) {
time_t atime = time(NULL); time_t atime = time(NULL);
unsigned int count; unsigned int count;
for (count=0; count < chanlist.size(); count++){ for (count=0; count < chanlist_size; count++){
//CChannelEventList events = g_Sectionsd->getEventsServiceKey(chanlist[liststart+count]->channel_id &0xFFFFFFFFFFFFULL); //CChannelEventList events = g_Sectionsd->getEventsServiceKey(chanlist[liststart+count]->channel_id &0xFFFFFFFFFFFFULL);
sectionsd_getEventsServiceKey(chanlist[count]->channel_id &0xFFFFFFFFFFFFULL, events); sectionsd_getEventsServiceKey(chanlist[count]->channel_id &0xFFFFFFFFFFFFULL, events);
chanlist[count]->nextEvent.startTime = (long)0x7fffffff; chanlist[count]->nextEvent.startTime = (long)0x7fffffff;
@@ -177,18 +178,17 @@ void CChannelList::updateEvents(void)
} else { } else {
t_channel_id *p_requested_channels = NULL; t_channel_id *p_requested_channels = NULL;
int size_requested_channels = 0; int size_requested_channels = 0;
size_t chanlist_size = chanlist.size();
if (chanlist.size()) { if (chanlist_size) {
size_requested_channels = chanlist.size()*sizeof(t_channel_id); size_requested_channels = chanlist_size*sizeof(t_channel_id);
p_requested_channels = (t_channel_id*)malloc(size_requested_channels); p_requested_channels = new t_channel_id[size_requested_channels];
for (uint32_t count = 0; count < chanlist.size(); count++){ for (uint32_t count = 0; count < chanlist_size; count++){
p_requested_channels[count] = chanlist[count]->channel_id&0xFFFFFFFFFFFFULL; p_requested_channels[count] = chanlist[count]->channel_id&0xFFFFFFFFFFFFULL;
} }
//CChannelEventList events = g_Sectionsd->getChannelEvents((CNeutrinoApp::getInstance()->getMode()) != NeutrinoMessages::mode_radio, p_requested_channels, size_requested_channels); //CChannelEventList events = g_Sectionsd->getChannelEvents((CNeutrinoApp::getInstance()->getMode()) != NeutrinoMessages::mode_radio, p_requested_channels, size_requested_channels);
CChannelEventList levents; CChannelEventList levents;
sectionsd_getChannelEvents(levents, (CNeutrinoApp::getInstance()->getMode()) != NeutrinoMessages::mode_radio, p_requested_channels, size_requested_channels); sectionsd_getChannelEvents(levents, (CNeutrinoApp::getInstance()->getMode()) != NeutrinoMessages::mode_radio, p_requested_channels, size_requested_channels);
for (uint32_t count=0; count < chanlist.size(); count++) { for (uint32_t count=0; count < chanlist_size; count++) {
chanlist[count]->currentEvent = CChannelEvent(); chanlist[count]->currentEvent = CChannelEvent();
for ( CChannelEventList::iterator e = levents.begin(); e != levents.end(); ++e ) for ( CChannelEventList::iterator e = levents.begin(); e != levents.end(); ++e )
if ((chanlist[count]->channel_id&0xFFFFFFFFFFFFULL) == e->get_channel_id()){ if ((chanlist[count]->channel_id&0xFFFFFFFFFFFFULL) == e->get_channel_id()){
@@ -196,7 +196,7 @@ void CChannelList::updateEvents(void)
break; break;
} }
} }
if (p_requested_channels != NULL) free(p_requested_channels); if (p_requested_channels != NULL) delete[] p_requested_channels;
} }
} }
events.clear(); events.clear();

View File

@@ -2606,6 +2606,12 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu)
g_EventList->exec(live_channel_id, channelList->getActiveChannelName()); g_EventList->exec(live_channel_id, channelList->getActiveChannelName());
StartSubtitles(); StartSubtitles();
} }
else if( ( msg == (neutrino_msg_t) g_settings.key_quickzap_up ) || ( msg == (neutrino_msg_t) g_settings.key_quickzap_down ) )
{
//quickzap
quickZap(msg);
}
else if( msg == CRCInput::RC_text) { else if( msg == CRCInput::RC_text) {
g_RCInput->clearRCMsg(); g_RCInput->clearRCMsg();
if(g_settings.mode_clock) if(g_settings.mode_clock)
@@ -2652,11 +2658,6 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu)
radioMode(); radioMode();
} }
} }
else if( ( msg == (neutrino_msg_t) g_settings.key_quickzap_up ) || ( msg == (neutrino_msg_t) g_settings.key_quickzap_down ) )
{
//quickzap
quickZap(msg);
}
else if( msg == (neutrino_msg_t) g_settings.key_subchannel_up ) { else if( msg == (neutrino_msg_t) g_settings.key_subchannel_up ) {
if(g_RemoteControl->subChannels.size() > 0) { if(g_RemoteControl->subChannels.size() > 0) {
StopSubtitles(); StopSubtitles();