Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPopkornium18 <mail@popkornium18.de>2020-06-27 01:44:55 +0300
committerPopkornium18 <mail@popkornium18.de>2020-06-27 14:38:37 +0300
commit01db6e219d098a2eccbb7b72ef3a24ad6c2dbbda (patch)
treea0d5dc517799c08698b9f8f7ca0a4e039d478436 /src/mumble
parentb1e8910c606c9f4e88e0f9016b54367643762696 (diff)
REFAC(client): replace NULL and Q_NULLPTR with nullptr
This changes all occurances of NULL and Q_NULLPTR in the mumble source dir to nullptr. Additionally comparisons with NULL were changed to `if (pointer)` if it would not be confusing. (e.g. booleans as parameters ` setEnabled(pointer != nullptr)`)
Diffstat (limited to 'src/mumble')
-rw-r--r--src/mumble/ACLEditor.cpp30
-rw-r--r--src/mumble/ACLEditor.h4
-rw-r--r--src/mumble/ALSAAudio.cpp42
-rw-r--r--src/mumble/ASIOInput.cpp36
-rw-r--r--src/mumble/Audio.cpp4
-rw-r--r--src/mumble/AudioConfigDialog.cpp2
-rw-r--r--src/mumble/AudioInput.cpp38
-rw-r--r--src/mumble/AudioOutput.cpp2
-rw-r--r--src/mumble/AudioOutputSample.cpp4
-rw-r--r--src/mumble/AudioStats.cpp4
-rw-r--r--src/mumble/AudioStats.h2
-rw-r--r--src/mumble/AudioWizard.cpp20
-rw-r--r--src/mumble/AudioWizard.h2
-rw-r--r--src/mumble/BanEditor.h2
-rw-r--r--src/mumble/BonjourClient.cpp2
-rw-r--r--src/mumble/CELTCodec.cpp14
-rw-r--r--src/mumble/CELTCodec_sbcelt.cpp12
-rw-r--r--src/mumble/Cert.cpp44
-rw-r--r--src/mumble/Cert.h2
-rw-r--r--src/mumble/ClientUser.cpp4
-rw-r--r--src/mumble/ClientUser.h4
-rw-r--r--src/mumble/ConfigDialog.cpp2
-rw-r--r--src/mumble/ConfigDialog.h2
-rw-r--r--src/mumble/ConfigWidget.cpp2
-rw-r--r--src/mumble/ConnectDialog.cpp63
-rw-r--r--src/mumble/ConnectDialog.h6
-rw-r--r--src/mumble/CrashReporter.cpp10
-rw-r--r--src/mumble/CustomElements.h4
-rw-r--r--src/mumble/Database.cpp4
-rw-r--r--src/mumble/DeveloperConsole.h2
-rw-r--r--src/mumble/G15LCDEngine_unix.cpp2
-rw-r--r--src/mumble/GKey.cpp16
-rw-r--r--src/mumble/Global.cpp20
-rw-r--r--src/mumble/GlobalShortcut.cpp8
-rw-r--r--src/mumble/GlobalShortcut.h12
-rw-r--r--src/mumble/GlobalShortcut_macx.mm14
-rw-r--r--src/mumble/GlobalShortcut_unix.cpp2
-rw-r--r--src/mumble/GlobalShortcut_win.cpp34
-rw-r--r--src/mumble/JackAudio.cpp4
-rw-r--r--src/mumble/LCD.cpp8
-rw-r--r--src/mumble/Log.cpp2
-rw-r--r--src/mumble/Log.h6
-rw-r--r--src/mumble/Log_macx.mm6
-rw-r--r--src/mumble/MainWindow.cpp88
-rw-r--r--src/mumble/ManualPlugin.cpp8
-rw-r--r--src/mumble/Messages.cpp18
-rw-r--r--src/mumble/MumbleApplication.cpp2
-rw-r--r--src/mumble/OSS.cpp8
-rw-r--r--src/mumble/OpusCodec.cpp4
-rw-r--r--src/mumble/Overlay.cpp22
-rw-r--r--src/mumble/Overlay.h2
-rw-r--r--src/mumble/OverlayClient.cpp18
-rw-r--r--src/mumble/OverlayConfig.cpp8
-rw-r--r--src/mumble/OverlayEditor.h2
-rw-r--r--src/mumble/OverlayEditorScene.cpp32
-rw-r--r--src/mumble/OverlayEditorScene.h2
-rw-r--r--src/mumble/OverlayPositionableItem.cpp10
-rw-r--r--src/mumble/OverlayUser.cpp2
-rw-r--r--src/mumble/OverlayUserGroup.cpp14
-rw-r--r--src/mumble/Overlay_macx.mm26
-rw-r--r--src/mumble/Overlay_unix.cpp2
-rw-r--r--src/mumble/Overlay_win.cpp4
-rw-r--r--src/mumble/Plugins.cpp28
-rw-r--r--src/mumble/Plugins.h2
-rw-r--r--src/mumble/PulseAudio.cpp46
-rw-r--r--src/mumble/RichTextEditor.h4
-rw-r--r--src/mumble/ServerHandler.cpp18
-rw-r--r--src/mumble/SharedMemory_unix.cpp8
-rw-r--r--src/mumble/SharedMemory_win.cpp22
-rw-r--r--src/mumble/SocketRPC.cpp6
-rw-r--r--src/mumble/SocketRPC.h4
-rw-r--r--src/mumble/TaskList.cpp6
-rw-r--r--src/mumble/TextMessage.h2
-rw-r--r--src/mumble/TextToSpeech.h2
-rw-r--r--src/mumble/TextToSpeech_unix.cpp6
-rw-r--r--src/mumble/TextToSpeech_win.cpp6
-rw-r--r--src/mumble/Themes.cpp2
-rw-r--r--src/mumble/Tokens.h2
-rw-r--r--src/mumble/Usage.h2
-rw-r--r--src/mumble/UserEdit.h4
-rw-r--r--src/mumble/UserInformation.h2
-rw-r--r--src/mumble/UserListModel.cpp4
-rw-r--r--src/mumble/UserListModel.h2
-rw-r--r--src/mumble/UserLocalVolumeDialog.cpp2
-rw-r--r--src/mumble/UserLockFile_win.cpp4
-rw-r--r--src/mumble/UserModel.cpp30
-rw-r--r--src/mumble/UserView.cpp2
-rw-r--r--src/mumble/UserView.h2
-rw-r--r--src/mumble/VersionCheck.h2
-rw-r--r--src/mumble/VoiceRecorder.cpp14
-rw-r--r--src/mumble/VoiceRecorder.h2
-rw-r--r--src/mumble/VoiceRecorderDialog.h2
-rw-r--r--src/mumble/WASAPI.cpp140
-rw-r--r--src/mumble/WASAPINotificationClient.cpp4
-rw-r--r--src/mumble/XboxInput.cpp14
-rw-r--r--src/mumble/main.cpp18
-rw-r--r--src/mumble/os_early_win.cpp22
-rw-r--r--src/mumble/os_macx.mm10
-rw-r--r--src/mumble/os_win.cpp18
-rw-r--r--src/mumble/widgets/MUComboBox.h2
100 files changed, 620 insertions, 621 deletions
diff --git a/src/mumble/ACLEditor.cpp b/src/mumble/ACLEditor.cpp
index 712eb3ece..8cdb3148c 100644
--- a/src/mumble/ACLEditor.cpp
+++ b/src/mumble/ACLEditor.cpp
@@ -22,7 +22,7 @@
// We define a global macro called 'g'. This can lead to issues when included code uses 'g' as a type or parameter name (like protobuf 3.7 does). As such, for now, we have to make this our last include.
#include "Global.h"
-ACLGroup::ACLGroup(const QString &name) : Group(NULL, name) {
+ACLGroup::ACLGroup(const QString &name) : Group(nullptr, name) {
bInherited = false;
}
@@ -72,7 +72,7 @@ ACLEditor::ACLEditor(int channelparentid, QWidget *p) : QDialog(p) {
qleChannelName->setFocus();
- pcaPassword = NULL;
+ pcaPassword = nullptr;
adjustSize();
}
@@ -83,7 +83,7 @@ ACLEditor::ACLEditor(int channelid, const MumbleProto::ACL &mea, QWidget *p) : Q
iChannel = channelid;
Channel *pChannel = Channel::get(iChannel);
- if (pChannel == NULL) {
+ if (!pChannel) {
g.l->log(Log::Warning, tr("Failed: Invalid channel"));
QDialog::reject();
return;
@@ -187,7 +187,7 @@ ACLEditor::ACLEditor(int channelid, const MumbleProto::ACL &mea, QWidget *p) : Q
}
}
- ChanACL *def = new ChanACL(NULL);
+ ChanACL *def = new ChanACL(nullptr);
def->bApplyHere = true;
def->bApplySubs = true;
@@ -202,7 +202,7 @@ ACLEditor::ACLEditor(int channelid, const MumbleProto::ACL &mea, QWidget *p) : Q
for (int i = 0; i < mea.acls_size(); ++i) {
const MumbleProto::ACL_ChanACL &as = mea.acls(i);
- ChanACL *acl = new ChanACL(NULL);
+ ChanACL *acl = new ChanACL(nullptr);
acl->bApplyHere = as.apply_here();
acl->bApplySubs = as.apply_subs();
acl->bInherited = as.inherited();
@@ -277,7 +277,7 @@ void ACLEditor::showEvent(QShowEvent *evt) {
void ACLEditor::accept() {
Channel *pChannel = Channel::get(iChannel);
- if (pChannel == NULL) {
+ if (!pChannel) {
// Channel gone while editing
g.l->log(Log::Warning, tr("Failed: Invalid channel"));
QDialog::reject();
@@ -518,13 +518,13 @@ ACLGroup *ACLEditor::currentGroup() {
if (gp->qsName == group)
return gp;
- return NULL;
+ return nullptr;
}
ChanACL *ACLEditor::currentACL() {
int idx = qlwACLs->currentRow();
if (idx < 0)
- return NULL;
+ return nullptr;
if (idx && ! bInheritACL)
idx += numInheritACL;
@@ -592,7 +592,7 @@ void ACLEditor::groupEnableCheck() {
qpbGroupRemoveRemove->setEnabled(enabled);
qpbGroupInheritRemove->setEnabled(enabled);
- enabled = (gp != NULL);
+ enabled = gp;
qlwGroupAdd->setEnabled(enabled);
qcbGroupAdd->setEnabled(enabled);
qpbGroupAddAdd->setEnabled(enabled);
@@ -685,7 +685,7 @@ void ACLEditor::on_qtwTab_currentChanged(int index) {
void ACLEditor::updatePasswordField() {
// Search for an ACL that represents the current password
- pcaPassword = NULL;
+ pcaPassword = nullptr;
foreach(ChanACL *acl, qlACLs) {
if (acl->isPassword()) {
pcaPassword = acl;
@@ -705,7 +705,7 @@ void ACLEditor::updatePasswordACL() {
delete pcaPassword;
// Search and remove the @all deny ACL
- ChanACL *denyall = NULL;
+ ChanACL *denyall = nullptr;
foreach(ChanACL *acl, qlACLs) {
if (acl->qsGroup == QLatin1String("all") &&
acl->bInherited == false &&
@@ -723,8 +723,8 @@ void ACLEditor::updatePasswordACL() {
}
} else {
// Add or Update
- if (pcaPassword == NULL || !qlACLs.contains(pcaPassword)) {
- pcaPassword = new ChanACL(NULL);
+ if (!pcaPassword || !qlACLs.contains(pcaPassword)) {
+ pcaPassword = new ChanACL(nullptr);
pcaPassword->bApplyHere = true;
pcaPassword->bApplySubs = false;
pcaPassword->bInherited = false;
@@ -733,7 +733,7 @@ void ACLEditor::updatePasswordACL() {
pcaPassword->qsGroup = QLatin1String("all");
qlACLs << pcaPassword;
- pcaPassword = new ChanACL(NULL);
+ pcaPassword = new ChanACL(nullptr);
pcaPassword->bApplyHere = true;
pcaPassword->bApplySubs = false;
pcaPassword->bInherited = false;
@@ -752,7 +752,7 @@ void ACLEditor::on_qlwACLs_currentRowChanged() {
}
void ACLEditor::on_qpbACLAdd_clicked() {
- ChanACL *as = new ChanACL(NULL);
+ ChanACL *as = new ChanACL(nullptr);
as->bApplyHere = true;
as->bApplySubs = true;
as->bInherited = false;
diff --git a/src/mumble/ACLEditor.h b/src/mumble/ACLEditor.h
index aebb46575..3cd532ff2 100644
--- a/src/mumble/ACLEditor.h
+++ b/src/mumble/ACLEditor.h
@@ -63,8 +63,8 @@ class ACLEditor : public QDialog, public Ui::ACLEditor {
void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
void fillWidgetFromSet(QListWidget *, const QSet<int> &);
public:
- ACLEditor(int parentchannelid, QWidget *p = NULL);
- ACLEditor(int channelid, const MumbleProto::ACL &mea, QWidget *p = NULL);
+ ACLEditor(int parentchannelid, QWidget *p = nullptr);
+ ACLEditor(int channelid, const MumbleProto::ACL &mea, QWidget *p = nullptr);
~ACLEditor();
void returnQuery(const MumbleProto::QueryUsers &mqu);
public slots:
diff --git a/src/mumble/ALSAAudio.cpp b/src/mumble/ALSAAudio.cpp
index 89f9c2b54..380cd52ea 100644
--- a/src/mumble/ALSAAudio.cpp
+++ b/src/mumble/ALSAAudio.cpp
@@ -25,7 +25,7 @@ class ALSAEnumerator {
ALSAEnumerator();
};
-static ALSAEnumerator *cards = NULL;
+static ALSAEnumerator *cards = nullptr;
class ALSAAudioInputRegistrar : public AudioInputRegistrar {
public:
@@ -58,9 +58,9 @@ static ALSAInit aiInit;
QMutex qmALSA;
void ALSAInit::initialize() {
- pairALSA = NULL;
- paorALSA = NULL;
- cards = NULL;
+ pairALSA = nullptr;
+ paorALSA = nullptr;
+ cards = nullptr;
int card = -1;
snd_card_next(&card);
@@ -151,9 +151,9 @@ ALSAEnumerator::ALSAEnumerator() {
qhOutput.insert(QLatin1String("default"), ALSAAudioOutput::tr("Default ALSA Card"));
#if SND_LIB_VERSION >= 0x01000e
- void **hints = NULL;
+ void **hints = nullptr;
void **hint;
- snd_config_t *basic = NULL;
+ snd_config_t *basic = nullptr;
int r;
snd_config_update();
@@ -208,14 +208,14 @@ ALSAEnumerator::ALSAEnumerator() {
snd_card_next(&card);
while (card != -1) {
char *name;
- snd_ctl_t *ctl=NULL;
+ snd_ctl_t *ctl=nullptr;
snd_card_get_longname(card, &name);
QByteArray dev=QString::fromLatin1("hw:%1").arg(card).toUtf8();
if (snd_ctl_open(&ctl, dev.data(), SND_CTL_READONLY) >= 0) {
- snd_pcm_info_t *info = NULL;
+ snd_pcm_info_t *info = nullptr;
snd_pcm_info_malloc(&info);
- char *cname = NULL;
+ char *cname = nullptr;
snd_card_get_name(card, &cname);
int device = -1;
@@ -288,8 +288,8 @@ void ALSAAudioInput::run() {
snd_pcm_sframes_t readblapp;
QByteArray device_name = g.s.qsALSAInput.toLatin1();
- snd_pcm_hw_params_t *hw_params = NULL;
- snd_pcm_t *capture_handle = NULL;
+ snd_pcm_hw_params_t *hw_params = nullptr;
+ snd_pcm_t *capture_handle = nullptr;
unsigned int rrate = SAMPLE_RATE;
bool bOk = true;
@@ -306,13 +306,13 @@ void ALSAAudioInput::run() {
ALSA_ERRCHECK(snd_pcm_hw_params_any(capture_handle, hw_params));
ALSA_ERRBAIL(snd_pcm_hw_params_set_access(capture_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED));
ALSA_ERRBAIL(snd_pcm_hw_params_set_format(capture_handle, hw_params, SND_PCM_FORMAT_S16));
- ALSA_ERRBAIL(snd_pcm_hw_params_set_rate_near(capture_handle, hw_params, &rrate, NULL));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_rate_near(capture_handle, hw_params, &rrate, nullptr));
ALSA_ERRBAIL(snd_pcm_hw_params_set_channels_near(capture_handle, hw_params, &iChannels));
snd_pcm_uframes_t wantPeriod = (rrate * iFrameSize) / SAMPLE_RATE;
snd_pcm_uframes_t wantBuff = wantPeriod * 8;
- ALSA_ERRBAIL(snd_pcm_hw_params_set_period_size_near(capture_handle, hw_params, &wantPeriod, NULL));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_period_size_near(capture_handle, hw_params, &wantPeriod, nullptr));
ALSA_ERRBAIL(snd_pcm_hw_params_set_buffer_size_near(capture_handle, hw_params, &wantBuff));
ALSA_ERRBAIL(snd_pcm_hw_params(capture_handle, hw_params));
@@ -320,7 +320,7 @@ void ALSAAudioInput::run() {
ALSA_ERRBAIL(snd_pcm_hw_params_current(capture_handle, hw_params));
ALSA_ERRBAIL(snd_pcm_hw_params_get_channels(hw_params, &iMicChannels));
- ALSA_ERRBAIL(snd_pcm_hw_params_get_rate(hw_params, &iMicFreq, NULL));
+ ALSA_ERRBAIL(snd_pcm_hw_params_get_rate(hw_params, &iMicFreq, nullptr));
#ifdef ALSA_VERBOSE
snd_output_t *log;
@@ -336,7 +336,7 @@ void ALSAAudioInput::run() {
if (capture_handle) {
snd_pcm_drain(capture_handle);
snd_pcm_close(capture_handle);
- capture_handle = NULL;
+ capture_handle = nullptr;
}
g.mw->msgBox(tr("Opening chosen ALSA Input failed: %1").arg(QString::fromLatin1(snd_strerror(err)).toHtmlEscaped()));
return;
@@ -396,7 +396,7 @@ ALSAAudioOutput::~ALSAAudioOutput() {
void ALSAAudioOutput::run() {
QMutexLocker qml(&qmALSA);
- snd_pcm_t *pcm_handle = NULL;
+ snd_pcm_t *pcm_handle = nullptr;
struct pollfd fds[16];
int count;
bool stillRun = true;
@@ -404,8 +404,8 @@ void ALSAAudioOutput::run() {
bool bOk = true;
- snd_pcm_hw_params_t *hw_params = NULL;
- snd_pcm_sw_params_t *sw_params = NULL;
+ snd_pcm_hw_params_t *hw_params = nullptr;
+ snd_pcm_sw_params_t *sw_params = nullptr;
QByteArray device_name = g.s.qsALSAOutput.toLatin1();
snd_pcm_hw_params_alloca(&hw_params);
@@ -425,7 +425,7 @@ void ALSAAudioOutput::run() {
ALSA_ERRBAIL(snd_pcm_hw_params_set_format(pcm_handle, hw_params, SND_PCM_FORMAT_S16));
ALSA_ERRBAIL(snd_pcm_hw_params_set_channels_near(pcm_handle, hw_params, &iChannels));
unsigned int rrate = SAMPLE_RATE;
- ALSA_ERRBAIL(snd_pcm_hw_params_set_rate_near(pcm_handle, hw_params, &rrate, NULL));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_rate_near(pcm_handle, hw_params, &rrate, nullptr));
unsigned int iOutputSize = (iFrameSize * rrate) / SAMPLE_RATE;
@@ -475,7 +475,7 @@ void ALSAAudioOutput::run() {
g.mw->msgBox(tr("Opening chosen ALSA Output failed: %1").arg(QString::fromLatin1(snd_strerror(err)).toHtmlEscaped()));
if (pcm_handle) {
snd_pcm_close(pcm_handle);
- pcm_handle = NULL;
+ pcm_handle = nullptr;
}
return;
}
@@ -494,7 +494,7 @@ void ALSAAudioOutput::run() {
ALSA_ERRBAIL(snd_pcm_hw_params_current(pcm_handle, hw_params));
ALSA_ERRBAIL(snd_pcm_hw_params_get_channels(hw_params, &iChannels));
- ALSA_ERRBAIL(snd_pcm_hw_params_get_rate(hw_params, &rrate, NULL));
+ ALSA_ERRBAIL(snd_pcm_hw_params_get_rate(hw_params, &rrate, nullptr));
iMixerFreq = rrate;
eSampleFormat = SampleShort;
diff --git a/src/mumble/ASIOInput.cpp b/src/mumble/ASIOInput.cpp
index d8ba9e29d..98bae3ec4 100644
--- a/src/mumble/ASIOInput.cpp
+++ b/src/mumble/ASIOInput.cpp
@@ -56,7 +56,7 @@ class ASIOInit : public DeferInit {
ASIOAudioInputRegistrar *airASIO;
ConfigRegistrar *crASIO;
public:
- ASIOInit() : airASIO(NULL), crASIO(NULL) {}
+ ASIOInit() : airASIO(nullptr), crASIO(nullptr) {}
void initialize();
void destroy();
};
@@ -66,8 +66,8 @@ void ASIOInit::initialize() {
HKEY hk;
FILETIME ft;
- airASIO = NULL;
- crASIO = NULL;
+ airASIO = nullptr;
+ crASIO = nullptr;
bool bFound = false;
@@ -87,7 +87,7 @@ void ASIOInit::initialize() {
DWORD idx = 0;
DWORD keynamelen = 255;
WCHAR keyname[255];
- while (RegEnumKeyEx(hkDevs, idx++, keyname, &keynamelen, NULL, NULL, NULL, &ft) == ERROR_SUCCESS) {
+ while (RegEnumKeyEx(hkDevs, idx++, keyname, &keynamelen, nullptr, nullptr, nullptr, &ft) == ERROR_SUCCESS) {
QString name=QString::fromUtf16(reinterpret_cast<ushort *>(keyname),keynamelen);
if (RegOpenKeyEx(hkDevs, keyname, 0, KEY_READ, &hk) == ERROR_SUCCESS) {
DWORD dtype = REG_SZ;
@@ -148,7 +148,7 @@ ASIOConfig::ASIOConfig(Settings &st) : ConfigWidget(st) {
FILETIME ft;
DWORD idx = 0;
DWORD keynamelen = keynamebufsize;
- while (RegEnumKeyEx(hkDevs, idx++, keyname, &keynamelen, NULL, NULL, NULL, &ft) == ERROR_SUCCESS) {
+ while (RegEnumKeyEx(hkDevs, idx++, keyname, &keynamelen, nullptr, nullptr, nullptr, &ft) == ERROR_SUCCESS) {
QString name=QString::fromUtf16(reinterpret_cast<ushort *>(keyname), keynamelen);
HKEY hk;
if (RegOpenKeyEx(hkDevs, keyname, 0, KEY_READ, &hk) == ERROR_SUCCESS) {
@@ -194,7 +194,7 @@ void ASIOConfig::on_qpbQuery_clicked() {
clearQuery();
CLSIDFromString(const_cast<wchar_t *>(reinterpret_cast<const wchar_t *>(qsCls.utf16())), &clsid);
- if (CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, clsid, reinterpret_cast<void **>(&iasio)) == S_OK) {
+ if (CoCreateInstance(clsid, nullptr, CLSCTX_INPROC_SERVER, clsid, reinterpret_cast<void **>(&iasio)) == S_OK) {
SleepEx(10, false);
if (iasio->init(mumble_mw_hwnd)) {
SleepEx(10, false);
@@ -276,7 +276,7 @@ void ASIOConfig::on_qpbConfig_clicked() {
IASIO *iasio;
CLSIDFromString(const_cast<wchar_t *>(reinterpret_cast<const wchar_t *>(qsCls.utf16())), &clsid);
- if (CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, clsid, reinterpret_cast<void **>(&iasio)) == S_OK) {
+ if (CoCreateInstance(clsid, nullptr, CLSCTX_INPROC_SERVER, clsid, reinterpret_cast<void **>(&iasio)) == S_OK) {
SleepEx(10, false);
if (iasio->init(mumble_mw_hwnd)) {
SleepEx(10, false);
@@ -396,9 +396,9 @@ ASIOInput::ASIOInput() {
QString qsCls = g.s.qsASIOclass;
CLSID clsid;
- iasio = NULL;
- abiInfo = NULL;
- aciInfo = NULL;
+ iasio = nullptr;
+ abiInfo = nullptr;
+ aciInfo = nullptr;
// Sanity check things first.
@@ -406,13 +406,13 @@ ASIOInput::ASIOInput() {
iNumSpeaker=g.s.qlASIOspeaker.count();
if ((iNumMic == 0) || (iNumSpeaker == 0)) {
- QMessageBox::warning(NULL, QLatin1String("Mumble"), tr("You need to select at least one microphone and one speaker source to use ASIO."), QMessageBox::Ok, QMessageBox::NoButton);
+ QMessageBox::warning(nullptr, QLatin1String("Mumble"), tr("You need to select at least one microphone and one speaker source to use ASIO."), QMessageBox::Ok, QMessageBox::NoButton);
return;
}
CLSIDFromString(const_cast<wchar_t *>(reinterpret_cast<const wchar_t *>(qsCls.utf16())), &clsid);
- if (CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, clsid, reinterpret_cast<void **>(&iasio)) == S_OK) {
- if (iasio->init(NULL)) {
+ if (CoCreateInstance(clsid, nullptr, CLSCTX_INPROC_SERVER, clsid, reinterpret_cast<void **>(&iasio)) == S_OK) {
+ if (iasio->init(nullptr)) {
iasio->setSampleRate(48000.0);
ASIOSampleRate srate = 0.0;
iasio->getSampleRate(&srate);
@@ -506,10 +506,10 @@ ASIOInput::ASIOInput() {
if (iasio) {
iasio->Release();
- iasio = NULL;
+ iasio = nullptr;
}
- QMessageBox::critical(NULL, QLatin1String("Mumble"), tr("Opening selected ASIO device failed. No input will be done."),
+ QMessageBox::critical(nullptr, QLatin1String("Mumble"), tr("Opening selected ASIO device failed. No input will be done."),
QMessageBox::Ok, QMessageBox::NoButton);
}
@@ -521,14 +521,14 @@ ASIOInput::~ASIOInput() {
iasio->stop();
iasio->disposeBuffers();
iasio->Release();
- iasio = NULL;
+ iasio = nullptr;
}
delete [] abiInfo;
- abiInfo = NULL;
+ abiInfo = nullptr;
delete [] aciInfo;
- aciInfo = NULL;
+ aciInfo = nullptr;
}
void ASIOInput::run() {
diff --git a/src/mumble/Audio.cpp b/src/mumble/Audio.cpp
index 5e1aa24c9..31cc481b7 100644
--- a/src/mumble/Audio.cpp
+++ b/src/mumble/Audio.cpp
@@ -47,7 +47,7 @@ void CodecInit::initialize() {
return;
}
- CELTCodec *codec = NULL;
+ CELTCodec *codec = nullptr;
#ifdef USE_SBCELT
codec = new CELTCodecSBCELT();
@@ -92,7 +92,7 @@ LoopUser::LoopUser() {
bMute = bDeaf = bSuppress = false;
bLocalIgnore = bLocalMute = bSelfDeaf = false;
tsState = Settings::Passive;
- cChannel = NULL;
+ cChannel = nullptr;
qetTicker.start();
qetLastFetch.start();
}
diff --git a/src/mumble/AudioConfigDialog.cpp b/src/mumble/AudioConfigDialog.cpp
index c1dcadfc1..d9eb7eff9 100644
--- a/src/mumble/AudioConfigDialog.cpp
+++ b/src/mumble/AudioConfigDialog.cpp
@@ -443,7 +443,7 @@ void AudioInputDialog::updateEchoEnableState() {
void AudioInputDialog::on_Tick_timeout() {
AudioInputPtr ai = g.ai;
- if (ai.get() == NULL || ! ai->sppPreprocess)
+ if (!ai.get() || ! ai->sppPreprocess)
return;
abSpeech->iBelow = qsTransmitMin->value();
diff --git a/src/mumble/AudioInput.cpp b/src/mumble/AudioInput.cpp
index 0e8a347ad..f9cf75352 100644
--- a/src/mumble/AudioInput.cpp
+++ b/src/mumble/AudioInput.cpp
@@ -150,7 +150,7 @@ AudioInputPtr AudioInputRegistrar::newFromChoice(QString choice) {
return AudioInputPtr(qmNew->value(choice)->create());
}
- AudioInputRegistrar *r = NULL;
+ AudioInputRegistrar *r = nullptr;
foreach(AudioInputRegistrar *air, *qmNew)
if (!r || (air->priority > r->priority))
r = air;
@@ -182,22 +182,22 @@ AudioInput::AudioInput() : opusBuffer(g.s.iFramesPerPacket * (SAMPLE_RATE / 100)
umtType = MessageHandler::UDPVoiceCELTAlpha;
activityState = ActivityStateActive;
- oCodec = NULL;
- opusState = NULL;
- cCodec = NULL;
- ceEncoder = NULL;
+ oCodec = nullptr;
+ opusState = nullptr;
+ cCodec = nullptr;
+ ceEncoder = nullptr;
#ifdef USE_OPUS
oCodec = g.oCodec;
if (oCodec) {
if (bAllowLowDelay && iAudioQuality >= 64000) { // > 64 kbit/s bitrate and low delay allowed
- opusState = oCodec->opus_encoder_create(SAMPLE_RATE, 1, OPUS_APPLICATION_RESTRICTED_LOWDELAY, NULL);
+ opusState = oCodec->opus_encoder_create(SAMPLE_RATE, 1, OPUS_APPLICATION_RESTRICTED_LOWDELAY, nullptr);
qWarning("AudioInput: Opus encoder set for low delay");
} else if (iAudioQuality >= 32000) { // > 32 kbit/s bitrate
- opusState = oCodec->opus_encoder_create(SAMPLE_RATE, 1, OPUS_APPLICATION_AUDIO, NULL);
+ opusState = oCodec->opus_encoder_create(SAMPLE_RATE, 1, OPUS_APPLICATION_AUDIO, nullptr);
qWarning("AudioInput: Opus encoder set for high quality speech");
} else {
- opusState = oCodec->opus_encoder_create(SAMPLE_RATE, 1, OPUS_APPLICATION_VOIP, NULL);
+ opusState = oCodec->opus_encoder_create(SAMPLE_RATE, 1, OPUS_APPLICATION_VOIP, nullptr);
qWarning("AudioInput: Opus encoder set for low quality speech");
}
@@ -221,9 +221,9 @@ AudioInput::AudioInput() : opusBuffer(g.s.iFramesPerPacket * (SAMPLE_RATE / 100)
bEchoMulti = false;
- sppPreprocess = NULL;
- sesEcho = NULL;
- srsMic = srsEcho = NULL;
+ sppPreprocess = nullptr;
+ sesEcho = nullptr;
+ srsMic = srsEcho = nullptr;
iEchoChannels = iMicChannels = 0;
iEchoFilled = iMicFilled = 0;
@@ -234,7 +234,7 @@ AudioInput::AudioInput() : opusBuffer(g.s.iFramesPerPacket * (SAMPLE_RATE / 100)
bResetEncoder = true;
- pfMicInput = pfEchoInput = NULL;
+ pfMicInput = pfEchoInput = nullptr;
iBitrate = 0;
dPeakSignal = dPeakSpeaker = dPeakMic = dPeakCleanMic = 0.0;
@@ -382,7 +382,7 @@ IN_MIXER_SHORT(8)
IN_MIXER_SHORT(N)
AudioInput::inMixerFunc AudioInput::chooseMixer(const unsigned int nchan, SampleFormat sf, quint64 chanmask) {
- inMixerFunc r = NULL;
+ inMixerFunc r = nullptr;
if (chanmask != 0xffffffffffffffffULL) {
if (sf == SampleFloat) {
@@ -483,8 +483,8 @@ void AudioInput::initializeMixer() {
iEchoFrameSize = bEchoMulti ? iFrameSize * iEchoChannels : iFrameSize;
pfEchoInput = new float[iEchoMCLength];
} else {
- srsEcho = NULL;
- pfEchoInput = NULL;
+ srsEcho = nullptr;
+ pfEchoInput = nullptr;
}
uiMicChannelMask = g.s.uiAudioInputChannelMask;
@@ -731,7 +731,7 @@ void AudioInput::resetAudioProcessor() {
qWarning("AudioInput: ECHO CANCELLER ACTIVE");
} else {
- sesEcho = NULL;
+ sesEcho = nullptr;
}
bResetEncoder = true;
@@ -754,7 +754,7 @@ bool AudioInput::selectCodec() {
}
if (!useOpus) {
- CELTCodec *switchto = NULL;
+ CELTCodec *switchto = nullptr;
if ((!g.uiSession || (g.s.lmLoopMode == Settings::Local)) && (!g.qmCodecs.isEmpty())) {
// Use latest for local loopback
QMap<int, CELTCodec *>::const_iterator i = g.qmCodecs.constEnd();
@@ -776,7 +776,7 @@ bool AudioInput::selectCodec() {
if (switchto != cCodec) {
if (cCodec && ceEncoder) {
cCodec->celt_encoder_destroy(ceEncoder);
- ceEncoder = NULL;
+ ceEncoder = nullptr;
}
cCodec = switchto;
if (cCodec)
@@ -822,7 +822,7 @@ int AudioInput::encodeOpusFrame(short *source, int size, EncodingOutputBuffer& b
}
if (bResetEncoder) {
- oCodec->opus_encoder_ctl(opusState, OPUS_RESET_STATE, NULL);
+ oCodec->opus_encoder_ctl(opusState, OPUS_RESET_STATE, nullptr);
bResetEncoder = false;
}
diff --git a/src/mumble/AudioOutput.cpp b/src/mumble/AudioOutput.cpp
index 8a8f01eec..116c9efbb 100644
--- a/src/mumble/AudioOutput.cpp
+++ b/src/mumble/AudioOutput.cpp
@@ -202,7 +202,7 @@ void AudioOutput::removeBuffer(AudioOutputUser *aop) {
AudioOutputSample *AudioOutput::playSample(const QString &filename, bool loop) {
SoundFile *handle = AudioOutputSample::loadSndfile(filename);
- if (handle == nullptr)
+ if (!handle)
return nullptr;
Timer t;
diff --git a/src/mumble/AudioOutputSample.cpp b/src/mumble/AudioOutputSample.cpp
index 7b2abc315..981a76518 100644
--- a/src/mumble/AudioOutputSample.cpp
+++ b/src/mumble/AudioOutputSample.cpp
@@ -39,7 +39,7 @@ SoundFile::~SoundFile() {
}
bool SoundFile::isOpen() const {
- return (sfFile != nullptr) && qfFile.isOpen();
+ return sfFile && qfFile.isOpen();
}
int SoundFile::channels() const {
@@ -198,7 +198,7 @@ QString AudioOutputSample::browseForSndfile(QString defaultpath) {
QString file = QFileDialog::getOpenFileName(nullptr, tr("Choose sound file"), defaultpath, QLatin1String("*.wav *.ogg *.ogv *.oga *.flac *.aiff"));
if (! file.isEmpty()) {
SoundFile *sf = AudioOutputSample::loadSndfile(file);
- if (sf == nullptr) {
+ if (!sf) {
QMessageBox::critical(nullptr,
tr("Invalid sound file"),
tr("The file '%1' cannot be used by Mumble. Please select a file with a compatible format and encoding.").arg(file.toHtmlEscaped()));
diff --git a/src/mumble/AudioStats.cpp b/src/mumble/AudioStats.cpp
index 11f25a20d..b6542003c 100644
--- a/src/mumble/AudioStats.cpp
+++ b/src/mumble/AudioStats.cpp
@@ -213,7 +213,7 @@ void AudioNoiseWidget::paintEvent(QPaintEvent *) {
paint.fillRect(rect(), pal.color(QPalette::Window));
AudioInputPtr ai = g.ai;
- if (ai.get() == NULL || ! ai->sppPreprocess)
+ if (!ai.get() || ! ai->sppPreprocess)
return;
QPolygonF poly;
@@ -315,7 +315,7 @@ AudioStats::~AudioStats() {
void AudioStats::on_Tick_timeout() {
AudioInputPtr ai = g.ai;
- if (ai.get() == NULL || ! ai->sppPreprocess)
+ if (!ai.get() || ! ai->sppPreprocess)
return;
bool nTalking = ai->isTransmitting();
diff --git a/src/mumble/AudioStats.h b/src/mumble/AudioStats.h
index 8c17460c2..16409a1a3 100644
--- a/src/mumble/AudioStats.h
+++ b/src/mumble/AudioStats.h
@@ -18,7 +18,7 @@ class AudioBar : public QWidget {
protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
public:
- AudioBar(QWidget *parent = NULL);
+ AudioBar(QWidget *parent = nullptr);
int iMin, iMax;
int iBelow, iAbove;
int iValue, iPeak;
diff --git a/src/mumble/AudioWizard.cpp b/src/mumble/AudioWizard.cpp
index cf17b37ba..ac663f23c 100644
--- a/src/mumble/AudioWizard.cpp
+++ b/src/mumble/AudioWizard.cpp
@@ -165,9 +165,9 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
fAngle = 0.0f;
fX = fY = 0.0f;
- qgsScene = NULL;
- qgiSource = NULL;
- aosSource = NULL;
+ qgsScene = nullptr;
+ qgiSource = nullptr;
+ aosSource = nullptr;
qgvView->scale(1.0f, -1.0f);
qgvView->viewport()->installEventFilter(this);
qgvView->setRenderHints(QPainter::Antialiasing);
@@ -323,7 +323,7 @@ void AudioWizard::showPage(int pageid) {
AudioOutputPtr ao = g.ao;
if (ao)
ao->wipe();
- aosSource = NULL;
+ aosSource = nullptr;
g.bPosTest = false;
@@ -340,8 +340,8 @@ void AudioWizard::showPage(int pageid) {
g.bPosTest = true;
if (qgsScene) {
delete qgsScene;
- qgiSource = NULL;
- qgsScene = NULL;
+ qgiSource = nullptr;
+ qgsScene = nullptr;
}
playChord();
} else {
@@ -379,7 +379,7 @@ void AudioWizard::playChord() {
}
void AudioWizard::restartAudio() {
- aosSource = NULL;
+ aosSource = nullptr;
Audio::stop();
@@ -390,8 +390,8 @@ void AudioWizard::restartAudio() {
if (qgsScene) {
delete qgsScene;
- qgiSource = NULL;
- qgsScene = NULL;
+ qgiSource = nullptr;
+ qgsScene = nullptr;
}
if ((currentPage() == qwpPositional) || (currentPage() == qwpDeviceTuning))
@@ -407,7 +407,7 @@ void AudioWizard::reject() {
AudioOutputPtr ao = g.ao;
if (ao)
ao->wipe();
- aosSource = NULL;
+ aosSource = nullptr;
g.bInAudioWizard = false;
g.mw->onChangeMute();
diff --git a/src/mumble/AudioWizard.h b/src/mumble/AudioWizard.h
index bc3ae627a..ac959baa3 100644
--- a/src/mumble/AudioWizard.h
+++ b/src/mumble/AudioWizard.h
@@ -20,7 +20,7 @@ class CompletablePage : public QWizardPage {
protected:
bool bComplete;
public:
- CompletablePage(QWizard *p = NULL);
+ CompletablePage(QWizard *p = nullptr);
void setComplete(bool);
bool isComplete() const Q_DECL_OVERRIDE;
};
diff --git a/src/mumble/BanEditor.h b/src/mumble/BanEditor.h
index c0536ba31..8a1b0c79c 100644
--- a/src/mumble/BanEditor.h
+++ b/src/mumble/BanEditor.h
@@ -25,7 +25,7 @@ class BanEditor : public QDialog, public Ui::BanEditor {
Ban toBan(bool &);
public:
- BanEditor(const MumbleProto::BanList &msbl, QWidget *p = NULL);
+ BanEditor(const MumbleProto::BanList &msbl, QWidget *p = nullptr);
public slots:
void accept();
void on_qlwBans_currentRowChanged();
diff --git a/src/mumble/BonjourClient.cpp b/src/mumble/BonjourClient.cpp
index 02fdfe838..4f04e6c6f 100644
--- a/src/mumble/BonjourClient.cpp
+++ b/src/mumble/BonjourClient.cpp
@@ -8,7 +8,7 @@
BonjourClient::BonjourClient() {
#ifdef Q_OS_WIN
HMODULE hLib = LoadLibrary(L"DNSSD.DLL");
- if (hLib == NULL) {
+ if (!hLib) {
qWarning("Bonjour: Failed to load dnssd.dll");
return;
}
diff --git a/src/mumble/CELTCodec.cpp b/src/mumble/CELTCodec.cpp
index 1e64c6b48..c7cda62c4 100644
--- a/src/mumble/CELTCodec.cpp
+++ b/src/mumble/CELTCodec.cpp
@@ -10,9 +10,9 @@
#include "MumbleApplication.h"
#ifdef Q_CC_GNU
-#define RESOLVE(var) { var = reinterpret_cast<__typeof__(var)>(qlCELT.resolve(#var)); bValid = bValid && (var != NULL); }
+#define RESOLVE(var) { var = reinterpret_cast<__typeof__(var)>(qlCELT.resolve(#var)); bValid = bValid && var; }
#else
-#define RESOLVE(var) { * reinterpret_cast<void **>(&var) = static_cast<void *>(qlCELT.resolve(#var)); bValid = bValid && (var != NULL); }
+#define RESOLVE(var) { * reinterpret_cast<void **>(&var) = static_cast<void *>(qlCELT.resolve(#var)); bValid = bValid && var; }
#endif
#ifdef Q_OS_WIN
@@ -23,7 +23,7 @@ extern "C" {
CELTCodec::CELTCodec(const QString &celt_version) {
bValid = false;
- cmMode = NULL;
+ cmMode = nullptr;
qsVersion = celt_version;
iBitstreamVersion = INT_MIN;
qlCELT.setLoadHints(QLibrary::ResolveAllSymbolsHint);
@@ -128,20 +128,20 @@ CELTCodec070::CELTCodec070(const QString &celt_version) : CELTCodec(celt_version
RESOLVE(celt_strerror);
if (bValid) {
- cmMode = celt_mode_create(SAMPLE_RATE, SAMPLE_RATE / 100, NULL);
+ cmMode = celt_mode_create(SAMPLE_RATE, SAMPLE_RATE / 100, nullptr);
}
}
CELTEncoder *CELTCodec070::encoderCreate() {
- return celt_encoder_create(cmMode, 1, NULL);
+ return celt_encoder_create(cmMode, 1, nullptr);
}
CELTDecoder *CELTCodec070::decoderCreate() {
- return celt_decoder_create(cmMode, 1, NULL);
+ return celt_decoder_create(cmMode, 1, nullptr);
}
int CELTCodec070::encode(CELTEncoder *st, const celt_int16 *pcm, unsigned char *compressed, int nbCompressedBytes) {
- return celt_encode(st, pcm, NULL, compressed, nbCompressedBytes);
+ return celt_encode(st, pcm, nullptr, compressed, nbCompressedBytes);
}
int CELTCodec070::decode_float(CELTDecoder *st, const unsigned char *data, int len, float *pcm) {
diff --git a/src/mumble/CELTCodec_sbcelt.cpp b/src/mumble/CELTCodec_sbcelt.cpp
index bfead7bdd..12134d53d 100644
--- a/src/mumble/CELTCodec_sbcelt.cpp
+++ b/src/mumble/CELTCodec_sbcelt.cpp
@@ -10,7 +10,7 @@
CELTCodec::CELTCodec(const QString &version) {
bValid = true;
- cmMode = NULL;
+ cmMode = nullptr;
qsVersion = version;
iBitstreamVersion = INT_MIN;
@@ -47,8 +47,8 @@ void CELTCodec::report() const {
CELTCodecSBCELT::CELTCodecSBCELT() : CELTCodec(QLatin1String("0.7.0")) {
if (bValid) {
- cmMode = ::celt_mode_create(SAMPLE_RATE, SAMPLE_RATE / 100, NULL);
- cmSBCELTMode = ::sbcelt_mode_create(SAMPLE_RATE, SAMPLE_RATE / 100, NULL);
+ cmMode = ::celt_mode_create(SAMPLE_RATE, SAMPLE_RATE / 100, nullptr);
+ cmSBCELTMode = ::sbcelt_mode_create(SAMPLE_RATE, SAMPLE_RATE / 100, nullptr);
this->celt_decoder_destroy = ::sbcelt_decoder_destroy;
this->celt_decoder_ctl = ::sbcelt_decoder_ctl;
@@ -56,15 +56,15 @@ CELTCodecSBCELT::CELTCodecSBCELT() : CELTCodec(QLatin1String("0.7.0")) {
}
CELTEncoder *CELTCodecSBCELT::encoderCreate() {
- return ::celt_encoder_create(cmMode, 1, NULL);
+ return ::celt_encoder_create(cmMode, 1, nullptr);
}
CELTDecoder *CELTCodecSBCELT::decoderCreate() {
- return ::sbcelt_decoder_create(cmSBCELTMode, 1, NULL);
+ return ::sbcelt_decoder_create(cmSBCELTMode, 1, nullptr);
}
int CELTCodecSBCELT::encode(CELTEncoder *st, const celt_int16 *pcm, unsigned char *compressed, int nbCompressedBytes) {
- return ::celt_encode(st, pcm, NULL, compressed, nbCompressedBytes);
+ return ::celt_encode(st, pcm, nullptr, compressed, nbCompressedBytes);
}
int CELTCodecSBCELT::decode_float(CELTDecoder *st, const unsigned char *data, int len, float *pcm) {
diff --git a/src/mumble/Cert.cpp b/src/mumble/Cert.cpp
index 197657859..4b4975f84 100644
--- a/src/mumble/Cert.cpp
+++ b/src/mumble/Cert.cpp
@@ -388,24 +388,24 @@ Settings::KeyPair CertWizard::generateNewCert(QString qsname, const QString &qse
}
Settings::KeyPair CertWizard::importCert(QByteArray data, const QString &pw) {
- X509 *x509 = NULL;
- EVP_PKEY *pkey = NULL;
- PKCS12 *pkcs = NULL;
- BIO *mem = NULL;
- STACK_OF(X509) *certs = NULL;
+ X509 *x509 = nullptr;
+ EVP_PKEY *pkey = nullptr;
+ PKCS12 *pkcs = nullptr;
+ BIO *mem = nullptr;
+ STACK_OF(X509) *certs = nullptr;
Settings::KeyPair kp;
int ret = 0;
mem = BIO_new_mem_buf(data.data(), data.size());
Q_UNUSED(BIO_set_close(mem, BIO_NOCLOSE));
- pkcs = d2i_PKCS12_bio(mem, NULL);
+ pkcs = d2i_PKCS12_bio(mem, nullptr);
if (pkcs) {
- ret = PKCS12_parse(pkcs, NULL, &pkey, &x509, &certs);
+ ret = PKCS12_parse(pkcs, nullptr, &pkey, &x509, &certs);
if (pkcs && !pkey && !x509 && ! pw.isEmpty()) {
if (certs) {
if (ret)
sk_X509_free(certs);
- certs = NULL;
+ certs = nullptr;
}
ret = PKCS12_parse(pkcs, pw.toUtf8().constData(), &pkey, &x509, &certs);
}
@@ -413,11 +413,11 @@ Settings::KeyPair CertWizard::importCert(QByteArray data, const QString &pw) {
unsigned char *dptr;
QByteArray key, crt;
- key.resize(i2d_PrivateKey(pkey, NULL));
+ key.resize(i2d_PrivateKey(pkey, nullptr));
dptr=reinterpret_cast<unsigned char *>(key.data());
i2d_PrivateKey(pkey, &dptr);
- crt.resize(i2d_X509(x509, NULL));
+ crt.resize(i2d_X509(x509, nullptr));
dptr=reinterpret_cast<unsigned char *>(crt.data());
i2d_X509(x509, &dptr);
@@ -431,7 +431,7 @@ Settings::KeyPair CertWizard::importCert(QByteArray data, const QString &pw) {
for (int i=0;i<sk_X509_num(certs);++i) {
X509 *c = sk_X509_value(certs, i);
- crt.resize(i2d_X509(c, NULL));
+ crt.resize(i2d_X509(c, nullptr));
dptr=reinterpret_cast<unsigned char *>(crt.data());
i2d_X509(c, &dptr);
@@ -464,13 +464,13 @@ Settings::KeyPair CertWizard::importCert(QByteArray data, const QString &pw) {
}
QByteArray CertWizard::exportCert(const Settings::KeyPair &kp) {
- X509 *x509 = NULL;
- EVP_PKEY *pkey = NULL;
- PKCS12 *pkcs = NULL;
- BIO *mem = NULL;
+ X509 *x509 = nullptr;
+ EVP_PKEY *pkey = nullptr;
+ PKCS12 *pkcs = nullptr;
+ BIO *mem = nullptr;
STACK_OF(X509) *certs = sk_X509_new_null();
const unsigned char *p;
- char *data = NULL;
+ char *data = nullptr;
if (kp.first.isEmpty())
return QByteArray();
@@ -480,26 +480,26 @@ QByteArray CertWizard::exportCert(const Settings::KeyPair &kp) {
QByteArray qba;
p = reinterpret_cast<const unsigned char *>(key.constData());
- pkey = d2i_AutoPrivateKey(NULL, &p, key.length());
+ pkey = d2i_AutoPrivateKey(nullptr, &p, key.length());
if (pkey) {
p = reinterpret_cast<const unsigned char *>(crt.constData());
- x509 = d2i_X509(NULL, &p, crt.length());
+ x509 = d2i_X509(nullptr, &p, crt.length());
if (x509 && X509_check_private_key(x509, pkey)) {
- X509_keyid_set1(x509, NULL, 0);
- X509_alias_set1(x509, NULL, 0);
+ X509_keyid_set1(x509, nullptr, 0);
+ X509_alias_set1(x509, nullptr, 0);
QList<QSslCertificate> qlCerts = kp.first;
qlCerts.removeFirst();
foreach(const QSslCertificate &cert, qlCerts) {
- X509 *c = NULL;
+ X509 *c = nullptr;
crt = cert.toDer();
p = reinterpret_cast<const unsigned char *>(crt.constData());
- c = d2i_X509(NULL, &p, crt.length());
+ c = d2i_X509(nullptr, &p, crt.length());
if (c)
sk_X509_push(certs, c);
}
diff --git a/src/mumble/Cert.h b/src/mumble/Cert.h
index 1dcf8fc71..907192cb3 100644
--- a/src/mumble/Cert.h
+++ b/src/mumble/Cert.h
@@ -39,7 +39,7 @@ class CertWizard : public QWizard, public Ui::Certificates {
protected:
Settings::KeyPair kpCurrent, kpNew;
public:
- CertWizard(QWidget *p = NULL);
+ CertWizard(QWidget *p = nullptr);
int nextId() const Q_DECL_OVERRIDE;
void initializePage(int) Q_DECL_OVERRIDE;
bool validateCurrentPage() Q_DECL_OVERRIDE;
diff --git a/src/mumble/ClientUser.cpp b/src/mumble/ClientUser.cpp
index c296031a0..94a35312c 100644
--- a/src/mumble/ClientUser.cpp
+++ b/src/mumble/ClientUser.cpp
@@ -77,7 +77,7 @@ ClientUser *ClientUser::match(const ClientUser *other, bool matchname) {
if (matchname && (p->qsName == other->qsName))
return p;
}
- return NULL;
+ return nullptr;
}
void ClientUser::remove(unsigned int uiSession) {
@@ -269,7 +269,7 @@ bool ClientUser::lessThanOverlay(const ClientUser *first, const ClientUser *seco
// If both times are invalid, fall back to alphabetically (continuing below)
}
- if (first->cChannel == second->cChannel || first->cChannel == NULL || second->cChannel == NULL)
+ if (first->cChannel == second->cChannel || !first->cChannel || !second->cChannel)
return lessThan(first, second);
// When sorting for the overlay always place the local users
diff --git a/src/mumble/ClientUser.h b/src/mumble/ClientUser.h
index 121ed3aef..08cb43792 100644
--- a/src/mumble/ClientUser.h
+++ b/src/mumble/ClientUser.h
@@ -35,7 +35,7 @@ class ClientUser : public QObject, public User {
QString qsFriendName;
QString getFlagsString() const;
- ClientUser(QObject *p = NULL);
+ ClientUser(QObject *p = nullptr);
/**
* Determines whether a user is active or not
@@ -56,7 +56,7 @@ class ClientUser : public QObject, public User {
static ClientUser *get(unsigned int);
static bool isValid(unsigned int);
- static ClientUser *add(unsigned int, QObject *p = NULL);
+ static ClientUser *add(unsigned int, QObject *p = nullptr);
static ClientUser *match(const ClientUser *p, bool matchname = false);
static void remove(unsigned int);
static void remove(ClientUser *);
diff --git a/src/mumble/ConfigDialog.cpp b/src/mumble/ConfigDialog.cpp
index 1066b6941..ab01414ee 100644
--- a/src/mumble/ConfigDialog.cpp
+++ b/src/mumble/ConfigDialog.cpp
@@ -176,7 +176,7 @@ void ConfigDialog::on_qlwIcons_currentItemChanged(QListWidgetItem *current, QLis
void ConfigDialog::updateListView() {
QWidget *ccw = qmIconWidgets.value(qlwIcons->currentItem());
- QListWidgetItem *sel = NULL;
+ QListWidgetItem *sel = nullptr;
qmIconWidgets.clear();
qlwIcons->clear();
diff --git a/src/mumble/ConfigDialog.h b/src/mumble/ConfigDialog.h
index 70a25ac8b..9917b8183 100644
--- a/src/mumble/ConfigDialog.h
+++ b/src/mumble/ConfigDialog.h
@@ -28,7 +28,7 @@ class ConfigDialog : public QDialog, public Ui::ConfigDialog {
Settings s;
public:
- ConfigDialog(QWidget *p = NULL);
+ ConfigDialog(QWidget *p = nullptr);
~ConfigDialog() Q_DECL_OVERRIDE;
/// @returns The pointer to the existing ConfigWidget with the given name or nullptr,
diff --git a/src/mumble/ConfigWidget.cpp b/src/mumble/ConfigWidget.cpp
index 67b256739..d0dee7b13 100644
--- a/src/mumble/ConfigWidget.cpp
+++ b/src/mumble/ConfigWidget.cpp
@@ -26,7 +26,7 @@ ConfigRegistrar::~ConfigRegistrar() {
c_qmNew->remove(iPriority);
if (c_qmNew->isEmpty()) {
delete c_qmNew;
- c_qmNew = NULL;
+ c_qmNew = nullptr;
}
}
diff --git a/src/mumble/ConnectDialog.cpp b/src/mumble/ConnectDialog.cpp
index e52c03a9e..2ef47b791 100644
--- a/src/mumble/ConnectDialog.cpp
+++ b/src/mumble/ConnectDialog.cpp
@@ -107,7 +107,7 @@ ServerView::ServerView(QWidget *p) : QTreeWidget(p) {
siLAN->setExpanded(true);
siLAN->setHidden(true);
#else
- siLAN = NULL;
+ siLAN = nullptr;
#endif
if (!g.s.disablePublicList) {
@@ -119,7 +119,7 @@ ServerView::ServerView(QWidget *p) : QTreeWidget(p) {
} else {
qWarning()<< "Public list disabled";
- siPublic = NULL;
+ siPublic = nullptr;
}
}
@@ -131,7 +131,7 @@ ServerView::~ServerView() {
QMimeData *ServerView::mimeData(const QList<QTreeWidgetItem *> mimeitems) const {
if (mimeitems.isEmpty())
- return NULL;
+ return nullptr;
ServerItem *si = static_cast<ServerItem *>(mimeitems.first());
return si->toMimeData();
@@ -206,7 +206,7 @@ void ServerItem::init() {
}
ServerItem::ServerItem(const FavoriteServer &fs) : QTreeWidgetItem(QTreeWidgetItem::UserType) {
- siParent = NULL;
+ siParent = nullptr;
bParent = false;
itType = FavoriteType;
@@ -233,7 +233,7 @@ ServerItem::ServerItem(const FavoriteServer &fs) : QTreeWidgetItem(QTreeWidgetIt
}
ServerItem::ServerItem(const PublicInfo &pi) : QTreeWidgetItem(QTreeWidgetItem::UserType) {
- siParent = NULL;
+ siParent = nullptr;
bParent = false;
itType = PublicType;
qsName = pi.qsName;
@@ -249,7 +249,7 @@ ServerItem::ServerItem(const PublicInfo &pi) : QTreeWidgetItem(QTreeWidgetItem::
}
ServerItem::ServerItem(const QString &name, const QString &host, unsigned short port, const QString &username, const QString &password) : QTreeWidgetItem(QTreeWidgetItem::UserType) {
- siParent = NULL;
+ siParent = nullptr;
bParent = false;
itType = FavoriteType;
qsName = name;
@@ -273,7 +273,7 @@ ServerItem::ServerItem(const QString &name, const QString &host, unsigned short
#ifdef USE_BONJOUR
ServerItem::ServerItem(const BonjourRecord &br) : QTreeWidgetItem(QTreeWidgetItem::UserType) {
- siParent = NULL;
+ siParent = nullptr;
bParent = false;
itType = LANType;
qsName = br.serviceName;
@@ -287,7 +287,7 @@ ServerItem::ServerItem(const BonjourRecord &br) : QTreeWidgetItem(QTreeWidgetIte
#endif
ServerItem::ServerItem(const QString &name, ItemType itype) {
- siParent = NULL;
+ siParent = nullptr;
bParent = true;
qsName = name;
itType = itype;
@@ -298,7 +298,7 @@ ServerItem::ServerItem(const QString &name, ItemType itype) {
}
ServerItem::ServerItem(const ServerItem *si) {
- siParent = NULL;
+ siParent = nullptr;
bParent = false;
itType = FavoriteType;
@@ -343,7 +343,7 @@ ServerItem::~ServerItem() {
ServerItem *ServerItem::fromMimeData(const QMimeData *mime, bool default_name, QWidget *p, bool convertHttpUrls) {
if (mime->hasFormat(QLatin1String("OriginatedInMumble")))
- return NULL;
+ return nullptr;
QUrl url;
if (mime->hasUrls() && ! mime->urls().isEmpty())
@@ -378,13 +378,13 @@ ServerItem *ServerItem::fromMimeData(const QMimeData *mime, bool default_name, Q
}
if (! url.isValid()) {
- return NULL;
+ return nullptr;
}
// An URL from text without a scheme will have the hostname text
// in the QUrl scheme and no hostname. We do not want to use that.
if (url.host().isEmpty()) {
- return NULL;
+ return nullptr;
}
// Some communication programs automatically create http links from domains.
@@ -401,7 +401,7 @@ ServerItem *ServerItem::fromMimeData(const QMimeData *mime, bool default_name, Q
ServerItem *ServerItem::fromUrl(QUrl url, QWidget *p) {
if (! url.isValid() || (url.scheme() != QLatin1String("mumble"))) {
- return NULL;
+ return nullptr;
}
QUrlQuery query(url);
@@ -411,9 +411,9 @@ ServerItem *ServerItem::fromUrl(QUrl url, QWidget *p) {
bool ok;
QString defUserName = QInputDialog::getText(p, ConnectDialog::tr("Adding host %1").arg(url.host()), ConnectDialog::tr("Enter username"), QLineEdit::Normal, g.s.qsUsername, &ok).trimmed();
if (! ok)
- return NULL;
+ return nullptr;
if (defUserName.isEmpty())
- return NULL;
+ return nullptr;
g.s.qsUsername = defUserName;
}
url.setUserName(g.s.qsUsername);
@@ -519,7 +519,7 @@ QVariant ServerItem::data(int column, int role) const {
}
void ServerItem::addServerItem(ServerItem *childitem) {
- Q_ASSERT(childitem->siParent == NULL);
+ Q_ASSERT(!childitem->siParent);
childitem->siParent = this;
qlChildren.append(childitem);
@@ -748,7 +748,7 @@ ConnectDialogEdit::ConnectDialogEdit(QWidget *parent) : QDialog(parent) {
}
void ConnectDialogEdit::init() {
- m_si = NULL;
+ m_si = nullptr;
usPort = 0;
bOk = true;
bCustomLabel = false;
@@ -782,9 +782,8 @@ void ConnectDialogEdit::showNotice(const QString &text) {
bool ConnectDialogEdit::updateFromClipboard() {
delete m_si;
- m_si = ServerItem::fromMimeData(QApplication::clipboard()->mimeData(), false, NULL, true);
- bool hasServerData = m_si != NULL;
- if (hasServerData) {
+ m_si = ServerItem::fromMimeData(QApplication::clipboard()->mimeData(), false, nullptr, true);
+ if (m_si) {
showNotice(tr("You have an URL in your clipboard.\nDo you want to fill the dialog with this data?\nHost: %1 Port: %2").arg(m_si->qsHostname).arg(m_si->usPort));
return true;
} else {
@@ -807,7 +806,7 @@ void ConnectDialogEdit::on_qbFill_clicked() {
qlePassword->setText(m_si->qsPassword);
delete m_si;
- m_si = NULL;
+ m_si = nullptr;
}
void ConnectDialogEdit::on_qbDiscard_clicked() {
@@ -904,7 +903,7 @@ ConnectDialog::ConnectDialog(QWidget *p, bool autoconnect) : QDialog(p), bAutoCo
#endif
bPublicInit = false;
- siAutoConnect = NULL;
+ siAutoConnect = nullptr;
bAllowPing = g.s.ptProxyType == Settings::NoProxy;
bAllowHostLookup = g.s.ptProxyType == Settings::NoProxy;
@@ -1024,7 +1023,7 @@ ConnectDialog::ConnectDialog(QWidget *p, bool autoconnect) : QDialog(p), bAutoCo
if (qtwServers->siFavorite->isHidden()
&& (!qtwServers->siLAN || qtwServers->siLAN->isHidden())
- && qtwServers->siPublic != NULL) {
+ && qtwServers->siPublic) {
qtwServers->siPublic->setExpanded(true);
}
@@ -1034,7 +1033,7 @@ ConnectDialog::ConnectDialog(QWidget *p, bool autoconnect) : QDialog(p), bAutoCo
new QShortcut(QKeySequence(QKeySequence::Copy), this, SLOT(on_qaFavoriteCopy_triggered()));
new QShortcut(QKeySequence(QKeySequence::Paste), this, SLOT(on_qaFavoritePaste_triggered()));
- qtwServers->setCurrentItem(NULL);
+ qtwServers->setCurrentItem(nullptr);
bLastFound = false;
qmPingCache = g.db->getPingCache();
@@ -1220,11 +1219,11 @@ void ConnectDialog::on_qtwServers_customContextMenuRequested(const QPoint &mpos)
ServerItem *si = static_cast<ServerItem *>(qtwServers->itemAt(mpos));
qmPopup->clear();
- if (si != NULL && si->bParent) {
- si = NULL;
+ if (si && si->bParent) {
+ si = nullptr;
}
- if (si != NULL) {
+ if (si) {
if (!g.s.disableConnectDialogEditing) {
if (si->itType == ServerItem::FavoriteType) {
@@ -1240,7 +1239,7 @@ void ConnectDialog::on_qtwServers_customContextMenuRequested(const QPoint &mpos)
}
}
- qmPopup->popup(qtwServers->viewport()->mapToGlobal(mpos), NULL);
+ qmPopup->popup(qtwServers->viewport()->mapToGlobal(mpos), nullptr);
}
void ConnectDialog::on_qtwServers_itemDoubleClicked(QTreeWidgetItem *item, int) {
@@ -1267,7 +1266,7 @@ void ConnectDialog::on_qtwServers_currentItemChanged(QTreeWidgetItem *item, QTre
}
void ConnectDialog::on_qtwServers_itemExpanded(QTreeWidgetItem *item) {
- if (qtwServers->siPublic != NULL && item == qtwServers->siPublic) {
+ if (qtwServers->siPublic && item == qtwServers->siPublic) {
if (!g.s.bPingServersDialogViewed) {
// Ask the user for consent to ping the servers. If the user does
// not give consent, disable the public server list and return.
@@ -1300,7 +1299,7 @@ void ConnectDialog::on_qtwServers_itemExpanded(QTreeWidgetItem *item) {
void ConnectDialog::on_qtwServers_itemCollapsed(QTreeWidgetItem *item)
{
- if (qtwServers->siPublic != NULL && item == qtwServers->siPublic) {
+ if (qtwServers->siPublic && item == qtwServers->siPublic) {
qgbSearch->setVisible(false);
}
}
@@ -1463,7 +1462,7 @@ void ConnectDialog::timeTick() {
ServerItem *current = static_cast<ServerItem *>(qtwServers->currentItem());
ServerItem *hover = static_cast<ServerItem *>(qtwServers->itemAt(qtwServers->viewport()->mapFromGlobal(QCursor::pos())));
- ServerItem *si = NULL;
+ ServerItem *si = nullptr;
if (tCurrent.elapsed() >= 1000000ULL)
si = current;
@@ -1480,7 +1479,7 @@ void ConnectDialog::timeTick() {
qlDNSLookup.removeAll(unresolved);
qlDNSLookup.prepend(unresolved);
}
- si = NULL;
+ si = nullptr;
}
}
diff --git a/src/mumble/ConnectDialog.h b/src/mumble/ConnectDialog.h
index 02e684b84..f344e489b 100644
--- a/src/mumble/ConnectDialog.h
+++ b/src/mumble/ConnectDialog.h
@@ -77,7 +77,7 @@ class ServerViewDelegate : public QStyledItemDelegate {
Q_OBJECT
Q_DISABLE_COPY(ServerViewDelegate)
public:
- ServerViewDelegate(QObject *p = NULL);
+ ServerViewDelegate(QObject *p = nullptr);
~ServerViewDelegate();
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
@@ -163,9 +163,9 @@ class ServerItem : public QTreeWidgetItem, public PingStats {
/// @param mime Mime data to analyze
/// @param default_name If true the hostname is set as item name if none is given
/// @param p Parent widget to use in case the user has to be queried
- /// @return Server item or NULL if mime data invalid.
+ /// @return Server item or nullptr if mime data invalid.
///
- static ServerItem *fromMimeData(const QMimeData *mime, bool default_name = true, QWidget *p = NULL, bool convertHttpUrls=false);
+ static ServerItem *fromMimeData(const QMimeData *mime, bool default_name = true, QWidget *p = nullptr, bool convertHttpUrls=false);
/// Create a ServerItem from a mumble:// URL
static ServerItem *fromUrl(QUrl url, QWidget *p);
diff --git a/src/mumble/CrashReporter.cpp b/src/mumble/CrashReporter.cpp
index 79aed2b0d..6b743aea3 100644
--- a/src/mumble/CrashReporter.cpp
+++ b/src/mumble/CrashReporter.cpp
@@ -59,8 +59,8 @@ CrashReporter::CrashReporter(QWidget *p) : QDialog(p) {
vbl->addWidget(dbb);
qelLoop = new QEventLoop(this);
- qpdProgress = NULL;
- qnrReply = NULL;
+ qpdProgress = nullptr;
+ qnrReply = nullptr;
}
CrashReporter::~CrashReporter() {
@@ -72,11 +72,11 @@ void CrashReporter::uploadFinished() {
qpdProgress->reset();
if (qnrReply->error() == QNetworkReply::NoError) {
if (qnrReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 200)
- QMessageBox::information(NULL, tr("Crash upload successful"), tr("Thank you for helping make Mumble better!"));
+ QMessageBox::information(nullptr, tr("Crash upload successful"), tr("Thank you for helping make Mumble better!"));
else
- QMessageBox::critical(NULL, tr("Crash upload failed"), tr("We're really sorry, but it appears the crash upload has failed with error %1 %2. Please inform a developer.").arg(qnrReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()).arg(qnrReply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString()));
+ QMessageBox::critical(nullptr, tr("Crash upload failed"), tr("We're really sorry, but it appears the crash upload has failed with error %1 %2. Please inform a developer.").arg(qnrReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()).arg(qnrReply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString()));
} else {
- QMessageBox::critical(NULL, tr("Crash upload failed"), tr("This really isn't funny, but apparently there's a bug in the crash reporting code, and we've failed to upload the report. You may inform a developer about error %1").arg(qnrReply->error()));
+ QMessageBox::critical(nullptr, tr("Crash upload failed"), tr("This really isn't funny, but apparently there's a bug in the crash reporting code, and we've failed to upload the report. You may inform a developer about error %1").arg(qnrReply->error()));
}
qelLoop->exit(0);
}
diff --git a/src/mumble/CustomElements.h b/src/mumble/CustomElements.h
index 13122b64d..4ba63bc71 100644
--- a/src/mumble/CustomElements.h
+++ b/src/mumble/CustomElements.h
@@ -19,7 +19,7 @@ class LogTextBrowser : public QTextBrowser {
void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
bool event(QEvent *e) Q_DECL_OVERRIDE;
public:
- LogTextBrowser(QWidget *p = NULL);
+ LogTextBrowser(QWidget *p = nullptr);
int getLogScroll();
int getLogScrollMaximum();
@@ -68,7 +68,7 @@ class ChatbarTextEdit : public QTextEdit {
void historyUp();
void historyDown();
public:
- ChatbarTextEdit(QWidget *p = NULL);
+ ChatbarTextEdit(QWidget *p = nullptr);
};
class DockTitleBar : public QLabel {
diff --git a/src/mumble/Database.cpp b/src/mumble/Database.cpp
index 89eb5bc90..8b1fb83b1 100644
--- a/src/mumble/Database.cpp
+++ b/src/mumble/Database.cpp
@@ -89,14 +89,14 @@ Database::Database(const QString &dbname) {
}
if (! found) {
- QMessageBox::critical(NULL, QLatin1String("Mumble"), tr("Mumble failed to initialize a database in any\nof the possible locations."), QMessageBox::Ok | QMessageBox::Default, QMessageBox::NoButton);
+ QMessageBox::critical(nullptr, QLatin1String("Mumble"), tr("Mumble failed to initialize a database in any\nof the possible locations."), QMessageBox::Ok | QMessageBox::Default, QMessageBox::NoButton);
qFatal("Database: Failed initialization");
}
QFileInfo fi(db.databaseName());
if (! fi.isWritable()) {
- QMessageBox::critical(NULL, QLatin1String("Mumble"), tr("The database '%1' is read-only. Mumble cannot store server settings (i.e. SSL certificates) until you fix this problem.").arg(fi.filePath().toHtmlEscaped()), QMessageBox::Ok | QMessageBox::Default, QMessageBox::NoButton);
+ QMessageBox::critical(nullptr, QLatin1String("Mumble"), tr("The database '%1' is read-only. Mumble cannot store server settings (i.e. SSL certificates) until you fix this problem.").arg(fi.filePath().toHtmlEscaped()), QMessageBox::Ok | QMessageBox::Default, QMessageBox::NoButton);
qWarning("Database: Database is read-only");
}
diff --git a/src/mumble/DeveloperConsole.h b/src/mumble/DeveloperConsole.h
index 44d92de7c..33ec367c9 100644
--- a/src/mumble/DeveloperConsole.h
+++ b/src/mumble/DeveloperConsole.h
@@ -21,7 +21,7 @@ class DeveloperConsole : public QObject {
public slots:
void addLogMessage(const QString &);
public:
- DeveloperConsole(QObject *parent = NULL);
+ DeveloperConsole(QObject *parent = nullptr);
~DeveloperConsole();
void show();
};
diff --git a/src/mumble/G15LCDEngine_unix.cpp b/src/mumble/G15LCDEngine_unix.cpp
index c53e618e0..f1f8a5865 100644
--- a/src/mumble/G15LCDEngine_unix.cpp
+++ b/src/mumble/G15LCDEngine_unix.cpp
@@ -47,7 +47,7 @@ void G15LCDDeviceUnix::setEnabled(bool b) {
}
void G15LCDDeviceUnix::blitImage(QImage *img, bool) {
- Q_ASSERT(img != NULL);
+ Q_ASSERT(img);
const unsigned int len = 6880;
uchar buf[len];
diff --git a/src/mumble/GKey.cpp b/src/mumble/GKey.cpp
index 9461b5ee5..00776dd74 100644
--- a/src/mumble/GKey.cpp
+++ b/src/mumble/GKey.cpp
@@ -23,7 +23,7 @@
* Software in a non-standard location.
*
* The DLL has an init function, it's called "LogiGkeyInit". It takes a
- * pointer, but the parameter must always be NULL. The function returns a BOOL
+ * pointer, but the parameter must always be nullptr. The function returns a BOOL
* as a status code.
*
* The DLL also has a shutdown function, called "LogiGkeyShutdown". It takes
@@ -49,7 +49,7 @@
* polling functions above, but do not check whether the button is pressed or
* not. Instead, they return the name of the button being queried as a pointer
* to a NUL-terminated array of wchar_t's. Presumably, the pointer will be
- * NULL if the name cannot be retrieved or translated.
+ * nullptr if the name cannot be retrieved or translated.
*/
/* USAGE
@@ -68,9 +68,9 @@
#include "GKey.h"
#ifdef Q_CC_GNU
-#define RESOLVE(var) { var = reinterpret_cast<__typeof__(var)>(qlLogiGkey.resolve(#var)); bValid = bValid && (var != NULL); }
+#define RESOLVE(var) { var = reinterpret_cast<__typeof__(var)>(qlLogiGkey.resolve(#var)); bValid = bValid && var; }
#else
-#define RESOLVE(var) { * reinterpret_cast<void **>(&var) = static_cast<void *>(qlLogiGkey.resolve(#var)); bValid = bValid && (var != NULL); }
+#define RESOLVE(var) { * reinterpret_cast<void **>(&var) = static_cast<void *>(qlLogiGkey.resolve(#var)); bValid = bValid && var; }
#endif
const QUuid GKeyLibrary::quMouse = QUuid(QString::fromLatin1(GKEY_MOUSE_GUID));
@@ -80,12 +80,12 @@ GKeyLibrary::GKeyLibrary()
{
QStringList alternatives;
- HKEY key = NULL;
+ HKEY key = nullptr;
DWORD type = 0;
WCHAR wcLocation[510];
DWORD len = 510;
if (RegOpenKeyEx(GKEY_LOGITECH_DLL_REG_HKEY, GKEY_LOGITECH_DLL_REG_PATH, 0, KEY_READ, &key) == ERROR_SUCCESS) {
- LONG err = RegQueryValueEx(key, L"", NULL, &type, reinterpret_cast<LPBYTE>(wcLocation), &len);
+ LONG err = RegQueryValueEx(key, L"", nullptr, &type, reinterpret_cast<LPBYTE>(wcLocation), &len);
if (err == ERROR_SUCCESS && type == REG_SZ) {
QString qsLocation = QString::fromUtf16(reinterpret_cast<ushort *>(wcLocation), len / 2);
qWarning("GKeyLibrary: Found ServerBinary with libLocation = \"%s\", len = %lu", qPrintable(qsLocation), static_cast<unsigned long>(len));
@@ -113,11 +113,11 @@ GKeyLibrary::GKeyLibrary()
RESOLVE(LogiGkeyGetKeyboardGkeyString);
if (bValid)
- bValid = LogiGkeyInit(NULL);
+ bValid = LogiGkeyInit(nullptr);
}
GKeyLibrary::~GKeyLibrary() {
- if (LogiGkeyShutdown != NULL)
+ if (LogiGkeyShutdown)
LogiGkeyShutdown();
}
diff --git a/src/mumble/Global.cpp b/src/mumble/Global.cpp
index b3c0d5716..23dbb7054 100644
--- a/src/mumble/Global.cpp
+++ b/src/mumble/Global.cpp
@@ -102,15 +102,15 @@ Global::Global() {
uiImageLength = 131072;
uiMaxUsers = 0;
- qs = NULL;
+ qs = nullptr;
- bc = NULL;
- lcd = NULL;
- l = NULL;
+ bc = nullptr;
+ lcd = nullptr;
+ l = nullptr;
#ifdef USE_OVERLAY
- ocIntercept = NULL;
- o = NULL;
+ ocIntercept = nullptr;
+ o = nullptr;
#endif
bHappyEaster = false;
@@ -126,7 +126,7 @@ Global::Global() {
#if defined(Q_OS_WIN)
QString appdata;
wchar_t appData[MAX_PATH];
- if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appData))) {
+ if (SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_APPDATA, nullptr, SHGFP_TYPE_CURRENT, appData))) {
appdata = QDir::fromNativeSeparators(QString::fromWCharArray(appData));
if (!appdata.isEmpty()) {
@@ -177,10 +177,10 @@ Global::~Global() {
const char Global::ccHappyEaster[] = {072, 057, 0162, 0145, 0143, 056, 0163, 0166, 0147, 0, 0117, 0160, 0145, 0156, 040, 0164, 0150, 0145, 040, 0160, 0157, 0144, 040, 0142, 0141, 0171, 040, 0144, 0157, 0157, 0162, 0163, 054, 040, 0110, 0101, 0114, 056, 0, 0111, 047, 0155, 040, 0163, 0157, 0162, 0162, 0171, 054, 040, 045, 061, 056, 040, 0111, 047, 0155, 040, 0141, 0146, 0162, 0141, 0151, 0144, 040, 0111, 040, 0143, 0141, 0156, 047, 0164, 040, 0144, 0157, 040, 0164, 0150, 0141, 0164, 056, 0, 0121,0127,0151,0144,0147,0145,0164,0173,0142,0141,0143,0153,0147,0162,0157,0165,0156,0144,055,0143,0157,0154,0157,0162,072,0142,0154,0141,0143,0153,073,0141,0154,0164,0145,0162,0156,0141,0164,0145,055,0142,0141,0143,0153,0147,0162,0157,0165,0156,0144,055,0143,0157,0154,0157,0162,072,043,063,063,060,060,060,060,073,0143,0157,0154,0157,0162,072,0167,0150,0151,0164,0145,073,0175,0121,0124,0145,0170,0164,0102,0162,0157,0167,0163,0145,0162,0173,0142,0141,0143,0153,0147,0162,0157,0165,0156,0144,055,0151,0155,0141,0147,0145,072,0165,0162,0154,050,072,057,0162,0145,0143,056,0163,0166,0147,051,073,0142,0141,0143,0153,0147,0162,0157,0165,0156,0144,055,0160,0157,0163,0151,0164,0151,0157,0156,072,0143,0145,0156,0164,0145,0162,0143,0145,0156,0164,0145,0162,073,0142,0141,0143,0153,0147,0162,0157,0165,0156,0144,055,0143,0154,0151,0160,072,0160,0141,0144,0144,0151,0156,0147,073,0142,0141,0143,0153,0147,0162,0157,0165,0156,0144,055,0157,0162,0151,0147,0151,0156,072,0160,0141,0144,0144,0151,0156,0147,073,0142,0141,0143,0153,0147,0162,0157,0165,0156,0144,055,0162,0145,0160,0145,0141,0164,072,0156,0157,055,0162,0145,0160,0145,0141,0164,073,0142,0141,0143,0153,0147,0162,0157,0165,0156,0144,055,0141,0164,0164,0141,0143,0150,0155,0145,0156,0164,072,0146,0151,0170,0145,0144,073,0175,0121,0115,0145,0156,0165,0102,0141,0162,072,072,0151,0164,0145,0155,0173,0142,0141,0143,0153,0147,0162,0157,0165,0156,0144,072,0164,0162,0141,0156,0163,0160,0141,0162,0145,0156,0164,073,0175,0121,0110,0145,0141,0144,0145,0162,0126,0151,0145,0167,072,072,0163,0145,0143,0164,0151,0157,0156,0173,0142,0141,0143,0153,0147,0162,0157,0165,0156,0144,072,0164,0162,0141,0156,0163,0160,0141,0162,0145,0156,0164,073,0175,0121,0124,0141,0142,0102,0141,0162,072,072,0164,0141,0142,0173,0142,0141,0143,0153,0147,0162,0157,0165,0156,0144,072,0164,0162,0141,0156,0163,0160,0141,0162,0145,0156,0164,073,0175,0};
-QMultiMap<int, DeferInit *> *DeferInit::qmDeferers = NULL;
+QMultiMap<int, DeferInit *> *DeferInit::qmDeferers = nullptr;
void DeferInit::add(int priority) {
- if (qmDeferers == NULL) {
+ if (!qmDeferers) {
qmDeferers = new QMultiMap<int, DeferInit *>();
}
qmDeferers->insert(priority, this);
@@ -204,5 +204,5 @@ void DeferInit::run_destroyers() {
d->destroy();
}
delete qmDeferers;
- qmDeferers = NULL;
+ qmDeferers = nullptr;
}
diff --git a/src/mumble/GlobalShortcut.cpp b/src/mumble/GlobalShortcut.cpp
index 321ab1718..2403a9433 100644
--- a/src/mumble/GlobalShortcut.cpp
+++ b/src/mumble/GlobalShortcut.cpp
@@ -29,7 +29,7 @@ const QString GlobalShortcutConfig::name = QLatin1String("GlobalShortcutConfig")
/**
* Used to save the global, unique, platform specific GlobalShortcutEngine.
*/
-GlobalShortcutEngine *GlobalShortcutEngine::engine = NULL;
+GlobalShortcutEngine *GlobalShortcutEngine::engine = nullptr;
static ConfigWidget *GlobalShortcutConfigDialogNew(Settings &st) {
return new GlobalShortcutConfig(st);
@@ -515,7 +515,7 @@ ShortcutDelegate::ShortcutDelegate(QObject *p) : QStyledItemDelegate(p) {
ShortcutDelegate::~ShortcutDelegate() {
delete itemEditorFactory();
- setItemEditorFactory(NULL);
+ setItemEditorFactory(nullptr);
}
/**
@@ -623,7 +623,7 @@ bool GlobalShortcutConfig::showWarning() const {
# else
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_MAVERICKS) {
# endif
- return !AXIsProcessTrustedWithOptions(NULL);
+ return !AXIsProcessTrustedWithOptions(nullptr);
} else
# endif
{
@@ -997,7 +997,7 @@ void GlobalShortcutEngine::remove(GlobalShortcut *gs) {
engine->needRemap();
if (engine->qmShortcuts.isEmpty()) {
delete engine;
- GlobalShortcutEngine::engine = NULL;
+ GlobalShortcutEngine::engine = nullptr;
}
}
diff --git a/src/mumble/GlobalShortcut.h b/src/mumble/GlobalShortcut.h
index 4b25fad5a..67498f5ae 100644
--- a/src/mumble/GlobalShortcut.h
+++ b/src/mumble/GlobalShortcut.h
@@ -61,7 +61,7 @@ class ShortcutKeyWidget : public QLineEdit {
public:
QList<QVariant> qlButtons;
bool bModified;
- ShortcutKeyWidget(QWidget *p = NULL);
+ ShortcutKeyWidget(QWidget *p = nullptr);
QList<QVariant> getShortcut() const;
void displayKeys(bool last = true);
public slots:
@@ -83,7 +83,7 @@ class ShortcutActionWidget : public MUComboBox {
Q_DISABLE_COPY(ShortcutActionWidget)
Q_PROPERTY(unsigned int index READ index WRITE setIndex USER true)
public:
- ShortcutActionWidget(QWidget *p = NULL);
+ ShortcutActionWidget(QWidget *p = nullptr);
unsigned int index() const;
void setIndex(int);
};
@@ -94,7 +94,7 @@ class ShortcutToggleWidget : public MUComboBox {
Q_DISABLE_COPY(ShortcutToggleWidget)
Q_PROPERTY(int index READ index WRITE setIndex USER true)
public:
- ShortcutToggleWidget(QWidget *p = NULL);
+ ShortcutToggleWidget(QWidget *p = nullptr);
int index() const;
void setIndex(int);
};
@@ -112,7 +112,7 @@ class ShortcutTargetDialog : public QDialog, public Ui::GlobalShortcutTarget {
QMap<QString, QString> qmHashNames;
ShortcutTarget stTarget;
public:
- ShortcutTargetDialog(const ShortcutTarget &, QWidget *p = NULL);
+ ShortcutTargetDialog(const ShortcutTarget &, QWidget *p = nullptr);
ShortcutTarget target() const;
public slots:
void accept() Q_DECL_OVERRIDE;
@@ -143,7 +143,7 @@ class ShortcutTargetWidget : public QFrame {
QLineEdit *qleTarget;
QToolButton *qtbEdit;
public:
- ShortcutTargetWidget(QWidget *p = NULL);
+ ShortcutTargetWidget(QWidget *p = nullptr);
ShortcutTarget target() const;
void setTarget(const ShortcutTarget &);
static QString targetString(const ShortcutTarget &);
@@ -240,7 +240,7 @@ class GlobalShortcutEngine : public QThread {
QList<QVariant> qlButtonList;
QList<QList<ShortcutKey *> > qlShortcutList;
- GlobalShortcutEngine(QObject *p = NULL);
+ GlobalShortcutEngine(QObject *p = nullptr);
~GlobalShortcutEngine() Q_DECL_OVERRIDE;
void resetMap();
void remap();
diff --git a/src/mumble/GlobalShortcut_macx.mm b/src/mumble/GlobalShortcut_macx.mm
index c6f4678e5..ef3366da9 100644
--- a/src/mumble/GlobalShortcut_macx.mm
+++ b/src/mumble/GlobalShortcut_macx.mm
@@ -112,15 +112,15 @@ CGEventRef GlobalShortcutMac::callback(CGEventTapProxy proxy, CGEventType type,
NSEvent *evt = [[NSEvent eventWithCGEvent:event] retain];
QMetaObject::invokeMethod(gs, "forwardEvent", Qt::QueuedConnection, Q_ARG(void *, evt));
[pool release];
- return NULL;
+ return nullptr;
}
- return suppress ? NULL : event;
+ return suppress ? nullptr : event;
}
GlobalShortcutMac::GlobalShortcutMac()
- : loop(Q_NULLPTR)
- , port(Q_NULLPTR)
+ : loop(nullptr)
+ , port(nullptr)
, modmask(static_cast<CGEventFlags>(0)) {
#ifndef QT_NO_DEBUG
qWarning("GlobalShortcutMac: Debug build detected. Disabling shortcut engine.");
@@ -153,7 +153,7 @@ GlobalShortcutMac::GlobalShortcutMac()
return;
}
- kbdLayout = NULL;
+ kbdLayout = nullptr;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
# if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
@@ -189,7 +189,7 @@ GlobalShortcutMac::~GlobalShortcutMac() {
#endif
if (loop) {
CFRunLoopStop(loop);
- loop = Q_NULLPTR;
+ loop = nullptr;
wait();
}
}
@@ -444,7 +444,7 @@ QString GlobalShortcutMac::buttonName(const QVariant &v) {
}
void GlobalShortcutMac::setEnabled(bool b) {
- // Since Mojave, passing NULL to CGEventTapEnable() segfaults.
+ // Since Mojave, passing nullptr to CGEventTapEnable() segfaults.
if (port) {
CGEventTapEnable(port, b);
}
diff --git a/src/mumble/GlobalShortcut_unix.cpp b/src/mumble/GlobalShortcut_unix.cpp
index a4f8e80b6..c789ec27d 100644
--- a/src/mumble/GlobalShortcut_unix.cpp
+++ b/src/mumble/GlobalShortcut_unix.cpp
@@ -56,7 +56,7 @@ GlobalShortcutX::GlobalShortcutX() {
iXIopcode = -1;
bRunning = false;
- display = XOpenDisplay(NULL);
+ display = XOpenDisplay(nullptr);
if (! display) {
qWarning("GlobalShortcutX: Unable to open dedicated display connection.");
diff --git a/src/mumble/GlobalShortcut_win.cpp b/src/mumble/GlobalShortcut_win.cpp
index b0cc41284..d664927f8 100644
--- a/src/mumble/GlobalShortcut_win.cpp
+++ b/src/mumble/GlobalShortcut_win.cpp
@@ -118,15 +118,15 @@ GlobalShortcutEngine *GlobalShortcutEngine::platformInit() {
GlobalShortcutWin::GlobalShortcutWin()
- : pDI(NULL)
- , hhMouse(NULL)
- , hhKeyboard(NULL)
+ : pDI(nullptr)
+ , hhMouse(nullptr)
+ , hhKeyboard(nullptr)
, uiHardwareDevices(0)
#ifdef USE_GKEY
- , gkey(NULL)
+ , gkey(nullptr)
#endif
#ifdef USE_XBOXINPUT
- , xboxinput(NULL)
+ , xboxinput(nullptr)
, nxboxinput(0)
#endif
{
@@ -144,7 +144,7 @@ GlobalShortcutWin::~GlobalShortcutWin() {
}
void GlobalShortcutWin::run() {
- if (FAILED(DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, reinterpret_cast<void **>(&pDI), NULL))) {
+ if (FAILED(DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8, reinterpret_cast<void **>(&pDI), nullptr))) {
qFatal("GlobalShortcutWin: Failed to create d8input");
return;
}
@@ -153,12 +153,12 @@ void GlobalShortcutWin::run() {
// On Windows 7 and greater, Windows will silently remove badly behaving hooks
// without telling the application. Users can tweak the timeout themselves
// with this registry key.
- HKEY key = NULL;
+ HKEY key = nullptr;
DWORD type = 0;
DWORD value = 0;
DWORD len = sizeof(DWORD);
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_READ, &key) == ERROR_SUCCESS) {
- LONG err = RegQueryValueExA(key, "LowLevelHooksTimeout", NULL, &type, reinterpret_cast<LPBYTE>(&value), &len);
+ LONG err = RegQueryValueExA(key, "LowLevelHooksTimeout", nullptr, &type, reinterpret_cast<LPBYTE>(&value), &len);
if (err == ERROR_SUCCESS && type == REG_DWORD) {
qWarning("GlobalShortcutWin: Found LowLevelHooksTimeout with value = 0x%lx", static_cast<unsigned long>(value));
} else if (err == ERROR_FILE_NOT_FOUND) {
@@ -207,10 +207,10 @@ void GlobalShortcutWin::run() {
#endif
if (bHook) {
- if (hhMouse != NULL) {
+ if (hhMouse) {
UnhookWindowsHookEx(hhMouse);
}
- if (hhKeyboard != NULL) {
+ if (hhKeyboard) {
UnhookWindowsHookEx(hhKeyboard);
}
}
@@ -471,7 +471,7 @@ BOOL GlobalShortcutWin::EnumDevicesCB(LPCDIDEVICEINSTANCE pdidi, LPVOID pContext
InputDevice *id = new InputDevice;
- id->pDID = NULL;
+ id->pDID = nullptr;
id->name = name;
@@ -555,7 +555,7 @@ BOOL GlobalShortcutWin::EnumDevicesCB(LPCDIDEVICEINSTANCE pdidi, LPVOID pContext
}
}
- if (FAILED(hr = cbgsw->pDI->CreateDevice(pdidi->guidInstance, &id->pDID, NULL)))
+ if (FAILED(hr = cbgsw->pDI->CreateDevice(pdidi->guidInstance, &id->pDID, nullptr)))
qFatal("GlobalShortcutWin: CreateDevice: %lx", hr);
if (FAILED(hr = id->pDID->EnumObjects(EnumDeviceObjectsCallback, static_cast<void *>(id), DIDFT_BUTTON)))
@@ -689,7 +689,7 @@ void GlobalShortcutWin::timeTicked() {
}
#ifdef USE_GKEY
- if (g.s.bEnableGKey && gkey != NULL && gkey->isValid()) {
+ if (g.s.bEnableGKey && gkey && gkey->isValid()) {
for (int button = GKEY_MIN_MOUSE_BUTTON; button <= GKEY_MAX_MOUSE_BUTTON; button++) {
QList<QVariant> ql;
ql << button;
@@ -710,7 +710,7 @@ void GlobalShortcutWin::timeTicked() {
#endif
#ifdef USE_XBOXINPUT
- if (g.s.bEnableXboxInput && xboxinput != NULL && xboxinput->isValid() && nxboxinput > 0) {
+ if (g.s.bEnableXboxInput && xboxinput && xboxinput->isValid() && nxboxinput > 0) {
XboxInputState state;
for (uint32_t i = 0; i < XBOXINPUT_MAX_DEVICES; i++) {
if (xboxinput->GetState(i, &state) == 0) {
@@ -791,7 +791,7 @@ void GlobalShortcutWin::timeTicked() {
// As explained above, initializing the hooks here yields a much superior
// experience, where this initialization has no observable effect on the
// behavior of the system's mouse input.
- if (bHook && hhMouse == NULL && hhKeyboard == NULL) {
+ if (bHook && !hhMouse && !hhKeyboard) {
HMODULE hSelf;
GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, reinterpret_cast<LPCTSTR>(&HookKeyboard), &hSelf);
hhMouse = SetWindowsHookEx(WH_MOUSE_LL, HookMouse, hSelf, 0);
@@ -817,7 +817,7 @@ QString GlobalShortcutWin::buttonName(const QVariant &v) {
QString name=QLatin1String("Unknown");
#ifdef USE_GKEY
- if (g.s.bEnableGKey && gkey != NULL && gkey->isValid()) {
+ if (g.s.bEnableGKey && gkey && gkey->isValid()) {
bool isGKey = false;
if (guid == GKeyLibrary::quMouse) {
isGKey = true;
@@ -834,7 +834,7 @@ QString GlobalShortcutWin::buttonName(const QVariant &v) {
#endif
#ifdef USE_XBOXINPUT
- if (g.s.bEnableXboxInput && xboxinput != NULL && xboxinput->isValid() && guid == XboxInput::s_XboxInputGuid) {
+ if (g.s.bEnableXboxInput && xboxinput && xboxinput->isValid() && guid == XboxInput::s_XboxInputGuid) {
uint32_t idx = (type >> 24) & 0xff;
uint32_t button = (type & 0x00ffffff);
diff --git a/src/mumble/JackAudio.cpp b/src/mumble/JackAudio.cpp
index 01fc3f6c5..99ef79c75 100644
--- a/src/mumble/JackAudio.cpp
+++ b/src/mumble/JackAudio.cpp
@@ -378,7 +378,7 @@ void JackAudioSystem::deactivate() {
bool JackAudioSystem::isOk() {
QMutexLocker lock(&qmWait);
- return client != nullptr;
+ return (client);
}
uint8_t JackAudioSystem::outPorts() {
@@ -860,7 +860,7 @@ bool JackAudioOutput::allocBuffer(const jack_nframes_t frames) {
QMutexLocker lock(&qmWait);
iFrameSize = frames;
- if (buffer != nullptr) {
+ if (buffer) {
jas->ringbufferFree(buffer);
}
diff --git a/src/mumble/LCD.cpp b/src/mumble/LCD.cpp
index c4735b45c..535ad8032 100644
--- a/src/mumble/LCD.cpp
+++ b/src/mumble/LCD.cpp
@@ -31,7 +31,7 @@ LCDEngineRegistrar::~LCDEngineRegistrar() {
qlInitializers->removeAll(n);
if (qlInitializers->isEmpty()) {
delete qlInitializers;
- qlInitializers = NULL;
+ qlInitializers = nullptr;
}
}
@@ -63,7 +63,7 @@ void LCDDeviceManager::initialize() {
if (qlDevices.count() > 0) {
crLCD = new ConfigRegistrar(5900, LCDConfigDialogNew);
} else {
- crLCD = NULL;
+ crLCD = nullptr;
}
}
@@ -249,8 +249,8 @@ void LCD::updateUserView() {
return;
QStringList qslTalking;
- User *me = g.uiSession ? ClientUser::get(g.uiSession) : NULL;
- Channel *home = me ? me->cChannel : NULL;
+ User *me = g.uiSession ? ClientUser::get(g.uiSession) : nullptr;
+ Channel *home = me ? me->cChannel : nullptr;
bool alert = false;
foreach(const QSize &size, qhImages.keys()) {
diff --git a/src/mumble/Log.cpp b/src/mumble/Log.cpp
index 7a6517439..b317d71be 100644
--- a/src/mumble/Log.cpp
+++ b/src/mumble/Log.cpp
@@ -743,7 +743,7 @@ void LogDocument::finished() {
// if the QTextDocument has just been set on the
// text edit widget.
QTextEdit *qte = qobject_cast<QTextEdit *>(parent());
- if (qte != NULL) {
+ if (qte) {
QEvent *e = new QEvent(QEvent::FontChange);
QApplication::postEvent(qte, e);
diff --git a/src/mumble/Log.h b/src/mumble/Log.h
index cbd83190d..6f71bde6d 100644
--- a/src/mumble/Log.h
+++ b/src/mumble/Log.h
@@ -78,11 +78,11 @@ class Log : public QObject {
void postNotification(MsgType mt, const QString &plain);
void postQtNotification(MsgType mt, const QString &plain);
public:
- Log(QObject *p = NULL);
+ Log(QObject *p = nullptr);
QString msgName(MsgType t) const;
void setIgnore(MsgType t, int ignore = 1 << 30);
void clearIgnore();
- static QString validHtml(const QString &html, QTextCursor *tc = NULL);
+ static QString validHtml(const QString &html, QTextCursor *tc = nullptr);
static QString imageToImg(const QByteArray &format, const QByteArray &image);
static QString imageToImg(QImage img);
static QString msgColor(const QString &text, LogColorType t);
@@ -115,7 +115,7 @@ class LogDocument : public QTextDocument {
Q_OBJECT
Q_DISABLE_COPY(LogDocument)
public:
- LogDocument(QObject *p = NULL);
+ LogDocument(QObject *p = nullptr);
QVariant loadResource(int, const QUrl &) Q_DECL_OVERRIDE;
public slots:
void finished();
diff --git a/src/mumble/Log_macx.mm b/src/mumble/Log_macx.mm
index b7da24c5c..26544294f 100644
--- a/src/mumble/Log_macx.mm
+++ b/src/mumble/Log_macx.mm
@@ -48,7 +48,7 @@ extern bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret);
static bool growl_available() {
static int isAvailable = -1;
if (isAvailable == -1) {
- OSStatus err = LSFindApplicationForInfo('GRRR', CFSTR("com.Growl.GrowlHelperApp"), CFSTR("GrowlHelperApp.app"), NULL, NULL);
+ OSStatus err = LSFindApplicationForInfo('GRRR', CFSTR("com.Growl.GrowlHelperApp"), CFSTR("GrowlHelperApp.app"), nullptr, nullptr);
isAvailable = (err != kLSApplicationNotFoundErr) ? 1 : 0;
if (isAvailable) {
QStringList qslAllEvents;
@@ -65,7 +65,7 @@ static bool growl_available() {
" default notifications enabledNotificationsList"
" icon of application \"Mumble\"\n"
"end tell\n").arg(qslAllEvents.join(QLatin1String(",")));
- qt_mac_execute_apple_script(qsScript, NULL);
+ qt_mac_execute_apple_script(qsScript, nullptr);
}
}
return isAvailable == 1;
@@ -100,7 +100,7 @@ void Log::postNotification(MsgType mt, const QString &plain) {
" notify with name \"%1\" title \"%1\" description \"%2\" application name \"Mumble\"\n"
"end tell\n").arg(title).arg(plain);
if (growl_available())
- qt_mac_execute_apple_script(qsScript, NULL);
+ qt_mac_execute_apple_script(qsScript, nullptr);
#endif
}
}
diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp
index c4b5c4744..ab9a8561d 100644
--- a/src/mumble/MainWindow.cpp
+++ b/src/mumble/MainWindow.cpp
@@ -134,14 +134,14 @@ MainWindow::MainWindow(QWidget *p) : QMainWindow(p) {
Channel::add(0, tr("Root"));
- aclEdit = NULL;
- banEdit = NULL;
- userEdit = NULL;
- tokenEdit = NULL;
+ aclEdit = nullptr;
+ banEdit = nullptr;
+ userEdit = nullptr;
+ tokenEdit = nullptr;
- voiceRecorderDialog = NULL;
+ voiceRecorderDialog = nullptr;
- qwPTTButtonWidget = NULL;
+ qwPTTButtonWidget = nullptr;
qtReconnect = new QTimer(this);
qtReconnect->setInterval(10000);
@@ -493,7 +493,7 @@ void MainWindow::closeEvent(QCloseEvent *e) {
if (qwPTTButtonWidget) {
qwPTTButtonWidget->close();
qwPTTButtonWidget->deleteLater();
- qwPTTButtonWidget = NULL;
+ qwPTTButtonWidget = nullptr;
}
g.bQuit = true;
@@ -634,7 +634,7 @@ void MainWindow::updateTrayIcon() {
void MainWindow::updateUserModel()
{
UserModel *um = static_cast<UserModel *>(qtvUsers->model());
- um->toggleChannelFiltered(NULL); // Force a UI refresh
+ um->toggleChannelFiltered(nullptr); // Force a UI refresh
}
void MainWindow::updateTransmitModeComboBox() {
@@ -656,21 +656,21 @@ QMenu *MainWindow::createPopupMenu() {
return QMainWindow::createPopupMenu();
}
- return NULL;
+ return nullptr;
}
Channel *MainWindow::getContextMenuChannel() {
if (cContextChannel)
return cContextChannel.data();
- return NULL;
+ return nullptr;
}
ClientUser *MainWindow::getContextMenuUser() {
if (cuContextUser)
return cuContextUser.data();
- return NULL;
+ return nullptr;
}
bool MainWindow::handleSpecialContextMenu(const QUrl &url, const QPoint &pos_, bool focus) {
@@ -695,7 +695,7 @@ bool MainWindow::handleSpecialContextMenu(const QUrl &url, const QPoint &pos_, b
qteChat->setFocus();
} else {
qpContextPosition = QPoint();
- qmUser->exec(pos_, NULL);
+ qmUser->exec(pos_, nullptr);
}
}
cuContextUser.clear();
@@ -711,7 +711,7 @@ bool MainWindow::handleSpecialContextMenu(const QUrl &url, const QPoint &pos_, b
qteChat->setFocus();
} else {
qpContextPosition = QPoint();
- qmChannel->exec(pos_, NULL);
+ qmChannel->exec(pos_, nullptr);
}
}
cContextChannel.clear();
@@ -750,7 +750,7 @@ void MainWindow::on_qtvUsers_customContextMenuRequested(const QPoint &mpos) {
cuContextUser.clear();
} else {
cContextChannel.clear();
- qmChannel->exec(qtvUsers->mapToGlobal(mpos), NULL);
+ qmChannel->exec(qtvUsers->mapToGlobal(mpos), nullptr);
cContextChannel.clear();
}
}
@@ -1157,7 +1157,7 @@ void MainWindow::setupView(bool toggle_minimize) {
} else {
if (qwPTTButtonWidget) {
qwPTTButtonWidget->deleteLater();
- qwPTTButtonWidget = NULL;
+ qwPTTButtonWidget = nullptr;
}
}
}
@@ -1192,8 +1192,8 @@ void MainWindow::on_Reconnect_timeout() {
void MainWindow::on_qmSelf_aboutToShow() {
ClientUser *user = ClientUser::get(g.uiSession);
- qaServerTexture->setEnabled(user != NULL);
- qaSelfComment->setEnabled(user != NULL);
+ qaServerTexture->setEnabled(user != nullptr);
+ qaSelfComment->setEnabled(user != nullptr);
qaServerTextureRemove->setEnabled(user && ! user->qbaTextureHash.isEmpty());
@@ -1322,7 +1322,7 @@ void MainWindow::on_qaServerBanList_triggered() {
if (banEdit) {
banEdit->reject();
delete banEdit;
- banEdit = NULL;
+ banEdit = nullptr;
}
}
@@ -1332,7 +1332,7 @@ void MainWindow::on_qaServerUserList_triggered() {
if (userEdit) {
userEdit->reject();
delete userEdit;
- userEdit = NULL;
+ userEdit = nullptr;
}
}
@@ -1474,7 +1474,7 @@ void MainWindow::on_qaServerTokens_triggered() {
if (tokenEdit) {
tokenEdit->reject();
delete tokenEdit;
- tokenEdit = NULL;
+ tokenEdit = nullptr;
}
tokenEdit = new Tokens(this);
@@ -1483,11 +1483,11 @@ void MainWindow::on_qaServerTokens_triggered() {
void MainWindow::voiceRecorderDialog_finished(int) {
voiceRecorderDialog->deleteLater();
- voiceRecorderDialog = NULL;
+ voiceRecorderDialog = nullptr;
}
void MainWindow::qmUser_aboutToShow() {
- ClientUser *p = NULL;
+ ClientUser *p = nullptr;
if (g.uiSession != 0) {
QModelIndex idx;
if (! qpContextPosition.isNull())
@@ -1863,7 +1863,7 @@ void MainWindow::openTextMessageDialog(ClientUser *p) {
int res = texm->exec();
// Try to get find the user using the session id.
- // This will return NULL if the user disconnected while typing the message.
+ // This will return nullptr if the user disconnected while typing the message.
p = ClientUser::get(session);
if (p && (res == QDialog::Accepted)) {
@@ -1969,9 +1969,9 @@ void MainWindow::sendChatbarMessage(QString qsMessage) {
ClientUser *p = pmModel->getUser(qtvUsers->currentIndex());
Channel *c = pmModel->getChannel(qtvUsers->currentIndex());
- if (!g.s.bChatBarUseSelection || p == NULL || p->uiSession == g.uiSession) {
+ if (!g.s.bChatBarUseSelection || !p || p->uiSession == g.uiSession) {
// Channel message
- if (!g.s.bChatBarUseSelection || c == NULL) // If no channel selected fallback to current one
+ if (!g.s.bChatBarUseSelection || !c) // If no channel selected fallback to current one
c = ClientUser::get(g.uiSession)->cChannel;
g.sh->sendChannelTextMessage(c->iId, qsMessage, false);
@@ -2030,7 +2030,7 @@ void MainWindow::on_qmConfig_aboutToShow() {
void MainWindow::qmChannel_aboutToShow() {
qmChannel->clear();
- Channel *c = NULL;
+ Channel *c = nullptr;
if (g.uiSession != 0) {
QModelIndex idx;
if (! qpContextPosition.isNull())
@@ -2179,7 +2179,7 @@ void MainWindow::on_qaChannelAdd_triggered() {
if (aclEdit) {
aclEdit->reject();
delete aclEdit;
- aclEdit = NULL;
+ aclEdit = nullptr;
}
aclEdit = new ACLEditor(c ? c->iId : 0, this);
@@ -2230,7 +2230,7 @@ void MainWindow::on_qaChannelACL_triggered() {
if (aclEdit) {
aclEdit->reject();
delete aclEdit;
- aclEdit = NULL;
+ aclEdit = nullptr;
}
}
@@ -2296,7 +2296,7 @@ void MainWindow::on_qaChannelCopyURL_triggered() {
g.sh->getConnectionInfo(host, port, uname, pw);
// walk back up the channel list to build the URL.
- while (c->cParent != NULL) {
+ while (c->cParent) {
channel.prepend(c->qsName);
channel.prepend(QLatin1String("/"));
c = c->cParent;
@@ -2324,8 +2324,8 @@ void MainWindow::on_qaListenerLocalVolume_triggered() {
* @see MainWindow::msgPermissionQuery(const MumbleProto::PermissionQuery &msg)
*/
void MainWindow::updateMenuPermissions() {
- ClientUser *cu = NULL;
- Channel *c = NULL;
+ ClientUser *cu = nullptr;
+ Channel *c = nullptr;
if (g.uiSession) {
cu = getContextMenuUser();
@@ -2349,7 +2349,7 @@ void MainWindow::updateMenuPermissions() {
c->uiPermissions = p;
}
- Channel *cparent = c ? c->cParent : NULL;
+ Channel *cparent = c ? c->cParent : nullptr;
ChanACL::Permissions pparent = cparent ? static_cast<ChanACL::Permissions>(cparent->uiPermissions) : ChanACL::None;
if (cparent && ! pparent) {
@@ -2362,8 +2362,8 @@ void MainWindow::updateMenuPermissions() {
cparent->uiPermissions = pparent;
}
- ClientUser *user = g.uiSession ? ClientUser::get(g.uiSession) : NULL;
- Channel *homec = user ? user->cChannel : NULL;
+ ClientUser *user = g.uiSession ? ClientUser::get(g.uiSession) : nullptr;
+ Channel *homec = user ? user->cChannel : nullptr;
ChanACL::Permissions homep = homec ? static_cast<ChanACL::Permissions>(homec->uiPermissions) : ChanACL::None;
if (homec && ! homep) {
@@ -2412,7 +2412,7 @@ void MainWindow::userStateChanged() {
}
ClientUser *user = ClientUser::get(g.uiSession);
- if (user == NULL) {
+ if (!user) {
g.bAttenuateOthers = false;
g.prioritySpeakerActiveOverride = false;
@@ -2682,9 +2682,9 @@ void MainWindow::on_VolumeDown_triggered(bool down, QVariant) {
Channel *MainWindow::mapChannel(int idx) const {
if (! g.uiSession)
- return NULL;
+ return nullptr;
- Channel *c = NULL;
+ Channel *c = nullptr;
if (idx < 0) {
switch (idx) {
@@ -3126,25 +3126,25 @@ void MainWindow::serverDisconnected(QAbstractSocket::SocketError err, QString re
if (aclEdit) {
aclEdit->reject();
delete aclEdit;
- aclEdit = NULL;
+ aclEdit = nullptr;
}
if (banEdit) {
banEdit->reject();
delete banEdit;
- banEdit = NULL;
+ banEdit = nullptr;
}
if (userEdit) {
userEdit->reject();
delete userEdit;
- userEdit = NULL;
+ userEdit = nullptr;
}
if (tokenEdit) {
tokenEdit->reject();
delete tokenEdit;
- tokenEdit = NULL;
+ tokenEdit = nullptr;
}
QSet<QAction *> qs;
@@ -3312,7 +3312,7 @@ void MainWindow::trayAboutToShow() {
}
QScreen *screen = Screen::screenAt(p);
- if(screen != nullptr){
+ if(screen){
QRect qr = screen->geometry();
if (p.y() < (qr.height() / 2))
@@ -3384,9 +3384,9 @@ void MainWindow::updateChatBar() {
if (g.uiSession == 0) {
qteChat->setDefaultText(tr("<center>Not connected</center>"), true);
- } else if (!g.s.bChatBarUseSelection || p == NULL || p->uiSession == g.uiSession) {
+ } else if (!g.s.bChatBarUseSelection || !p || p->uiSession == g.uiSession) {
// Channel tree target
- if (!g.s.bChatBarUseSelection || c == NULL) // If no channel selected fallback to current one
+ if (!g.s.bChatBarUseSelection || !c) // If no channel selected fallback to current one
c = ClientUser::get(g.uiSession)->cChannel;
qteChat->setDefaultText(tr("<center>Type message to channel '%1' here</center>").arg(c->qsName.toHtmlEscaped()));
diff --git a/src/mumble/ManualPlugin.cpp b/src/mumble/ManualPlugin.cpp
index c89134f60..8849a8e9c 100644
--- a/src/mumble/ManualPlugin.cpp
+++ b/src/mumble/ManualPlugin.cpp
@@ -17,7 +17,7 @@
#include "../../plugins/mumble_plugin.h"
-static QPointer<Manual> mDlg = NULL;
+static QPointer<Manual> mDlg = nullptr;
static bool bLinkable = false;
static bool bActive = true;
@@ -113,7 +113,7 @@ void Manual::changeEvent(QEvent *e) {
void Manual::on_qpbUnhinge_pressed() {
qpbUnhinge->setEnabled(false);
- mDlg->setParent(NULL);
+ mDlg->setParent(nullptr);
mDlg->show();
}
@@ -287,8 +287,8 @@ static MumblePlugin manual = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
- NULL, // About is handled by MumblePluginQt
- NULL, // Config is handled by MumblePluginQt
+ nullptr, // About is handled by MumblePluginQt
+ nullptr, // Config is handled by MumblePluginQt
trylock,
unlock,
longdesc,
diff --git a/src/mumble/Messages.cpp b/src/mumble/Messages.cpp
index 9cdebc0f5..2cb14655c 100644
--- a/src/mumble/Messages.cpp
+++ b/src/mumble/Messages.cpp
@@ -41,7 +41,7 @@
#include "Global.h"
#define ACTOR_INIT \
- ClientUser *pSrc=NULL; \
+ ClientUser *pSrc=nullptr; \
if (msg.has_actor()) \
pSrc = ClientUser::get(msg.actor()); \
Q_UNUSED(pSrc);
@@ -72,7 +72,7 @@ void MainWindow::msgBanList(const MumbleProto::BanList &msg) {
if (banEdit) {
banEdit->reject();
delete banEdit;
- banEdit = NULL;
+ banEdit = nullptr;
}
banEdit = new BanEditor(msg, this);
banEdit->show();
@@ -346,7 +346,7 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
ACTOR_INIT;
ClientUser* pSelf = ClientUser::get(g.uiSession);
ClientUser *pDst = ClientUser::get(msg.session());
- Channel *channel = NULL;
+ Channel *channel = nullptr;
if (msg.has_channel_id()) {
channel = Channel::get(msg.channel_id());
@@ -754,14 +754,14 @@ void MainWindow::msgChannelState(const MumbleProto::ChannelState &msg) {
return;
Channel *c = Channel::get(msg.channel_id());
- Channel *p = msg.has_parent() ? Channel::get(msg.parent()) : NULL;
+ Channel *p = msg.has_parent() ? Channel::get(msg.parent()) : nullptr;
if (!c) {
// Addresses channel does not exist so create it
if (p && msg.has_name()) {
c = pmModel->addChannel(msg.channel_id(), p, u8(msg.name()));
c->bTemporary = msg.temporary();
- p = NULL; // No need to move it later
+ p = nullptr; // No need to move it later
ServerHandlerPtr sh = g.sh;
if (sh)
@@ -927,7 +927,7 @@ void MainWindow::msgACL(const MumbleProto::ACL &msg) {
if (aclEdit) {
aclEdit->reject();
delete aclEdit;
- aclEdit = NULL;
+ aclEdit = nullptr;
}
if (Channel::get(msg.channel_id())) {
aclEdit = new ACLEditor(msg.channel_id(), msg, this);
@@ -1057,7 +1057,7 @@ void MainWindow::msgUserList(const MumbleProto::UserList &msg) {
if (userEdit) {
userEdit->reject();
delete userEdit;
- userEdit = NULL;
+ userEdit = nullptr;
}
userEdit = new UserEdit(msg, this);
userEdit->show();
@@ -1159,9 +1159,9 @@ void MainWindow::msgUserStats(const MumbleProto::UserStats &msg) {
ui->update(msg);
} else {
#ifdef USE_OVERLAY
- ui = new UserInformation(msg, g.ocIntercept ? g.mw : NULL);
+ ui = new UserInformation(msg, g.ocIntercept ? g.mw : nullptr);
#else
- ui = new UserInformation(msg, NULL);
+ ui = new UserInformation(msg, nullptr);
#endif
ui->setAttribute(Qt::WA_DeleteOnClose, true);
connect(ui, SIGNAL(destroyed()), this, SLOT(destroyUserInformation()));
diff --git a/src/mumble/MumbleApplication.cpp b/src/mumble/MumbleApplication.cpp
index c6f5f32f1..d0588e406 100644
--- a/src/mumble/MumbleApplication.cpp
+++ b/src/mumble/MumbleApplication.cpp
@@ -69,7 +69,7 @@ bool MumbleApplication::event(QEvent *e) {
/// by GlobalShortcutWin. Otherwise, returns false.
static bool gswForward(MSG *msg) {
GlobalShortcutWin *gsw = static_cast<GlobalShortcutWin *>(GlobalShortcutEngine::engine);
- if (gsw == NULL) {
+ if (gsw) {
return false;
}
switch (msg->message) {
diff --git a/src/mumble/OSS.cpp b/src/mumble/OSS.cpp
index 653cedea6..04ae22374 100644
--- a/src/mumble/OSS.cpp
+++ b/src/mumble/OSS.cpp
@@ -26,7 +26,7 @@ class OSSEnumerator {
OSSEnumerator();
};
-static OSSEnumerator *cards = NULL;
+static OSSEnumerator *cards = nullptr;
class OSSInit : public DeferInit {
void initialize() {
@@ -34,7 +34,7 @@ class OSSInit : public DeferInit {
};
void destroy() {
delete cards;
- cards = NULL;
+ cards = nullptr;
};
};
@@ -231,7 +231,7 @@ void OSSInput::run() {
}
qWarning("OSSInput: Releasing.");
- ioctl(fd, SNDCTL_DSP_RESET, NULL);
+ ioctl(fd, SNDCTL_DSP_RESET, nullptr);
out:
close(fd);
@@ -339,6 +339,6 @@ void OSSOutput::run() {
}
}
qWarning("OSSOutput: Releasing device");
- ioctl(fd, SNDCTL_DSP_RESET, NULL);
+ ioctl(fd, SNDCTL_DSP_RESET, nullptr);
close(fd);
}
diff --git a/src/mumble/OpusCodec.cpp b/src/mumble/OpusCodec.cpp
index 5b143fa9b..913b7cbb6 100644
--- a/src/mumble/OpusCodec.cpp
+++ b/src/mumble/OpusCodec.cpp
@@ -10,9 +10,9 @@
#include "MumbleApplication.h"
#ifdef Q_CC_GNU
-#define RESOLVE(var) { var = reinterpret_cast<__typeof__(var)>(qlOpus.resolve(#var)); bValid = bValid && (var != NULL); }
+#define RESOLVE(var) { var = reinterpret_cast<__typeof__(var)>(qlOpus.resolve(#var)); bValid = bValid && var; }
#else
-#define RESOLVE(var) { * reinterpret_cast<void **>(&var) = static_cast<void *>(qlOpus.resolve(#var)); bValid = bValid && (var != NULL); }
+#define RESOLVE(var) { * reinterpret_cast<void **>(&var) = static_cast<void *>(qlOpus.resolve(#var)); bValid = bValid && var; }
#endif
OpusCodec::OpusCodec() {
diff --git a/src/mumble/Overlay.cpp b/src/mumble/Overlay.cpp
index d6f6501c3..8d02dc58d 100644
--- a/src/mumble/Overlay.cpp
+++ b/src/mumble/Overlay.cpp
@@ -42,16 +42,16 @@
QString OverlayAppInfo::applicationIdentifierForPath(const QString &path) {
#ifdef Q_OS_MAC
QString qsIdentifier;
- CFDictionaryRef plist = NULL;
- CFDataRef data = NULL;
+ CFDictionaryRef plist = nullptr;
+ CFDataRef data = nullptr;
QFile qfAppBundle(QString::fromLatin1("%1/Contents/Info.plist").arg(path));
if (qfAppBundle.exists()) {
qfAppBundle.open(QIODevice::ReadOnly);
QByteArray qbaPlistData = qfAppBundle.readAll();
- data = CFDataCreateWithBytesNoCopy(NULL, reinterpret_cast<UInt8 *>(qbaPlistData.data()), qbaPlistData.count(), kCFAllocatorNull);
- plist = static_cast<CFDictionaryRef>(CFPropertyListCreateFromXMLData(NULL, data, kCFPropertyListImmutable, NULL));
+ data = CFDataCreateWithBytesNoCopy(nullptr, reinterpret_cast<UInt8 *>(qbaPlistData.data()), qbaPlistData.count(), kCFAllocatorNull);
+ plist = static_cast<CFDictionaryRef>(CFPropertyListCreateFromXMLData(nullptr, data, kCFPropertyListImmutable, nullptr));
if (plist) {
CFStringRef ident = static_cast<CFStringRef>(CFDictionaryGetValue(plist, CFSTR("CFBundleIdentifier")));
if (ident) {
@@ -79,14 +79,14 @@ OverlayAppInfo OverlayAppInfo::applicationInfoForId(const QString &identifier) {
QString qsAppName(identifier);
QIcon qiAppIcon;
#if defined(Q_OS_MAC)
- CFStringRef bundleId = NULL;
- CFURLRef bundleUrl = NULL;
- CFBundleRef bundle = NULL;
+ CFStringRef bundleId = nullptr;
+ CFURLRef bundleUrl = nullptr;
+ CFBundleRef bundle = nullptr;
OSStatus err = noErr;
char buf[4096];
bundleId = CFStringCreateWithCharacters(kCFAllocatorDefault, reinterpret_cast<const UniChar *>(identifier.unicode()), identifier.length());
- err = LSFindApplicationForInfo(kLSUnknownCreator, bundleId, NULL, NULL, &bundleUrl);
+ err = LSFindApplicationForInfo(kLSUnknownCreator, bundleId, nullptr, nullptr, &bundleUrl);
if (err == noErr) {
// Figure out the bundle name of the application.
CFStringRef absBundlePath = CFURLCopyFileSystemPath(bundleUrl, kCFURLPOSIXPathStyle);
@@ -96,7 +96,7 @@ OverlayAppInfo OverlayAppInfo::applicationInfoForId(const QString &identifier) {
qsAppName = QFileInfo(qsBundlePath).bundleName();
// Load the bundle's icon.
- bundle = CFBundleCreate(NULL, bundleUrl);
+ bundle = CFBundleCreate(nullptr, bundleUrl);
if (bundle) {
CFDictionaryRef info = CFBundleGetInfoDictionary(bundle);
if (info) {
@@ -138,7 +138,7 @@ OverlayAppInfo OverlayAppInfo::applicationInfoForId(const QString &identifier) {
//
// To sidestep the removal of the function, we simply
// call through to GetModuleHandle() directly.
- HINSTANCE qWinAppInstValue = GetModuleHandle(NULL);
+ HINSTANCE qWinAppInstValue = GetModuleHandle(nullptr);
HICON icon = ExtractIcon(qWinAppInstValue, identifier.toStdWString().c_str(), 0);
if (icon) {
extern QPixmap qt_pixmapFromWinHICON(HICON icon);
@@ -264,7 +264,7 @@ void Overlay::createPipe() {
#endif
if (! qlsServer->listen(pipepath)) {
- QMessageBox::warning(NULL, QLatin1String("Mumble"), tr("Failed to create communication with overlay at %2: %1. No overlay will be available.").arg(qlsServer->errorString().toHtmlEscaped(), pipepath.toHtmlEscaped()), QMessageBox::Ok, QMessageBox::NoButton);
+ QMessageBox::warning(nullptr, QLatin1String("Mumble"), tr("Failed to create communication with overlay at %2: %1. No overlay will be available.").arg(qlsServer->errorString().toHtmlEscaped(), pipepath.toHtmlEscaped()), QMessageBox::Ok, QMessageBox::NoButton);
} else {
qWarning() << "Overlay: Listening on" << qlsServer->fullServerName();
connect(qlsServer, SIGNAL(newConnection()), this, SLOT(newConnection()));
diff --git a/src/mumble/Overlay.h b/src/mumble/Overlay.h
index 0ff768b32..4e84ec926 100644
--- a/src/mumble/Overlay.h
+++ b/src/mumble/Overlay.h
@@ -63,7 +63,7 @@ class OverlayMouse : public QGraphicsPixmapItem {
public:
bool contains(const QPointF &) const Q_DECL_OVERRIDE;
bool collidesWithPath(const QPainterPath &, Qt::ItemSelectionMode = Qt::IntersectsItemShape) const Q_DECL_OVERRIDE;
- OverlayMouse(QGraphicsItem * = NULL);
+ OverlayMouse(QGraphicsItem * = nullptr);
};
class OverlayPrivate : public QObject {
diff --git a/src/mumble/OverlayClient.cpp b/src/mumble/OverlayClient.cpp
index 371be0636..b88a690c3 100644
--- a/src/mumble/OverlayClient.cpp
+++ b/src/mumble/OverlayClient.cpp
@@ -40,11 +40,11 @@ OverlayClient::OverlayClient(QLocalSocket *socket, QObject *p)
, iMouseY(0) {
qlsSocket = socket;
- qlsSocket->setParent(NULL);
+ qlsSocket->setParent(nullptr);
connect(qlsSocket, SIGNAL(readyRead()), this, SLOT(readyRead()));
omMsg.omh.iLength = -1;
- smMem = NULL;
+ smMem = nullptr;
uiWidth = uiHeight = 0;
uiPid = ~0ULL;
@@ -139,7 +139,7 @@ void OverlayClient::updateMouse() {
HICON c = ::GetCursor();
ICONINFO info;
ZeroMemory(&info, sizeof(info));
- if (c != NULL && ::GetIconInfo(c, &info)) {
+ if (c && ::GetIconInfo(c, &info)) {
extern QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int format = 0);
if (info.hbmColor) {
@@ -228,9 +228,9 @@ outer:
widgets.prepend(g.mw);
foreach(QWidget *w, widgets) {
- if (w->graphicsProxyWidget() == NULL) {
+ if (!w->graphicsProxyWidget()) {
if ((w == g.mw) || (! w->isHidden())) {
- QGraphicsProxyWidget *qgpw = new QGraphicsProxyWidget(NULL, Qt::Window);
+ QGraphicsProxyWidget *qgpw = new QGraphicsProxyWidget(nullptr, Qt::Window);
qgpw->setOpacity(0.90f);
qgpw->setWidget(w);
if (w == g.mw) {
@@ -306,13 +306,13 @@ void OverlayClient::hideGui() {
QGraphicsProxyWidget *qgpw = w->graphicsProxyWidget();
if (qgpw) {
qgpw->setVisible(false);
- qgpw->setWidget(NULL);
+ qgpw->setWidget(nullptr);
delete qgpw;
}
}
if (g.ocIntercept == this)
- g.ocIntercept = NULL;
+ g.ocIntercept = nullptr;
foreach(QWidget *w, widgetlist) {
if (bWasVisible)
@@ -374,7 +374,7 @@ void OverlayClient::readyReadMsgInit(unsigned int length) {
if (! smMem->data()) {
qWarning() << "OverlayClient: Failed to create shared memory" << uiWidth << uiHeight;
delete smMem;
- smMem = NULL;
+ smMem = nullptr;
return;
}
QByteArray key = smMem->name().toUtf8();
@@ -531,7 +531,7 @@ void OverlayClient::setupScene(bool show) {
void OverlayClient::setupRender() {
qgs.setSceneRect(0, 0, uiWidth, uiHeight);
- qgv.setScene(NULL);
+ qgv.setScene(nullptr);
qgv.setGeometry(-2, -2, uiWidth + 2, uiHeight + 2);
qgv.viewport()->setGeometry(0, 0, uiWidth, uiHeight);
qgv.setScene(&qgs);
diff --git a/src/mumble/OverlayConfig.cpp b/src/mumble/OverlayConfig.cpp
index 8e31f92b4..580a10b31 100644
--- a/src/mumble/OverlayConfig.cpp
+++ b/src/mumble/OverlayConfig.cpp
@@ -150,12 +150,12 @@ void OverlayConfig::refreshTimeLive() {
OverlayConfig::OverlayConfig(Settings &st) :
ConfigWidget(st),
- qgpiScreen(NULL),
+ qgpiScreen(nullptr),
qgs(),
qgsFpsPreview(),
- qgpiFpsDemo(NULL),
- oug(NULL),
- qgtiInstructions(NULL),
+ qgpiFpsDemo(nullptr),
+ oug(nullptr),
+ qgtiInstructions(nullptr),
fViewScale(1.0f) {
setupUi(this);
diff --git a/src/mumble/OverlayEditor.h b/src/mumble/OverlayEditor.h
index 859621df0..7f5861fbf 100644
--- a/src/mumble/OverlayEditor.h
+++ b/src/mumble/OverlayEditor.h
@@ -23,7 +23,7 @@ class OverlayEditor : public QDialog, public Ui::OverlayEditor {
void enterEvent(QEvent *e) Q_DECL_OVERRIDE;
void leaveEvent(QEvent *e) Q_DECL_OVERRIDE;
public:
- OverlayEditor(QWidget *p = NULL, QGraphicsItem *qgi = NULL, OverlaySettings *osptr = NULL);
+ OverlayEditor(QWidget *p = nullptr, QGraphicsItem *qgi = nullptr, OverlaySettings *osptr = nullptr);
~OverlayEditor() Q_DECL_OVERRIDE;
signals:
void applySettings();
diff --git a/src/mumble/OverlayEditorScene.cpp b/src/mumble/OverlayEditorScene.cpp
index 7ba9c6738..69ec2947d 100644
--- a/src/mumble/OverlayEditorScene.cpp
+++ b/src/mumble/OverlayEditorScene.cpp
@@ -56,7 +56,7 @@ OverlayEditorScene::OverlayEditorScene(const OverlaySettings &srcos, QObject *p)
qgpiBox = new QGraphicsPathItem(qgiGroup);
qgpiBox->hide();
- qgpiSelected = NULL;
+ qgpiSelected = nullptr;
qgriSelected = new QGraphicsRectItem;
qgriSelected->hide();
@@ -209,7 +209,7 @@ void OverlayEditorScene::resync() {
qgiGroup->setOpacity(os.fUser[tsColor]);
- qgpiSelected = NULL;
+ qgpiSelected = nullptr;
qgriSelected->setVisible(false);
}
@@ -253,7 +253,7 @@ void OverlayEditorScene::drawBackground(QPainter *p, const QRectF &rect) {
}
QGraphicsPixmapItem *OverlayEditorScene::childAt(const QPointF &pos) {
- QGraphicsItem *item = NULL;
+ QGraphicsItem *item = nullptr;
if (qgriSelected->isVisible()) {
if (qgriSelected->rect().contains(pos)) {
@@ -274,7 +274,7 @@ QGraphicsPixmapItem *OverlayEditorScene::childAt(const QPointF &pos) {
}
QRectF OverlayEditorScene::selectedRect() const {
- const QRectF *qrf = NULL;
+ const QRectF *qrf = nullptr;
if (qgpiSelected == qgpiMuted)
qrf = & os.qrfMutedDeafened;
@@ -544,19 +544,19 @@ void OverlayEditorScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) {
qmTrans->addAction(userOpacity[i]);
}
- QAction *color = NULL;
- QAction *fontAction = NULL;
+ QAction *color = nullptr;
+ QAction *fontAction = nullptr;
QAction *objectOpacity[8];
for (int i=0;i<8;++i)
- objectOpacity[i] = NULL;
- QAction *boxpen[4] = { NULL, NULL, NULL, NULL};
- QAction *boxpad[4] = { NULL, NULL, NULL, NULL};
- QAction *boxpencolor = NULL;
- QAction *boxfillcolor = NULL;
+ objectOpacity[i] = nullptr;
+ QAction *boxpen[4] = { nullptr, nullptr, nullptr, nullptr};
+ QAction *boxpad[4] = { nullptr, nullptr, nullptr, nullptr};
+ QAction *boxpencolor = nullptr;
+ QAction *boxfillcolor = nullptr;
QAction *align[6];
for (int i=0;i<6;++i)
- align[i] = NULL;
+ align[i] = nullptr;
if (item) {
qm.addSeparator();
@@ -729,7 +729,7 @@ void OverlayEditorScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) {
os.qcBoxFill = qc;
moveBox();
} else if (act == color) {
- QColor *col = NULL;
+ QColor *col = nullptr;
if (item == qgpiChannel)
col = & os.qcChannel;
else if (item == qgpiName)
@@ -750,7 +750,7 @@ void OverlayEditorScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) {
} else if (act == fontAction) {
QFont *fontptr = (item == qgpiChannel) ? &os.qfChannel : &os.qfUserName;
- qgpiSelected = NULL;
+ qgpiSelected = nullptr;
qgriSelected->hide();
// QFontDialog doesn't really like graphics view. At all.
@@ -762,7 +762,7 @@ void OverlayEditorScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) {
int ret;
if (g.ocIntercept) {
- QGraphicsProxyWidget *qgpw = new QGraphicsProxyWidget(NULL, Qt::Window);
+ QGraphicsProxyWidget *qgpw = new QGraphicsProxyWidget(nullptr, Qt::Window);
qgpw->setWidget(&qfd);
addItem(qgpw);
@@ -775,7 +775,7 @@ void OverlayEditorScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) {
ret = qfd.exec();
qgpw->hide();
- qgpw->setWidget(NULL);
+ qgpw->setWidget(nullptr);
delete qgpw;
} else {
Qt::WindowFlags wf = g.mw->windowFlags();
diff --git a/src/mumble/OverlayEditorScene.h b/src/mumble/OverlayEditorScene.h
index 596047654..ac5542896 100644
--- a/src/mumble/OverlayEditorScene.h
+++ b/src/mumble/OverlayEditorScene.h
@@ -51,7 +51,7 @@ class OverlayEditorScene : public QGraphicsScene {
unsigned int uiZoom;
OverlaySettings os;
- OverlayEditorScene(const OverlaySettings &, QObject *p = NULL);
+ OverlayEditorScene(const OverlaySettings &, QObject *p = nullptr);
public slots:
void resync();
void updateSelected();
diff --git a/src/mumble/OverlayPositionableItem.cpp b/src/mumble/OverlayPositionableItem.cpp
index e86683412..bed165b81 100644
--- a/src/mumble/OverlayPositionableItem.cpp
+++ b/src/mumble/OverlayPositionableItem.cpp
@@ -14,12 +14,12 @@
OverlayPositionableItem::OverlayPositionableItem(QRectF *posPtr, const bool isPositionable)
: m_position(posPtr)
, m_isPositionEditable(isPositionable)
- , m_qgeiHandle(NULL) {
+ , m_qgeiHandle(nullptr) {
}
OverlayPositionableItem::~OverlayPositionableItem() {
delete m_qgeiHandle;
- m_qgeiHandle = NULL;
+ m_qgeiHandle = nullptr;
}
void OverlayPositionableItem::createPositioningHandle() {
@@ -46,7 +46,7 @@ bool OverlayPositionableItem::sceneEventFilter(QGraphicsItem *watched, QEvent *e
}
void OverlayPositionableItem::onMove() {
- if (m_qgeiHandle == NULL) {
+ if (!m_qgeiHandle) {
return;
}
@@ -67,7 +67,7 @@ void OverlayPositionableItem::updateRender() {
QPoint absPos(iroundf(sr.width() * m_position->x() + 0.5f), iroundf(sr.height() * m_position->y() + 0.5f));
if (m_isPositionEditable) {
- if (m_qgeiHandle == NULL) {
+ if (!m_qgeiHandle) {
createPositioningHandle();
}
m_qgeiHandle->setPos(absPos.x(), absPos.y());
@@ -83,7 +83,7 @@ void OverlayPositionableItem::updateRender() {
void OverlayPositionableItem::setItemVisible(const bool &visible) {
setVisible(visible);
- if (m_qgeiHandle != NULL) {
+ if (m_qgeiHandle) {
m_qgeiHandle->setVisible(visible);
}
}
diff --git a/src/mumble/OverlayUser.cpp b/src/mumble/OverlayUser.cpp
index 720dee0a1..f97690b71 100644
--- a/src/mumble/OverlayUser.cpp
+++ b/src/mumble/OverlayUser.cpp
@@ -27,7 +27,7 @@ OverlayUser::OverlayUser(ClientUser *cu, unsigned int height, OverlaySettings *o
updateLayout();
}
-OverlayUser::OverlayUser(Settings::TalkState ts, unsigned int height, OverlaySettings *osptr) : OverlayGroup(), os(osptr), uiSize(height), cuUser(NULL), tsColor(ts) {
+OverlayUser::OverlayUser(Settings::TalkState ts, unsigned int height, OverlaySettings *osptr) : OverlayGroup(), os(osptr), uiSize(height), cuUser(nullptr), tsColor(ts) {
qsChannelName = Overlay::tr("Channel");
setup();
diff --git a/src/mumble/OverlayUserGroup.cpp b/src/mumble/OverlayUserGroup.cpp
index eb0a67549..4b2f8fd88 100644
--- a/src/mumble/OverlayUserGroup.cpp
+++ b/src/mumble/OverlayUserGroup.cpp
@@ -41,7 +41,7 @@ QRectF OverlayGroup::boundingRect() const {
OverlayUserGroup::OverlayUserGroup(OverlaySettings *osptr) :
OverlayGroup(),
os(osptr),
- qgeiHandle(NULL),
+ qgeiHandle(nullptr),
bShowExamples(false) { }
OverlayUserGroup::~OverlayUserGroup() {
@@ -58,7 +58,7 @@ void OverlayUserGroup::reset() {
qmUsers.clear();
delete qgeiHandle;
- qgeiHandle = NULL;
+ qgeiHandle = nullptr;
}
int OverlayUserGroup::type() const {
@@ -69,8 +69,8 @@ void OverlayUserGroup::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) {
e->accept();
#ifdef Q_OS_MAC
- bool embed = g.ocIntercept != NULL;
- QMenu qm(embed ? NULL : e->widget());
+ bool embed = g.ocIntercept;
+ QMenu qm(embed ? nullptr : e->widget());
if (embed) {
QGraphicsScene *scene = g.ocIntercept->qgv.scene();
scene->addWidget(&qm);
@@ -146,7 +146,7 @@ void OverlayUserGroup::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) {
if (g.ocIntercept) {
QMetaObject::invokeMethod(g.ocIntercept, "openEditor", Qt::QueuedConnection);
} else {
- OverlayEditor oe(qApp->activeModalWidget(), NULL, os);
+ OverlayEditor oe(qApp->activeModalWidget(), nullptr, os);
connect(&oe, SIGNAL(applySettings()), this, SLOT(updateLayout()));
oe.exec();
}
@@ -286,7 +286,7 @@ void OverlayUserGroup::updateUsers() {
}
} else {
delete qgeiHandle;
- qgeiHandle = NULL;
+ qgeiHandle = nullptr;
}
ClientUser *self = ClientUser::get(g.uiSession);
@@ -356,7 +356,7 @@ void OverlayUserGroup::updateUsers() {
unsigned int xPos = 0;
foreach(OverlayUser *ou, users) {
- if (ou->parentItem() == NULL)
+ if (!ou->parentItem())
ou->setParentItem(this);
ou->setPos(xPos * (width+4) + xOffset, yPos * (height + 4) + yOffset);
diff --git a/src/mumble/Overlay_macx.mm b/src/mumble/Overlay_macx.mm
index a4a51ca16..b1732e6a3 100644
--- a/src/mumble/Overlay_macx.mm
+++ b/src/mumble/Overlay_macx.mm
@@ -207,7 +207,7 @@ void OverlayClient::updateMouse() {
QPixmap pm = qmCursors.value(csShape);
if (pm.isNull()) {
NSImage *img = [cursor image];
- CGImageRef cgimg = NULL;
+ CGImageRef cgimg = nullptr;
NSArray *reps = [img representations];
for (NSUInteger i = 0; i < [reps count]; i++) {
NSImageRep *rep = [reps objectAtIndex:i];
@@ -238,7 +238,7 @@ bool OverlayConfig::isInstalled() {
// Determine if the installed bundle is correctly installed (i.e. it's loadable)
NSBundle *bundle = [NSBundle bundleWithPath:MumbleOverlayLoaderBundle];
- ret = [bundle preflightAndReturnError:NULL];
+ ret = [bundle preflightAndReturnError:nullptr];
// Do the bundle identifiers match?
if (ret) {
@@ -252,34 +252,34 @@ bool OverlayConfig::isInstalled() {
// Also checks whether the new installer is compatiable with the current version of
// Mumble.
static bool isInstallerNewer(QString path, NSUInteger curVer) {
- xar_t pkg = NULL;
- xar_iter_t iter = NULL;
- xar_file_t file = NULL;
- char *data = NULL;
+ xar_t pkg = nullptr;
+ xar_iter_t iter = nullptr;
+ xar_file_t file = nullptr;
+ char *data = nullptr;
size_t size = 0;
bool ret = false;
QString qsMinVer, qsOverlayVer;
pkg = xar_open(path.toUtf8().constData(), READ);
- if (pkg == NULL) {
+ if (!pkg) {
qWarning("isInstallerNewer: Unable to open pkg.");
goto out;
}
iter = xar_iter_new();
- if (iter == NULL) {
+ if (!iter) {
qWarning("isInstallerNewer: Unable to allocate iter");
goto out;
}
file = xar_file_first(pkg, iter);
- while (file != NULL) {
+ while (file) {
if (!strcmp(xar_get_path(file), "upgrade.xml"))
break;
file = xar_file_next(iter);
}
- if (file != NULL) {
+ if (file) {
if (xar_extract_tobuffersz(pkg, file, &data, &size) == -1) {
goto out;
}
@@ -345,7 +345,7 @@ static bool authExec(AuthorizationRef ref, const char **argv) {
OSStatus err = noErr;
int pid = 0, status = 0;
- err = AuthorizationExecuteWithPrivileges(ref, argv[0], kAuthorizationFlagDefaults, const_cast<char * const *>(&argv[1]), NULL);
+ err = AuthorizationExecuteWithPrivileges(ref, argv[0], kAuthorizationFlagDefaults, const_cast<char * const *>(&argv[1]), nullptr);
if (err == errAuthorizationSuccess) {
do {
pid = wait(&status);
@@ -393,10 +393,10 @@ bool OverlayConfig::uninstallFiles() {
// Perform uninstallation using Authorization Services. (Pops up a dialog asking for admin privileges)
if (bundleOk) {
- err = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth);
+ err = AuthorizationCreate(nullptr, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth);
if (err == errAuthorizationSuccess) {
QByteArray tmp = QString::fromLatin1("/tmp/%1_Uninstalled_MumbleOverlay.osax").arg(QDateTime::currentMSecsSinceEpoch()).toLocal8Bit();
- const char *remove[] = { "/bin/mv", [MumbleOverlayLoaderBundle UTF8String], tmp.constData(), NULL };
+ const char *remove[] = { "/bin/mv", [MumbleOverlayLoaderBundle UTF8String], tmp.constData(), nullptr };
ret = authExec(auth, remove);
}
AuthorizationFree(auth, kAuthorizationFlagDefaults);
diff --git a/src/mumble/Overlay_unix.cpp b/src/mumble/Overlay_unix.cpp
index a2b51890c..fbd961608 100644
--- a/src/mumble/Overlay_unix.cpp
+++ b/src/mumble/Overlay_unix.cpp
@@ -7,7 +7,7 @@
#include "OverlayConfig.h"
void Overlay::platformInit() {
- d = NULL;
+ d = nullptr;
}
void Overlay::setActiveInternal(bool) {
diff --git a/src/mumble/Overlay_win.cpp b/src/mumble/Overlay_win.cpp
index 6da0304ec..7bf34eedf 100644
--- a/src/mumble/Overlay_win.cpp
+++ b/src/mumble/Overlay_win.cpp
@@ -252,7 +252,7 @@ void OverlayPrivateWin::onHelperProcessExited(int exitCode, QProcess::ExitStatus
QString path;
qint64 elapsedMsec = 0;
- QTimer *restartTimer = NULL;
+ QTimer *restartTimer = nullptr;
if (helper == m_helper_process) {
path = m_helper_exe_path;
elapsedMsec = m_helper_start_time.elapsed();
@@ -302,7 +302,7 @@ void OverlayPrivateWin::onDelayedRestartTimerTriggered() {
QTimer *timer = qobject_cast<QTimer *>(sender());
- QProcess *helper = NULL;
+ QProcess *helper = nullptr;
if (timer == m_helper_restart_timer) {
helper = m_helper_process;
} else if (timer == m_helper64_restart_timer) {
diff --git a/src/mumble/Plugins.cpp b/src/mumble/Plugins.cpp
index 96e250363..63e8248a6 100644
--- a/src/mumble/Plugins.cpp
+++ b/src/mumble/Plugins.cpp
@@ -57,9 +57,9 @@ struct PluginInfo {
PluginInfo::PluginInfo() {
locked = false;
enabled = false;
- p = NULL;
- p2 = NULL;
- pqt = NULL;
+ p = nullptr;
+ p2 = nullptr;
+ pqt = nullptr;
}
struct PluginFetchMeta {
@@ -122,7 +122,7 @@ PluginInfo *PluginConfig::pluginForItem(QTreeWidgetItem *i) const {
return pi;
}
}
- return NULL;
+ return nullptr;
}
void PluginConfig::on_qpbConfig_clicked() {
@@ -182,7 +182,7 @@ void PluginConfig::refillPluginList() {
i->setData(0, Qt::UserRole, pi->filename);
}
qtwPlugins->setCurrentItem(qtwPlugins->topLevelItem(0));
- on_qtwPlugins_currentItemChanged(qtwPlugins->topLevelItem(0), NULL);
+ on_qtwPlugins_currentItemChanged(qtwPlugins->topLevelItem(0), nullptr);
}
void PluginConfig::on_qtwPlugins_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *) {
@@ -217,7 +217,7 @@ Plugins::Plugins(QObject *p) : QObject(p) {
QTimer *timer=new QTimer(this);
timer->setObjectName(QLatin1String("Timer"));
timer->start(500);
- locked = prevlocked = NULL;
+ locked = prevlocked = nullptr;
bValid = false;
iPluginTry = 0;
for (int i=0;i<3;i++)
@@ -243,7 +243,7 @@ Plugins::Plugins(QObject *p) : QObject(p) {
#ifdef Q_OS_WIN
// According to MS KB Q131065, we need this to OpenProcess()
- hToken = NULL;
+ hToken = nullptr;
if (!OpenThreadToken(GetCurrentThread(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, FALSE, &hToken)) {
if (GetLastError() == ERROR_NO_TOKEN) {
@@ -256,7 +256,7 @@ Plugins::Plugins(QObject *p) : QObject(p) {
LUID luid;
cbPrevious=sizeof(TOKEN_PRIVILEGES);
- LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid);
+ LookupPrivilegeValue(nullptr, SE_DEBUG_NAME, &luid);
tp.PrivilegeCount = 1;
tp.Privileges[0].Luid = luid;
@@ -270,7 +270,7 @@ Plugins::~Plugins() {
clearPlugins();
#ifdef Q_OS_WIN
- AdjustTokenPrivileges(hToken, FALSE, &tpPrevious, cbPrevious, NULL, NULL);
+ AdjustTokenPrivileges(hToken, FALSE, &tpPrevious, cbPrevious, nullptr, nullptr);
CloseHandle(hToken);
#endif
}
@@ -290,7 +290,7 @@ void Plugins::rescanPlugins() {
clearPlugins();
QWriteLocker lock(&g.p->qrwlPlugins);
- prevlocked = locked = NULL;
+ prevlocked = locked = nullptr;
bValid = false;
QDir qd(qsSystemPlugins, QString(), QDir::Name, QDir::Files | QDir::Readable);
@@ -329,7 +329,7 @@ void Plugins::rescanPlugins() {
if (mpf2) {
pi->p2 = mpf2();
if (pi->p2->magic != MUMBLE_PLUGIN_MAGIC_2) {
- pi->p2 = NULL;
+ pi->p2 = nullptr;
}
}
@@ -337,7 +337,7 @@ void Plugins::rescanPlugins() {
if (mpfqt) {
pi->pqt = mpfqt();
if (pi->pqt->magic != MUMBLE_PLUGIN_MAGIC_QT) {
- pi->pqt = NULL;
+ pi->pqt = nullptr;
}
}
@@ -416,7 +416,7 @@ bool Plugins::fetch() {
locked->p->unlock();
locked->locked = false;
prevlocked = locked;
- locked = NULL;
+ locked = nullptr;
for (int i=0;i<3;i++)
fPosition[i]=fFront[i]=fTop[i]=fCameraPosition[i]=fCameraFront[i]=fCameraTop[i] = 0.0f;
}
@@ -432,7 +432,7 @@ void Plugins::on_Timer_timeout() {
if (prevlocked) {
g.l->log(Log::Information, tr("%1 lost link.").arg(prevlocked->shortname.toHtmlEscaped()));
- prevlocked = NULL;
+ prevlocked = nullptr;
}
diff --git a/src/mumble/Plugins.h b/src/mumble/Plugins.h
index 90d5a2a5d..40d9c0bad 100644
--- a/src/mumble/Plugins.h
+++ b/src/mumble/Plugins.h
@@ -75,7 +75,7 @@ class Plugins : public QObject {
float fPosition[3], fFront[3], fTop[3];
float fCameraPosition[3], fCameraFront[3], fCameraTop[3];
- Plugins(QObject *p = NULL);
+ Plugins(QObject *p = nullptr);
~Plugins() Q_DECL_OVERRIDE;
public slots:
void on_Timer_timeout();
diff --git a/src/mumble/PulseAudio.cpp b/src/mumble/PulseAudio.cpp
index b77a70bb9..395a0351f 100644
--- a/src/mumble/PulseAudio.cpp
+++ b/src/mumble/PulseAudio.cpp
@@ -15,7 +15,7 @@
static const char *mumble_sink_input = "Mumble Speakers";
static const char *mumble_echo = "Mumble Speakers (Echo)";
-static PulseAudioSystem *pasys = NULL;
+static PulseAudioSystem *pasys = nullptr;
#define NBLOCKS 8
@@ -51,24 +51,24 @@ class PulseAudioInit : public DeferInit {
airPulseAudio = new PulseAudioInputRegistrar();
aorPulseAudio = new PulseAudioOutputRegistrar();
} else {
- airPulseAudio = NULL;
- aorPulseAudio = NULL;
+ airPulseAudio = nullptr;
+ aorPulseAudio = nullptr;
delete pasys;
- pasys = NULL;
+ pasys = nullptr;
}
};
void destroy() {
delete airPulseAudio;
delete aorPulseAudio;
delete pasys;
- pasys = NULL;
+ pasys = nullptr;
};
};
static PulseAudioInit pulseinit;
PulseAudioSystem::PulseAudioSystem() {
- pasInput = pasOutput = pasSpeaker = NULL;
+ pasInput = pasOutput = pasSpeaker = nullptr;
bSourceDone=bSinkDone=bServerDone = false;
iDelayCache = 0;
bAttenuating = false;
@@ -87,13 +87,13 @@ PulseAudioSystem::PulseAudioSystem() {
pa_proplist_sets(proplist, PA_PROP_APPLICATION_ICON_NAME, "mumble");
pa_proplist_sets(proplist, PA_PROP_MEDIA_ROLE, "game");
- pacContext = pa_context_new_with_proplist(api, NULL, proplist);
+ pacContext = pa_context_new_with_proplist(api, nullptr, proplist);
pa_proplist_free(proplist);
pa_context_set_subscribe_callback(pacContext, subscribe_callback, this);
pa_context_set_state_callback(pacContext, context_state_callback, this);
- pa_context_connect(pacContext, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL);
+ pa_context_connect(pacContext, nullptr, PA_CONTEXT_NOAUTOSPAWN, nullptr);
pade = api->defer_new(api, defer_event_callback, this);
api->defer_enable(pade, false);
@@ -196,7 +196,7 @@ void PulseAudioSystem::eventCallback(pa_mainloop_api *api, pa_defer_event *) {
if (pss.channels == 0)
pss.channels = 1;
- pasOutput = pa_stream_new(pacContext, mumble_sink_input, &pss, (pss.channels == 1) ? NULL : &pcm);
+ pasOutput = pa_stream_new(pacContext, mumble_sink_input, &pss, (pss.channels == 1) ? nullptr : &pcm);
pa_stream_set_state_callback(pasOutput, write_stream_callback, this);
pa_stream_set_write_callback(pasOutput, write_callback, this);
}
@@ -235,7 +235,7 @@ void PulseAudioSystem::eventCallback(pa_mainloop_api *api, pa_defer_event *) {
iDelayCache = g.s.iOutputDelay;
qsOutputCache = odev;
- pa_stream_connect_playback(pasOutput, qPrintable(odev), &buff, PA_STREAM_ADJUST_LATENCY, NULL, NULL);
+ pa_stream_connect_playback(pasOutput, qPrintable(odev), &buff, PA_STREAM_ADJUST_LATENCY, nullptr, nullptr);
pa_context_get_sink_info_by_name(pacContext, qPrintable(odev), sink_info_callback, this);
}
}
@@ -261,7 +261,7 @@ void PulseAudioSystem::eventCallback(pa_mainloop_api *api, pa_defer_event *) {
pss.rate = SAMPLE_RATE;
pss.channels = 1;
- pasInput = pa_stream_new(pacContext, "Microphone", &pss, NULL);
+ pasInput = pa_stream_new(pacContext, "Microphone", &pss, nullptr);
pa_stream_set_state_callback(pasInput, read_stream_callback, this);
pa_stream_set_read_callback(pasInput, read_callback, this);
}
@@ -299,7 +299,7 @@ void PulseAudioSystem::eventCallback(pa_mainloop_api *api, pa_defer_event *) {
pa_stream_connect_record(pasInput, qPrintable(idev), &buff, PA_STREAM_ADJUST_LATENCY);
// Ensure stream is initially un-muted
- pa_stream_cork(pasInput, 0, NULL, NULL);
+ pa_stream_cork(pasInput, 0, nullptr, nullptr);
connect(g.mw, &MainWindow::corkAudioInputStream, this, &PulseAudioSystem::corkAudioInputStream);
}
@@ -329,7 +329,7 @@ void PulseAudioSystem::eventCallback(pa_mainloop_api *api, pa_defer_event *) {
if ((pss.channels == 0) || (! g.s.bEchoMulti))
pss.channels = 1;
- pasSpeaker = pa_stream_new(pacContext, mumble_echo, &pss, (pss.channels == 1) ? NULL : &pcm);
+ pasSpeaker = pa_stream_new(pacContext, mumble_echo, &pss, (pss.channels == 1) ? nullptr : &pcm);
pa_stream_set_state_callback(pasSpeaker, read_stream_callback, this);
pa_stream_set_read_callback(pasSpeaker, read_callback, this);
}
@@ -489,13 +489,13 @@ void PulseAudioSystem::read_callback(pa_stream *s, size_t bytes, void *userdata)
PulseAudioSystem *pas = reinterpret_cast<PulseAudioSystem *>(userdata);
size_t length = bytes;
- const void *data = NULL;
+ const void *data = nullptr;
pa_stream_peek(s, &data, &length);
- if (data == NULL && length > 0) {
+ if (!data && length > 0) {
qWarning("PulseAudio: pa_stream_peek reports no data at current read index.");
- } else if (data == NULL && length == 0) {
+ } else if (!data && length == 0) {
qWarning("PulseAudio: pa_stream_peek reports empty memblockq.");
- } else if (data == NULL || length == 0) {
+ } else if (!data || length == 0) {
qWarning("PulseAudio: invalid pa_stream_peek state encountered.");
return;
}
@@ -523,7 +523,7 @@ void PulseAudioSystem::read_callback(pa_stream *s, size_t bytes, void *userdata)
pai->eMicFormat = PulseAudioInput::SampleShort;
pai->initializeMixer();
}
- if (data != NULL) {
+ if (data) {
pai->addMic(data, static_cast<unsigned int>(length) / pai->iMicSampleSize);
}
} else if (s == pas->pasSpeaker) {
@@ -537,7 +537,7 @@ void PulseAudioSystem::read_callback(pa_stream *s, size_t bytes, void *userdata)
pai->eEchoFormat = PulseAudioInput::SampleShort;
pai->initializeMixer();
}
- if (data != NULL) {
+ if (data) {
pai->addEcho(data, static_cast<unsigned int>(length) / pai->iEchoSampleSize);
}
}
@@ -637,7 +637,7 @@ void PulseAudioSystem::write_callback(pa_stream *s, size_t bytes, void *userdata
pas->setVolumes();
}
- pa_stream_write(s, buffer, iSampleSize * samples, NULL, 0, PA_SEEK_RELATIVE);
+ pa_stream_write(s, buffer, iSampleSize * samples, nullptr, 0, PA_SEEK_RELATIVE);
}
void PulseAudioSystem::volume_sink_input_list_callback(pa_context *c, const pa_sink_input_info *i, int eol, void *userdata) {
@@ -671,7 +671,7 @@ void PulseAudioSystem::volume_sink_input_list_callback(pa_context *c, const pa_s
pa_sw_cvolume_multiply_scalar(&patt.attenuated_volume, &i->volume, adj);
// set it on the sink input
- pa_operation_unref(pa_context_set_sink_input_volume(c, i->index, &patt.attenuated_volume, NULL, NULL));
+ pa_operation_unref(pa_context_set_sink_input_volume(c, i->index, &patt.attenuated_volume, nullptr, nullptr));
// store it
pas->qhVolumes[i->index] = patt;
@@ -839,8 +839,8 @@ void PulseAudioSystem::contextCallback(pa_context *c) {
switch (pa_context_get_state(c)) {
case PA_CONTEXT_READY:
bPulseIsGood = true;
- pa_operation_unref(pa_context_subscribe(pacContext, PA_SUBSCRIPTION_MASK_SOURCE, NULL, this));
- pa_operation_unref(pa_context_subscribe(pacContext, PA_SUBSCRIPTION_MASK_SINK, NULL, this));
+ pa_operation_unref(pa_context_subscribe(pacContext, PA_SUBSCRIPTION_MASK_SOURCE, nullptr, this));
+ pa_operation_unref(pa_context_subscribe(pacContext, PA_SUBSCRIPTION_MASK_SINK, nullptr, this));
query();
break;
case PA_CONTEXT_TERMINATED:
diff --git a/src/mumble/RichTextEditor.h b/src/mumble/RichTextEditor.h
index 6afc018f1..29756ec89 100644
--- a/src/mumble/RichTextEditor.h
+++ b/src/mumble/RichTextEditor.h
@@ -32,7 +32,7 @@ class RichTextEditorLink : public QDialog, Ui::RichTextEditorLink {
Q_OBJECT
Q_DISABLE_COPY(RichTextEditorLink)
public:
- RichTextEditorLink(const QString &text = QString(), QWidget *p = NULL);
+ RichTextEditorLink(const QString &text = QString(), QWidget *p = nullptr);
QString text() const;
};
@@ -48,7 +48,7 @@ class RichTextEditor : public QTabWidget, Ui::RichTextEditor {
QColor qcColor;
bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
public:
- RichTextEditor(QWidget *p = NULL);
+ RichTextEditor(QWidget *p = nullptr);
QString text();
bool isModified() const;
signals:
diff --git a/src/mumble/ServerHandler.cpp b/src/mumble/ServerHandler.cpp
index f9e774057..e0fc48c8b 100644
--- a/src/mumble/ServerHandler.cpp
+++ b/src/mumble/ServerHandler.cpp
@@ -67,7 +67,7 @@ ServerHandlerMessageEvent::ServerHandlerMessageEvent(const QByteArray &msg, unsi
#ifdef Q_OS_WIN
static HANDLE loadQoS() {
- HANDLE hQoS = NULL;
+ HANDLE hQoS = nullptr;
HRESULT hr = E_FAIL;
@@ -91,7 +91,7 @@ static HANDLE loadQoS() {
if (! QOSCreateHandle(&qvVer, &hQoS)) {
qWarning("ServerHandler: Failed to create QOS2 handle");
- hQoS = NULL;
+ hQoS = nullptr;
} else {
qWarning("ServerHandler: QOS2 loaded");
}
@@ -103,11 +103,11 @@ static HANDLE loadQoS() {
ServerHandler::ServerHandler()
: database(new Database(QLatin1String("ServerHandler"))) {
cConnection.reset();
- qusUdp = NULL;
+ qusUdp = nullptr;
bStrong = false;
usPort = 0;
bUdp = true;
- tConnectionTimeoutTimer = NULL;
+ tConnectionTimeoutTimer = nullptr;
uiVersion = 0;
iInFlightTCPPings = 0;
@@ -156,7 +156,7 @@ ServerHandler::~ServerHandler() {
#ifdef Q_OS_WIN
if (hQoS) {
QOSCloseHandle(hQoS);
- Connection::setQoS(NULL);
+ Connection::setQoS(nullptr);
}
#endif
}
@@ -343,7 +343,7 @@ void ServerHandler::run() {
do {
saTargetServer = qlAddresses.takeFirst();
- tConnectionTimeoutTimer = NULL;
+ tConnectionTimeoutTimer = nullptr;
qbaDigest = QByteArray();
bStrong = true;
qtsSock = new QSslSocket(this);
@@ -414,14 +414,14 @@ void ServerHandler::run() {
QMutexLocker qml(&qmUdp);
#ifdef Q_OS_WIN
- if (hQoS != NULL) {
+ if (hQoS) {
if (! QOSRemoveSocketFromFlow(hQoS, 0, dwFlowUDP, 0))
qWarning("ServerHandler: Failed to remove UDP from QoS");
dwFlowUDP = 0;
}
#endif
delete qusUdp;
- qusUdp = NULL;
+ qusUdp = nullptr;
}
ticker->stop();
@@ -771,7 +771,7 @@ void ServerHandler::serverConnectionConnected() {
}
#endif
#elif defined(Q_OS_WIN)
- if (hQoS != NULL) {
+ if (hQoS) {
struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
diff --git a/src/mumble/SharedMemory_unix.cpp b/src/mumble/SharedMemory_unix.cpp
index 1a5302e98..6a031397f 100644
--- a/src/mumble/SharedMemory_unix.cpp
+++ b/src/mumble/SharedMemory_unix.cpp
@@ -18,7 +18,7 @@ struct SharedMemory2Private {
};
SharedMemory2::SharedMemory2(QObject *p, unsigned int minsize, const QString &memname) : QObject(p) {
- a_ucData = NULL;
+ a_ucData = nullptr;
d = new SharedMemory2Private();
d->iShmemFD = -1;
@@ -56,13 +56,13 @@ SharedMemory2::SharedMemory2(QObject *p, unsigned int minsize, const QString &me
} else if (memsize > std::numeric_limits<unsigned int>::max()) {
qWarning() << "SharedMemory2: Segment too big" << memsize;
} else {
- a_ucData = reinterpret_cast<unsigned char *>(mmap(NULL, minsize, prot, MAP_SHARED, d->iShmemFD, 0));
+ a_ucData = reinterpret_cast<unsigned char *>(mmap(nullptr, minsize, prot, MAP_SHARED, d->iShmemFD, 0));
if (a_ucData != reinterpret_cast<unsigned char *>(-1)) {
uiSize = memsize;
return;
}
qWarning() << "SharedMemory2: Failed to map shared memory segment" << qsName;
- a_ucData = NULL;
+ a_ucData = nullptr;
}
close(d->iShmemFD);
@@ -75,7 +75,7 @@ SharedMemory2::~SharedMemory2() {
systemRelease();
if (a_ucData) {
munmap(a_ucData, uiSize);
- a_ucData = NULL;
+ a_ucData = nullptr;
}
}
diff --git a/src/mumble/SharedMemory_win.cpp b/src/mumble/SharedMemory_win.cpp
index 3f29272f0..97a9fe6ac 100644
--- a/src/mumble/SharedMemory_win.cpp
+++ b/src/mumble/SharedMemory_win.cpp
@@ -14,46 +14,46 @@ struct SharedMemory2Private {
};
SharedMemory2::SharedMemory2(QObject *p, unsigned int minsize, const QString &memname) : QObject(p) {
- a_ucData = NULL;
+ a_ucData = nullptr;
d = new SharedMemory2Private();
- d->hMemory = NULL;
+ d->hMemory = nullptr;
if (memname.isEmpty()) {
// Create a new segment
for (int i=0;i<100;++i) {
qsName = QString::fromLatin1("Local\\MumbleOverlayMemory%1").arg(++uiIndex);
- d->hMemory = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, minsize, qsName.toStdWString().c_str());
+ d->hMemory = CreateFileMappingW(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, minsize, qsName.toStdWString().c_str());
if (d->hMemory && GetLastError() != ERROR_ALREADY_EXISTS) {
break;
}
if (d->hMemory)
CloseHandle(d->hMemory);
- d->hMemory = NULL;
+ d->hMemory = nullptr;
}
} else {
// Open existing segment
qsName = memname;
- d->hMemory = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, minsize, qsName.toStdWString().c_str());
+ d->hMemory = CreateFileMappingW(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, minsize, qsName.toStdWString().c_str());
qWarning("%p %lx", d->hMemory, GetLastError());
if (GetLastError() != ERROR_ALREADY_EXISTS) {
qWarning() << "SharedMemory2: Memory doesn't exist" << qsName;
if (d->hMemory) {
CloseHandle(d->hMemory);
- d->hMemory = NULL;
+ d->hMemory = nullptr;
}
}
}
- if (d->hMemory == NULL) {
+ if (!d->hMemory) {
qWarning() << "SharedMemory2: CreateFileMapping failed for" << qsName;
} else {
a_ucData = reinterpret_cast<unsigned char *>(MapViewOfFile(d->hMemory, FILE_MAP_ALL_ACCESS, 0, 0, 0));
- if (a_ucData == NULL) {
+ if (!a_ucData) {
qWarning() << "SharedMemory2: Failed to map memory" << qsName;
} else {
MEMORY_BASIC_INFORMATION mbi;
@@ -69,11 +69,11 @@ SharedMemory2::SharedMemory2(QObject *p, unsigned int minsize, const QString &me
if (a_ucData) {
UnmapViewOfFile(a_ucData);
- a_ucData = NULL;
+ a_ucData = nullptr;
}
if (d->hMemory) {
CloseHandle(d->hMemory);
- d->hMemory = NULL;
+ d->hMemory = nullptr;
}
}
@@ -90,6 +90,6 @@ void SharedMemory2::systemRelease() {
// This doesn't really do anything on Win32, since it has delete-on-close semantics anyway
if (d->hMemory) {
CloseHandle(d->hMemory);
- d->hMemory = NULL;
+ d->hMemory = nullptr;
}
}
diff --git a/src/mumble/SocketRPC.cpp b/src/mumble/SocketRPC.cpp
index 121e7baa0..3078c0ef5 100644
--- a/src/mumble/SocketRPC.cpp
+++ b/src/mumble/SocketRPC.cpp
@@ -18,7 +18,7 @@
// We define a global macro called 'g'. This can lead to issues when included code uses 'g' as a type or parameter name (like protobuf 3.7 does). As such, for now, we have to make this our last include.
#include "Global.h"
-SocketRPCClient::SocketRPCClient(QLocalSocket *s, QObject *p) : QObject(p), qlsSocket(s), qbBuffer(NULL) {
+SocketRPCClient::SocketRPCClient(QLocalSocket *s, QObject *p) : QObject(p), qlsSocket(s), qbBuffer(nullptr) {
qlsSocket->setParent(this);
connect(qlsSocket, SIGNAL(disconnected()), this, SLOT(disconnected()));
@@ -59,7 +59,7 @@ void SocketRPCClient::readyRead() {
qxsrReader.clear();
qxsrReader.setDevice(qlsSocket);
- qxswWriter.setDevice(NULL);
+ qxswWriter.setDevice(nullptr);
delete qbBuffer;
qbaOutput = QByteArray();
qbBuffer = new QBuffer(&qbaOutput, this);
@@ -252,7 +252,7 @@ SocketRPC::SocketRPC(const QString &basename, QObject *p) : QObject(p) {
if (! qlsServer->listen(pipepath)) {
qWarning() << "SocketRPC: Listen failed";
delete qlsServer;
- qlsServer = NULL;
+ qlsServer = nullptr;
} else {
connect(qlsServer, SIGNAL(newConnection()), this, SLOT(newConnection()));
}
diff --git a/src/mumble/SocketRPC.h b/src/mumble/SocketRPC.h
index 164f3b6f7..fc7295d92 100644
--- a/src/mumble/SocketRPC.h
+++ b/src/mumble/SocketRPC.h
@@ -28,7 +28,7 @@ class SocketRPCClient : public QObject {
void processXml();
public:
- SocketRPCClient(QLocalSocket *s, QObject *p = NULL);
+ SocketRPCClient(QLocalSocket *s, QObject *p = nullptr);
public slots:
void disconnected();
void error(QLocalSocket::LocalSocketError);
@@ -43,7 +43,7 @@ class SocketRPC : public QObject {
QLocalServer *qlsServer;
public:
typedef QMap<QString, QVariant> ParameterMap;
- SocketRPC(const QString &basename, QObject *p = NULL);
+ SocketRPC(const QString &basename, QObject *p = nullptr);
static bool send(const QString &basename, const QString &request, const ParameterMap &param = ParameterMap());
public slots:
void newConnection();
diff --git a/src/mumble/TaskList.cpp b/src/mumble/TaskList.cpp
index 9fb19686c..308cea772 100644
--- a/src/mumble/TaskList.cpp
+++ b/src/mumble/TaskList.cpp
@@ -27,11 +27,11 @@ void TaskList::addToRecentList(QString name, QString user, QString host, int por
return;
HRESULT hr;
- IShellLink *link = NULL;
- IPropertyStore *ps = NULL;
+ IShellLink *link = nullptr;
+ IPropertyStore *ps = nullptr;
PROPVARIANT pt;
- hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, __uuidof(IShellLink), reinterpret_cast<void **>(&link));
+ hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, __uuidof(IShellLink), reinterpret_cast<void **>(&link));
if (!link || FAILED(hr))
return;
diff --git a/src/mumble/TextMessage.h b/src/mumble/TextMessage.h
index 810213f88..f9a7bdaf2 100644
--- a/src/mumble/TextMessage.h
+++ b/src/mumble/TextMessage.h
@@ -17,7 +17,7 @@ class TextMessage : public QDialog, public Ui::TextMessage {
public slots:
void on_qcbTreeMessage_stateChanged(int);
public:
- TextMessage(QWidget *parent = NULL, QString title = tr("Enter text"), bool bChannel = false);
+ TextMessage(QWidget *parent = nullptr, QString title = tr("Enter text"), bool bChannel = false);
QString message();
bool bTreeMessage;
};
diff --git a/src/mumble/TextToSpeech.h b/src/mumble/TextToSpeech.h
index 9c87164d4..bebb42d33 100644
--- a/src/mumble/TextToSpeech.h
+++ b/src/mumble/TextToSpeech.h
@@ -19,7 +19,7 @@ class TextToSpeech : public QObject {
protected:
bool enabled;
public:
- TextToSpeech(QObject *parent = NULL);
+ TextToSpeech(QObject *parent = nullptr);
~TextToSpeech() Q_DECL_OVERRIDE;
bool isEnabled() const;
public slots:
diff --git a/src/mumble/TextToSpeech_unix.cpp b/src/mumble/TextToSpeech_unix.cpp
index bce35592c..575e87efd 100644
--- a/src/mumble/TextToSpeech_unix.cpp
+++ b/src/mumble/TextToSpeech_unix.cpp
@@ -39,13 +39,13 @@ class TextToSpeechPrivate {
TextToSpeechPrivate::TextToSpeechPrivate() {
initialized = false;
volume = -1;
- spd = NULL;
+ spd = nullptr;
}
TextToSpeechPrivate::~TextToSpeechPrivate() {
if (spd) {
spd_close(spd);
- spd = NULL;
+ spd = nullptr;
}
}
@@ -54,7 +54,7 @@ void TextToSpeechPrivate::ensureInitialized() {
return;
}
- spd = spd_open("Mumble", NULL, NULL, SPD_MODE_THREADED);
+ spd = spd_open("Mumble", nullptr, nullptr, SPD_MODE_THREADED);
if (! spd) {
qWarning("TextToSpeech: Failed to contact speech dispatcher.");
} else {
diff --git a/src/mumble/TextToSpeech_win.cpp b/src/mumble/TextToSpeech_win.cpp
index f18c65581..f70c2c847 100644
--- a/src/mumble/TextToSpeech_win.cpp
+++ b/src/mumble/TextToSpeech_win.cpp
@@ -21,9 +21,9 @@ class TextToSpeechPrivate {
};
TextToSpeechPrivate::TextToSpeechPrivate() {
- pVoice = NULL;
+ pVoice = nullptr;
- HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
+ HRESULT hr = CoCreateInstance(CLSID_SpVoice, nullptr, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
if (FAILED(hr))
qWarning("TextToSpeechPrivate: Failed to allocate TTS Voice");
}
@@ -35,7 +35,7 @@ TextToSpeechPrivate::~TextToSpeechPrivate() {
void TextToSpeechPrivate::say(const QString &text) {
if (pVoice) {
- pVoice->Speak((const wchar_t *) text.utf16(), SPF_ASYNC, NULL);
+ pVoice->Speak((const wchar_t *) text.utf16(), SPF_ASYNC, nullptr);
}
}
diff --git a/src/mumble/Themes.cpp b/src/mumble/Themes.cpp
index edafcb210..f20e23ab3 100644
--- a/src/mumble/Themes.cpp
+++ b/src/mumble/Themes.cpp
@@ -106,7 +106,7 @@ bool Themes::apply() {
applyFallback();
}
- if (g.mw != NULL) {
+ if (g.mw) {
g.mw->qteLog->document()->setDefaultStyleSheet(qApp->styleSheet());
}
return result;
diff --git a/src/mumble/Tokens.h b/src/mumble/Tokens.h
index 163f55fcc..72d48b61e 100644
--- a/src/mumble/Tokens.h
+++ b/src/mumble/Tokens.h
@@ -15,7 +15,7 @@ class Tokens : public QDialog, public Ui::Tokens {
protected:
QByteArray qbaDigest;
public:
- Tokens(QWidget *p = NULL);
+ Tokens(QWidget *p = nullptr);
public slots:
void accept() Q_DECL_OVERRIDE;
public slots:
diff --git a/src/mumble/Usage.h b/src/mumble/Usage.h
index c2c1df9c4..900121446 100644
--- a/src/mumble/Usage.h
+++ b/src/mumble/Usage.h
@@ -23,7 +23,7 @@ class Usage : public QObject {
QBuffer qbReport;
QDataStream qdsReport;
public:
- Usage(QObject *p = NULL);
+ Usage(QObject *p = nullptr);
public slots:
/// Performs the actual registration.
void registerUsage();
diff --git a/src/mumble/UserEdit.h b/src/mumble/UserEdit.h
index 8ff31dd70..deca37305 100644
--- a/src/mumble/UserEdit.h
+++ b/src/mumble/UserEdit.h
@@ -28,7 +28,7 @@ class UserEdit : public QDialog, public Ui::UserEdit {
Q_DISABLE_COPY(UserEdit)
public:
/// Constructs a dialog for editing the given userList.
- UserEdit(const MumbleProto::UserList &userList, QWidget *p = NULL);
+ UserEdit(const MumbleProto::UserList &userList, QWidget *p = nullptr);
public slots:
void accept() Q_DECL_OVERRIDE;
@@ -60,7 +60,7 @@ class UserEdit : public QDialog, public Ui::UserEdit {
class UserListFilterProxyModel : public QSortFilterProxyModel {
Q_OBJECT
public:
- explicit UserListFilterProxyModel(QObject *parent = NULL);
+ explicit UserListFilterProxyModel(QObject *parent = nullptr);
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const Q_DECL_OVERRIDE;
diff --git a/src/mumble/UserInformation.h b/src/mumble/UserInformation.h
index f28cf1f10..261bce0c2 100644
--- a/src/mumble/UserInformation.h
+++ b/src/mumble/UserInformation.h
@@ -33,7 +33,7 @@ class UserInformation : public QDialog, Ui::UserInformation {
void tick();
void on_qpbCertificate_clicked();
public:
- UserInformation(const MumbleProto::UserStats &msg, QWidget *p = NULL);
+ UserInformation(const MumbleProto::UserStats &msg, QWidget *p = nullptr);
void update(const MumbleProto::UserStats &msg);
unsigned int session() const;
};
diff --git a/src/mumble/UserListModel.cpp b/src/mumble/UserListModel.cpp
index ddfa55382..f690cc7fa 100644
--- a/src/mumble/UserListModel.cpp
+++ b/src/mumble/UserListModel.cpp
@@ -269,10 +269,10 @@ QString UserListModel::pathForChannelId(const int channelId) const {
path = QLatin1String("-");
Channel *channel = Channel::get(channelId);
- if (channel != NULL) {
+ if (channel) {
QStringList pathParts;
- while (channel->cParent != NULL) {
+ while (channel->cParent) {
pathParts.prepend(channel->qsName);
channel = channel->cParent;
}
diff --git a/src/mumble/UserListModel.h b/src/mumble/UserListModel.h
index 147fcc2ca..d9b93bb4d 100644
--- a/src/mumble/UserListModel.h
+++ b/src/mumble/UserListModel.h
@@ -32,7 +32,7 @@ class UserListModel : public QAbstractTableModel {
/// UserListModel constructs a table model representing the userList.
/// @param userList User list protobuf structure (will be copied)
/// @param parent Parent in QObject hierarchy
- UserListModel(const MumbleProto::UserList& userList, QObject *parent = NULL);
+ UserListModel(const MumbleProto::UserList& userList, QObject *parent = nullptr);
int rowCount(const QModelIndex &parentIndex = QModelIndex()) const Q_DECL_OVERRIDE;
int columnCount(const QModelIndex &parentIndex = QModelIndex()) const Q_DECL_OVERRIDE;
diff --git a/src/mumble/UserLocalVolumeDialog.cpp b/src/mumble/UserLocalVolumeDialog.cpp
index 9ff913ff1..e87323605 100644
--- a/src/mumble/UserLocalVolumeDialog.cpp
+++ b/src/mumble/UserLocalVolumeDialog.cpp
@@ -49,7 +49,7 @@
UserLocalVolumeDialog::UserLocalVolumeDialog(unsigned int sessionId,
QMap<unsigned int, UserLocalVolumeDialog *> *qmUserVolTracker)
- : QDialog(NULL)
+ : QDialog(nullptr)
, m_clientSession(sessionId)
, m_qmUserVolTracker(qmUserVolTracker) {
setupUi(this);
diff --git a/src/mumble/UserLockFile_win.cpp b/src/mumble/UserLockFile_win.cpp
index fbfa3447b..29c69242e 100644
--- a/src/mumble/UserLockFile_win.cpp
+++ b/src/mumble/UserLockFile_win.cpp
@@ -27,10 +27,10 @@ bool UserLockFile::acquire() {
reinterpret_cast<const wchar_t *>(m_path.utf16()),
GENERIC_WRITE,
0,
- NULL,
+ nullptr,
CREATE_ALWAYS,
FILE_ATTRIBUTE_HIDDEN,
- NULL
+ nullptr
);
if (m_handle == INVALID_HANDLE_VALUE && GetLastError() == ERROR_SHARING_VIOLATION) {
return false;
diff --git a/src/mumble/UserModel.cpp b/src/mumble/UserModel.cpp
index 32c059d06..5bc7a9583 100644
--- a/src/mumble/UserModel.cpp
+++ b/src/mumble/UserModel.cpp
@@ -37,7 +37,7 @@ bool ModelItem::bUsersTop = false;
ModelItem::ModelItem(Channel *c) {
this->cChan = c;
- this->pUser = NULL;
+ this->pUser = nullptr;
this->isListener = false;
bCommentSeen = true;
c_qhChannels.insert(c, this);
@@ -46,7 +46,7 @@ ModelItem::ModelItem(Channel *c) {
}
ModelItem::ModelItem(ClientUser *p, bool isListener) {
- this->cChan = NULL;
+ this->cChan = nullptr;
this->pUser = p;
this->isListener = isListener;
bCommentSeen = true;
@@ -110,7 +110,7 @@ void ModelItem::wipe() {
ModelItem *ModelItem::child(int idx) const {
if (! validRow(idx))
- return NULL;
+ return nullptr;
return qlChildren.at(idx);
}
@@ -121,13 +121,13 @@ bool ModelItem::validRow(int idx) const {
ClientUser *ModelItem::userAt(int idx) const {
if (! validRow(idx))
- return NULL;
+ return nullptr;
return qlChildren.at(idx)->pUser;
}
Channel *ModelItem::channelAt(int idx) const {
if (! validRow(idx))
- return NULL;
+ return nullptr;
return qlChildren.at(idx)->cChan;
}
@@ -337,7 +337,7 @@ QModelIndex UserModel::parent(const QModelIndex &idx) const {
ModelItem *item = static_cast<ModelItem *>(idx.internalPointer());
- ModelItem *parent_item = (item) ? item->parent : NULL;
+ ModelItem *parent_item = item ? item->parent : nullptr;
if (! parent_item)
return QModelIndex();
@@ -570,7 +570,7 @@ QVariant UserModel::otherRoles(const QModelIndex &idx, int role) const {
ClientUser *p = item->pUser;
Channel *c = item->cChan;
int section = idx.column();
- bool isUser = p != NULL;
+ bool isUser = p;
switch (role) {
case Qt::ToolTipRole:
@@ -1014,7 +1014,7 @@ void UserModel::removeUser(ClientUser *p) {
citem->qlChildren.removeAt(row);
endRemoveRows();
- p->cChannel = NULL;
+ p->cChannel = nullptr;
ClientUser::remove(p);
qmHashes.remove(p->qsHash);
@@ -1264,7 +1264,7 @@ Channel *UserModel::addChannel(int id, Channel *p, const QString &name) {
Channel *c = Channel::add(id, name);
if (! c)
- return NULL;
+ return nullptr;
ModelItem *item = new ModelItem(c);
ModelItem *citem = ModelItem::c_qhChannels.value(p);
@@ -1472,7 +1472,7 @@ void UserModel::unlinkChannels(Channel *c, QList<Channel *> links) {
}
void UserModel::unlinkAll(Channel *c) {
- c->unlink(NULL);
+ c->unlink(nullptr);
recheckLinks();
}
@@ -1505,7 +1505,7 @@ void UserModel::removeAll() {
ClientUser *UserModel::getUser(const QModelIndex &idx) const {
if (! idx.isValid())
- return NULL;
+ return nullptr;
ModelItem *item;
item = static_cast<ModelItem *>(idx.internalPointer());
@@ -1544,7 +1544,7 @@ void UserModel::setSelectedUser(unsigned int session) {
Channel *UserModel::getChannel(const QModelIndex &idx) const {
if (! idx.isValid())
- return NULL;
+ return nullptr;
ModelItem *item;
item = static_cast<ModelItem *>(idx.internalPointer());
@@ -1583,7 +1583,7 @@ void UserModel::setSelectedChannel(int id) {
Channel *UserModel::getSubChannel(Channel *p, int idx) const {
ModelItem *item=ModelItem::c_qhChannels.value(p);
if (! item)
- return NULL;
+ return nullptr;
foreach(ModelItem *i, item->qlChildren) {
if (i->cChan) {
@@ -1592,12 +1592,12 @@ Channel *UserModel::getSubChannel(Channel *p, int idx) const {
idx--;
}
}
- return NULL;
+ return nullptr;
}
void UserModel::userStateChanged() {
ClientUser *user = qobject_cast<ClientUser *>(sender());
- if (user == NULL)
+ if (!user)
return;
const QModelIndex idx = index(user);
diff --git a/src/mumble/UserView.cpp b/src/mumble/UserView.cpp
index f1f236deb..e30bb6605 100644
--- a/src/mumble/UserView.cpp
+++ b/src/mumble/UserView.cpp
@@ -345,7 +345,7 @@ void UserView::updateChannel(const QModelIndex &idx) {
// Check whether user resides in this channel or a subchannel
if (g.uiSession != 0) {
const ClientUser* user = ClientUser::get(g.uiSession);
- if (user != NULL) {
+ if (user) {
Channel *chan = user->cChannel;
while (chan) {
if (chan == c) {
diff --git a/src/mumble/UserView.h b/src/mumble/UserView.h
index 16c24b45c..44bffc574 100644
--- a/src/mumble/UserView.h
+++ b/src/mumble/UserView.h
@@ -17,7 +17,7 @@ class UserDelegate : public QStyledItemDelegate {
Q_OBJECT
Q_DISABLE_COPY(UserDelegate)
public:
- UserDelegate(QObject *parent = NULL);
+ UserDelegate(QObject *parent = nullptr);
void paint(QPainter * painter, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
//! Width/height in px of user/channel flag icons
diff --git a/src/mumble/VersionCheck.h b/src/mumble/VersionCheck.h
index c712a1f28..fb9660276 100644
--- a/src/mumble/VersionCheck.h
+++ b/src/mumble/VersionCheck.h
@@ -23,7 +23,7 @@ class VersionCheck : public QObject {
public slots:
void fetched(QByteArray data, QUrl url);
public:
- VersionCheck(bool autocheck, QObject *parent = NULL, bool focus = false);
+ VersionCheck(bool autocheck, QObject *parent = nullptr, bool focus = false);
};
#endif
diff --git a/src/mumble/VoiceRecorder.cpp b/src/mumble/VoiceRecorder.cpp
index 5f33ee212..535a524bb 100644
--- a/src/mumble/VoiceRecorder.cpp
+++ b/src/mumble/VoiceRecorder.cpp
@@ -32,7 +32,7 @@ VoiceRecorder::RecordBuffer::RecordBuffer(
VoiceRecorder::RecordInfo::RecordInfo(const QString& userName_)
: userName(userName_)
- , soundFile(NULL)
+ , soundFile(nullptr)
, lastWrittenAbsoluteSample(0) {
}
@@ -171,7 +171,7 @@ QString VoiceRecorder::expandTemplateVariables(const QString &path, const QStrin
}
int VoiceRecorder::indexForUser(const ClientUser *clientUser) const {
- Q_ASSERT(!m_config.mixDownMode || clientUser == NULL);
+ Q_ASSERT(!m_config.mixDownMode || !clientUser);
return (m_config.mixDownMode) ? 0 : clientUser->uiSession;
}
@@ -231,7 +231,7 @@ SF_INFO VoiceRecorder::createSoundFileInfo() const {
}
bool VoiceRecorder::ensureFileIsOpenedFor(SF_INFO& soundFileInfo, boost::shared_ptr<RecordInfo>& ri) {
- if (ri->soundFile != NULL) {
+ if (ri->soundFile) {
// Nothing to do
return true;
}
@@ -272,8 +272,8 @@ bool VoiceRecorder::ensureFileIsOpenedFor(SF_INFO& soundFileInfo, boost::shared_
#else
ri->soundFile = sf_open(qPrintable(filename), SFM_WRITE, &soundFileInfo);
#endif
- if (ri->soundFile == NULL) {
- qWarning() << "Failed to open file for recorder: "<< sf_strerror(NULL);
+ if (!ri->soundFile) {
+ qWarning() << "Failed to open file for recorder: "<< sf_strerror(nullptr);
m_recording = false;
emit error(CreateFileFailed, tr("Recorder failed to open file '%1'").arg(filename));
emit recording_stopped();
@@ -287,7 +287,7 @@ bool VoiceRecorder::ensureFileIsOpenedFor(SF_INFO& soundFileInfo, boost::shared_
if ((soundFileInfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_FLOAT &&
(soundFileInfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_VORBIS) {
- sf_command(ri->soundFile, SFC_SET_CLIPPING, NULL, SF_TRUE);
+ sf_command(ri->soundFile, SFC_SET_CLIPPING, nullptr, SF_TRUE);
}
return true;
@@ -397,7 +397,7 @@ void VoiceRecorder::addBuffer(const ClientUser *clientUser,
boost::shared_array<float> buffer,
int samples) {
- Q_ASSERT(!m_config.mixDownMode || clientUser == NULL);
+ Q_ASSERT(!m_config.mixDownMode || !clientUser);
if (!m_recording)
return;
diff --git a/src/mumble/VoiceRecorder.h b/src/mumble/VoiceRecorder.h
index b52136d71..db06512e7 100644
--- a/src/mumble/VoiceRecorder.h
+++ b/src/mumble/VoiceRecorder.h
@@ -106,7 +106,7 @@ class VoiceRecorder : public QThread {
/// Adds an audio buffer which contains |samples| audio samples to the recorder.
/// The audio data will be assumed to be recorded at the time
/// prepareBufferAdds was last called.
- /// @param clientUser User for which to add the audio data. NULL in mixdown mode.
+ /// @param clientUser User for which to add the audio data. nullptr in mixdown mode.
void addBuffer(const ClientUser *clientUser, boost::shared_array<float> buffer, int samples);
/// Returns the elapsed time since the recording started.
diff --git a/src/mumble/VoiceRecorderDialog.h b/src/mumble/VoiceRecorderDialog.h
index c90082adc..bc7794f69 100644
--- a/src/mumble/VoiceRecorderDialog.h
+++ b/src/mumble/VoiceRecorderDialog.h
@@ -17,7 +17,7 @@ class VoiceRecorderDialog : public QDialog, private Ui::VoiceRecorderDialog {
QTimer *qtTimer;
public:
- explicit VoiceRecorderDialog(QWidget *p = NULL);
+ explicit VoiceRecorderDialog(QWidget *p = nullptr);
~VoiceRecorderDialog() Q_DECL_OVERRIDE;
void closeEvent(QCloseEvent *evt) Q_DECL_OVERRIDE;
diff --git a/src/mumble/WASAPI.cpp b/src/mumble/WASAPI.cpp
index fbdba71ae..26f1effd4 100644
--- a/src/mumble/WASAPI.cpp
+++ b/src/mumble/WASAPI.cpp
@@ -65,7 +65,7 @@ class WASAPIInit : public DeferInit {
WASAPIInputRegistrar *wirReg;
WASAPIOutputRegistrar *worReg;
public:
- WASAPIInit() : wirReg(NULL), worReg(NULL) { }
+ WASAPIInit() : wirReg(nullptr), worReg(nullptr) { }
void initialize();
void destroy();
};
@@ -75,8 +75,8 @@ static WASAPIInit wasapiinit;
extern bool bIsWin7, bIsVistaSP1;
void WASAPIInit::initialize() {
- wirReg = NULL;
- worReg = NULL;
+ wirReg = nullptr;
+ worReg = nullptr;
if (! bIsVistaSP1) {
qWarning("WASAPIInit: Requires Vista SP1");
@@ -84,7 +84,7 @@ void WASAPIInit::initialize() {
}
HMODULE hLib = LoadLibrary(L"AVRT.DLL");
- if (hLib == NULL) {
+ if (!hLib) {
qWarning("WASAPIInit: Failed to load avrt.dll");
return;
}
@@ -123,8 +123,8 @@ bool getAndCheckMixFormat(const char* sourceName,
WAVEFORMATEXTENSIBLE **waveFormatExtensible,
SAMPLEFORMAT *sampleFormat) {
- *waveFormatEx = NULL;
- *waveFormatExtensible = NULL;
+ *waveFormatEx = nullptr;
+ *waveFormatExtensible = nullptr;
HRESULT hr = audioClient->GetMixFormat(waveFormatEx);
if (FAILED(hr)) {
@@ -228,10 +228,10 @@ const QHash<QString, QString> WASAPISystem::getDevices(EDataFlow dataflow) {
HRESULT hr;
- IMMDeviceEnumerator *pEnumerator = NULL;
- IMMDeviceCollection *pCollection = NULL;
+ IMMDeviceEnumerator *pEnumerator = nullptr;
+ IMMDeviceCollection *pCollection = nullptr;
- hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), reinterpret_cast<void **>(&pEnumerator));
+ hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), reinterpret_cast<void **>(&pEnumerator));
if (! pEnumerator || FAILED(hr)) {
qWarning("WASAPI: Failed to instatiate enumerator: hr=0x%08lx", hr);
@@ -245,13 +245,13 @@ const QHash<QString, QString> WASAPISystem::getDevices(EDataFlow dataflow) {
UINT ndev = 0;
pCollection->GetCount(&ndev);
for (unsigned int idx=0;idx<ndev;++idx) {
- IMMDevice *pDevice = NULL;
- IPropertyStore *pStore = NULL;
+ IMMDevice *pDevice = nullptr;
+ IPropertyStore *pStore = nullptr;
pCollection->Item(idx, &pDevice);
pDevice->OpenPropertyStore(STGM_READ, &pStore);
- LPWSTR strid = NULL;
+ LPWSTR strid = nullptr;
pDevice->GetId(&strid);
PROPVARIANT varName;
@@ -302,15 +302,15 @@ WASAPIInput::~WASAPIInput() {
static IMMDevice *openNamedOrDefaultDevice(const QString& name, EDataFlow dataFlow, ERole role) {
HRESULT hr;
- IMMDeviceEnumerator *pEnumerator = NULL;
+ IMMDeviceEnumerator *pEnumerator = nullptr;
- hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), reinterpret_cast<void **>(&pEnumerator));
+ hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), reinterpret_cast<void **>(&pEnumerator));
if (!pEnumerator || FAILED(hr)) {
qWarning("WASAPI: Failed to instantiate enumerator: hr=0x%08lx", hr);
- return NULL;
+ return nullptr;
}
- IMMDevice *pDevice = NULL;
+ IMMDevice *pDevice = nullptr;
// Try to find a device pointer for |name|.
if (!name.isEmpty()) {
STACKVAR(wchar_t, devname, name.length() + 1);
@@ -324,7 +324,7 @@ static IMMDevice *openNamedOrDefaultDevice(const QString& name, EDataFlow dataFl
}
}
- // Use the default device if |pDevice| is still NULL.
+ // Use the default device if |pDevice| is still nullptr.
// We retrieve the actual device name for the currently selected default device and
// open the device by it's real name to work around triggering the automatic
// ducking behavior.
@@ -334,7 +334,7 @@ static IMMDevice *openNamedOrDefaultDevice(const QString& name, EDataFlow dataFl
qWarning("WASAPI: Failed to open device: df=%d, e=%d, hr=0x%08lx", dataFlow, role, hr);
goto cleanup;
}
- wchar_t *devname = NULL;
+ wchar_t *devname = nullptr;
hr = pDevice->GetId(&devname);
if (FAILED(hr)) {
qWarning("WASAPI: Failed to query device: df=%d, e=%d, hr=0x%08lx", dataFlow, role, hr);
@@ -359,14 +359,14 @@ cleanup:
void WASAPIInput::run() {
HRESULT hr;
- IMMDevice *pMicDevice = NULL;
- IAudioClient *pMicAudioClient = NULL;
- IAudioCaptureClient *pMicCaptureClient = NULL;
- IMMDevice *pEchoDevice = NULL;
- IAudioClient *pEchoAudioClient = NULL;
- IAudioCaptureClient *pEchoCaptureClient = NULL;
- WAVEFORMATEX *micpwfx = NULL, *echopwfx = NULL;
- WAVEFORMATEXTENSIBLE *micpwfxe = NULL, *echopwfxe = NULL;
+ IMMDevice *pMicDevice = nullptr;
+ IAudioClient *pMicAudioClient = nullptr;
+ IAudioCaptureClient *pMicCaptureClient = nullptr;
+ IMMDevice *pEchoDevice = nullptr;
+ IAudioClient *pEchoAudioClient = nullptr;
+ IAudioCaptureClient *pEchoCaptureClient = nullptr;
+ WAVEFORMATEX *micpwfx = nullptr, *echopwfx = nullptr;
+ WAVEFORMATEXTENSIBLE *micpwfxe = nullptr, *echopwfxe = nullptr;
WAVEFORMATEXTENSIBLE wfe;
UINT32 bufferFrameCount;
UINT32 numFramesAvailable;
@@ -379,18 +379,18 @@ void WASAPIInput::run() {
DWORD flags;
DWORD dwTaskIndex = 0;
HANDLE hMmThread;
- float *tbuff = NULL;
- short *sbuff = NULL;
+ float *tbuff = nullptr;
+ short *sbuff = nullptr;
bool doecho = g.s.doEcho();
REFERENCE_TIME def, min, latency, want;
bool exclusive = false;
- CoInitialize(NULL);
+ CoInitialize(nullptr);
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
hMmThread = AvSetMmThreadCharacteristics(L"Pro Audio", &dwTaskIndex);
- if (hMmThread == NULL) {
+ if (!hMmThread) {
qWarning("WASAPIInput: Failed to set Pro Audio thread priority");
}
@@ -406,7 +406,7 @@ void WASAPIInput::run() {
doecho = false;
}
- hr = pMicDevice->Activate(__uuidof(IAudioClient), CLSCTX_ALL, NULL, (void **) &pMicAudioClient);
+ hr = pMicDevice->Activate(__uuidof(IAudioClient), CLSCTX_ALL, nullptr, (void **) &pMicAudioClient);
if (FAILED(hr)) {
qWarning("WASAPIInput: Activate Mic AudioClient failed: hr=0x%08lx", hr);
goto cleanup;
@@ -433,7 +433,7 @@ void WASAPIInput::run() {
micpwfxe = &wfe;
micpwfx = reinterpret_cast<WAVEFORMATEX *>(&wfe);
- hr = pMicAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, want, want, micpwfx, NULL);
+ hr = pMicAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, want, want, micpwfx, nullptr);
if (SUCCEEDED(hr)) {
eMicFormat = SampleShort;
exclusive = true;
@@ -441,8 +441,8 @@ void WASAPIInput::run() {
break;
}
- micpwfxe = NULL;
- micpwfx = NULL;
+ micpwfxe = nullptr;
+ micpwfx = nullptr;
}
}
@@ -455,7 +455,7 @@ void WASAPIInput::run() {
goto cleanup;
}
- hr = pMicAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, 0, 0, micpwfx, NULL);
+ hr = pMicAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, 0, 0, micpwfx, nullptr);
if (FAILED(hr)) {
qWarning("WASAPIInput: Mic Initialize failed: hr=0x%08lx", hr);
if (hr == E_ACCESSDENIED) {
@@ -493,7 +493,7 @@ void WASAPIInput::run() {
iMicFreq = micpwfx->nSamplesPerSec;
if (doecho) {
- hr = pEchoDevice->Activate(__uuidof(IAudioClient), CLSCTX_ALL, NULL, (void **) &pEchoAudioClient);
+ hr = pEchoDevice->Activate(__uuidof(IAudioClient), CLSCTX_ALL, nullptr, (void **) &pEchoAudioClient);
if (FAILED(hr)) {
qWarning("WASAPIInput: Activate Echo AudioClient failed: hr=0x%08lx", hr);
goto cleanup;
@@ -504,7 +504,7 @@ void WASAPIInput::run() {
goto cleanup;
}
- hr = pEchoAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_LOOPBACK, 0, 0, echopwfx, NULL);
+ hr = pEchoAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_LOOPBACK, 0, 0, echopwfx, nullptr);
if (FAILED(hr)) {
qWarning("WASAPIInput: Echo Initialize failed: hr=0x%08lx", hr);
goto cleanup;
@@ -649,10 +649,10 @@ cleanup:
if (pEchoDevice)
pEchoDevice->Release();
- if (hMmThread != NULL)
+ if (hMmThread)
AvRevertMmThreadCharacteristics(hMmThread);
- if (hEvent != NULL)
+ if (hEvent)
CloseHandle(hEvent);
delete [] tbuff;
@@ -676,14 +676,14 @@ void WASAPIOutput::setVolumes(IMMDevice *pDevice, bool talking) {
float fVolume = 1.0f;
hr = i.key()->GetMasterVolume(&fVolume);
if (qFuzzyCompare(i.value().second, fVolume))
- hr = i.key()->SetMasterVolume(i.value().first, NULL);
+ hr = i.key()->SetMasterVolume(i.value().first, nullptr);
i.key()->Release();
}
qmVolumes.clear();
return;
}
- IAudioSessionManager2 *pAudioSessionManager = NULL;
+ IAudioSessionManager2 *pAudioSessionManager = nullptr;
int max = 0;
DWORD dwMumble = GetCurrentProcessId();
@@ -693,9 +693,9 @@ void WASAPIOutput::setVolumes(IMMDevice *pDevice, bool talking) {
// FIXME: Try to keep the session object around when returning volume.
- if (SUCCEEDED(hr = pDevice->Activate(bIsWin7 ? __uuidof(IAudioSessionManager2) : __uuidof(IAudioSessionManager), CLSCTX_ALL, NULL, (void **) &pAudioSessionManager))) {
- IAudioSessionEnumerator *pEnumerator = NULL;
- IAudioSessionQuery *pMysticQuery = NULL;
+ if (SUCCEEDED(hr = pDevice->Activate(bIsWin7 ? __uuidof(IAudioSessionManager2) : __uuidof(IAudioSessionManager), CLSCTX_ALL, nullptr, (void **) &pAudioSessionManager))) {
+ IAudioSessionEnumerator *pEnumerator = nullptr;
+ IAudioSessionQuery *pMysticQuery = nullptr;
if (! bIsWin7) {
if (SUCCEEDED(hr = pAudioSessionManager->QueryInterface(IID_IAudioSessionQuery, (void **) &pMysticQuery))) {
hr = pMysticQuery->GetQueryInterface(&pEnumerator);
@@ -709,7 +709,7 @@ void WASAPIOutput::setVolumes(IMMDevice *pDevice, bool talking) {
if (SUCCEEDED(hr)) {
if (SUCCEEDED(hr = pEnumerator->GetCount(&max))) {
for (int i=0;i<max;++i) {
- IAudioSessionControl *pControl = NULL;
+ IAudioSessionControl *pControl = nullptr;
if (SUCCEEDED(hr = pEnumerator->GetSession(i, &pControl))) {
setVolumeForSessionControl(pControl, dwMumble, seen);
pControl->Release();
@@ -749,7 +749,7 @@ bool WASAPIOutput::setVolumeForSessionControl2(IAudioSessionControl2 *control2,
seen.insert(quuid);
// Adjust volume
- ISimpleAudioVolume *pVolume = NULL;
+ ISimpleAudioVolume *pVolume = nullptr;
if (FAILED(hr = control2->QueryInterface(__uuidof(ISimpleAudioVolume), (void **) &pVolume)))
return false;
@@ -759,7 +759,7 @@ bool WASAPIOutput::setVolumeForSessionControl2(IAudioSessionControl2 *control2,
float fVolume = 1.0f;
if (SUCCEEDED(hr = pVolume->GetMasterVolume(&fVolume)) && ! qFuzzyCompare(fVolume,0.0f)) {
float fSetVolume = fVolume * g.s.fOtherVolume;
- if (SUCCEEDED(hr = pVolume->SetMasterVolume(fSetVolume, NULL))) {
+ if (SUCCEEDED(hr = pVolume->SetMasterVolume(fSetVolume, nullptr))) {
hr = pVolume->GetMasterVolume(&fSetVolume);
qmVolumes.insert(pVolume, VolumePair(fVolume,fSetVolume));
keep = true;
@@ -775,7 +775,7 @@ bool WASAPIOutput::setVolumeForSessionControl2(IAudioSessionControl2 *control2,
bool WASAPIOutput::setVolumeForSessionControl(IAudioSessionControl *control, const DWORD mumblePID, QSet<QUuid> &seen) {
HRESULT hr;
- IAudioSessionControl2 *pControl2 = NULL;
+ IAudioSessionControl2 *pControl2 = nullptr;
if (!SUCCEEDED(hr = control->QueryInterface(bIsWin7 ? __uuidof(IAudioSessionControl2) : IID_IVistaAudioSessionControl2, (void **) &pControl2)))
return false;
@@ -791,18 +791,18 @@ static void SetDuckingOptOut(IMMDevice *pDevice) {
return;
HRESULT hr;
- IAudioSessionManager2 *pSessionManager2 = NULL;
- IAudioSessionControl *pSessionControl = NULL;
- IAudioSessionControl2 *pSessionControl2 = NULL;
+ IAudioSessionManager2 *pSessionManager2 = nullptr;
+ IAudioSessionControl *pSessionControl = nullptr;
+ IAudioSessionControl2 *pSessionControl2 = nullptr;
// Get session manager & control1+2 to disable ducking
- hr = pDevice->Activate(__uuidof(IAudioSessionManager2), CLSCTX_ALL, NULL, reinterpret_cast<void**>(&pSessionManager2));
+ hr = pDevice->Activate(__uuidof(IAudioSessionManager2), CLSCTX_ALL, nullptr, reinterpret_cast<void**>(&pSessionManager2));
if (FAILED(hr)) {
qWarning("WASAPIOutput: Activate AudioSessionManager2 failed: hr=0x%08lx", hr);
goto cleanup;
}
- hr = pSessionManager2->GetAudioSessionControl(NULL, 0, &pSessionControl);
+ hr = pSessionManager2->GetAudioSessionControl(nullptr, 0, &pSessionControl);
if (FAILED(hr)) {
qWarning("WASAPIOutput: GetAudioSessionControl failed: hr=0x%08lx", hr);
goto cleanup;
@@ -833,11 +833,11 @@ cleanup:
void WASAPIOutput::run() {
HRESULT hr;
- IMMDevice *pDevice = NULL;
- IAudioClient *pAudioClient = NULL;
- IAudioRenderClient *pRenderClient = NULL;
- WAVEFORMATEX *pwfx = NULL;
- WAVEFORMATEXTENSIBLE *pwfxe = NULL;
+ IMMDevice *pDevice = nullptr;
+ IAudioClient *pAudioClient = nullptr;
+ IAudioRenderClient *pRenderClient = nullptr;
+ WAVEFORMATEX *pwfx = nullptr;
+ WAVEFORMATEXTENSIBLE *pwfxe = nullptr;
UINT32 bufferFrameCount;
REFERENCE_TIME def, min, latency, want;
UINT32 numFramesAvailable;
@@ -853,12 +853,12 @@ void WASAPIOutput::run() {
bool exclusive = false;
bool mixed = false;
- CoInitialize(NULL);
+ CoInitialize(nullptr);
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
hMmThread = AvSetMmThreadCharacteristics(L"Pro Audio", &dwTaskIndex);
- if (hMmThread == NULL) {
+ if (!hMmThread) {
qWarning("WASAPIOutput: Failed to set Pro Audio thread priority");
}
@@ -870,7 +870,7 @@ void WASAPIOutput::run() {
// Opt-out of the Windows 7 ducking behavior
SetDuckingOptOut(pDevice);
- hr = pDevice->Activate(__uuidof(IAudioClient), CLSCTX_ALL, NULL, (void **) &pAudioClient);
+ hr = pDevice->Activate(__uuidof(IAudioClient), CLSCTX_ALL, nullptr, (void **) &pAudioClient);
if (FAILED(hr)) {
qWarning("WASAPIOutput: Activate AudioClient failed: hr=0x%08lx", hr);
goto cleanup;
@@ -910,7 +910,7 @@ void WASAPIOutput::run() {
pwfx->nBlockAlign = pwfx->nChannels * pwfx->wBitsPerSample / 8;
pwfx->nAvgBytesPerSec = pwfx->nBlockAlign * pwfx->nSamplesPerSec;
- hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, want, want, pwfx, NULL);
+ hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, want, want, pwfx, nullptr);
if (SUCCEEDED(hr)) {
eSampleFormat = SampleShort;
exclusive = true;
@@ -918,8 +918,8 @@ void WASAPIOutput::run() {
} else {
CoTaskMemFree(pwfx);
- pwfxe = NULL;
- pwfx = NULL;
+ pwfxe = nullptr;
+ pwfx = nullptr;
}
}
@@ -941,7 +941,7 @@ void WASAPIOutput::run() {
pwfxe->dwChannelMask = KSAUDIO_SPEAKER_STEREO;
}
- WAVEFORMATEX *closestFormat = NULL;
+ WAVEFORMATEX *closestFormat = nullptr;
hr = pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, pwfx, &closestFormat);
if (hr == S_FALSE) {
qWarning("WASAPIOutput: Driver says no to 2 channel output. Closest format: %d channels @ %lu kHz", closestFormat->nChannels, static_cast<unsigned long>(closestFormat->nSamplesPerSec));
@@ -961,7 +961,7 @@ void WASAPIOutput::run() {
CoTaskMemFree(closestFormat);
}
- hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, bufferDuration, 0, pwfx, NULL);
+ hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, bufferDuration, 0, pwfx, nullptr);
if (FAILED(hr)) {
qWarning("WASAPIOutput: Initialize failed: hr=0x%08lx", hr);
goto cleanup;
@@ -1096,9 +1096,9 @@ cleanup:
if (pDevice)
pDevice->Release();
- if (hMmThread != NULL)
+ if (hMmThread)
AvRevertMmThreadCharacteristics(hMmThread);
- if (hEvent != NULL)
+ if (hEvent)
CloseHandle(hEvent);
}
diff --git a/src/mumble/WASAPINotificationClient.cpp b/src/mumble/WASAPINotificationClient.cpp
index 25ecf51da..83cfb31eb 100644
--- a/src/mumble/WASAPINotificationClient.cpp
+++ b/src/mumble/WASAPINotificationClient.cpp
@@ -77,7 +77,7 @@ HRESULT STDMETHODCALLTYPE WASAPINotificationClient::QueryInterface(REFIID riid,
}
else
{
- *ppvInterface = NULL;
+ *ppvInterface = nullptr;
return E_NOINTERFACE;
}
return S_OK;
@@ -165,7 +165,7 @@ WASAPINotificationClient& WASAPINotificationClient::get() {
WASAPINotificationClient::WASAPINotificationClient() : QObject(), pEnumerator(0), listsMutex() {
AddRef(); // Static singleton, always has a self-reference
- HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), reinterpret_cast<void **>(&pEnumerator));
+ HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), reinterpret_cast<void **>(&pEnumerator));
if (!pEnumerator || FAILED(hr)) {
if (pEnumerator) {
pEnumerator->Release();
diff --git a/src/mumble/XboxInput.cpp b/src/mumble/XboxInput.cpp
index f33d01e22..e7a4d4265 100644
--- a/src/mumble/XboxInput.cpp
+++ b/src/mumble/XboxInput.cpp
@@ -10,10 +10,10 @@
const QUuid XboxInput::s_XboxInputGuid = QUuid(QString::fromLatin1("ca3937e3-640c-4d9e-9ef3-903f8b4fbcab"));
XboxInput::XboxInput()
- : GetState(NULL)
- , m_getStateFunc(NULL)
- , m_getStateExFunc(NULL)
- , m_xinputlib(NULL)
+ : GetState(nullptr)
+ , m_getStateFunc(nullptr)
+ , m_getStateExFunc(nullptr)
+ , m_xinputlib(nullptr)
, m_valid(false) {
// Load the most suitable XInput DLL available.
@@ -33,7 +33,7 @@ XboxInput::XboxInput()
foreach(const QString &lib, alternatives) {
m_xinputlib = LoadLibraryW(reinterpret_cast<const wchar_t *>(lib.utf16()));
- if (m_xinputlib != NULL) {
+ if (m_xinputlib) {
qWarning("XboxInput: using XInput DLL '%s'", qPrintable(lib));
m_valid = true;
break;
@@ -51,10 +51,10 @@ XboxInput::XboxInput()
// For reference, see SDL's XInput support: http://www.libsdl.org/tmp/SDL/src/core/windows/SDL_xinput.c
m_getStateExFunc = reinterpret_cast<XboxInputGetStateFunc>(GetProcAddress(m_xinputlib, (char *)100));
- if (m_getStateExFunc != NULL) {
+ if (m_getStateExFunc) {
GetState = m_getStateExFunc;
qWarning("XboxInput: using XInputGetStateEx() as querying function.");
- } else if (m_getStateFunc != NULL) {
+ } else if (m_getStateFunc) {
GetState = m_getStateFunc;
qWarning("XboxInput: using XInputGetState() as querying function.");
} else {
diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp
index 41648e6be..6f7881c02 100644
--- a/src/mumble/main.cpp
+++ b/src/mumble/main.cpp
@@ -220,7 +220,7 @@ int main(int argc, char **argv) {
}
#if defined(Q_OS_WIN)
- QMessageBox::information(NULL, MainWindow::tr("Invocation"), helpOutput);
+ QMessageBox::information(nullptr, MainWindow::tr("Invocation"), helpOutput);
#else
printf("%s", qPrintable(helpOutput));
#endif
@@ -264,7 +264,7 @@ int main(int argc, char **argv) {
else {
QString rpcError = MainWindow::tr("Error: No RPC command specified");
#if defined(Q_OS_WIN)
- QMessageBox::information(NULL, MainWindow::tr("RPC"), rpcError);
+ QMessageBox::information(nullptr, MainWindow::tr("RPC"), rpcError);
#else
printf("%s\n", qPrintable(rpcError));
#endif
@@ -297,7 +297,7 @@ int main(int argc, char **argv) {
{
size_t reqSize;
- if (_wgetenv_s(&reqSize, NULL, 0, L"PATH") != 0) {
+ if (_wgetenv_s(&reqSize, nullptr, 0, L"PATH") != 0) {
qWarning() << "Failed to get PATH. Not adding application directory to PATH. DBus bindings may not work.";
} else if (reqSize > 0) {
STACKVAR(wchar_t, buff, reqSize+1);
@@ -482,7 +482,7 @@ int main(int argc, char **argv) {
a.processEvents();
// Main Window
- g.mw=new MainWindow(NULL);
+ g.mw=new MainWindow(nullptr);
g.mw->show();
g.talkingUI = new TalkingUI();
@@ -514,7 +514,7 @@ int main(int argc, char **argv) {
g.l->log(Log::Information, MainWindow::tr("Welcome to Mumble."));
// Plugins
- g.p = new Plugins(NULL);
+ g.p = new Plugins(nullptr);
g.p->rescanPlugins();
Audio::start();
@@ -655,7 +655,7 @@ int main(int argc, char **argv) {
DeferInit::run_destroyers();
delete Global::g_global_struct;
- Global::g_global_struct = NULL;
+ Global::g_global_struct = nullptr;
#ifndef QT_NO_DEBUG
#if (GOOGLE_PROTOBUF_VERSION >= 2001000)
@@ -715,7 +715,7 @@ int main(int argc, char **argv) {
bool ok = QProcess::startDetached(qApp->applicationFilePath(), arguments);
#endif
if(!ok) {
- QMessageBox::warning(NULL,
+ QMessageBox::warning(nullptr,
QApplication::tr("Failed to restart mumble"),
QApplication::tr("Mumble failed to restart itself. Please restart it manually.")
);
@@ -735,14 +735,14 @@ extern "C" __declspec(dllexport) int MumbleMain(HINSTANCE instance, HINSTANCE pr
int argc;
wchar_t **argvW = CommandLineToArgvW(GetCommandLineW(), &argc);
- if (argvW == Q_NULLPTR) {
+ if (!argvW) {
return -1;
}
QVector<QByteArray> argvS;
argvS.reserve(argc);
- QVector<char *> argvV(argc, Q_NULLPTR);
+ QVector<char *> argvV(argc, nullptr);
for (int i = 0; i < argc; ++i) {
argvS.append(QString::fromWCharArray(argvW[i]).toLocal8Bit());
argvV[i] = argvS.back().data();
diff --git a/src/mumble/os_early_win.cpp b/src/mumble/os_early_win.cpp
index cb4d90f8c..a485e1d11 100644
--- a/src/mumble/os_early_win.cpp
+++ b/src/mumble/os_early_win.cpp
@@ -13,14 +13,14 @@
// Alert shows a fatal error dialog and waits for the user to click OK.
static void Alert(LPCWSTR title, LPCWSTR msg) {
- MessageBox(NULL, msg, title, MB_OK|MB_ICONERROR);
+ MessageBox(nullptr, msg, title, MB_OK|MB_ICONERROR);
}
// GetExecutablePath returns the path to mumble.exe.
static const std::wstring GetExecutablePath() {
wchar_t path[MAX_PATH];
- if (GetModuleFileNameW(NULL, path, MAX_PATH) == 0)
+ if (GetModuleFileNameW(nullptr, path, MAX_PATH) == 0)
return std::wstring();
std::wstring exe_path(path);
@@ -44,9 +44,9 @@ static bool UIAccessDisabledViaConfig() {
memset(&buf, 0, sizeof(buf));
DWORD sz = sizeof(buf) - 1*sizeof(wchar_t);
- HKEY key = NULL;
+ HKEY key = nullptr;
bool success = (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Mumble\\Mumble\\shortcut\\windows\\uiaccess", 0, KEY_READ, &key) == ERROR_SUCCESS) &&
- (RegQueryValueExW(key, L"enable" , NULL, NULL, (LPBYTE)&buf, &sz) == ERROR_SUCCESS);
+ (RegQueryValueExW(key, L"enable" , nullptr, nullptr, (LPBYTE)&buf, &sz) == ERROR_SUCCESS);
if (success && _wcsicmp(buf, L"false") == 0) {
return true;
}
@@ -56,7 +56,7 @@ static bool UIAccessDisabledViaConfig() {
// ProcessHasUIAccess returns true if the current process has UIAccess enabled.
static bool ProcessHasUIAccess() {
- HANDLE token = NULL;
+ HANDLE token = nullptr;
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) {
return false;
}
@@ -98,7 +98,7 @@ static bool RelaunchWithoutUIAccessIfNecessary() {
// restore it (which may be equivalent to not setting it all)
// once we've been relaunched.
const wchar_t *compat_layer_env = _wgetenv(L"__COMPAT_LAYER");
- if (compat_layer_env == NULL) {
+ if (!compat_layer_env) {
compat_layer_env = L"mumble_exe_none";
}
_wputenv_s(L"mumble_exe_prev_compat_layer", compat_layer_env);
@@ -119,12 +119,12 @@ static bool RelaunchWithoutUIAccessIfNecessary() {
if (!CreateProcessW(exe_path.c_str(),
GetCommandLineW(),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
FALSE,
0,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
&startup_info,
&process_info)) {
return false;
@@ -140,7 +140,7 @@ static bool RelaunchWithoutUIAccessIfNecessary() {
// variables set by RelaunchWithoutUIAccessIfNecessary.
static void CleanupEnvironmentVariables() {
wchar_t *prev_compat_layer_env = _wgetenv(L"mumble_exe_prev_compat_layer");
- if (prev_compat_layer_env != NULL) {
+ if (prev_compat_layer_env) {
if (wcscmp(prev_compat_layer_env, L"mumble_exe_none") == 0) {
_wputenv_s(L"__COMPAT_LAYER", L"");
} else {
diff --git a/src/mumble/os_macx.mm b/src/mumble/os_macx.mm
index 307039f2f..db69de99c 100644
--- a/src/mumble/os_macx.mm
+++ b/src/mumble/os_macx.mm
@@ -13,8 +13,8 @@
// We define a global macro called 'g'. This can lead to issues when included code uses 'g' as a type or parameter name (like protobuf 3.7 does). As such, for now, we have to make this our last include.
#include "Global.h"
-char *os_lang = NULL;
-static FILE *fConsole = NULL;
+char *os_lang = nullptr;
+static FILE *fConsole = nullptr;
static QSharedPointer<LogEmitter> le;
@@ -53,8 +53,8 @@ static void mumbleMessageOutputQString(QtMsgType type, const QString &msg) {
le->addLogEntry(fmsg);
if (type == QtFatalMsg) {
- CFStringRef csMsg = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%s\n\nThe error has been logged. Please submit your log file to the Mumble project if the problem persists."), qPrintable(msg));
- CFUserNotificationDisplayAlert(0, 0, NULL, NULL, NULL, CFSTR("Mumble has encountered a fatal error"), csMsg, CFSTR("OK"), NULL, NULL, NULL);
+ CFStringRef csMsg = CFStringCreateWithFormat(kCFAllocatorDefault, nullptr, CFSTR("%s\n\nThe error has been logged. Please submit your log file to the Mumble project if the problem persists."), qPrintable(msg));
+ CFUserNotificationDisplayAlert(0, 0, nullptr, nullptr, nullptr, CFSTR("Mumble has encountered a fatal error"), csMsg, CFSTR("OK"), nullptr, nullptr, nullptr);
CFRelease(csMsg);
exit(0);
}
@@ -110,7 +110,7 @@ static void crashhandler_signals_setup() {
static void crashhandler_signals_restore() {
for (size_t i = 0; i < NSIGS; i++) {
- signal(sigs[i], NULL);
+ signal(sigs[i], nullptr);
}
}
diff --git a/src/mumble/os_win.cpp b/src/mumble/os_win.cpp
index 57218cca7..9728a980a 100644
--- a/src/mumble/os_win.cpp
+++ b/src/mumble/os_win.cpp
@@ -40,7 +40,7 @@ extern "C" {
#define DUMP_BUFFER_SIZE 1024
static wchar_t wcCrashDumpPath[DUMP_BUFFER_SIZE];
-static FILE *fConsole = NULL;
+static FILE *fConsole = nullptr;
static wchar_t wcComment[DUMP_BUFFER_SIZE] = L"";
static MINIDUMP_USER_STREAM musComment;
@@ -76,7 +76,7 @@ static void mumbleMessageOutputQString(QtMsgType type, const QString &msg) {
OutputDebugStringA(qPrintable(fmsg));
le->addLogEntry(fmsg);
if (type == QtFatalMsg) {
- ::MessageBoxA(NULL, qPrintable(msg), "Mumble", MB_OK | MB_ICONERROR);
+ ::MessageBoxA(nullptr, qPrintable(msg), "Mumble", MB_OK | MB_ICONERROR);
exit(0);
}
}
@@ -96,9 +96,9 @@ static LONG WINAPI MumbleUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* Ex
musi.UserStreamCount = 1;
musi.UserStreamArray = &musComment;
- HANDLE hMinidump = CreateFile(wcCrashDumpPath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hMinidump = CreateFile(wcCrashDumpPath, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hMinidump != INVALID_HANDLE_VALUE) {
- if (MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hMinidump, static_cast<MINIDUMP_TYPE>(MiniDumpWithIndirectlyReferencedMemory | MiniDumpWithThreadInfo), &i, &musi, NULL)) {
+ if (MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hMinidump, static_cast<MINIDUMP_TYPE>(MiniDumpWithIndirectlyReferencedMemory | MiniDumpWithThreadInfo), &i, &musi, nullptr)) {
FlushFileBuffers(hMinidump);
}
CloseHandle(hMinidump);
@@ -140,7 +140,7 @@ static void enableCrashOnCrashes() {
BOOL SetHeapOptions() {
HMODULE hLib = LoadLibrary(L"kernel32.dll");
- if (hLib == NULL)
+ if (!hLib)
return FALSE;
typedef BOOL (WINAPI *HSI)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T);
@@ -154,7 +154,7 @@ BOOL SetHeapOptions() {
#define HeapEnableTerminationOnCorruption (HEAP_INFORMATION_CLASS)1
#endif
- BOOL fRet = (pHsi)(NULL, HeapEnableTerminationOnCorruption, NULL, 0) ? TRUE : FALSE;
+ BOOL fRet = (pHsi)(nullptr, HeapEnableTerminationOnCorruption, nullptr, 0) ? TRUE : FALSE;
if (hLib)
FreeLibrary(hLib);
@@ -221,7 +221,7 @@ void os_init() {
#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);
}
@@ -320,8 +320,8 @@ DWORD WinVerifySslCert(const QByteArray& cert) {
chainParameter.RequestedUsage.Usage.cUsageIdentifier = ARRAYSIZE(usage);
chainParameter.RequestedUsage.Usage.rgpszUsageIdentifier = const_cast<LPSTR *>(usage);
- PCCERT_CHAIN_CONTEXT chainContext = NULL;
- CertGetCertificateChain(NULL, certContext, NULL, NULL, &chainParameter, 0, NULL, &chainContext);
+ PCCERT_CHAIN_CONTEXT chainContext = nullptr;
+ CertGetCertificateChain(nullptr, certContext, nullptr, nullptr, &chainParameter, 0, nullptr, &chainContext);
if (chainContext) {
errorStatus = chainContext->TrustStatus.dwErrorStatus;
diff --git a/src/mumble/widgets/MUComboBox.h b/src/mumble/widgets/MUComboBox.h
index 10c647979..c25d6fff0 100644
--- a/src/mumble/widgets/MUComboBox.h
+++ b/src/mumble/widgets/MUComboBox.h
@@ -11,7 +11,7 @@
class MUComboBox : public QComboBox {
Q_OBJECT
public:
- MUComboBox(QWidget *parent = NULL);
+ MUComboBox(QWidget *parent = nullptr);
};
#endif