diff options
author | Popkornium18 <mail@popkornium18.de> | 2020-07-02 00:52:34 +0300 |
---|---|---|
committer | Popkornium18 <mail@popkornium18.de> | 2020-07-02 01:55:36 +0300 |
commit | 410837526c940f5ad1c84d60960cdbcb40d97019 (patch) | |
tree | 7f5589b314126f3288817379eeeadd86bb499676 /src | |
parent | e62d5abb3164a7fac8d0930f720d71de504dd632 (diff) |
REFAC(server): replace NULL with nullptr
This changes all occurances of NULL in the murmur source
dir to nullptr. Additionally explicit comparisons with NULL were
removed.
Diffstat (limited to 'src')
-rw-r--r-- | src/murmur/BonjourServer.cpp | 4 | ||||
-rw-r--r-- | src/murmur/Cert.cpp | 12 | ||||
-rw-r--r-- | src/murmur/DBus.cpp | 12 | ||||
-rw-r--r-- | src/murmur/Messages.cpp | 14 | ||||
-rw-r--r-- | src/murmur/Meta.cpp | 12 | ||||
-rw-r--r-- | src/murmur/Meta.h | 2 | ||||
-rw-r--r-- | src/murmur/MurmurGRPCImpl.cpp | 6 | ||||
-rw-r--r-- | src/murmur/MurmurIce.cpp | 24 | ||||
-rw-r--r-- | src/murmur/PBKDF2.cpp | 4 | ||||
-rw-r--r-- | src/murmur/Server.cpp | 42 | ||||
-rw-r--r-- | src/murmur/Server.h | 16 | ||||
-rw-r--r-- | src/murmur/ServerDB.cpp | 8 | ||||
-rw-r--r-- | src/murmur/ServerUser.cpp | 2 | ||||
-rw-r--r-- | src/murmur/Tray.cpp | 6 | ||||
-rw-r--r-- | src/murmur/UnixMurmur.cpp | 12 | ||||
-rw-r--r-- | src/murmur/main.cpp | 28 |
16 files changed, 102 insertions, 102 deletions
diff --git a/src/murmur/BonjourServer.cpp b/src/murmur/BonjourServer.cpp index 97a53a186..de54465a4 100644 --- a/src/murmur/BonjourServer.cpp +++ b/src/murmur/BonjourServer.cpp @@ -8,13 +8,13 @@ #include "BonjourServiceRegister.h" BonjourServer::BonjourServer() { - bsrRegister = NULL; + bsrRegister = nullptr; #ifdef Q_OS_WIN static bool bDelayLoadFailed = false; if (bDelayLoadFailed) return; HMODULE hLib = LoadLibrary(L"DNSSD.DLL"); - if (hLib == NULL) { + if (!hLib) { bDelayLoadFailed = true; qWarning("Bonjour: Failed to load dnssd.dll"); return; diff --git a/src/murmur/Cert.cpp b/src/murmur/Cert.cpp index 17ceab5f6..52adf638c 100644 --- a/src/murmur/Cert.cpp +++ b/src/murmur/Cert.cpp @@ -28,20 +28,20 @@ bool Server::isKeyForCert(const QSslKey &key, const QSslCertificate &cert) { QByteArray qbaKey = key.toDer(); QByteArray qbaCert = cert.toDer(); - X509 *x509 = NULL; - EVP_PKEY *pkey = NULL; - BIO *mem = NULL; + X509 *x509 = nullptr; + EVP_PKEY *pkey = nullptr; + BIO *mem = nullptr; mem = BIO_new_mem_buf(qbaKey.data(), qbaKey.size()); Q_UNUSED(BIO_set_close(mem, BIO_NOCLOSE)); - pkey = d2i_PrivateKey_bio(mem, NULL); + pkey = d2i_PrivateKey_bio(mem, nullptr); BIO_free(mem); mem = BIO_new_mem_buf(qbaCert.data(), qbaCert.size()); Q_UNUSED(BIO_set_close(mem, BIO_NOCLOSE)); - x509 = d2i_X509_bio(mem, NULL); + x509 = d2i_X509_bio(mem, nullptr); BIO_free(mem); - mem = NULL; + mem = nullptr; if (x509 && pkey && X509_check_private_key(x509, pkey)) { EVP_PKEY_free(pkey); diff --git a/src/murmur/DBus.cpp b/src/murmur/DBus.cpp index fdd486ce3..db00c3d50 100644 --- a/src/murmur/DBus.cpp +++ b/src/murmur/DBus.cpp @@ -169,7 +169,7 @@ void MurmurDBus::registerTypes() { qDBusRegisterMetaType<QList<LogEntry> >(); } -QDBusConnection *MurmurDBus::qdbc = NULL; +QDBusConnection *MurmurDBus::qdbc = nullptr; MurmurDBus::MurmurDBus(Server *srv) : QDBusAbstractAdaptor(srv) { server = srv; @@ -299,7 +299,7 @@ void MurmurDBus::authenticateSlot(int &res, QString &uname, int sessionId, const } } if (ok && (msg.arguments().count() >= 3)) { - server->setTempGroups(uid, sessionId, NULL, msg.arguments().at(2).toStringList()); + server->setTempGroups(uid, sessionId, nullptr, msg.arguments().at(2).toStringList()); } if (ok) { server->log(QString("DBus Authenticate success for %1: %2").arg(uname).arg(uid)); @@ -380,13 +380,13 @@ void MurmurDBus::setPlayerState(const PlayerInfo &npi, const QDBusMessage &msg) void MurmurDBus::sendMessage(unsigned int session, const QString &text, const QDBusMessage &msg) { PLAYER_SETUP; - server->sendTextMessage(NULL, pUser, false, text); + server->sendTextMessage(nullptr, pUser, false, text); } void MurmurDBus::sendMessageChannel(int id, bool tree, const QString &text, const QDBusMessage &msg) { CHANNEL_SETUP_VAR(id); - server->sendTextMessage(cChannel, NULL, tree, text); + server->sendTextMessage(cChannel, nullptr, tree, text); } void MurmurDBus::addChannel(const QString &name, int chanparent, const QDBusMessage &msg, int &newid) { @@ -454,7 +454,7 @@ void MurmurDBus::getACL(int id, const QDBusMessage &msg, QList<ACLInfo> &acls, Q if ((p == cChannel) || (p->bInheritACL)) p = p->cParent; else - p =NULL; + p =nullptr; } inherit = cChannel->bInheritACL; @@ -476,7 +476,7 @@ void MurmurDBus::getACL(int id, const QDBusMessage &msg, QList<ACLInfo> &acls, Q QString name; foreach(name, allnames) { Group *g = cChannel->qhGroups.value(name); - Group *pg = p ? Group::getGroup(p, name) : NULL; + Group *pg = p ? Group::getGroup(p, name) : nullptr; if (!g && ! pg) continue; GroupInfo gi(g ? g : pg); diff --git a/src/murmur/Messages.cpp b/src/murmur/Messages.cpp index dfabd73eb..3a72bbb66 100644 --- a/src/murmur/Messages.cpp +++ b/src/murmur/Messages.cpp @@ -213,7 +213,7 @@ void Server::msgAuthenticate(ServerUser *uSource, MumbleProto::Authenticate &msg ok = true; } - ServerUser *uOld = NULL; + ServerUser *uOld = nullptr; foreach(ServerUser *u, qhUsers) { if (u == uSource) continue; @@ -320,7 +320,7 @@ void Server::msgAuthenticate(ServerUser *uSource, MumbleProto::Authenticate &msg sendMessage(uSource, mpcv); if (!bOpus && uSource->bOpus && fake_celt_support) { - sendTextMessage(NULL, uSource, false, QLatin1String("<strong>WARNING:</strong> Your client doesn't support the CELT codec, you won't be able to talk to or hear most clients. Please make sure your client was built with CELT support.")); + sendTextMessage(nullptr, uSource, false, QLatin1String("<strong>WARNING:</strong> Your client doesn't support the CELT codec, you won't be able to talk to or hear most clients. Please make sure your client was built with CELT support.")); } // Transmit channel tree @@ -1032,8 +1032,8 @@ void Server::msgUserRemove(ServerUser *uSource, MumbleProto::UserRemove &msg) { void Server::msgChannelState(ServerUser *uSource, MumbleProto::ChannelState &msg) { MSG_SETUP(ServerUser::Authenticated); - Channel *c = NULL; - Channel *p = NULL; + Channel *c = nullptr; + Channel *p = nullptr; // If this message relates to an existing channel check if the id is really valid if (msg.has_channel_id()) { @@ -1534,7 +1534,7 @@ void Server::msgACL(ServerUser *uSource, MumbleProto::ACL &msg) { if ((p==c) || p->bInheritACL) p = p->cParent; else - p = NULL; + p = nullptr; } while (! chans.isEmpty()) { @@ -1561,13 +1561,13 @@ void Server::msgACL(ServerUser *uSource, MumbleProto::ACL &msg) { QSet<QString> allnames=Group::groupNames(c); foreach(const QString &name, allnames) { Group *g = c->qhGroups.value(name); - Group *pg = p ? Group::getGroup(p, name) : NULL; + Group *pg = p ? Group::getGroup(p, name) : nullptr; MumbleProto::ACL_ChanGroup *group = msg.add_groups(); group->set_name(u8(name)); group->set_inherit(g ? g->bInherit : true); group->set_inheritable(g ? g->bInheritable : true); - group->set_inherited((pg != NULL) && pg->bInheritable); + group->set_inherited(pg && pg->bInheritable); if (g) { foreach(int id, g->qsAdd) { qsId.insert(id); diff --git a/src/murmur/Meta.cpp b/src/murmur/Meta.cpp index a408c516d..b36c7f1c2 100644 --- a/src/murmur/Meta.cpp +++ b/src/murmur/Meta.cpp @@ -43,7 +43,7 @@ MetaParams Meta::mp; #ifdef Q_OS_WIN -HANDLE Meta::hQoS = NULL; +HANDLE Meta::hQoS = nullptr; #endif MetaParams::MetaParams() { @@ -104,7 +104,7 @@ MetaParams::MetaParams() { bLogGroupChanges = false; bLogACLChanges = false; - qsSettings = NULL; + qsSettings = nullptr; } MetaParams::~MetaParams() { @@ -129,7 +129,7 @@ template <class T> T MetaParams::typeCheckedFromSettings(const QString &name, const T &defaultValue, QSettings *settings) { // Use qsSettings unless a specific QSettings instance // is requested. - if (settings == NULL) { + if (!settings) { settings = qsSettings; } @@ -648,10 +648,10 @@ Meta::Meta() { qvVer.MajorVersion = 1; qvVer.MinorVersion = 0; - hQoS = NULL; + hQoS = nullptr; HMODULE hLib = LoadLibrary(L"qWave.dll"); - if (hLib == NULL) { + if (!hLib) { qWarning("Meta: Failed to load qWave.dll, no QoS available"); } else { FreeLibrary(hLib); @@ -667,7 +667,7 @@ Meta::~Meta() { #ifdef Q_OS_WIN if (hQoS) { QOSCloseHandle(hQoS); - Connection::setQoS(NULL); + Connection::setQoS(nullptr); } #endif } diff --git a/src/murmur/Meta.h b/src/murmur/Meta.h index 9720180fb..6fd4c951d 100644 --- a/src/murmur/Meta.h +++ b/src/murmur/Meta.h @@ -162,7 +162,7 @@ public: private: template <class T> - T typeCheckedFromSettings(const QString &name, const T &variable, QSettings *settings = NULL); + T typeCheckedFromSettings(const QString &name, const T &variable, QSettings *settings = nullptr); }; class Meta : public QObject { diff --git a/src/murmur/MurmurGRPCImpl.cpp b/src/murmur/MurmurGRPCImpl.cpp index cb275062c..a555bccd1 100644 --- a/src/murmur/MurmurGRPCImpl.cpp +++ b/src/murmur/MurmurGRPCImpl.cpp @@ -531,7 +531,7 @@ void MurmurRPCImpl::authenticateSlot(int &res, QString &uname, int sessionId, co } } if (!qsl.isEmpty()) { - s->setTempGroups(res, sessionId, NULL, qsl); + s->setTempGroups(res, sessionId, nullptr, qsl); } } break; @@ -1856,7 +1856,7 @@ void V1_ACLGet::impl(bool) { if ((p == channel) || p->bInheritACL) { p = p->cParent; } else { - p = NULL; + p = nullptr; } } @@ -1877,7 +1877,7 @@ void V1_ACLGet::impl(bool) { const QSet<QString> allnames = ::Group::groupNames(channel); foreach(const QString &name, allnames) { ::Group *g = channel->qhGroups.value(name); - ::Group *pg = p ? ::Group::getGroup(p, name) : NULL; + ::Group *pg = p ? ::Group::getGroup(p, name) : nullptr; if (!g && ! pg) { continue; } diff --git a/src/murmur/MurmurIce.cpp b/src/murmur/MurmurIce.cpp index 9597f95b9..76211f06a 100644 --- a/src/murmur/MurmurIce.cpp +++ b/src/murmur/MurmurIce.cpp @@ -34,7 +34,7 @@ using namespace std; using namespace Murmur; -static MurmurIce *mi = NULL; +static MurmurIce *mi = nullptr; static Ice::ObjectPtr iopServer; static Ice::PropertiesPtr ippProperties; @@ -48,7 +48,7 @@ void IceStart() { void IceStop() { delete mi; - mi = NULL; + mi = nullptr; } /// Remove all NUL bytes from |s|. @@ -294,10 +294,10 @@ MurmurIce::~MurmurIce() { communicator->shutdown(); communicator->waitForShutdown(); communicator->destroy(); - communicator=NULL; + communicator=nullptr; qWarning("MurmurIce: Shutdown complete"); } - iopServer = NULL; + iopServer = nullptr; } void MurmurIce::customEvent(QEvent *evt) { @@ -707,7 +707,7 @@ void MurmurIce::authenticateSlot(int &res, QString &uname, int sessionId, const qsl << u8(str); } if (! qsl.isEmpty()) - server->setTempGroups(res, sessionId, NULL, qsl); + server->setTempGroups(res, sessionId, nullptr, qsl); } } @@ -866,7 +866,7 @@ void ServerI::ice_ping(const Ice::Current ¤t) const { #define ACCESS_Server_isRunning_READ static void impl_Server_isRunning(const ::Murmur::AMD_Server_isRunningPtr cb, int server_id) { NEED_SERVER_EXISTS; - cb->ice_response(server != NULL); + cb->ice_response(server != nullptr); } static void impl_Server_start(const ::Murmur::AMD_Server_startPtr cb, int server_id) { @@ -1139,7 +1139,7 @@ static void impl_Server_sendMessage(const ::Murmur::AMD_Server_sendMessagePtr cb NEED_SERVER; NEED_PLAYER; - server->sendTextMessage(NULL, user, false, u8(text)); + server->sendTextMessage(nullptr, user, false, u8(text)); cb->ice_response(); } @@ -1250,7 +1250,7 @@ static void impl_Server_sendMessageChannel(const ::Murmur::AMD_Server_sendMessag NEED_SERVER; NEED_CHANNEL; - server->sendTextMessage(channel, NULL, tree, u8(text)); + server->sendTextMessage(channel, nullptr, tree, u8(text)); cb->ice_response(); } @@ -1268,7 +1268,7 @@ static void impl_Server_setChannelState(const ::Murmur::AMD_Server_setChannelSta int channelid = state.id; NEED_SERVER; NEED_CHANNEL; - ::Channel *np = NULL; + ::Channel *np = nullptr; if (channel->iId != 0) { NEED_CHANNEL_VAR(np, state.parent); } @@ -1347,7 +1347,7 @@ static void impl_Server_getACL(const ::Murmur::AMD_Server_getACLPtr cb, int serv if ((p == channel) || (p->bInheritACL)) p = p->cParent; else - p = NULL; + p = nullptr; } bool inherit = channel->bInheritACL; @@ -1369,7 +1369,7 @@ static void impl_Server_getACL(const ::Murmur::AMD_Server_getACLPtr cb, int serv const QSet<QString> allnames = ::Group::groupNames(channel); foreach(const QString &name, allnames) { ::Group *g = channel->qhGroups.value(name); - ::Group *pg = p ? ::Group::getGroup(p, name) : NULL; + ::Group *pg = p ? ::Group::getGroup(p, name) : nullptr; if (!g && ! pg) continue; ::Murmur::Group mg; @@ -1789,7 +1789,7 @@ static void impl_Meta_getSliceChecksums(const ::Murmur::AMD_Meta_getSliceChecksu static void impl_Meta_getServer(const ::Murmur::AMD_Meta_getServerPtr cb, const Ice::ObjectAdapterPtr adapter, ::Ice::Int id) { QList<int> server_list = ServerDB::getAllServers(); if (! server_list.contains(id)) - cb->ice_response(NULL); + cb->ice_response(nullptr); else cb->ice_response(idToProxy(id, adapter)); } diff --git a/src/murmur/PBKDF2.cpp b/src/murmur/PBKDF2.cpp index 6a79f48d5..e7bc01619 100644 --- a/src/murmur/PBKDF2.cpp +++ b/src/murmur/PBKDF2.cpp @@ -98,7 +98,7 @@ QString PBKDF2::getHash(const QString &hexSalt, const QString &password, int ite iterationCount, EVP_sha384(), DERIVED_KEY_LENGTH, reinterpret_cast<unsigned char*>(hash.data())) == 0) { - qFatal("PBKDF2: PKCS5_PBKDF2_HMAC failed: %s", ERR_error_string(ERR_get_error(), NULL)); + qFatal("PBKDF2: PKCS5_PBKDF2_HMAC failed: %s", ERR_error_string(ERR_get_error(), nullptr)); return QString(); } @@ -110,7 +110,7 @@ QString PBKDF2::getSalt() { QByteArray salt(SALT_LENGTH, 0); if (RAND_bytes(reinterpret_cast<unsigned char*>(salt.data()), salt.size()) != 1) { - qFatal("PBKDF2: RAND_bytes for salt failed: %s", ERR_error_string(ERR_get_error(), NULL)); + qFatal("PBKDF2: RAND_bytes for salt failed: %s", ERR_error_string(ERR_get_error(), nullptr)); return QString(); } diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp index 141cc691e..1ddcebe5d 100644 --- a/src/murmur/Server.cpp +++ b/src/murmur/Server.cpp @@ -85,7 +85,7 @@ bool SslServer::hasDualStackSupport() { return false; } - SOCKET s = ::WSASocket(AF_INET6, SOCK_STREAM, IPPROTO_TCP, NULL, 0, WSA_FLAG_OVERLAPPED); + SOCKET s = ::WSASocket(AF_INET6, SOCK_STREAM, IPPROTO_TCP, nullptr, 0, WSA_FLAG_OVERLAPPED); if (s != INVALID_SOCKET) { const int ipv6only = 0; if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, reinterpret_cast<const char*>(&ipv6only), sizeof(ipv6only)) == 0) { @@ -106,7 +106,7 @@ void SslServer::incomingConnection(qintptr v) { QSslSocket *SslServer::nextPendingSSLConnection() { if (qlSockets.isEmpty()) - return NULL; + return nullptr; return qlSockets.takeFirst(); } @@ -114,14 +114,14 @@ Server::Server(int snum, QObject *p) : QThread(p) { bValid = true; iServerNum = snum; #ifdef USE_BONJOUR - bsRegistration = NULL; + bsRegistration = nullptr; #endif bUsingMetaCert = false; #ifdef Q_OS_UNIX aiNotify[0] = aiNotify[1] = -1; #else - hNotify = NULL; + hNotify = nullptr; #endif qtTimeout = new QTimer(this); @@ -129,7 +129,7 @@ Server::Server(int snum, QObject *p) : QThread(p) { bPreferAlpha = false; bOpus = true; - qnamNetwork = NULL; + qnamNetwork = nullptr; readParams(); initialize(); @@ -176,10 +176,10 @@ Server::Server(int snum, QObject *p) : QThread(p) { #ifndef SIO_UDP_CONNRESET #define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12) #endif - SOCKET sock = ::WSASocket(addr.ss_family, SOCK_DGRAM, IPPROTO_UDP, NULL, 0, WSA_FLAG_OVERLAPPED); + SOCKET sock = ::WSASocket(addr.ss_family, SOCK_DGRAM, IPPROTO_UDP, nullptr, 0, WSA_FLAG_OVERLAPPED); DWORD dwBytesReturned = 0; BOOL bNewBehaviour = FALSE; - if (WSAIoctl(sock, SIO_UDP_CONNRESET, &bNewBehaviour, sizeof(bNewBehaviour), NULL, 0, &dwBytesReturned, NULL, NULL) == SOCKET_ERROR) { + if (WSAIoctl(sock, SIO_UDP_CONNRESET, &bNewBehaviour, sizeof(bNewBehaviour), nullptr, 0, &dwBytesReturned, nullptr, nullptr) == SOCKET_ERROR) { log(QString("Failed to set SIO_UDP_CONNRESET: %1").arg(WSAGetLastError())); } #endif @@ -241,7 +241,7 @@ Server::Server(int snum, QObject *p) : QThread(p) { return; } #else - hNotify = CreateEvent(NULL, FALSE, FALSE, NULL); + hNotify = CreateEvent(nullptr, FALSE, FALSE, nullptr); #endif connect(this, SIGNAL(tcpTransmit(QByteArray, unsigned int)), this, SLOT(tcpTransmitData(QByteArray, unsigned int)), Qt::QueuedConnection); @@ -642,7 +642,7 @@ void Server::initBonjour() { void Server::removeBonjour() { delete bsRegistration; - bsRegistration = NULL; + bsRegistration = nullptr; log("Stopped announcing server via bonjour"); } #endif @@ -738,7 +738,7 @@ void Server::run() { STACKVAR(HANDLE, events, nfds+1); for (int i=0;i<nfds;++i) { fds[i] = qlUdpSocket.at(i); - events[i] = CreateEvent(NULL, FALSE, FALSE, NULL); + events[i] = CreateEvent(nullptr, FALSE, FALSE, nullptr); ::WSAEventSelect(fds[i], events[i], FD_READ); } events[nfds] = hNotify; @@ -875,8 +875,8 @@ void Server::run() { } qrwlVoiceThread.unlock(); rl.relock(); - if (u != NULL && !qhUsers.contains(uiSession)) - u = NULL; + if (u && !qhUsers.contains(uiSession)) + u = nullptr; break; } } @@ -916,7 +916,7 @@ void Server::run() { } #ifdef Q_OS_WIN for (int i=0;i<nfds-1;++i) { - ::WSAEventSelect(fds[i], NULL, 0); + ::WSAEventSelect(fds[i], nullptr, 0); CloseHandle(events[i]); } #endif @@ -1512,7 +1512,7 @@ void Server::sslError(const QList<QSslError> &errors) { // Because abort() tears down a lot of internal state // of the QSslSocket, inlcuding the 'SSL *' object // associated with the socket, this is fatal and leads - // to crashes, such as attempting to derefernce a NULL + // to crashes, such as attempting to derefernce a nullptr // 'SSL *' object. // // To avoid this, we use a non-forceful disconnect @@ -1609,7 +1609,7 @@ void Server::connectionClosed(QAbstractSocket::SocketError err, const QString &r } void Server::message(unsigned int uiType, const QByteArray &qbaMsg, ServerUser *u) { - if (u == NULL) { + if (!u) { u = static_cast<ServerUser *>(sender()); } @@ -1726,7 +1726,7 @@ void Server::sendProtoMessage(ServerUser *u, const ::google::protobuf::Message & } void Server::sendProtoAll(const ::google::protobuf::Message &msg, unsigned int msgType, unsigned int version) { - sendProtoExcept(NULL, msg, msgType, version); + sendProtoExcept(nullptr, msg, msgType, version); } void Server::sendProtoExcept(ServerUser *u, const ::google::protobuf::Message &msg, unsigned int msgType, unsigned int version) { @@ -1747,12 +1747,12 @@ void Server::removeChannel(Channel *chan, Channel *dest) { Channel *c; User *p; - if (dest == NULL) + if (!dest) dest = chan->cParent; { QWriteLocker wl(&qrwlVoiceThread); - chan->unlink(NULL); + chan->unlink(nullptr); } foreach(c, chan->qlChannels) { @@ -1855,7 +1855,7 @@ void Server::userEnterChannel(User *p, Channel *c, MumbleProto::UserState &mpus) QWriteLocker wl(&qrwlVoiceThread); c->addUser(p); - bool mayspeak = ChanACL::hasPermission(static_cast<ServerUser *>(p), c, ChanACL::Speak, NULL); + bool mayspeak = ChanACL::hasPermission(static_cast<ServerUser *>(p), c, ChanACL::Speak, nullptr); bool sup = p->bSuppress; if (mayspeak == sup) { @@ -2076,7 +2076,7 @@ void Server::recheckCodecVersions(ServerUser *connectingUser) { iCodecBeta = version; } else if (bOpus == enableOpus) { if (bOpus && connectingUser && !connectingUser->bOpus) { - sendTextMessage(NULL, connectingUser, false, QLatin1String("<strong>WARNING:</strong> Your client doesn't support the Opus codec the server is using, you won't be able to talk or hear anyone. Please upgrade to a client with Opus support.")); + sendTextMessage(nullptr, connectingUser, false, QLatin1String("<strong>WARNING:</strong> Your client doesn't support the Opus codec the server is using, you won't be able to talk or hear anyone. Please upgrade to a client with Opus support.")); } return; } @@ -2096,7 +2096,7 @@ void Server::recheckCodecVersions(ServerUser *connectingUser) { // Only authenticated users and the currently connecting user (if recheck is called in that context) have a reliable u->bOpus. if((u->sState == ServerUser::Authenticated || u == connectingUser) && !u->bOpus) { - sendTextMessage(NULL, u, false, QLatin1String("<strong>WARNING:</strong> Your client doesn't support the Opus codec the server is switching to, you won't be able to talk or hear anyone. Please upgrade to a client with Opus support.")); + sendTextMessage(nullptr, u, false, QLatin1String("<strong>WARNING:</strong> Your client doesn't support the Opus codec the server is switching to, you won't be able to talk or hear anyone. Please upgrade to a client with Opus support.")); } } } diff --git a/src/murmur/Server.h b/src/murmur/Server.h index 92fc1d240..7f448713f 100644 --- a/src/murmur/Server.h +++ b/src/murmur/Server.h @@ -68,7 +68,7 @@ class SslServer : public QTcpServer { void incomingConnection(qintptr) Q_DECL_OVERRIDE; public: QSslSocket *nextPendingSSLConnection(); - SslServer(QObject *parent = NULL); + SslServer(QObject *parent = nullptr); /// Checks whether the AF_INET6 socket on this system has dual-stack support. static bool hasDualStackSupport(); @@ -199,7 +199,7 @@ class Server : public QThread { void newClient(); void connectionClosed(QAbstractSocket::SocketError, const QString &); void sslError(const QList<QSslError> &); - void message(unsigned int, const QByteArray &, ServerUser *cCon = NULL); + void message(unsigned int, const QByteArray &, ServerUser *cCon = nullptr); void checkTimeout(); void tcpTransmitData(QByteArray, unsigned int); void doSync(unsigned int); @@ -296,7 +296,7 @@ class Server : public QThread { QFlags<ChanACL::Perm> effectivePermissions(ServerUser *p, Channel *c); void sendClientPermission(ServerUser *u, Channel *c, bool updatelast = false); void flushClientPermissionCache(ServerUser *u, MumbleProto::PermissionQuery &mpqq); - void clearACLCache(User *p = NULL); + void clearACLCache(User *p = nullptr); void clearWhisperTargetCache(); void sendProtoAll(const ::google::protobuf::Message &msg, unsigned int msgType, unsigned int minversion); @@ -325,14 +325,14 @@ class Server : public QThread { void log(ServerUser *u, const QString &) const; void removeChannel(int id); - void removeChannel(Channel *c, Channel *dest = NULL); + void removeChannel(Channel *c, Channel *dest = nullptr); void userEnterChannel(User *u, Channel *c, MumbleProto::UserState &mpus); bool unregisterUser(int id); - Server(int snum, QObject *parent = NULL); + Server(int snum, QObject *parent = nullptr); ~Server(); - bool canNest(Channel *newParent, Channel *channel = NULL) const; + bool canNest(Channel *newParent, Channel *channel = nullptr) const; // RPC functions. Implementation in RPC.cpp void connectAuthenticator(QObject *p); @@ -340,7 +340,7 @@ class Server : public QThread { void connectListener(QObject *p); void disconnectListener(QObject *p); void setTempGroups(int userid, int sessionId, Channel *cChannel, const QStringList &groups); - void clearTempGroups(User *user, Channel *cChannel = NULL, bool recurse = true); + void clearTempGroups(User *user, Channel *cChannel = nullptr, bool recurse = true); void startListeningToChannel(ServerUser *user, Channel *cChannel); void stopListeningToChannel(ServerUser *user, Channel *cChannel); signals: @@ -403,7 +403,7 @@ class Server : public QThread { int authenticate(QString &name, const QString &pw, int sessionId = 0, const QStringList &emails = QStringList(), const QString &certhash = QString(), bool bStrongCert = false, const QList<QSslCertificate> & = QList<QSslCertificate>()); Channel *addChannel(Channel *c, const QString &name, bool temporary = false, int position = 0, unsigned int maxUsers = 0); void removeChannelDB(const Channel *c); - void readChannels(Channel *p = NULL); + void readChannels(Channel *p = nullptr); void readLinks(); void updateChannel(const Channel *c); void readChannelPrivs(Channel *c); diff --git a/src/murmur/ServerDB.cpp b/src/murmur/ServerDB.cpp index 14b7cb281..536bc73be 100644 --- a/src/murmur/ServerDB.cpp +++ b/src/murmur/ServerDB.cpp @@ -62,7 +62,7 @@ class TransactionHolder { } }; -QSqlDatabase *ServerDB::db = NULL; +QSqlDatabase *ServerDB::db = nullptr; Timer ServerDB::tLogClean; QString ServerDB::qsUpgradeSuffix; @@ -692,7 +692,7 @@ ServerDB::ServerDB() { ServerDB::~ServerDB() { db->close(); delete db; - db = NULL; + db = nullptr; } bool ServerDB::prepare(QSqlQuery &query, const QString &str, bool fatal, bool warn) { @@ -1483,7 +1483,7 @@ void ServerDB::setSUPW(int srvnum, const QString &pw) { } void ServerDB::disableSU(int srvnum) { - writeSUPW(srvnum, QString(), QString(), QVariant()); // NULL, NULL, NULL + writeSUPW(srvnum, QString(), QString(), QVariant()); // nullptr, nullptr, nullptr } QString ServerDB::getLegacySHA1Hash(const QString &password) { @@ -2003,7 +2003,7 @@ void Server::dumpChannel(const Channel *c) { ChanACL *acl; int pid; - if (c == NULL) { + if (!c) { c = qhChannels.value(0); } diff --git a/src/murmur/ServerUser.cpp b/src/murmur/ServerUser.cpp index 9eab92440..d55845166 100644 --- a/src/murmur/ServerUser.cpp +++ b/src/murmur/ServerUser.cpp @@ -12,7 +12,7 @@ # include "Utils.h" #endif -ServerUser::ServerUser(Server *p, QSslSocket *socket) : Connection(p, socket), User(), s(NULL), leakyBucket(p->iMessageLimit, p->iMessageBurst) { +ServerUser::ServerUser(Server *p, QSslSocket *socket) : Connection(p, socket), User(), s(nullptr), leakyBucket(p->iMessageLimit, p->iMessageBurst) { sState = ServerUser::Connected; sUdpSocket = INVALID_SOCKET; diff --git a/src/murmur/Tray.cpp b/src/murmur/Tray.cpp index bb3664f9c..6c5a876a8 100644 --- a/src/murmur/Tray.cpp +++ b/src/murmur/Tray.cpp @@ -38,7 +38,7 @@ Tray::Tray(QObject *p, LogEmitter *logger) : QObject(p) { // Can't construct a QMenu which decends from QObject, and qsti is a QObject. // Qt bug? - qm = new QMenu(tr("Murmur"), NULL); + qm = new QMenu(tr("Murmur"), nullptr); qm->addAction(qaShowLog); qm->addSeparator(); qm->addAction(qaAbout); @@ -59,13 +59,13 @@ void Tray::on_Tray_activated(QSystemTrayIcon::ActivationReason r) { } void Tray::on_Quit_triggered() { - if (QMessageBox::question(NULL, tr("Murmur"), tr("Are you sure you want to quit Murmur?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) { + if (QMessageBox::question(nullptr, tr("Murmur"), tr("Are you sure you want to quit Murmur?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) { qApp->quit(); } } void Tray::on_About_triggered() { - AboutDialog ad(NULL); + AboutDialog ad(nullptr); ad.exec(); } diff --git a/src/murmur/UnixMurmur.cpp b/src/murmur/UnixMurmur.cpp index baec20a31..954e4f2a5 100644 --- a/src/murmur/UnixMurmur.cpp +++ b/src/murmur/UnixMurmur.cpp @@ -135,21 +135,21 @@ UnixMurmur::UnixMurmur() { sigemptyset(&hup.sa_mask); hup.sa_flags = SA_RESTART; - if (sigaction(SIGHUP, &hup, NULL)) + if (sigaction(SIGHUP, &hup, nullptr)) qFatal("Failed to install SIGHUP handler"); term.sa_handler = termSignalHandler; sigemptyset(&term.sa_mask); term.sa_flags = SA_RESTART; - if (sigaction(SIGTERM, &term, NULL)) + if (sigaction(SIGTERM, &term, nullptr)) qFatal("Failed to install SIGTERM handler"); usr1.sa_handler = usr1SignalHandler; sigemptyset(&usr1.sa_mask); usr1.sa_flags = SA_RESTART; - if (sigaction(SIGUSR1, &usr1, NULL)) + if (sigaction(SIGUSR1, &usr1, nullptr)) qFatal("Failed to install SIGUSR1 handler"); umask(S_IRWXO); @@ -160,9 +160,9 @@ UnixMurmur::~UnixMurmur() { delete qsnTerm; delete qsnUsr1; - qsnHup = NULL; - qsnTerm = NULL; - qsnUsr1 = NULL; + qsnHup = nullptr; + qsnTerm = nullptr; + qsnUsr1 = nullptr; close(iHupFd[0]); close(iHupFd[1]); diff --git a/src/murmur/main.cpp b/src/murmur/main.cpp index a24b77356..0d81dfb44 100644 --- a/src/murmur/main.cpp +++ b/src/murmur/main.cpp @@ -43,7 +43,7 @@ # include <sys/syslog.h> #endif -QFile *qfLog = NULL; +QFile *qfLog = nullptr; static bool bVerbose = false; #ifdef QT_NO_DEBUG @@ -53,10 +53,10 @@ static bool detach = false; #endif #ifdef Q_OS_UNIX -static UnixMurmur *unixMurmur = NULL; +static UnixMurmur *unixMurmur = nullptr; #endif -Meta *meta = NULL; +Meta *meta = nullptr; static LogEmitter le; @@ -145,7 +145,7 @@ static void murmurMessageOutputQString(QtMsgType type, const QString &msg) { fprintf(stderr, "%s", qPrintable(m)); } #else - ::MessageBoxA(NULL, qPrintable(m), "Murmur", MB_OK | MB_ICONWARNING); + ::MessageBoxA(nullptr, qPrintable(m), "Murmur", MB_OK | MB_ICONWARNING); #endif exit(1); } @@ -176,7 +176,7 @@ int main(int argc, char **argv) { #define MMXSSE 0x02800000 if ((cpuinfo[3] & MMXSSE) != MMXSSE) { - ::MessageBoxA(NULL, "Mumble requires a SSE capable processor (Pentium 3 / Ahtlon-XP)", "Mumble", MB_OK | MB_ICONERROR); + ::MessageBoxA(nullptr, "Mumble requires a SSE capable processor (Pentium 3 / Ahtlon-XP)", "Mumble", MB_OK | MB_ICONERROR); exit(0); } @@ -252,7 +252,7 @@ int main(int argc, char **argv) { qInstallMessageHandler(murmurMessageOutputWithContext); #ifdef Q_OS_WIN - Tray tray(NULL, &le); + Tray tray(nullptr, &le); #endif QStringList args = a.arguments(); @@ -311,7 +311,7 @@ int main(int argc, char **argv) { return 0; } else if (args.at(i) == QLatin1String("-license") || args.at(i) == QLatin1String("--license")) { #ifdef Q_OS_WIN - AboutDialog ad(NULL, AboutDialogOptionsShowLicense); + AboutDialog ad(nullptr, AboutDialogOptionsShowLicense); ad.exec(); return 0; #else @@ -320,7 +320,7 @@ int main(int argc, char **argv) { #endif } else if (args.at(i) == QLatin1String("-authors") || args.at(i) == QLatin1String("--authors")) { #ifdef Q_OS_WIN - AboutDialog ad(NULL, AboutDialogOptionsShowAuthors); + AboutDialog ad(nullptr, AboutDialogOptionsShowAuthors); ad.exec(); return 0; #else @@ -329,7 +329,7 @@ int main(int argc, char **argv) { #endif } else if (args.at(i) == QLatin1String("-third-party-licenses") || args.at(i) == QLatin1String("--third-party-licenses")) { #ifdef Q_OS_WIN - AboutDialog ad(NULL, AboutDialogOptionsShowThirdPartyLicenses); + AboutDialog ad(nullptr, AboutDialogOptionsShowThirdPartyLicenses); ad.exec(); return 0; #else @@ -422,7 +422,7 @@ int main(int argc, char **argv) { qfLog = new QFile(Meta::mp.qsLogfile); if (! qfLog->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) { delete qfLog; - qfLog = NULL; + qfLog = nullptr; #ifdef Q_OS_UNIX fprintf(stderr, "murmurd: failed to open logfile %s: no logging will be done\n", qPrintable(Meta::mp.qsLogfile)); #else @@ -463,7 +463,7 @@ int main(int argc, char **argv) { char *p; printf("Password: "); - fflush(NULL); + fflush(nullptr); if (fgets(password, 255, stdin) != password) qFatal("No password provided"); p = strchr(password, '\r'); @@ -616,7 +616,7 @@ int main(int argc, char **argv) { #ifdef USE_DBUS delete MurmurDBus::qdbc; - MurmurDBus::qdbc = NULL; + MurmurDBus::qdbc = nullptr; #endif #ifdef USE_ICE @@ -628,11 +628,11 @@ int main(int argc, char **argv) { #endif delete qfLog; - qfLog = NULL; + qfLog = nullptr; delete meta; - qInstallMessageHandler(NULL); + qInstallMessageHandler(nullptr); #ifdef Q_OS_UNIX if (! Meta::mp.qsPid.isEmpty()) { |