From 20597b3632d3b6e25ba532716106f90d5b64d0e8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 28 Oct 2013 23:58:17 +0100 Subject: *: use nullptr instead of NULL --- src/output/AlsaOutputPlugin.cxx | 14 +++++++------- src/output/HttpdOutputPlugin.cxx | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/output') diff --git a/src/output/AlsaOutputPlugin.cxx b/src/output/AlsaOutputPlugin.cxx index 79b81282b..149ca507d 100644 --- a/src/output/AlsaOutputPlugin.cxx +++ b/src/output/AlsaOutputPlugin.cxx @@ -169,7 +169,7 @@ alsa_init(const config_param ¶m, Error &error) if (!ad->Init(param, error)) { delete ad; - return NULL; + return nullptr; } alsa_configure(ad, param); @@ -393,7 +393,7 @@ alsa_setup(AlsaOutput *ad, AudioFormat &audio_format, unsigned int sample_rate = audio_format.sample_rate; unsigned int channels = audio_format.channels; int err; - const char *cmd = NULL; + const char *cmd = nullptr; int retry = MPD_ALSA_RETRY_NR; unsigned int period_time, period_time_ro; unsigned int buffer_time; @@ -460,7 +460,7 @@ configure_hw: audio_format.channels = (int8_t)channels; err = snd_pcm_hw_params_set_rate_near(ad->pcm, hwparams, - &sample_rate, NULL); + &sample_rate, nullptr); if (err < 0 || sample_rate == 0) { error.Format(alsa_output_domain, err, "ALSA device \"%s\" does not support %u Hz audio", @@ -493,12 +493,12 @@ configure_hw: buffer_time = ad->buffer_time; cmd = "snd_pcm_hw_params_set_buffer_time_near"; err = snd_pcm_hw_params_set_buffer_time_near(ad->pcm, hwparams, - &buffer_time, NULL); + &buffer_time, nullptr); if (err < 0) goto error; } else { err = snd_pcm_hw_params_get_buffer_time(hwparams, &buffer_time, - NULL); + nullptr); if (err < 0) buffer_time = 0; } @@ -515,7 +515,7 @@ configure_hw: period_time = period_time_ro; cmd = "snd_pcm_hw_params_set_period_time_near"; err = snd_pcm_hw_params_set_period_time_near(ad->pcm, hwparams, - &period_time, NULL); + &period_time, nullptr); if (err < 0) goto error; } @@ -540,7 +540,7 @@ configure_hw: snd_pcm_uframes_t alsa_period_size; cmd = "snd_pcm_hw_params_get_period_size"; err = snd_pcm_hw_params_get_period_size(hwparams, &alsa_period_size, - NULL); + nullptr); if (err < 0) goto error; diff --git a/src/output/HttpdOutputPlugin.cxx b/src/output/HttpdOutputPlugin.cxx index a456701b5..369c06937 100644 --- a/src/output/HttpdOutputPlugin.cxx +++ b/src/output/HttpdOutputPlugin.cxx @@ -98,7 +98,7 @@ HttpdOutput::Configure(const config_param ¶m, Error &error) const char *encoder_name = param.GetBlockValue("encoder", "vorbis"); const auto encoder_plugin = encoder_plugin_get(encoder_name); - if (encoder_plugin == NULL) { + if (encoder_plugin == nullptr) { error.Format(httpd_output_domain, "No such encoder: %s", encoder_name); return false; @@ -109,7 +109,7 @@ HttpdOutput::Configure(const config_param ¶m, Error &error) /* set up bind_to_address */ const char *bind_to_address = param.GetBlockValue("bind_to_address"); - bool success = bind_to_address != NULL && + bool success = bind_to_address != nullptr && strcmp(bind_to_address, "any") != 0 ? AddHost(bind_to_address, port, error) : AddPort(port, error); @@ -263,7 +263,7 @@ HttpdOutput::ReadPage() } while (size < sizeof(buffer)); if (size == 0) - return NULL; + return nullptr; return Page::Copy(buffer, size); } @@ -344,7 +344,7 @@ HttpdOutput::Close() clients.clear(); - if (header != NULL) + if (header != nullptr) header->Unref(); encoder_close(encoder); @@ -378,7 +378,7 @@ HttpdOutput::RemoveClient(HttpdClient &client) void HttpdOutput::SendHeader(HttpdClient &client) const { - if (header != NULL) + if (header != nullptr) client.PushPage(header); } @@ -408,7 +408,7 @@ httpd_output_delay(struct audio_output *ao) void HttpdOutput::BroadcastPage(Page *page) { - assert(page != NULL); + assert(page != nullptr); const ScopeLock protect(mutex); for (auto &client : clients) @@ -482,7 +482,7 @@ httpd_output_pause(struct audio_output *ao) inline void HttpdOutput::SendTag(const Tag *tag) { - assert(tag != NULL); + assert(tag != nullptr); if (encoder->plugin.tag != nullptr) { /* embed encoder tags */ @@ -502,8 +502,8 @@ HttpdOutput::SendTag(const Tag *tag) new clients */ Page *page = ReadPage(); - if (page != NULL) { - if (header != NULL) + if (page != nullptr) { + if (header != nullptr) header->Unref(); header = page; BroadcastPage(page); @@ -511,7 +511,7 @@ HttpdOutput::SendTag(const Tag *tag) } else { /* use Icy-Metadata */ - if (metadata != NULL) + if (metadata != nullptr) metadata->Unref(); static constexpr TagType types[] = { @@ -520,7 +520,7 @@ HttpdOutput::SendTag(const Tag *tag) }; metadata = icy_server_metadata_page(*tag, &types[0]); - if (metadata != NULL) { + if (metadata != nullptr) { const ScopeLock protect(mutex); for (auto &client : clients) client.PushMetaData(metadata); -- cgit v1.2.3