Skip to content

Commit

Permalink
Don't include all of the standard namespace. (libmythupnp)
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 b231fd9 commit b62f520
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 13 deletions.
3 changes: 1 addition & 2 deletions mythtv/libs/libmythupnp/bufferedsocketdevice.h
Expand Up @@ -15,7 +15,6 @@

// C++ headers
#include <deque>
using namespace std;

// Qt headers
#include <QString>
Expand Down Expand Up @@ -51,7 +50,7 @@ class BufferedSocketDevice
quint16 m_nDestPort {0};

MMembuf m_bufRead;
deque<QByteArray*> m_bufWrite;
std::deque<QByteArray*> m_bufWrite;

int ReadBytes ( );
bool ConsumeWriteBuf( qulonglong nbytes );
Expand Down
4 changes: 1 addition & 3 deletions mythtv/libs/libmythupnp/httprequest.cpp
Expand Up @@ -59,8 +59,6 @@
#define O_LARGEFILE 0
#endif

using namespace std;

static std::array<const MIMETypes,63> g_MIMETypes
{{
// Image Mime Types
Expand Down Expand Up @@ -403,7 +401,7 @@ qint64 HTTPRequest::SendResponse( void )
// ----------------------------------------------------------------------
// DEBUGGING
if (getenv("HTTPREQUEST_DEBUG"))
cout << m_response.buffer().constData() << endl;
std::cout << m_response.buffer().constData() << std::endl;
// ----------------------------------------------------------------------

LOG(VB_HTTP, LOG_DEBUG, QString("Reponse Content Length: %1").arg(nContentLen));
Expand Down
5 changes: 1 addition & 4 deletions mythtv/libs/libmythupnp/httpserver.cpp
Expand Up @@ -43,9 +43,6 @@

#include "serviceHosts/rttiServiceHost.h"

using namespace std;


/**
* \brief Handle an OPTIONS request
*/
Expand Down Expand Up @@ -119,7 +116,7 @@ HttpServer::HttpServer() :
m_privateToken(QUuid::createUuid().toString()) // Cryptographically random and sufficiently long enough to act as a secure token
{
// Number of connections processed concurrently
int maxHttpWorkers = max(QThread::idealThreadCount() * 2, 2); // idealThreadCount can return -1
int maxHttpWorkers = std::max(QThread::idealThreadCount() * 2, 2); // idealThreadCount can return -1
// Don't allow more connections than we can process, it causes browsers
// to open lots of new connections instead of reusing existing ones
setMaxPendingConnections(maxHttpWorkers);
Expand Down
4 changes: 1 addition & 3 deletions mythtv/libs/libmythupnp/ssdp.cpp
Expand Up @@ -33,8 +33,6 @@
#include <sys/select.h>
#endif

using namespace std;

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -267,7 +265,7 @@ void SSDP::run()
if (socket != nullptr && socket->socket() >= 0)
{
FD_SET( socket->socket(), &read_set );
nMaxSocket = max( socket->socket(), nMaxSocket );
nMaxSocket = std::max( socket->socket(), nMaxSocket );

#if 0
if (socket->bytesAvailable() > 0)
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythupnp/upnpcds.cpp
Expand Up @@ -13,7 +13,6 @@
#include <algorithm>
#include <cmath>
#include <cstdint>
using namespace std;

#include "upnp.h"
#include "upnpcds.h"
Expand Down

0 comments on commit b62f520

Please sign in to comment.