Skip to content

Commit

Permalink
Replace a few uses of getenv with qEnvironmentVariableIsSet
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-kendall committed Oct 7, 2020
1 parent d78f56e commit 7159fff
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
8 changes: 4 additions & 4 deletions mythtv/libs/libmythbase/mythcommandlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#endif

// Qt headers
#include <QtGlobal>
#include <QCoreApplication>
#include <QDateTime>
#include <QDir>
Expand Down Expand Up @@ -1161,11 +1162,10 @@ void CommandLineArg::PrintDeprecatedWarning(QString &keyword) const

/** \brief Default constructor for MythCommandLineArg class
*/
MythCommandLineParser::MythCommandLineParser(QString appname) :
m_appname(std::move(appname))
MythCommandLineParser::MythCommandLineParser(QString appname)
: m_appname(std::move(appname))
{
char *verbose = getenv("VERBOSE_PARSER");
if (verbose != nullptr)
if (qEnvironmentVariableIsSet("VERBOSE_PARSER"))
{
std::cerr << "MythCommandLineParser is now operating verbosely." << std::endl;
m_verbose = true;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythmetadata/metadatadownload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void MetadataDownload::run()

// Experimental:
// If nothing matches, always return the first found item
if (getenv("EXPERIMENTAL_METADATA_GRAB"))
if (qEnvironmentVariableIsSet("EXPERIMENTAL_METADATA_GRAB"))
{
MetadataLookup *newlookup = list.takeFirst();

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/Bluray/mythbdbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ MythBDBuffer::MythBDBuffer(const QString &Filename)
: MythOpticalBuffer(kMythBufferBD),
m_overlayPlanes(2, nullptr)
{
m_tryHDMVNavigation = nullptr != getenv("MYTHTV_HDMV");
m_tryHDMVNavigation = qEnvironmentVariableIsSet("MYTHTV_HDMV");
m_mainThread = QThread::currentThread();
MythBDBuffer::OpenFile(Filename);
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/decoders/avformatdecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ int AvFormatDecoder::OpenFile(MythMediaBuffer *Buffer, bool novideo,
.arg(framenum)));
}

if (getenv("FORCE_DTS_TIMESTAMPS"))
if (qEnvironmentVariableIsSet("FORCE_DTS_TIMESTAMPS"))
m_forceDtsTimestamps = true;

if (m_ringBuffer->IsDVD())
Expand Down
9 changes: 3 additions & 6 deletions mythtv/programs/mythfrontend/mediarenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,10 @@ MediaRenderer::MediaRenderer()
#endif

UPNPSubscription *subscription = nullptr;
if (getenv("MYTHTV_UPNPSCANNER"))
if (qEnvironmentVariableIsSet("MYTHTV_UPNPSCANNER"))
{
LOG(VB_UPNP, LOG_INFO,
"MediaRenderer: Registering UPnP Subscription Extension.");

subscription = new UPNPSubscription(
m_pHttpServer->GetSharePath(), nPort);
LOG(VB_UPNP, LOG_INFO, "MediaRenderer: Registering UPnP Subscription Extension.");
subscription = new UPNPSubscription(m_pHttpServer->GetSharePath(), nPort);
m_pHttpServer->RegisterExtension(subscription);
}

Expand Down

0 comments on commit 7159fff

Please sign in to comment.