summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShlyak Pavel2018-11-30 21:15:46 +0100
committerAlf Gaida2018-12-10 00:48:44 +0100
commitad95ad78b3aa0b07d76865cfa62aae79ec451668 (patch)
tree010f78f12ed0bc70f0ce339ccb71c48d1b1189b4 /src
parentProvide minimum versions (diff)
downloadpavucontrol-slx-ad95ad78b3aa0b07d76865cfa62aae79ec451668.tar.gz
pavucontrol-slx-ad95ad78b3aa0b07d76865cfa62aae79ec451668.tar.xz
pavucontrol-slx-ad95ad78b3aa0b07d76865cfa62aae79ec451668.zip
Modernize the code with nullptr
Diffstat (limited to 'src')
-rw-r--r--src/cardwidget.cc2
-rw-r--r--src/devicewidget.cc6
-rw-r--r--src/minimalstreamwidget.cc2
-rw-r--r--src/pavucontrol.cc18
-rw-r--r--src/rolewidget.cc4
-rw-r--r--src/sinkinputwidget.cc8
-rw-r--r--src/sinkwidget.cc10
-rw-r--r--src/sourceoutputwidget.cc8
-rw-r--r--src/sourcewidget.cc8
-rw-r--r--src/streamwidget.cc2
10 files changed, 34 insertions, 34 deletions
diff --git a/src/cardwidget.cc b/src/cardwidget.cc
index 9fecefe..f86ff30 100644
--- a/src/cardwidget.cc
+++ b/src/cardwidget.cc
@@ -64,7 +64,7 @@ void CardWidget::changeProfile(const QByteArray & name)
{
pa_operation* o;
- if (!(o = pa_context_set_card_profile_by_index(get_context(), index, name.constData(), NULL, NULL))) {
+ if (!(o = pa_context_set_card_profile_by_index(get_context(), index, name.constData(), nullptr, nullptr))) {
show_error(tr("pa_context_set_card_profile_by_index() failed").toUtf8().constData());
return;
}
diff --git a/src/devicewidget.cc b/src/devicewidget.cc
index 4af15e2..95c7ef4 100644
--- a/src/devicewidget.cc
+++ b/src/devicewidget.cc
@@ -61,7 +61,7 @@ DeviceWidget::DeviceWidget(MainWindow* parent, QByteArray deviceType) :
connect(offsetButton, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &DeviceWidget::onOffsetChange);
for (unsigned i = 0; i < PA_CHANNELS_MAX; i++)
- channels[i] = NULL;
+ channels[i] = nullptr;
// FIXME:
@@ -151,7 +151,7 @@ void DeviceWidget::onOffsetChange() {
card_name = QByteArray::fromStdString(card_stream.str());
if (!(o = pa_context_set_port_latency_offset(get_context(),
- card_name, activePort, offset, NULL, NULL))) {
+ card_name, activePort, offset, nullptr, nullptr))) {
show_error(tr("pa_context_set_port_latency_offset() failed").toUtf8().constData());
return;
}
@@ -236,7 +236,7 @@ void DeviceWidget::renamePopup() {
pa_operation* o;
gchar *key = g_markup_printf_escaped("%s:%s", mDeviceType.constData(), name.constData());
- if (!(o = pa_ext_device_manager_set_device_description(get_context(), key, new_name.toUtf8().constData(), NULL, NULL)))
+ if (!(o = pa_ext_device_manager_set_device_description(get_context(), key, new_name.toUtf8().constData(), nullptr, nullptr)))
show_error(tr("pa_ext_device_manager_set_device_description() failed").toUtf8().constData());
else
pa_operation_unref(o);
diff --git a/src/minimalstreamwidget.cc b/src/minimalstreamwidget.cc
index 11eb4c7..ae6d924 100644
--- a/src/minimalstreamwidget.cc
+++ b/src/minimalstreamwidget.cc
@@ -32,7 +32,7 @@ MinimalStreamWidget::MinimalStreamWidget(QWidget *parent) :
QWidget(parent),
peakProgressBar(new QProgressBar(this)),
lastPeak(0),
- peak(NULL),
+ peak(nullptr),
updating(false),
volumeMeterEnabled(false),
volumeMeterVisible(true) {
diff --git a/src/pavucontrol.cc b/src/pavucontrol.cc
index cf2975c..1692a8d 100644
--- a/src/pavucontrol.cc
+++ b/src/pavucontrol.cc
@@ -51,8 +51,8 @@
#include <QCommandLineOption>
#include <QString>
-static pa_context* context = NULL;
-static pa_mainloop_api* api = NULL;
+static pa_context* context = nullptr;
+static pa_mainloop_api* api = nullptr;
static int n_outstanding = 0;
static int default_tab = 0;
static bool retry = false;
@@ -470,7 +470,7 @@ void context_state_callback(pa_context *c, void *userdata) {
PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT|
PA_SUBSCRIPTION_MASK_CLIENT|
PA_SUBSCRIPTION_MASK_SERVER|
- PA_SUBSCRIPTION_MASK_CARD), NULL, NULL))) {
+ PA_SUBSCRIPTION_MASK_CARD), nullptr, nullptr))) {
show_error(QObject::tr("pa_context_subscribe() failed").toUtf8().constData());
return;
}
@@ -535,7 +535,7 @@ void context_state_callback(pa_context *c, void *userdata) {
pa_ext_stream_restore_set_subscribe_cb(c, ext_stream_restore_subscribe_cb, w);
- if ((o = pa_ext_stream_restore_subscribe(c, 1, NULL, NULL)))
+ if ((o = pa_ext_stream_restore_subscribe(c, 1, nullptr, nullptr)))
pa_operation_unref(o);
} else
@@ -549,7 +549,7 @@ void context_state_callback(pa_context *c, void *userdata) {
pa_ext_device_restore_set_subscribe_cb(c, ext_device_restore_subscribe_cb, w);
- if ((o = pa_ext_device_restore_subscribe(c, 1, NULL, NULL)))
+ if ((o = pa_ext_device_restore_subscribe(c, 1, nullptr, nullptr)))
pa_operation_unref(o);
} else
@@ -562,7 +562,7 @@ void context_state_callback(pa_context *c, void *userdata) {
pa_ext_device_manager_set_subscribe_cb(c, ext_device_manager_subscribe_cb, w);
- if ((o = pa_ext_device_manager_subscribe(c, 1, NULL, NULL)))
+ if ((o = pa_ext_device_manager_subscribe(c, 1, nullptr, nullptr)))
pa_operation_unref(o);
} else
@@ -578,7 +578,7 @@ void context_state_callback(pa_context *c, void *userdata) {
w->removeAllWidgets();
w->updateDeviceVisibility();
pa_context_unref(context);
- context = NULL;
+ context = nullptr;
if (reconnect_timeout > 0) {
g_debug("%s", QObject::tr("Connection failed, attempting reconnect").toUtf8().constData());
@@ -609,7 +609,7 @@ gboolean connect_to_pulse(gpointer userdata) {
pa_proplist_sets(proplist, PA_PROP_APPLICATION_ICON_NAME, "audio-card");
pa_proplist_sets(proplist, PA_PROP_APPLICATION_VERSION, PACKAGE_VERSION);
- context = pa_context_new_with_proplist(api, NULL, proplist);
+ context = pa_context_new_with_proplist(api, nullptr, proplist);
g_assert(context);
pa_proplist_free(proplist);
@@ -617,7 +617,7 @@ gboolean connect_to_pulse(gpointer userdata) {
pa_context_set_state_callback(context, context_state_callback, w);
w->setConnectingMessage();
- if (pa_context_connect(context, NULL, PA_CONTEXT_NOFAIL, NULL) < 0) {
+ if (pa_context_connect(context, nullptr, PA_CONTEXT_NOFAIL, nullptr) < 0) {
if (pa_context_errno(context) == PA_ERR_INVALID) {
w->setConnectingMessage(QObject::tr("Connection to PulseAudio failed. Automatic retry in 5s\n\n"
"In this case this is likely because PULSE_SERVER in the Environment/X11 Root Window Properties\n"
diff --git a/src/rolewidget.cc b/src/rolewidget.cc
index 685d766..a37fb48 100644
--- a/src/rolewidget.cc
+++ b/src/rolewidget.cc
@@ -51,11 +51,11 @@ void RoleWidget::executeVolumeUpdate() {
info.channel_map.channels = 1;
info.channel_map.map[0] = PA_CHANNEL_POSITION_MONO;
info.volume = volume;
- info.device = device == "" ? NULL : device.constData();
+ info.device = device == "" ? nullptr : device.constData();
info.mute = muteToggleButton->isChecked();
pa_operation* o;
- if (!(o = pa_ext_stream_restore_write(get_context(), PA_UPDATE_REPLACE, &info, 1, TRUE, NULL, NULL))) {
+ if (!(o = pa_ext_stream_restore_write(get_context(), PA_UPDATE_REPLACE, &info, 1, TRUE, nullptr, nullptr))) {
show_error(tr("pa_ext_stream_restore_write() failed").toUtf8().constData());
return;
}
diff --git a/src/sinkinputwidget.cc b/src/sinkinputwidget.cc
index e6479f9..ddfadef 100644
--- a/src/sinkinputwidget.cc
+++ b/src/sinkinputwidget.cc
@@ -60,7 +60,7 @@ uint32_t SinkInputWidget::sinkIndex() {
void SinkInputWidget::executeVolumeUpdate() {
pa_operation* o;
- if (!(o = pa_context_set_sink_input_volume(get_context(), index, &volume, NULL, NULL))) {
+ if (!(o = pa_context_set_sink_input_volume(get_context(), index, &volume, nullptr, nullptr))) {
show_error(tr("pa_context_set_sink_input_volume() failed").toUtf8().constData());
return;
}
@@ -75,7 +75,7 @@ void SinkInputWidget::onMuteToggleButton() {
return;
pa_operation* o;
- if (!(o = pa_context_set_sink_input_mute(get_context(), index, muteToggleButton->isChecked(), NULL, NULL))) {
+ if (!(o = pa_context_set_sink_input_mute(get_context(), index, muteToggleButton->isChecked(), nullptr, nullptr))) {
show_error(tr("pa_context_set_sink_input_mute() failed").toUtf8().constData());
return;
}
@@ -85,7 +85,7 @@ void SinkInputWidget::onMuteToggleButton() {
void SinkInputWidget::onKill() {
pa_operation* o;
- if (!(o = pa_context_kill_sink_input(get_context(), index, NULL, NULL))) {
+ if (!(o = pa_context_kill_sink_input(get_context(), index, nullptr, nullptr))) {
show_error(tr("pa_context_kill_sink_input() failed").toUtf8().constData());
return;
}
@@ -110,7 +110,7 @@ void SinkInputWidget::SinkMenuItem::onToggle() {
return;*/
pa_operation* o;
- if (!(o = pa_context_move_sink_input_by_index(get_context(), widget->index, index, NULL, NULL))) {
+ if (!(o = pa_context_move_sink_input_by_index(get_context(), widget->index, index, nullptr, nullptr))) {
show_error(tr("pa_context_move_sink_input_by_index() failed").toUtf8().constData());
return;
}
diff --git a/src/sinkwidget.cc b/src/sinkwidget.cc
index da69b7e..f91a99a 100644
--- a/src/sinkwidget.cc
+++ b/src/sinkwidget.cc
@@ -77,7 +77,7 @@ SinkWidget::SinkWidget(MainWindow *parent) :
void SinkWidget::executeVolumeUpdate() {
pa_operation* o;
- if (!(o = pa_context_set_sink_volume_by_index(get_context(), index, &volume, NULL, NULL))) {
+ if (!(o = pa_context_set_sink_volume_by_index(get_context(), index, &volume, nullptr, nullptr))) {
show_error(tr("pa_context_set_sink_volume_by_index() failed").toUtf8().constData());
return;
}
@@ -92,7 +92,7 @@ void SinkWidget::onMuteToggleButton() {
return;
pa_operation* o;
- if (!(o = pa_context_set_sink_mute_by_index(get_context(), index, muteToggleButton->isChecked(), NULL, NULL))) {
+ if (!(o = pa_context_set_sink_mute_by_index(get_context(), index, muteToggleButton->isChecked(), nullptr, nullptr))) {
show_error(tr("pa_context_set_sink_mute_by_index() failed").toUtf8().constData());
return;
}
@@ -106,7 +106,7 @@ void SinkWidget::onDefaultToggleButton() {
if (updating)
return;
- if (!(o = pa_context_set_default_sink(get_context(), name, NULL, NULL))) {
+ if (!(o = pa_context_set_default_sink(get_context(), name, nullptr, nullptr))) {
show_error(tr("pa_context_set_default_sink() failed").toUtf8().constData());
return;
}
@@ -122,7 +122,7 @@ void SinkWidget::onPortChange() {
pa_operation* o;
QByteArray port = portList->itemData(sel).toString().toUtf8();
- if (!(o = pa_context_set_sink_port_by_index(get_context(), index, port.constData(), NULL, NULL))) {
+ if (!(o = pa_context_set_sink_port_by_index(get_context(), index, port.constData(), nullptr, nullptr))) {
show_error(tr("pa_context_set_sink_port_by_index() failed").toUtf8().constData());
return;
}
@@ -162,7 +162,7 @@ void SinkWidget::onEncodingsChange() {
}
}
- if (!(o = pa_ext_device_restore_save_formats(get_context(), PA_DEVICE_TYPE_SINK, index, n_formats, formats, NULL, NULL))) {
+ if (!(o = pa_ext_device_restore_save_formats(get_context(), PA_DEVICE_TYPE_SINK, index, n_formats, formats, nullptr, nullptr))) {
show_error(tr("pa_ext_device_restore_save_sink_formats() failed").toUtf8().constData());
free(formats);
return;
diff --git a/src/sourceoutputwidget.cc b/src/sourceoutputwidget.cc
index ed3c252..8595f02 100644
--- a/src/sourceoutputwidget.cc
+++ b/src/sourceoutputwidget.cc
@@ -68,7 +68,7 @@ uint32_t SourceOutputWidget::sourceIndex() {
void SourceOutputWidget::executeVolumeUpdate() {
pa_operation* o;
- if (!(o = pa_context_set_source_output_volume(get_context(), index, &volume, NULL, NULL))) {
+ if (!(o = pa_context_set_source_output_volume(get_context(), index, &volume, nullptr, nullptr))) {
show_error(tr("pa_context_set_source_output_volume() failed").toUtf8().constData());
return;
}
@@ -83,7 +83,7 @@ void SourceOutputWidget::onMuteToggleButton() {
return;
pa_operation* o;
- if (!(o = pa_context_set_source_output_mute(get_context(), index, muteToggleButton->isChecked(), NULL, NULL))) {
+ if (!(o = pa_context_set_source_output_mute(get_context(), index, muteToggleButton->isChecked(), nullptr, nullptr))) {
show_error(tr("pa_context_set_source_output_mute() failed").toUtf8().constData());
return;
}
@@ -94,7 +94,7 @@ void SourceOutputWidget::onMuteToggleButton() {
void SourceOutputWidget::onKill() {
pa_operation* o;
- if (!(o = pa_context_kill_source_output(get_context(), index, NULL, NULL))) {
+ if (!(o = pa_context_kill_source_output(get_context(), index, nullptr, nullptr))) {
show_error(tr("pa_context_kill_source_output() failed").toUtf8().constData());
return;
}
@@ -121,7 +121,7 @@ void SourceOutputWidget::SourceMenuItem::onToggle() {
return;*/
pa_operation* o;
- if (!(o = pa_context_move_source_output_by_index(get_context(), widget->index, index, NULL, NULL))) {
+ if (!(o = pa_context_move_source_output_by_index(get_context(), widget->index, index, nullptr, nullptr))) {
show_error(tr("pa_context_move_source_output_by_index() failed").toUtf8().constData());
return;
}
diff --git a/src/sourcewidget.cc b/src/sourcewidget.cc
index 66b3efc..a2f4427 100644
--- a/src/sourcewidget.cc
+++ b/src/sourcewidget.cc
@@ -31,7 +31,7 @@ SourceWidget::SourceWidget(MainWindow *parent) :
void SourceWidget::executeVolumeUpdate() {
pa_operation* o;
- if (!(o = pa_context_set_source_volume_by_index(get_context(), index, &volume, NULL, NULL))) {
+ if (!(o = pa_context_set_source_volume_by_index(get_context(), index, &volume, nullptr, nullptr))) {
show_error(tr("pa_context_set_source_volume_by_index() failed").toUtf8().constData());
return;
}
@@ -46,7 +46,7 @@ void SourceWidget::onMuteToggleButton() {
return;
pa_operation* o;
- if (!(o = pa_context_set_source_mute_by_index(get_context(), index, muteToggleButton->isChecked(), NULL, NULL))) {
+ if (!(o = pa_context_set_source_mute_by_index(get_context(), index, muteToggleButton->isChecked(), nullptr, nullptr))) {
show_error(tr("pa_context_set_source_mute_by_index() failed").toUtf8().constData());
return;
}
@@ -60,7 +60,7 @@ void SourceWidget::onDefaultToggleButton() {
if (updating)
return;
- if (!(o = pa_context_set_default_source(get_context(), name, NULL, NULL))) {
+ if (!(o = pa_context_set_default_source(get_context(), name, nullptr, nullptr))) {
show_error(tr("pa_context_set_default_source() failed").toUtf8().constData());
return;
}
@@ -76,7 +76,7 @@ void SourceWidget::onPortChange() {
pa_operation* o;
QByteArray port = portList->itemData(current).toByteArray();
- if (!(o = pa_context_set_source_port_by_index(get_context(), index, port.constData(), NULL, NULL))) {
+ if (!(o = pa_context_set_source_port_by_index(get_context(), index, port.constData(), nullptr, nullptr))) {
show_error(tr("pa_context_set_source_port_by_index() failed").toUtf8().constData());
return;
}
diff --git a/src/streamwidget.cc b/src/streamwidget.cc
index 018f1eb..d55a3fd 100644
--- a/src/streamwidget.cc
+++ b/src/streamwidget.cc
@@ -49,7 +49,7 @@ StreamWidget::StreamWidget(MainWindow *parent) :
setContextMenuPolicy(Qt::ActionsContextMenu);
for (unsigned i = 0; i < PA_CHANNELS_MAX; i++)
- channels[i] = NULL;
+ channels[i] = nullptr;
}
void StreamWidget::setChannelMap(const pa_channel_map &m, bool can_decibel) {