From 7d8d99504619922df7c1ebb039c95dbed977a4b0 Mon Sep 17 00:00:00 2001 From: satbaby Date: Mon, 18 Jun 2012 16:57:44 +0200 Subject: [PATCH] use empty() instead of size() --- lib/libupnpclient/UPNPDevice.cpp | 8 ++++---- lib/timerdclient/timerdclient.cpp | 2 +- src/driver/record.cpp | 2 +- src/eitd/sectionsd.cpp | 2 +- src/gui/moviebrowser.cpp | 6 +++--- src/gui/scan.cpp | 2 +- src/gui/scan_setup.cpp | 6 +++--- src/gui/upnpbrowser.cpp | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/libupnpclient/UPNPDevice.cpp b/lib/libupnpclient/UPNPDevice.cpp index 568f2c8d7..67eb72cbb 100644 --- a/lib/libupnpclient/UPNPDevice.cpp +++ b/lib/libupnpclient/UPNPDevice.cpp @@ -387,7 +387,7 @@ std::string CUPnPDevice::HTTP(std::string url, std::string post, std::string act } path = url.substr(pos2); - if (post.size()) + if (!post.empty()) command << "POST " << path << " HTTP/1.0\r\n"; else command << "GET " << path << " HTTP/1.0\r\n"; @@ -397,18 +397,18 @@ std::string CUPnPDevice::HTTP(std::string url, std::string post, std::string act command << "Accept: text/xml\r\n"; command << "Connection: Close\r\n"; - if (post.size()) + if (!post.empty()) { command << "Content-Length: " << post.size() << "\r\n"; command << "Content-Type: text/xml\r\n"; } - if (action.size()) + if (!action.empty()) command << "SOAPAction: \"" << action << "\"\r\n"; command << "\r\n"; - if (post.size()) + if (!post.empty()) command << post; t_socket = socket(PF_INET, SOCK_STREAM, 0); diff --git a/lib/timerdclient/timerdclient.cpp b/lib/timerdclient/timerdclient.cpp index 28a3861ae..0926748a9 100644 --- a/lib/timerdclient/timerdclient.cpp +++ b/lib/timerdclient/timerdclient.cpp @@ -247,7 +247,7 @@ int CTimerdClient::addTimerEvent( CTimerd::CTimerEventTypes evType, void* data, //printf("[CTimerdClient] checking for overlapping timers\n"); CTimerd::TimerList overlappingTimer; overlappingTimer = getOverlappingTimers(alarmtime, stoptime); - if (overlappingTimer.size() > 0) + if (!overlappingTimer.empty()) { // timerd starts eventID at 0 so we can return -1 return -1; diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 0580b687e..e6c4d0071 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -1473,7 +1473,7 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mo if(SAME_TRANSPONDER(live_channel_id, channel_id)) { printf("%s zapTo_record channel_id %llx\n", __FUNCTION__, channel_id); ret = g_Zapit->zapTo_record(channel_id) > 0; - } else if(recmap.size()) { + } else if(!recmap.empty()) { ret = false; } else { if (mode != last_mode && (last_mode != NeutrinoMessages::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) { diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 2759b8e82..70c8a19eb 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -215,7 +215,7 @@ static bool deleteEvent(const event_id_t uniqueKey) MySIeventsOrderUniqueKey::iterator e = mySIeventsOrderUniqueKey.find(uniqueKey); if (e != mySIeventsOrderUniqueKey.end()) { - if (e->second->times.size()) { + if (!e->second->times.empty()) { mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.erase(e->second); mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.erase(e->second); } diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 5b4f8e2d1..dff2e4448 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -2086,8 +2086,8 @@ void CMovieBrowser::onDeleteFile(MI_MOVIE_INFO& movieSelectionHandler) m_vMovieInfo.erase( (std::vector::iterator)&movieSelectionHandler); TRACE("List size: %d\n", m_vMovieInfo.size()); - //if(m_vMovieInfo.size() == 0) fileInfoStale(); - //if(m_vMovieInfo.size() == 0) onSetGUIWindow(m_settings.gui); + //if(m_vMovieInfo.empty()) fileInfoStale(); + //if(m_vMovieInfo.empty()) onSetGUIWindow(m_settings.gui); updateSerienames(); refreshBrowserList(); refreshLastPlayList(); @@ -2399,7 +2399,7 @@ void CMovieBrowser::loadAllTsFileNamesFromStorage(void) TRACE("[mb] Dir%d, Files:%d \r\n",m_dirNames.size(),m_vMovieInfo.size()); /* - if(m_vMovieInfo.size() == 0) + if(m_vMovieInfo.empty()) { std::string msg = g_Locale->getText(LOCALE_MOVIEBROWSER_ERROR_NO_MOVIES); DisplayErrorMessage(msg.c_str()); diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index d53b7111f..f3255966b 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -253,7 +253,7 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) g_Zapit->setScanBouquetMode( (CZapitClient::bouquetMode)scansettings.bouquetMode); /* send satellite list to zapit */ - if(satList.size()) + if(!satList.empty()) g_Zapit->setScanSatelliteList( satList); tuned = -1; diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 7b7df4e27..a908d182d 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -618,7 +618,7 @@ void CScanSetup::fillSatSelect() if(CFEManager::getInstance()->getMode() != CFEManager::FE_MODE_ALONE) break; } - if(!sfound && satpos.size()) { + if(!sfound && !satpos.empty()) { tmpit = satpos.begin(); std::string satname = CServiceManager::getInstance()->GetSatelliteName(*tmpit); snprintf(scansettings.satNameNoDiseqc, sizeof(scansettings.satNameNoDiseqc), "%s", satname.c_str()); @@ -649,7 +649,7 @@ void CScanSetup::fillCableSelect() dprintf(DEBUG_DEBUG, "got scanprovider (cable): %s\n", sit->second.name.c_str()); } - if (!sfound && satmap.size()) { + if (!sfound && !satmap.empty()) { sat_iterator_t sit = satmap.begin(); snprintf(scansettings.satNameNoDiseqc, sizeof(scansettings.satNameNoDiseqc), "%s", sit->second.name.c_str()); } @@ -678,7 +678,7 @@ int CScanSetup::showScanMenuSatFind() feSatSelect->addOption(satname.c_str()); if (!sfound && strcmp(scansettings.satNameNoDiseqc, satname.c_str()) == 0) sfound = true; - if (!sfound && !firstname.size()) + if (!sfound && firstname.empty()) firstname = satname; count++; } diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 503562a90..d0bf82fb5 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -390,7 +390,7 @@ void CUpnpBrowserGui::selectDevice() m_devices = m_socket->Discover("urn:schemas-upnp-org:service:ContentDirectory:1"); scanBox->hide(); - if (!m_devices.size()) + if (m_devices.empty()) { ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_UPNPBROWSER_NOSERVERS, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); delete scanBox; @@ -457,7 +457,7 @@ void CUpnpBrowserGui::selectDevice() #endif m_devices = m_socket->Discover("urn:schemas-upnp-org:service:ContentDirectory:1"); scanBox->hide(); - if (!m_devices.size()) + if (m_devices.empty()) { ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_UPNPBROWSER_NOSERVERS, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); delete scanBox;