use empty() instead of size()

This commit is contained in:
satbaby
2012-06-16 10:38:38 +02:00
parent bc574e9688
commit c1a1aae4c1
5 changed files with 9 additions and 9 deletions

View File

@@ -631,11 +631,11 @@ const std::string & CRemoteControl::setSubChannel(const int numSub, const bool f
const std::string & CRemoteControl::subChannelUp(void) const std::string & CRemoteControl::subChannelUp(void)
{ {
//return setSubChannel((subChannels.size() == 0) ? -1 : (int)((selected_subchannel + 1) % subChannels.size())); //return setSubChannel((subChannels.empty()) ? -1 : (int)((selected_subchannel + 1) % subChannels.size()));
// if there are any NVOD/subchannels switch these else switch audio channel (if any) // if there are any NVOD/subchannels switch these else switch audio channel (if any)
if ( !subChannels.empty() || !g_settings.audiochannel_up_down_enable) if ( !subChannels.empty() || !g_settings.audiochannel_up_down_enable)
{ {
return setSubChannel((subChannels.size() == 0) ? -1 : (int)((selected_subchannel + 1) % subChannels.size())); return setSubChannel( subChannels.empty() ? -1 : (int)((selected_subchannel + 1) % subChannels.size()));
} }
else else
{ {

View File

@@ -678,7 +678,7 @@ int CChannelList::show()
actzap = updateSelection(new_selected); actzap = updateSelection(new_selected);
} }
else if (msg == (neutrino_msg_t)g_settings.key_bouquet_up) { else if (msg == (neutrino_msg_t)g_settings.key_bouquet_up) {
if (bouquetList->Bouquets.size() > 0) { if (!bouquetList->Bouquets.empty()) {
bool found = true; bool found = true;
uint32_t nNext = (bouquetList->getActiveBouquetNumber()+1) % bouquetList->Bouquets.size(); uint32_t nNext = (bouquetList->getActiveBouquetNumber()+1) % bouquetList->Bouquets.size();
if(bouquetList->Bouquets[nNext]->channelList->getSize() <= 0) { if(bouquetList->Bouquets[nNext]->channelList->getSize() <= 0) {

View File

@@ -881,7 +881,7 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
this->paint(); this->paint();
} }
if (msg == CRCInput::RC_yellow) { if (msg == CRCInput::RC_yellow) {
if (bouquetList->Bouquets.size() > 0) { if (!bouquetList->Bouquets.empty()) {
bool found = true; bool found = true;
uint32_t nNext = (bouquetList->getActiveBouquetNumber()+1) % bouquetList->Bouquets.size(); uint32_t nNext = (bouquetList->getActiveBouquetNumber()+1) % bouquetList->Bouquets.size();
//printf("**************************** EpgPlus::exec current bouquet %d new %d\n", bouquetList->getActiveBouquetNumber(), nNext); //printf("**************************** EpgPlus::exec current bouquet %d new %d\n", bouquetList->getActiveBouquetNumber(), nNext);
@@ -908,7 +908,7 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
} }
} }
else if (msg == CRCInput::RC_green) { else if (msg == CRCInput::RC_green) {
if (bouquetList->Bouquets.size() > 0) { if (!bouquetList->Bouquets.empty()) {
bool found = true; bool found = true;
int nNext = (bouquetList->getActiveBouquetNumber()+bouquetList->Bouquets.size()-1) % bouquetList->Bouquets.size(); int nNext = (bouquetList->getActiveBouquetNumber()+bouquetList->Bouquets.size()-1) % bouquetList->Bouquets.size();
if(bouquetList->Bouquets[nNext]->channelList->getSize() <= 0) { if(bouquetList->Bouquets[nNext]->channelList->getSize() <= 0) {
@@ -1263,7 +1263,7 @@ int CEPGplusHandler::exec (CMenuTarget * parent, const std::string & /*actionKey
//channelList = CNeutrinoApp::getInstance()->channelList; //channelList = CNeutrinoApp::getInstance()->channelList;
int bnum = bouquetList->getActiveBouquetNumber(); int bnum = bouquetList->getActiveBouquetNumber();
current_bouquet = bnum; current_bouquet = bnum;
if(bouquetList->Bouquets.size() && bouquetList->Bouquets[bnum]->channelList->getSize() > 0) if(!bouquetList->Bouquets.empty() && bouquetList->Bouquets[bnum]->channelList->getSize() > 0)
channelList = bouquetList->Bouquets[bnum]->channelList; channelList = bouquetList->Bouquets[bnum]->channelList;
else else
channelList = CNeutrinoApp::getInstance()->channelList; channelList = CNeutrinoApp::getInstance()->channelList;

View File

@@ -390,7 +390,7 @@ void CControlAPI::ExecCGI(CyhookHandler *hh)
hh->SetHeader(HTTP_OK, "text/xml; charset=UTF-8"); hh->SetHeader(HTTP_OK, "text/xml; charset=UTF-8");
else else
hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8"); hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8");
if (hh->ParamList.size() > 0) if ( !hh->ParamList.empty() )
{ {
script = hh->ParamList["1"]; script = hh->ParamList["1"];
unsigned int len = hh->ParamList.size(); unsigned int len = hh->ParamList.size();

View File

@@ -628,7 +628,7 @@ CBouquetManager::ChannelIterator::ChannelIterator(CBouquetManager* owner, const
{ {
Owner = owner; Owner = owner;
tv = TV; tv = TV;
if (Owner->Bouquets.size() == 0) if (Owner->Bouquets.empty())
c = -2; c = -2;
else { else {
b = 0; b = 0;
@@ -644,7 +644,7 @@ CBouquetManager::ChannelIterator CBouquetManager::ChannelIterator::operator ++(i
c++; c++;
if ((unsigned int) c >= getBouquet()->size()) { if ((unsigned int) c >= getBouquet()->size()) {
for (b++; b < Owner->Bouquets.size(); b++) for (b++; b < Owner->Bouquets.size(); b++)
if (getBouquet()->size() != 0) { if ( !getBouquet()->empty() ) {
c = 0; c = 0;
goto end; goto end;
} }