Skip to content

Commit

Permalink
Don't include all of the standard namespace. (libmythtv)
Browse files Browse the repository at this point in the history
Including all of the standard namespace is considered bad practice. It
defeats the purpose of namespaces, and pollutes the global name table.
  • Loading branch information
linuxdude42 committed Oct 2, 2020
1 parent 91b3102 commit fa37950
Show file tree
Hide file tree
Showing 70 changed files with 315 additions and 365 deletions.
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/DVD/mythdvddecoder.cpp
Expand Up @@ -433,8 +433,8 @@ void MythDVDDecoder::PostProcessTracks(void)

if (!m_tracks[kTrackTypeSubtitle].empty())
{
map<int,uint> lang_sub_cnt;
map<int,int> stream2idx;
std::map<int,uint> lang_sub_cnt;
std::map<int,int> stream2idx;

// First, create a map containing stream id -> track index
// of the subtitle streams that have been found so far.
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/DetectLetterbox.cpp
Expand Up @@ -13,7 +13,7 @@ DetectLetterbox::DetectLetterbox(MythPlayer* const Player)
int dbAdjustFill = gCoreContext->GetNumSetting("AdjustFill", 0);
m_isDetectLetterbox = dbAdjustFill >= kAdjustFill_AutoDetect_DefaultOff;
m_detectLetterboxDefaultMode =
static_cast<AdjustFillMode>(max(static_cast<int>(kAdjustFill_Off),
static_cast<AdjustFillMode>(std::max(static_cast<int>(kAdjustFill_Off),
dbAdjustFill - kAdjustFill_AutoDetect_DefaultOff));
m_detectLetterboxDetectedMode = Player->GetAdjustFill();
m_detectLetterboxLimit = gCoreContext->GetNumSetting("DetectLeterboxLimit", 75);
Expand Down Expand Up @@ -249,7 +249,7 @@ void DetectLetterbox::Detect(VideoFrame *Frame)
if (m_detectLetterboxDetectedMode != m_detectLetterboxDefaultMode)
{
LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Non Letterbox detected on line: %1 (limit: %2)")
.arg(min(maxTop, maxBottom)).arg(halfLimit));
.arg(std::min(maxTop, maxBottom)).arg(halfLimit));
m_detectLetterboxLock.lock();
m_detectLetterboxConsecutiveCounter = 0;
m_detectLetterboxDetectedMode = m_detectLetterboxDefaultMode;
Expand Down
48 changes: 24 additions & 24 deletions mythtv/libs/libmythtv/cardutil.cpp
Expand Up @@ -1272,12 +1272,12 @@ bool set_on_input(const QString &to_set, uint inputid, const QString &value)
* \param hostname Host on which device resides, only
* required if said host is not the localhost
*/
vector<uint> CardUtil::GetInputIDs(const QString& videodevice,
std::vector<uint> CardUtil::GetInputIDs(const QString& videodevice,
const QString& rawtype,
const QString& inputname,
QString hostname)
{
vector<uint> list;
std::vector<uint> list;

if (hostname.isEmpty())
hostname = gCoreContext->GetHostName();
Expand Down Expand Up @@ -1340,9 +1340,9 @@ uint CardUtil::GetChildInputCount(uint inputid)
return count;
}

vector<uint> CardUtil::GetChildInputIDs(uint inputid)
std::vector<uint> CardUtil::GetChildInputIDs(uint inputid)
{
vector<uint> list;
std::vector<uint> list;

if (!inputid)
return list;
Expand Down Expand Up @@ -1502,8 +1502,8 @@ static uint clone_capturecard(uint src_inputid, uint orig_dst_inputid)
}

// copy input group linkages
vector<uint> src_grps = CardUtil::GetInputGroups(src_inputid);
vector<uint> dst_grps = CardUtil::GetInputGroups(dst_inputid);
std::vector<uint> src_grps = CardUtil::GetInputGroups(src_inputid);
std::vector<uint> dst_grps = CardUtil::GetInputGroups(dst_inputid);
for (uint dst_grp : dst_grps)
CardUtil::UnlinkInputGroup(dst_inputid, dst_grp);
for (uint src_grp : src_grps)
Expand Down Expand Up @@ -1589,7 +1589,7 @@ QString CardUtil::GetFirewireChangerModel(uint inputid)
return fwnode;
}

vector<uint> CardUtil::GetInputIDs(uint sourceid)
std::vector<uint> CardUtil::GetInputIDs(uint sourceid)
{
MSqlQuery query(MSqlQuery::InitCon());

Expand All @@ -1599,7 +1599,7 @@ vector<uint> CardUtil::GetInputIDs(uint sourceid)
"WHERE sourceid = :SOURCEID");
query.bindValue(":SOURCEID", sourceid);

vector<uint> list;
std::vector<uint> list;

if (!query.exec())
{
Expand Down Expand Up @@ -1631,7 +1631,7 @@ bool CardUtil::SetStartChannel(uint inputid, const QString &channum)
return true;
}

bool CardUtil::GetInputInfo(InputInfo &input, vector<uint> *groupids)
bool CardUtil::GetInputInfo(InputInfo &input, std::vector<uint> *groupids)
{
if (!input.m_inputId)
return false;
Expand Down Expand Up @@ -1999,9 +1999,9 @@ bool CardUtil::UnlinkInputGroup(uint inputid, uint inputgroupid)
return true;
}

vector<uint> CardUtil::GetInputGroups(uint inputid)
std::vector<uint> CardUtil::GetInputGroups(uint inputid)
{
vector<uint> list;
std::vector<uint> list;

MSqlQuery query(MSqlQuery::InitCon());

Expand All @@ -2025,9 +2025,9 @@ vector<uint> CardUtil::GetInputGroups(uint inputid)
return list;
}

vector<uint> CardUtil::GetGroupInputIDs(uint inputgroupid)
std::vector<uint> CardUtil::GetGroupInputIDs(uint inputgroupid)
{
vector<uint> list;
std::vector<uint> list;

MSqlQuery query(MSqlQuery::InitCon());

Expand All @@ -2052,12 +2052,12 @@ vector<uint> CardUtil::GetGroupInputIDs(uint inputgroupid)
return list;
}

vector<uint> CardUtil::GetConflictingInputs(uint inputid)
std::vector<uint> CardUtil::GetConflictingInputs(uint inputid)
{
LOG(VB_RECORD, LOG_INFO,
QString("CardUtil[%1]: GetConflictingInputs() input %1").arg(inputid));

vector<uint> inputids;
std::vector<uint> inputids;

MSqlQuery query(MSqlQuery::InitCon());

Expand Down Expand Up @@ -2107,8 +2107,8 @@ bool CardUtil::GetTimeouts(uint inputid,
MythDB::DBError("CardUtil::GetTimeouts()", query);
else if (query.next())
{
signal_timeout = (uint) max(query.value(0).toInt(), 250);
channel_timeout = (uint) max(query.value(1).toInt(), 500);
signal_timeout = (uint) std::max(query.value(0).toInt(), 250);
channel_timeout = (uint) std::max(query.value(1).toInt(), 500);
return true;
}

Expand Down Expand Up @@ -2563,7 +2563,7 @@ int CardUtil::CreateCaptureCard(const QString &videodevice,

bool CardUtil::DeleteInput(uint inputid)
{
vector<uint> childids = GetChildInputIDs(inputid);
std::vector<uint> childids = GetChildInputIDs(inputid);
for (uint childid : childids)
{
if (!DeleteInput(childid))
Expand Down Expand Up @@ -2641,9 +2641,9 @@ bool CardUtil::DeleteAllInputs(void)
query.exec("TRUNCATE TABLE iptv_channel"));
}

vector<uint> CardUtil::GetInputList(void)
std::vector<uint> CardUtil::GetInputList(void)
{
vector<uint> list;
std::vector<uint> list;

MSqlQuery query(MSqlQuery::InitCon());
query.prepare(
Expand All @@ -2662,9 +2662,9 @@ vector<uint> CardUtil::GetInputList(void)
return list;
}

vector<uint> CardUtil::GetSchedInputList(void)
std::vector<uint> CardUtil::GetSchedInputList(void)
{
vector<uint> list;
std::vector<uint> list;

MSqlQuery query(MSqlQuery::InitCon());
query.prepare(
Expand All @@ -2684,9 +2684,9 @@ vector<uint> CardUtil::GetSchedInputList(void)
return list;
}

vector<uint> CardUtil::GetLiveTVInputList(void)
std::vector<uint> CardUtil::GetLiveTVInputList(void)
{
vector<uint> list;
std::vector<uint> list;

MSqlQuery query(MSqlQuery::InitCon());
query.prepare(
Expand Down
23 changes: 11 additions & 12 deletions mythtv/libs/libmythtv/cardutil.h
Expand Up @@ -5,7 +5,6 @@
// C++ headers
#include <cstdint>
#include <vector>
using namespace std;

// Qt headers
#include <QList>
Expand Down Expand Up @@ -250,26 +249,26 @@ class MTV_PUBLIC CardUtil

static bool DeleteInput(uint inputid);
static bool DeleteAllInputs(void);
static vector<uint> GetInputList(void);
static vector<uint> GetSchedInputList(void);
static vector<uint> GetLiveTVInputList(void);
static std::vector<uint> GetInputList(void);
static std::vector<uint> GetSchedInputList(void);
static std::vector<uint> GetLiveTVInputList(void);

/// Convenience function for GetInputIDs()
static uint GetFirstInputID(const QString &videodevice)
{
vector<uint> list = GetInputIDs(videodevice);
std::vector<uint> list = GetInputIDs(videodevice);
if (list.empty())
return 0;
return list[0];
}

static vector<uint> GetInputIDs(const QString& videodevice = QString(),
static std::vector<uint> GetInputIDs(const QString& videodevice = QString(),
const QString& rawtype = QString(),
const QString& inputname = QString(),
QString hostname = QString());

static uint GetChildInputCount(uint inputid);
static vector<uint> GetChildInputIDs(uint inputid);
static std::vector<uint> GetChildInputIDs(uint inputid);

static bool IsInputTypePresent(const QString &rawtype,
QString hostname = QString());
Expand Down Expand Up @@ -324,9 +323,9 @@ class MTV_PUBLIC CardUtil

// Other input functions

static vector<uint> GetInputIDs(uint sourceid);
static std::vector<uint> GetInputIDs(uint sourceid);
static bool GetInputInfo(InputInfo &input,
vector<uint> *groupids = nullptr);
std::vector<uint> *groupids = nullptr);
static QList<InputInfo> GetAllInputInfo();
static QString GetInputName(uint inputid);
static QString GetStartingChannel(uint inputid);
Expand All @@ -344,9 +343,9 @@ class MTV_PUBLIC CardUtil
static uint GetDeviceInputGroup(uint inputid);
static bool LinkInputGroup(uint inputid, uint inputgroupid);
static bool UnlinkInputGroup(uint inputid, uint inputgroupid);
static vector<uint> GetInputGroups(uint inputid);
static vector<uint> GetGroupInputIDs(uint inputgroupid);
static vector<uint> GetConflictingInputs(uint inputid);
static std::vector<uint> GetInputGroups(uint inputid);
static std::vector<uint> GetGroupInputIDs(uint inputgroupid);
static std::vector<uint> GetConflictingInputs(uint inputid);

static QString GetDeviceLabel(const QString &inputtype,
const QString &videodevice);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/channelgroup.cpp
Expand Up @@ -213,7 +213,7 @@ int ChannelGroup::GetNextChannelGroup(const ChannelGroupList &sorted, int grpid)
if (grpid == -1)
return sorted[0].m_grpId;

auto it = find(sorted.cbegin(), sorted.cend(), grpid);
auto it = std::find(sorted.cbegin(), sorted.cend(), grpid);

// If grpid is not in the list, return -1 for all channels
if (it == sorted.end())
Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libmythtv/channelgroup.h
Expand Up @@ -4,7 +4,6 @@
// c/c++
#include <utility>
#include <vector>
using namespace std;

// qt
#include <QString>
Expand All @@ -29,7 +28,7 @@ class MTV_PUBLIC ChannelGroupItem
uint m_grpId;
QString m_name;
};
using ChannelGroupList = vector<ChannelGroupItem>;
using ChannelGroupList = std::vector<ChannelGroupItem>;

/** \class ChannelGroup
*/
Expand Down
6 changes: 2 additions & 4 deletions mythtv/libs/libmythtv/channelinfo.h
Expand Up @@ -6,8 +6,6 @@
#include <utility>
#include <vector>

using namespace std;

// Qt headers
#include <QString>
#include <QImage>
Expand Down Expand Up @@ -130,7 +128,7 @@ class MTV_PUBLIC ChannelInfo
QList<uint> m_groupIdList;
QList<uint> m_inputIdList;
};
using ChannelInfoList = vector<ChannelInfo>;
using ChannelInfoList = std::vector<ChannelInfo>;

class MTV_PUBLIC ChannelInsertInfo
{
Expand Down Expand Up @@ -258,7 +256,7 @@ class MTV_PUBLIC ChannelInsertInfo
uint m_oldTsId {0};
uint m_oldServiceId {0};
};
using ChannelInsertInfoList = vector<ChannelInsertInfo>;
using ChannelInsertInfoList = std::vector<ChannelInsertInfo>;

Q_DECLARE_METATYPE(ChannelInfo*)

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/channelsettings.cpp
Expand Up @@ -379,7 +379,7 @@ class CommMethod : public MythUIComboBoxSetting
"this channel or skips detection by marking the channel as "
"Commercial Free."));

deque<int> tmp = GetPreferredSkipTypeCombinations();
std::deque<int> tmp = GetPreferredSkipTypeCombinations();
tmp.push_front(COMM_DETECT_UNINIT);
tmp.push_back(COMM_DETECT_COMMFREE);

Expand Down
17 changes: 8 additions & 9 deletions mythtv/libs/libmythtv/channelutil.cpp
Expand Up @@ -3,7 +3,6 @@
#include <algorithm>
#include <cstdint>
#include <set>
using namespace std;

#include <QFile>
#include <QHash>
Expand Down Expand Up @@ -274,7 +273,7 @@ static uint insert_dtv_multiplex(
return mplex;
}

static void handle_transport_desc(vector<uint> &muxes,
static void handle_transport_desc(std::vector<uint> &muxes,
const MPEGDescriptor &desc,
uint sourceid, uint tsid, uint netid)
{
Expand Down Expand Up @@ -433,10 +432,10 @@ uint ChannelUtil::CreateMultiplex(uint sourceid, const DTVMultiplex &mux,
/** \fn ChannelUtil::CreateMultiplexes(int, const NetworkInformationTable*)
*
*/
vector<uint> ChannelUtil::CreateMultiplexes(
std::vector<uint> ChannelUtil::CreateMultiplexes(
int sourceid, const NetworkInformationTable *nit)
{
vector<uint> muxes;
std::vector<uint> muxes;

if (sourceid <= 0)
return muxes;
Expand Down Expand Up @@ -1099,10 +1098,10 @@ QStringList ChannelUtil::GetValidRecorderList(
}


vector<uint> ChannelUtil::GetConflicting(const QString &channum, uint sourceid)
std::vector<uint> ChannelUtil::GetConflicting(const QString &channum, uint sourceid)
{
MSqlQuery query(MSqlQuery::InitCon());
vector<uint> conflicting;
std::vector<uint> conflicting;

if (sourceid)
{
Expand Down Expand Up @@ -1464,7 +1463,7 @@ int ChannelUtil::CreateChanID(uint sourceid, const QString &chan_num)
return chanid;

// try to at least base it on the sourceid for human readability
chanid = max(get_max_chanid(sourceid) + 1, sourceid * 10000);
chanid = std::max(get_max_chanid(sourceid) + 1, sourceid * 10000);

if (chanid_available(chanid))
return chanid;
Expand Down Expand Up @@ -2132,7 +2131,7 @@ ChannelInfoList ChannelUtil::GetChannelsInternal(
return list;
}

vector<uint> ChannelUtil::GetChanIDs(int sourceid, bool onlyVisible)
std::vector<uint> ChannelUtil::GetChanIDs(int sourceid, bool onlyVisible)
{
MSqlQuery query(MSqlQuery::InitCon());

Expand All @@ -2146,7 +2145,7 @@ vector<uint> ChannelUtil::GetChanIDs(int sourceid, bool onlyVisible)
select += "AND sourceid=" + QString::number(sourceid);
}

vector<uint> list;
std::vector<uint> list;
query.prepare(select);
if (!query.exec())
{
Expand Down

0 comments on commit fa37950

Please sign in to comment.