From 93dae11e51f65311ccba76cc4e4326efb80270b0 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Sat, 16 Feb 2013 17:18:00 +0000 Subject: [PATCH] Generally empty()/isEmpty() is more efficient than using size() --- mythplugins/mythnetvision/mythnetvision/nettree.cpp | 2 +- mythtv/libs/libmyth/mythrssmanager.cpp | 2 +- mythtv/libs/libmythtv/cardutil.cpp | 2 +- mythtv/libs/libmythtv/eithelper.cpp | 2 +- mythtv/libs/libmythtv/eitscanner.cpp | 2 +- mythtv/libs/libmythtv/osd.cpp | 2 +- mythtv/libs/libmythtv/programdata.cpp | 4 ++-- mythtv/libs/libmythtv/recorders/channelbase.cpp | 2 +- mythtv/libs/libmythtv/util-xv.cpp | 2 +- mythtv/libs/libmythtv/videoout_vdpau.cpp | 2 +- mythtv/libs/libmythui/mythuieditbar.cpp | 2 +- mythtv/programs/mythfrontend/guidegrid.cpp | 2 +- mythtv/programs/mythfrontend/scheduleeditor.cpp | 2 +- mythtv/programs/mythfrontend/videolist.cpp | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/mythplugins/mythnetvision/mythnetvision/nettree.cpp b/mythplugins/mythnetvision/mythnetvision/nettree.cpp index 51ee796a51f..2a0164937b2 100644 --- a/mythplugins/mythnetvision/mythnetvision/nettree.cpp +++ b/mythplugins/mythnetvision/mythnetvision/nettree.cpp @@ -1199,7 +1199,7 @@ void NetTree::TreeRefresh() void NetTree::updateRSS() { - if (!findAllDBRSS().count()) + if (findAllDBRSS().isEmpty()) return; QString title(tr("Updating RSS. This could take a while...")); diff --git a/mythtv/libs/libmyth/mythrssmanager.cpp b/mythtv/libs/libmyth/mythrssmanager.cpp index 17a4771b415..1202903304b 100644 --- a/mythtv/libs/libmyth/mythrssmanager.cpp +++ b/mythtv/libs/libmyth/mythrssmanager.cpp @@ -95,7 +95,7 @@ void RSSManager::processAndInsertRSS(RSSSite *site) m_inprogress.removeOne(site); } - if (!m_inprogress.count()) + if (m_inprogress.isEmpty()) emit finished(); } diff --git a/mythtv/libs/libmythtv/cardutil.cpp b/mythtv/libs/libmythtv/cardutil.cpp index 53619c9ab0c..0e37293e4e7 100644 --- a/mythtv/libs/libmythtv/cardutil.cpp +++ b/mythtv/libs/libmythtv/cardutil.cpp @@ -1859,7 +1859,7 @@ InputNames CardUtil::ProbeV4LVideoInputs(int videofd, bool &ok) #endif // USING_V4L1 // Create an input on single input cards that don't advertise input - if (!list.size()) + if (list.isEmpty()) list[0] = "Television"; ok = true; diff --git a/mythtv/libs/libmythtv/eithelper.cpp b/mythtv/libs/libmythtv/eithelper.cpp index 5c3f170947e..e12f25c0209 100644 --- a/mythtv/libs/libmythtv/eithelper.cpp +++ b/mythtv/libs/libmythtv/eithelper.cpp @@ -71,7 +71,7 @@ uint EITHelper::ProcessEvents(void) QMutexLocker locker(&eitList_lock); uint insertCount = 0; - if (!db_events.size()) + if (db_events.empty()) return 0; MSqlQuery query(MSqlQuery::InitCon()); diff --git a/mythtv/libs/libmythtv/eitscanner.cpp b/mythtv/libs/libmythtv/eitscanner.cpp index 86f1f731434..553a443724b 100644 --- a/mythtv/libs/libmythtv/eitscanner.cpp +++ b/mythtv/libs/libmythtv/eitscanner.cpp @@ -228,7 +228,7 @@ void EITScanner::StartActiveScan(TVRec *_rec, uint max_seconds_per_source) { rec = _rec; - if (!activeScanChannels.size()) + if (activeScanChannels.isEmpty()) { // TODO get input name and use it in crawl. MSqlQuery query(MSqlQuery::InitCon()); diff --git a/mythtv/libs/libmythtv/osd.cpp b/mythtv/libs/libmythtv/osd.cpp index 5703ed38908..1b30ad44a80 100644 --- a/mythtv/libs/libmythtv/osd.cpp +++ b/mythtv/libs/libmythtv/osd.cpp @@ -182,7 +182,7 @@ bool OSD::Init(const QRect &rect, float font_aspect) LoadWindows(); RevertUIScale(); - if (!m_Children.size()) + if (m_Children.isEmpty()) { LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to load any windows."); return false; diff --git a/mythtv/libs/libmythtv/programdata.cpp b/mythtv/libs/libmythtv/programdata.cpp index 06e822f5eda..329368fea3a 100644 --- a/mythtv/libs/libmythtv/programdata.cpp +++ b/mythtv/libs/libmythtv/programdata.cpp @@ -356,11 +356,11 @@ static int score_match(const QString &a, const QString &b) QStringList al, bl; al = A.split(" ", QString::SkipEmptyParts); - if (!al.size()) + if (al.isEmpty()) return 0; bl = B.split(" ", QString::SkipEmptyParts); - if (!bl.size()) + if (bl.isEmpty()) return 0; // score words symmetrically diff --git a/mythtv/libs/libmythtv/recorders/channelbase.cpp b/mythtv/libs/libmythtv/recorders/channelbase.cpp index 88a89a755ce..35544fc0ffd 100644 --- a/mythtv/libs/libmythtv/recorders/channelbase.cpp +++ b/mythtv/libs/libmythtv/recorders/channelbase.cpp @@ -267,7 +267,7 @@ uint ChannelBase::GetNextChannel(const QString &channum, int direction) const int ChannelBase::GetNextInputNum(void) const { // Exit early if inputs don't exist.. - if (!m_inputs.size()) + if (m_inputs.isEmpty()) return -1; // Find current input diff --git a/mythtv/libs/libmythtv/util-xv.cpp b/mythtv/libs/libmythtv/util-xv.cpp index fe77a14ec23..c1b73ca8f57 100644 --- a/mythtv/libs/libmythtv/util-xv.cpp +++ b/mythtv/libs/libmythtv/util-xv.cpp @@ -117,7 +117,7 @@ void del_open_xv_port(int port) { open_xv_ports.remove(port); - if (!open_xv_ports.count()) + if (open_xv_ports.isEmpty()) { SignalHandler::SetHandler(SIGINT, NULL); SignalHandler::SetHandler(SIGTERM, NULL); diff --git a/mythtv/libs/libmythtv/videoout_vdpau.cpp b/mythtv/libs/libmythtv/videoout_vdpau.cpp index 4bc5b6b6912..1d94dc2109b 100644 --- a/mythtv/libs/libmythtv/videoout_vdpau.cpp +++ b/mythtv/libs/libmythtv/videoout_vdpau.cpp @@ -268,7 +268,7 @@ bool VideoOutputVDPAU::CreateVideoSurfaces(uint num) void VideoOutputVDPAU::DeleteVideoSurfaces(void) { - if (!m_render || !m_video_surfaces.size()) + if (!m_render || m_video_surfaces.isEmpty()) return; for (int i = 0; i < m_video_surfaces.size(); i++) diff --git a/mythtv/libs/libmythui/mythuieditbar.cpp b/mythtv/libs/libmythui/mythuieditbar.cpp index b4ad7b277bc..2e18e7905ae 100644 --- a/mythtv/libs/libmythui/mythuieditbar.cpp +++ b/mythtv/libs/libmythui/mythuieditbar.cpp @@ -119,7 +119,7 @@ void MythUIEditBar::Display(void) ClearImages(); - if (!m_regions.size()) + if (m_regions.isEmpty()) { if (keep) keep->SetVisible(true); diff --git a/mythtv/programs/mythfrontend/guidegrid.cpp b/mythtv/programs/mythfrontend/guidegrid.cpp index 5a0aa447408..082e387e1fe 100644 --- a/mythtv/programs/mythfrontend/guidegrid.cpp +++ b/mythtv/programs/mythfrontend/guidegrid.cpp @@ -174,7 +174,7 @@ void GuideGrid::RunProgramGuide(uint chanid, const QString &channum, // check there are some channels setup ChannelInfoList channels = ChannelUtil::GetChannels( 0, true, "", (changrpid<0) ? 0 : changrpid); - if (!channels.size()) + if (channels.empty()) { QString message; if (changrpid == -1) diff --git a/mythtv/programs/mythfrontend/scheduleeditor.cpp b/mythtv/programs/mythfrontend/scheduleeditor.cpp index a9849be8736..d44b58fcf58 100644 --- a/mythtv/programs/mythfrontend/scheduleeditor.cpp +++ b/mythtv/programs/mythfrontend/scheduleeditor.cpp @@ -1714,7 +1714,7 @@ void MetadataOptions::HandleDownloadedImages(MetadataLookup *lookup) DownloadMap map = lookup->GetDownloads(); - if (!map.size()) + if (map.isEmpty()) return; for (DownloadMap::const_iterator i = map.begin(); i != map.end(); ++i) diff --git a/mythtv/programs/mythfrontend/videolist.cpp b/mythtv/programs/mythfrontend/videolist.cpp index 3c96397185c..4e46fd54ae6 100644 --- a/mythtv/programs/mythfrontend/videolist.cpp +++ b/mythtv/programs/mythfrontend/videolist.cpp @@ -1013,7 +1013,7 @@ void VideoListImp::buildDbList() QStringList dirs = GetVideoDirs(); - if (!dirs.size()) + if (dirs.isEmpty()) return; QString test_prefix(dirs[0]);