summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-28 23:58:17 +0100
committerMax Kellermann <max@duempel.org>2013-10-28 23:58:17 +0100
commit20597b3632d3b6e25ba532716106f90d5b64d0e8 (patch)
treefa6dabaff127150caf3cf4723257f15ef2c3e0f8 /src
parent4728735acf20fba24d0d03ab431160e250325869 (diff)
*: use nullptr instead of NULL
Diffstat (limited to 'src')
-rw-r--r--src/AudioConfig.cxx2
-rw-r--r--src/AudioFormat.hxx2
-rw-r--r--src/DatabaseQueue.cxx2
-rw-r--r--src/FilterInternal.hxx6
-rw-r--r--src/Mapper.cxx4
-rw-r--r--src/OutputList.cxx4
-rw-r--r--src/OutputList.hxx2
-rw-r--r--src/ReplayGainConfig.cxx4
-rw-r--r--src/command/OtherCommands.cxx4
-rw-r--r--src/command/PlayerCommands.cxx2
-rw-r--r--src/db/ProxyDatabasePlugin.cxx10
-rw-r--r--src/decoder/AdPlugDecoderPlugin.cxx2
-rw-r--r--src/decoder/DsfDecoderPlugin.cxx6
-rw-r--r--src/decoder/FfmpegMetaData.cxx14
-rw-r--r--src/decoder/VorbisComments.cxx10
-rw-r--r--src/decoder/VorbisDecoderPlugin.cxx14
-rw-r--r--src/event/Loop.cxx2
-rw-r--r--src/event/ServerSocket.hxx6
-rw-r--r--src/filter/ChainFilterPlugin.cxx4
-rw-r--r--src/filter/ReplayGainFilterPlugin.cxx8
-rw-r--r--src/filter/ReplayGainFilterPlugin.hxx4
-rw-r--r--src/fs/Charset.cxx6
-rw-r--r--src/fs/Config.cxx8
-rw-r--r--src/input/ArchiveInputPlugin.cxx10
-rw-r--r--src/input/DespotifyInputPlugin.cxx16
-rw-r--r--src/input/RewindInputPlugin.cxx2
-rw-r--r--src/mixer/AlsaMixerPlugin.cxx18
-rw-r--r--src/mixer/PulseMixerPlugin.cxx16
-rw-r--r--src/output/AlsaOutputPlugin.cxx14
-rw-r--r--src/output/HttpdOutputPlugin.cxx22
-rw-r--r--src/pcm/PcmBuffer.cxx4
-rw-r--r--src/pcm/PcmBuffer.hxx7
-rw-r--r--src/pcm/PcmChannels.cxx8
-rw-r--r--src/pcm/PcmConvert.cxx52
-rw-r--r--src/pcm/PcmExport.cxx4
-rw-r--r--src/pcm/PcmFormat.cxx8
-rw-r--r--src/playlist/AsxPlaylistPlugin.cxx24
-rw-r--r--src/playlist/CuePlaylistPlugin.cxx8
-rw-r--r--src/playlist/EmbeddedCuePlaylistPlugin.cxx14
-rw-r--r--src/playlist/M3uPlaylistPlugin.cxx6
-rw-r--r--src/playlist/PlsPlaylistPlugin.cxx30
-rw-r--r--src/playlist/RssPlaylistPlugin.cxx24
-rw-r--r--src/playlist/SoundCloudPlaylistPlugin.cxx50
-rw-r--r--src/playlist/XspfPlaylistPlugin.cxx24
-rw-r--r--src/protocol/Result.cxx4
-rw-r--r--src/tag/Tag.hxx6
-rw-r--r--src/tag/TagId3.hxx2
47 files changed, 250 insertions, 249 deletions
diff --git a/src/AudioConfig.cxx b/src/AudioConfig.cxx
index 3d6337991..a8fc7aab3 100644
--- a/src/AudioConfig.cxx
+++ b/src/AudioConfig.cxx
@@ -41,7 +41,7 @@ void initAudioConfig(void)
{
const struct config_param *param = config_get_param(CONF_AUDIO_OUTPUT_FORMAT);
- if (param == NULL)
+ if (param == nullptr)
return;
Error error;
diff --git a/src/AudioFormat.hxx b/src/AudioFormat.hxx
index 5b0686031..fae7625ea 100644
--- a/src/AudioFormat.hxx
+++ b/src/AudioFormat.hxx
@@ -305,7 +305,7 @@ sample_format_to_string(SampleFormat format);
*
* @param af the #audio_format object
* @param s a buffer to print into
- * @return the string, or NULL if the #audio_format object is invalid
+ * @return the string, or nullptr if the #audio_format object is invalid
*/
gcc_pure gcc_malloc
const char *
diff --git a/src/DatabaseQueue.cxx b/src/DatabaseQueue.cxx
index e277c0fca..fb933e0d4 100644
--- a/src/DatabaseQueue.cxx
+++ b/src/DatabaseQueue.cxx
@@ -31,7 +31,7 @@ static bool
AddToQueue(Partition &partition, Song &song, Error &error)
{
PlaylistResult result =
- partition.playlist.AppendSong(partition.pc, &song, NULL);
+ partition.playlist.AppendSong(partition.pc, &song, nullptr);
if (result != PlaylistResult::SUCCESS) {
error.Set(playlist_domain, int(result), "Playlist error");
return false;
diff --git a/src/FilterInternal.hxx b/src/FilterInternal.hxx
index ab648af1e..e2884e82f 100644
--- a/src/FilterInternal.hxx
+++ b/src/FilterInternal.hxx
@@ -41,7 +41,7 @@ public:
* @param audio_format the audio format of incoming data; the
* plugin may modify the object to enforce another input
* format
- * @param error location to store the error occurring, or NULL
+ * @param error location to store the error occurring, or nullptr
* to ignore errors.
* @return the format of outgoing data or
* AudioFormat::Undefined() on error
@@ -60,10 +60,10 @@ public:
* @param src the input buffer
* @param src_size the size of #src_buffer in bytes
* @param dest_size_r the size of the returned buffer
- * @param error location to store the error occurring, or NULL
+ * @param error location to store the error occurring, or nullptr
* to ignore errors.
* @return the destination buffer on success (will be
- * invalidated by filter_close() or filter_filter()), NULL on
+ * invalidated by filter_close() or filter_filter()), nullptr on
* error
*/
virtual const void *FilterPCM(const void *src, size_t src_size,
diff --git a/src/Mapper.cxx b/src/Mapper.cxx
index ebc9f89df..08597732a 100644
--- a/src/Mapper.cxx
+++ b/src/Mapper.cxx
@@ -156,7 +156,7 @@ map_to_relative_path(const char *path_utf8)
AllocatedPath
map_uri_fs(const char *uri)
{
- assert(uri != NULL);
+ assert(uri != nullptr);
assert(*uri != '/');
if (music_dir_fs.IsNull())
@@ -186,7 +186,7 @@ map_directory_child_fs(const Directory &directory, const char *name)
assert(!music_dir_fs.IsNull());
/* check for invalid or unauthorized base names */
- if (*name == 0 || strchr(name, '/') != NULL ||
+ if (*name == 0 || strchr(name, '/') != nullptr ||
strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
return AllocatedPath::Null();
diff --git a/src/OutputList.cxx b/src/OutputList.cxx
index 670131ed9..b569408dc 100644
--- a/src/OutputList.cxx
+++ b/src/OutputList.cxx
@@ -86,7 +86,7 @@ const struct audio_output_plugin *const audio_output_plugins[] = {
#ifdef ENABLE_WINMM_OUTPUT
&winmm_output_plugin,
#endif
- NULL
+ nullptr
};
const struct audio_output_plugin *
@@ -96,5 +96,5 @@ audio_output_plugin_get(const char *name)
if (strcmp(plugin->name, name) == 0)
return plugin;
- return NULL;
+ return nullptr;
}
diff --git a/src/OutputList.hxx b/src/OutputList.hxx
index b7716c67e..756cf22a4 100644
--- a/src/OutputList.hxx
+++ b/src/OutputList.hxx
@@ -28,6 +28,6 @@ audio_output_plugin_get(const char *name);
#define audio_output_plugins_for_each(plugin) \
for (const struct audio_output_plugin *plugin, \
*const*output_plugin_iterator = &audio_output_plugins[0]; \
- (plugin = *output_plugin_iterator) != NULL; ++output_plugin_iterator)
+ (plugin = *output_plugin_iterator) != nullptr; ++output_plugin_iterator)
#endif
diff --git a/src/ReplayGainConfig.cxx b/src/ReplayGainConfig.cxx
index 36c2ff545..8f9b0d3f7 100644
--- a/src/ReplayGainConfig.cxx
+++ b/src/ReplayGainConfig.cxx
@@ -61,7 +61,7 @@ replay_gain_get_mode_string(void)
bool
replay_gain_set_mode_string(const char *p)
{
- assert(p != NULL);
+ assert(p != nullptr);
if (strcmp(p, "off") == 0)
replay_gain_mode = REPLAY_GAIN_OFF;
@@ -83,7 +83,7 @@ void replay_gain_global_init(void)
{
const struct config_param *param = config_get_param(CONF_REPLAYGAIN);
- if (param != NULL &&
+ if (param != nullptr &&
!replay_gain_set_mode_string(param->value.c_str())) {
FormatFatalError("replaygain value \"%s\" at line %i is invalid\n",
param->value.c_str(), param->line);
diff --git a/src/command/OtherCommands.cxx b/src/command/OtherCommands.cxx
index 510ef89e7..75faa4dc2 100644
--- a/src/command/OtherCommands.cxx
+++ b/src/command/OtherCommands.cxx
@@ -129,7 +129,7 @@ handle_lsinfo(Client &client, int argc, char *argv[])
return print_error(client, error);
Song *song = Song::LoadFile(path_utf8, nullptr);
- if (song == NULL) {
+ if (song == nullptr) {
command_error(client, ACK_ERROR_NO_EXIST,
"No such file");
return CommandResult::ERROR;
@@ -310,7 +310,7 @@ handle_config(Client &client,
}
const char *path = mapper_get_music_directory_utf8();
- if (path != NULL)
+ if (path != nullptr)
client_printf(client, "music_directory: %s\n", path);
return CommandResult::OK;
diff --git a/src/command/PlayerCommands.cxx b/src/command/PlayerCommands.cxx
index d30bde273..171ffaa4f 100644
--- a/src/command/PlayerCommands.cxx
+++ b/src/command/PlayerCommands.cxx
@@ -111,7 +111,7 @@ CommandResult
handle_status(Client &client,
gcc_unused int argc, gcc_unused char *argv[])
{
- const char *state = NULL;
+ const char *state = nullptr;
int updateJobId;
int song;
diff --git a/src/db/ProxyDatabasePlugin.cxx b/src/db/ProxyDatabasePlugin.cxx
index 68d3a1128..3293c26b5 100644
--- a/src/db/ProxyDatabasePlugin.cxx
+++ b/src/db/ProxyDatabasePlugin.cxx
@@ -131,7 +131,7 @@ ProxyDatabase::Create(const config_param &param, Error &error)
ProxyDatabase *db = new ProxyDatabase();
if (!db->Configure(param, error)) {
delete db;
- db = NULL;
+ db = nullptr;
}
return db;
@@ -149,9 +149,9 @@ ProxyDatabase::Configure(const config_param &param, gcc_unused Error &error)
bool
ProxyDatabase::Open(Error &error)
{
- connection = mpd_connection_new(host.empty() ? NULL : host.c_str(),
+ connection = mpd_connection_new(host.empty() ? nullptr : host.c_str(),
port, 0);
- if (connection == NULL) {
+ if (connection == nullptr) {
error.Set(libmpdclient_domain, (int)MPD_ERROR_OOM, "Out of memory");
return false;
}
@@ -254,7 +254,7 @@ Copy(TagBuilder &tag, TagType d_tag,
for (unsigned i = 0;; ++i) {
const char *value = mpd_song_get_tag(song, s_tag, i);
- if (value == NULL)
+ if (value == nullptr)
break;
tag.AddItem(d_tag, value);
@@ -339,7 +339,7 @@ ReceiveEntities(struct mpd_connection *connection)
{
std::list<ProxyEntity> entities;
struct mpd_entity *entity;
- while ((entity = mpd_recv_entity(connection)) != NULL)
+ while ((entity = mpd_recv_entity(connection)) != nullptr)
entities.push_back(ProxyEntity(entity));
mpd_response_finish(connection);
diff --git a/src/decoder/AdPlugDecoderPlugin.cxx b/src/decoder/AdPlugDecoderPlugin.cxx
index 8f2ed3bd7..4ab3a8301 100644
--- a/src/decoder/AdPlugDecoderPlugin.cxx
+++ b/src/decoder/AdPlugDecoderPlugin.cxx
@@ -72,7 +72,7 @@ adplug_file_decode(Decoder &decoder, const char *path_fs)
break;
opl.update(buffer, frames_per_buffer);
- cmd = decoder_data(decoder, NULL,
+ cmd = decoder_data(decoder, nullptr,
buffer, sizeof(buffer),
0);
} while (cmd == DecoderCommand::NONE);
diff --git a/src/decoder/DsfDecoderPlugin.cxx b/src/decoder/DsfDecoderPlugin.cxx
index 7f47074ee..065bc7958 100644
--- a/src/decoder/DsfDecoderPlugin.cxx
+++ b/src/decoder/DsfDecoderPlugin.cxx
@@ -314,7 +314,7 @@ dsf_scan_stream(InputStream &is,
{
/* check DSF metadata */
DsfMetaData metadata;
- if (!dsf_read_metadata(NULL, is, &metadata))
+ if (!dsf_read_metadata(nullptr, is, &metadata))
return false;
AudioFormat audio_format;
@@ -338,12 +338,12 @@ dsf_scan_stream(InputStream &is,
static const char *const dsf_suffixes[] = {
"dsf",
- NULL
+ nullptr
};
static const char *const dsf_mime_types[] = {
"application/x-dsf",
- NULL
+ nullptr
};
const struct DecoderPlugin dsf_decoder_plugin = {
diff --git a/src/decoder/FfmpegMetaData.cxx b/src/decoder/FfmpegMetaData.cxx
index 17255f0a4..6e92b4a13 100644
--- a/src/decoder/FfmpegMetaData.cxx
+++ b/src/decoder/FfmpegMetaData.cxx
@@ -32,7 +32,7 @@ static const struct tag_table ffmpeg_tags[] = {
{ "album_artist-sort", TAG_ALBUM_ARTIST_SORT },
/* sentinel */
- { NULL, TAG_NUM_OF_ITEM_TYPES }
+ { nullptr, TAG_NUM_OF_ITEM_TYPES }
};
static void
@@ -40,9 +40,9 @@ ffmpeg_copy_metadata(TagType type,
AVDictionary *m, const char *name,
const struct tag_handler *handler, void *handler_ctx)
{
- AVDictionaryEntry *mt = NULL;
+ AVDictionaryEntry *mt = nullptr;
- while ((mt = av_dict_get(m, name, mt, 0)) != NULL)
+ while ((mt = av_dict_get(m, name, mt, 0)) != nullptr)
tag_handler_invoke_tag(handler, handler_ctx,
type, mt->value);
}
@@ -51,9 +51,9 @@ static void
ffmpeg_scan_pairs(AVDictionary *dict,
const struct tag_handler *handler, void *handler_ctx)
{
- AVDictionaryEntry *i = NULL;
+ AVDictionaryEntry *i = nullptr;
- while ((i = av_dict_get(dict, "", i, AV_DICT_IGNORE_SUFFIX)) != NULL)
+ while ((i = av_dict_get(dict, "", i, AV_DICT_IGNORE_SUFFIX)) != nullptr)
tag_handler_invoke_pair(handler, handler_ctx,
i->key, i->value);
}
@@ -67,10 +67,10 @@ ffmpeg_scan_dictionary(AVDictionary *dict,
handler, handler_ctx);
for (const struct tag_table *i = ffmpeg_tags;
- i->name != NULL; ++i)
+ i->name != nullptr; ++i)
ffmpeg_copy_metadata(i->type, dict, i->name,
handler, handler_ctx);
- if (handler->pair != NULL)
+ if (handler->pair != nullptr)
ffmpeg_scan_pairs(dict, handler, handler_ctx);
}
diff --git a/src/decoder/VorbisComments.cxx b/src/decoder/VorbisComments.cxx
index 8fd078ff4..d4f019b58 100644
--- a/src/decoder/VorbisComments.cxx
+++ b/src/decoder/VorbisComments.cxx
@@ -43,7 +43,7 @@ vorbis_comment_value(const char *comment, const char *needle)
comment[len] == '=')
return comment + len + 1;
- return NULL;
+ return nullptr;
}
bool
@@ -91,7 +91,7 @@ vorbis_copy_comment(const char *comment,
const char *value;
value = vorbis_comment_value(comment, name);
- if (value != NULL) {
+ if (value != nullptr) {
tag_handler_invoke_tag(handler, handler_ctx, tag_type, value);
return true;
}
@@ -103,11 +103,11 @@ static void
vorbis_scan_comment(const char *comment,
const struct tag_handler *handler, void *handler_ctx)
{
- if (handler->pair != NULL) {
+ if (handler->pair != nullptr) {
char *name = g_strdup((const char*)comment);
char *value = strchr(name, '=');
- if (value != NULL && value > name) {
+ if (value != nullptr && value > name) {
*value++ = 0;
tag_handler_invoke_pair(handler, handler_ctx,
name, value);
@@ -116,7 +116,7 @@ vorbis_scan_comment(const char *comment,
g_free(name);
}
- for (const struct tag_table *i = xiph_tags; i->name != NULL; ++i)
+ for (const struct tag_table *i = xiph_tags; i->name != nullptr; ++i)
if (vorbis_copy_comment(comment, i->name, i->type,
handler, handler_ctx))
return;
diff --git a/src/decoder/VorbisDecoderPlugin.cxx b/src/decoder/VorbisDecoderPlugin.cxx
index 8e59afe3b..075e3c730 100644
--- a/src/decoder/VorbisDecoderPlugin.cxx
+++ b/src/decoder/VorbisDecoderPlugin.cxx
@@ -133,9 +133,9 @@ vorbis_is_open(struct vorbis_input_stream *vis, OggVorbis_File *vf,
vis->input_stream = &input_stream;
vis->seekable = input_stream.CheapSeeking();
- int ret = ov_open_callbacks(vis, vf, NULL, 0, vorbis_is_callbacks);
+ int ret = ov_open_callbacks(vis, vf, nullptr, 0, vorbis_is_callbacks);
if (ret < 0) {
- if (decoder == NULL ||
+ if (decoder == nullptr ||
decoder_get_command(*decoder) == DecoderCommand::NONE)
FormatWarning(vorbis_domain,
"Failed to open Ogg Vorbis stream: %s",
@@ -191,7 +191,7 @@ vorbis_stream_decode(Decoder &decoder,
return;
const vorbis_info *vi = ov_info(&vf, -1);
- if (vi == NULL) {
+ if (vi == nullptr) {
LogWarning(vorbis_domain, "ov_info() has failed");
return;
}
@@ -265,7 +265,7 @@ vorbis_stream_decode(Decoder &decoder,
if (current_section != prev_section) {
vi = ov_info(&vf, -1);
- if (vi == NULL) {
+ if (vi == nullptr) {
LogWarning(vorbis_domain,
"ov_info() has failed");
break;
@@ -309,7 +309,7 @@ vorbis_scan_stream(InputStream &is,
struct vorbis_input_stream vis;
OggVorbis_File vf;
- if (!vorbis_is_open(&vis, &vf, NULL, is))
+ if (!vorbis_is_open(&vis, &vf, nullptr, is))
return false;
tag_handler_invoke_duration(handler, handler_ctx,
@@ -323,7 +323,7 @@ vorbis_scan_stream(InputStream &is,
}
static const char *const vorbis_suffixes[] = {
- "ogg", "oga", NULL
+ "ogg", "oga", nullptr
};
static const char *const vorbis_mime_types[] = {
@@ -335,7 +335,7 @@ static const char *const vorbis_mime_types[] = {
"audio/x-ogg",
"audio/x-vorbis",
"audio/x-vorbis+ogg",
- NULL
+ nullptr
};
const struct DecoderPlugin vorbis_decoder_plugin = {
diff --git a/src/event/Loop.cxx b/src/event/Loop.cxx
index e8d9e4b96..665dfa500 100644
--- a/src/event/Loop.cxx
+++ b/src/event/Loop.cxx
@@ -230,7 +230,7 @@ guint
EventLoop::AddIdle(GSourceFunc function, gpointer data)
{
GSource *source = g_idle_source_new();
- g_source_set_callback(source, function, data, NULL);
+ g_source_set_callback(source, function, data, nullptr);
guint id = g_source_attach(source, GetContext());
g_source_unref(source);
return id;
diff --git a/src/event/ServerSocket.hxx b/src/event/ServerSocket.hxx
index a4ca2d96d..6143d273a 100644
--- a/src/event/ServerSocket.hxx
+++ b/src/event/ServerSocket.hxx
@@ -75,7 +75,7 @@ public:
* Add a listener on a port on all interfaces.
*
* @param port the TCP port
- * @param error_r location to store the error occurring, or NULL to
+ * @param error_r location to store the error occurring, or nullptr to
* ignore errors
* @return true on success
*/
@@ -87,7 +87,7 @@ public:
*
* @param hostname the host name to be resolved
* @param port the TCP port
- * @param error_r location to store the error occurring, or NULL to
+ * @param error_r location to store the error occurring, or nullptr to
* ignore errors
* @return true on success
*/
@@ -97,7 +97,7 @@ public:
* Add a listener on a Unix domain socket.
*
* @param path the absolute socket path
- * @param error_r location to store the error occurring, or NULL to
+ * @param error_r location to store the error occurring, or nullptr to
* ignore errors
* @return true on success
*/
diff --git a/src/filter/ChainFilterPlugin.cxx b/src/filter/ChainFilterPlugin.cxx
index ab1bfbd12..cb52b86ca 100644
--- a/src/filter/ChainFilterPlugin.cxx
+++ b/src/filter/ChainFilterPlugin.cxx
@@ -152,8 +152,8 @@ ChainFilter::FilterPCM(const void *src, size_t src_size,
into the current one */
src = child.filter->FilterPCM(src, src_size, &src_size,
error);
- if (src == NULL)
- return NULL;
+ if (src == nullptr)
+ return nullptr;
}
/* return the output of the last filter */
diff --git a/src/filter/ReplayGainFilterPlugin.cxx b/src/filter/ReplayGainFilterPlugin.cxx
index 4d6173e9b..b2dcde4cc 100644
--- a/src/filter/ReplayGainFilterPlugin.cxx
+++ b/src/filter/ReplayGainFilterPlugin.cxx
@@ -80,7 +80,7 @@ public:
}
void SetMixer(Mixer *_mixer, unsigned _base) {
- assert(_mixer == NULL || (_base > 0 && _base <= 100));
+ assert(_mixer == nullptr || (_base > 0 && _base <= 100));
mixer = _mixer;
base = _base;
@@ -89,7 +89,7 @@ public:
}
void SetInfo(const ReplayGainInfo *_info) {
- if (_info != NULL) {
+ if (_info != nullptr) {
info = *_info;
info.Complete();
} else
@@ -137,7 +137,7 @@ ReplayGainFilter::Update()
} else
volume = PCM_VOLUME_1;
- if (mixer != NULL) {
+ if (mixer != nullptr) {
/* update the hardware mixer volume */
unsigned _volume = (volume * base) / PCM_VOLUME_1;
@@ -198,7 +198,7 @@ ReplayGainFilter::FilterPCM(const void *src, size_t src_size,
volume);
if (!success) {
error.Set(replay_gain_domain, "pcm_volume() has failed");
- return NULL;
+ return nullptr;
}
return dest;
diff --git a/src/filter/ReplayGainFilterPlugin.hxx b/src/filter/ReplayGainFilterPlugin.hxx
index 74bec22d1..fbd1f2712 100644
--- a/src/filter/ReplayGainFilterPlugin.hxx
+++ b/src/filter/ReplayGainFilterPlugin.hxx
@@ -28,7 +28,7 @@ class Mixer;
/**
* Enables or disables the hardware mixer for applying replay gain.
*
- * @param mixer the hardware mixer, or NULL to fall back to software
+ * @param mixer the hardware mixer, or nullptr to fall back to software
* volume
* @param base the base volume level for scale=1.0, between 1 and 100
* (including).
@@ -40,7 +40,7 @@ replay_gain_filter_set_mixer(Filter *_filter, Mixer *mixer,
/**
* Sets a new #replay_gain_info at the beginning of a new song.
*
- * @param info the new #replay_gain_info value, or NULL if no replay
+ * @param info the new #replay_gain_info value, or nullptr if no replay
* gain data is available for the current song
*/
void
diff --git a/src/fs/Charset.cxx b/src/fs/Charset.cxx
index 39bb36e77..dad5779f9 100644
--- a/src/fs/Charset.cxx
+++ b/src/fs/Charset.cxx
@@ -48,8 +48,8 @@ static bool
IsSupportedCharset(const char *charset)
{
/* convert a space to check if the charset is valid */
- char *test = g_convert(" ", 1, charset, "UTF-8", NULL, NULL, NULL);
- if (test == NULL)
+ char *test = g_convert(" ", 1, charset, "UTF-8", nullptr, nullptr, nullptr);
+ if (test == nullptr)
return false;
g_free(test);
@@ -59,7 +59,7 @@ IsSupportedCharset(const char *charset)
void
SetFSCharset(const char *charset)
{
- assert(charset != NULL);
+ assert(charset != nullptr);
if (!IsSupportedCharset(charset))
FormatFatalError("invalid filesystem charset: %s", charset);
diff --git a/src/fs/Config.cxx b/src/fs/Config.cxx
index 3d7e99b4a..63e64ef99 100644
--- a/src/fs/Config.cxx
+++ b/src/fs/Config.cxx
@@ -38,15 +38,15 @@
void
ConfigureFS()
{
- const char *charset = NULL;
+ const char *charset = nullptr;
- charset = config_get_string(CONF_FS_CHARSET, NULL);
- if (charset == NULL) {
+ charset = config_get_string(CONF_FS_CHARSET, nullptr);
+ if (charset == nullptr) {
#ifndef WIN32
const gchar **encodings;
g_get_filename_charsets(&encodings);
- if (encodings[0] != NULL && *encodings[0] != '\0')
+ if (encodings[0] != nullptr && *encodings[0] != '\0')
charset = encodings[0];
#else
/* Glib claims that file system encoding is always utf-8
diff --git a/src/input/ArchiveInputPlugin.cxx b/src/input/ArchiveInputPlugin.cxx
index c5c881330..5288f2b3b 100644
--- a/src/input/ArchiveInputPlugin.cxx
+++ b/src/input/ArchiveInputPlugin.cxx
@@ -48,7 +48,7 @@ input_archive_open(const char *pathname,
InputStream *is;
if (!PathTraits::IsAbsoluteFS(pathname))
- return NULL;
+ return nullptr;
char *pname = g_strdup(pathname);
// archive_lookup will modify pname when true is returned
@@ -57,7 +57,7 @@ input_archive_open(const char *pathname,
FormatDebug(archive_domain,
"not an archive, lookup %s failed", pname);
g_free(pname);
- return NULL;
+ return nullptr;
}
//check which archive plugin to use (by ext)
@@ -66,13 +66,13 @@ input_archive_open(const char *pathname,
FormatWarning(archive_domain,
"can't handle archive %s", archive);
g_free(pname);
- return NULL;
+ return nullptr;
}
auto file = archive_file_open(arplug, archive, error);
- if (file == NULL) {
+ if (file == nullptr) {
g_free(pname);
- return NULL;
+ return nullptr;
}
//setup fileops
diff --git a/src/input/DespotifyInputPlugin.cxx b/src/input/DespotifyInputPlugin.cxx
index 5476b41fd..b08299516 100644
--- a/src/input/DespotifyInputPlugin.cxx
+++ b/src/input/DespotifyInputPlugin.cxx
@@ -131,26 +131,26 @@ input_despotify_open(const char *url,
struct ds_track *track;
if (!g_str_has_prefix(url, "spt://"))
- return NULL;
+ return nullptr;
session = mpd_despotify_get_session();
if (!session)
- return NULL;
+ return nullptr;
ds_link = despotify_link_from_uri(url + 6);
if (!ds_link) {
FormatDebug(despotify_domain, "Can't find %s", url);
- return NULL;
+ return nullptr;
}
if (ds_link->type != LINK_TYPE_TRACK) {
despotify_free_link(ds_link);
- return NULL;
+ return nullptr;
}
track = despotify_link_get_track(session, ds_link);
despotify_free_link(ds_link);
if (!track)
- return NULL;
+ return nullptr;
DespotifyInputStream *ctx =
new DespotifyInputStream(url, mutex, cond,
@@ -158,13 +158,13 @@ input_despotify_open(const char *url,
if (!mpd_despotify_register_callback(callback, ctx)) {
delete ctx;
- return NULL;
+ return nullptr;
}
if (despotify_play(ctx->session, ctx->track, false) == false) {
mpd_despotify_unregister_callback(callback);
delete ctx;
- return NULL;
+ return nullptr;
}
return &ctx->base;
@@ -213,7 +213,7 @@ input_despotify_tag(InputStream *is)
DespotifyInputStream *ctx = (DespotifyInputStream *)is;
Tag *tag = ctx->tag;
- ctx->tag = NULL;
+ ctx->tag = nullptr;
return tag;
}
diff --git a/src/input/RewindInputPlugin.cxx b/src/input/RewindInputPlugin.cxx
index 8d229c54f..e11f56631 100644
--- a/src/input/RewindInputPlugin.cxx
+++ b/src/input/RewindInputPlugin.cxx
@@ -240,7 +240,7 @@ const InputPlugin rewind_input_plugin = {
InputStream *
input_rewind_open(InputStream *is)
{
- assert(is != NULL);
+ assert(is != nullptr);
assert(is->offset == 0);
if (is->seekable)
diff --git a/src/mixer/AlsaMixerPlugin.cxx b/src/mixer/AlsaMixerPlugin.cxx
index f651e94ce..7defdd7be 100644
--- a/src/mixer/AlsaMixerPlugin.cxx
+++ b/src/mixer/AlsaMixerPlugin.cxx
@@ -195,7 +195,7 @@ static snd_mixer_elem_t *
alsa_mixer_lookup_elem(snd_mixer_t *handle, const char *name, unsigned idx)
{
for (snd_mixer_elem_t *elem = snd_mixer_first_elem(handle);
- elem != NULL; elem = snd_mixer_elem_next(elem)) {
+ elem != nullptr; elem = snd_mixer_elem_next(elem)) {
if (snd_mixer_elem_get_type(elem) == SND_MIXER_ELEM_SIMPLE &&
StringEqualsCaseASCII(snd_mixer_selem_get_name(elem),
name) &&
@@ -203,7 +203,7 @@ alsa_mixer_lookup_elem(snd_mixer_t *handle, const char *name, unsigned idx)
return elem;
}
- return NULL;
+ return nullptr;
}
inline bool
@@ -218,8 +218,8 @@ AlsaMixer::Setup(Error &error)
return false;
}
- if ((err = snd_mixer_selem_register(handle, NULL,
- NULL)) < 0) {
+ if ((err = snd_mixer_selem_register(handle, nullptr,
+ nullptr)) < 0) {
error.Format(alsa_mixer_domain, err,
"snd_mixer_selem_register() failed: %s",
snd_strerror(err));
@@ -234,7 +234,7 @@ AlsaMixer::Setup(Error &error)
}
elem = alsa_mixer_lookup_elem(handle, control, index);
- if (elem == NULL) {
+ if (elem == nullptr) {
error.Format(alsa_mixer_domain, 0,
"no such mixer control: %s", control);
return false;
@@ -283,11 +283,11 @@ alsa_mixer_open(Mixer *data, Error &error)
inline void
AlsaMixer::Close()
{
- assert(handle != NULL);
+ assert(handle != nullptr);
delete monitor;
- snd_mixer_elem_set_callback(elem, NULL);
+ snd_mixer_elem_set_callback(elem, nullptr);
snd_mixer_close(handle);
}
@@ -305,7 +305,7 @@ AlsaMixer::GetVolume(Error &error)
int ret;
long level;
- assert(handle != NULL);
+ assert(handle != nullptr);
err = snd_mixer_handle_events(handle);
if (err < 0) {
@@ -351,7 +351,7 @@ AlsaMixer::SetVolume(unsigned volume, Error &error)
long level;
int err;
- assert(handle != NULL);
+ assert(handle != nullptr);
vol = volume;
diff --git a/src/mixer/PulseMixerPlugin.cxx b/src/mixer/PulseMixerPlugin.cxx
index 368fd3830..ff10256cb 100644
--- a/src/mixer/PulseMixerPlugin.cxx
+++ b/src/mixer/PulseMixerPlugin.cxx
@@ -75,7 +75,7 @@ pulse_mixer_volume_cb(gcc_unused pa_context *context, const pa_sink_input_info *
if (eol)
return;
- if (i == NULL) {
+ if (i == nullptr) {
pulse_mixer_offline(pm);
return;
}
@@ -92,14 +92,14 @@ pulse_mixer_update(PulseMixer *pm,
{
pa_operation *o;
- assert(context != NULL);
- assert(stream != NULL);
+ assert(context != nullptr);
+ assert(stream != nullptr);
assert(pa_stream_get_state(stream) == PA_STREAM_READY);
o = pa_context_get_sink_input_info(context,
pa_stream_get_index(stream),
pulse_mixer_volume_cb, pm);
- if (o == NULL) {
+ if (o == nullptr) {
FormatError(pulse_mixer_domain,
"pa_context_get_sink_input_info() failed: %s",
pa_strerror(pa_context_errno(context)));
@@ -116,12 +116,12 @@ pulse_mixer_on_connect(gcc_unused PulseMixer *pm,
{
pa_operation *o;
- assert(context != NULL);
+ assert(context != nullptr);
o = pa_context_subscribe(context,
(pa_subscription_mask_t)PA_SUBSCRIPTION_MASK_SINK_INPUT,
- NULL, NULL);
- if (o == NULL) {
+ nullptr, nullptr);
+ if (o == nullptr) {
FormatError(pulse_mixer_domain,
"pa_context_subscribe() failed: %s",
pa_strerror(pa_context_errno(context)));
@@ -150,7 +150,7 @@ pulse_mixer_init(void *ao, gcc_unused const config_param &param,
{
PulseOutput *po = (PulseOutput *)ao;
- if (ao == NULL) {
+ if (ao == nullptr) {
error.Set(pulse_mixer_domain,
"The pulse mixer cannot work without the audio output");
return nullptr;
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 &param, 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 &param, 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 &param, 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);
diff --git a/src/pcm/PcmBuffer.cxx b/src/pcm/PcmBuffer.cxx
index 6ace399f3..578c579be 100644
--- a/src/pcm/PcmBuffer.cxx
+++ b/src/pcm/PcmBuffer.cxx
@@ -25,8 +25,8 @@ void *
PcmBuffer::Get(size_t new_size)
{
if (new_size == 0)
- /* never return NULL, because NULL would be assumed to
- be an error condition */
+ /* never return nullptr, because nullptr would be
+ assumed to be an error condition */
new_size = 1;
return buffer.Get(new_size);
diff --git a/src/pcm/PcmBuffer.hxx b/src/pcm/PcmBuffer.hxx
index fa89d7f20..717e24938 100644
--- a/src/pcm/PcmBuffer.hxx
+++ b/src/pcm/PcmBuffer.hxx
@@ -42,9 +42,10 @@ public:
* Get the buffer, and guarantee a minimum size. This buffer becomes
* invalid with the next pcm_buffer_get() call.
*
- * This function will never return NULL, even if size is zero, because
- * the PCM library uses the NULL return value to signal "error". An
- * empty destination buffer is not always an error.
+ * This function will never return nullptr, even if size is
+ * zero, because the PCM library uses the nullptr return value
+ * to signal "error". An empty destination buffer is not
+ * always an error.
*/
gcc_malloc
void *Get(size_t size);
diff --git a/src/pcm/PcmChannels.cxx b/src/pcm/PcmChannels.cxx
index a0791078c..eb69985c1 100644
--- a/src/pcm/PcmChannels.cxx
+++ b/src/pcm/PcmChannels.cxx
@@ -95,7 +95,7 @@ pcm_convert_channels_16(PcmBuffer &buffer,
pcm_convert_channels_16_n_to_2(dest, src_channels, src,
src_end);
else
- return NULL;
+ return nullptr;
return dest;
}
@@ -159,7 +159,7 @@ pcm_convert_channels_24(PcmBuffer &buffer,
pcm_convert_channels_24_n_to_2(dest, src_channels, src,
src_end);
else
- return NULL;
+ return nullptr;
return dest;
}
@@ -222,7 +222,7 @@ pcm_convert_channels_32(PcmBuffer &buffer,
pcm_convert_channels_32_n_to_2(dest, src_channels, src,
src_end);
else
- return NULL;
+ return nullptr;
return dest;
}
@@ -284,7 +284,7 @@ pcm_convert_channels_float(PcmBuffer &buffer,
pcm_convert_channels_float_n_to_2(dest, src_channels, src,
src_end);
else
- return NULL;
+ return nullptr;
return dest;
}
diff --git a/src/pcm/PcmConvert.cxx b/src/pcm/PcmConvert.cxx
index 6061aee88..eeaf99aee 100644
--- a/src/pcm/PcmConvert.cxx
+++ b/src/pcm/PcmConvert.cxx
@@ -60,11 +60,11 @@ PcmConvert::Convert16(const AudioFormat src_format,
src_format.format,
src_buffer, src_size,
&len);
- if (buf == NULL) {
+ if (buf == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %s to 16 bit is not implemented",
sample_format_to_string(src_format.format));
- return NULL;
+ return nullptr;
}
if (src_format.channels != dest_format.channels) {
@@ -72,13 +72,13 @@ PcmConvert::Convert16(const AudioFormat src_format,
dest_format.channels,
src_format.channels,
buf, len, &len);
- if (buf == NULL) {
+ if (buf == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %u to %u channels "
"is not implemented",
src_format.channels,
dest_format.channels);
- return NULL;
+ return nullptr;
}
}
@@ -87,8 +87,8 @@ PcmConvert::Convert16(const AudioFormat src_format,
src_format.sample_rate, buf, len,
dest_format.sample_rate, &len,
error);
- if (buf == NULL)
- return NULL;
+ if (buf == nullptr)
+ return nullptr;
}
*dest_size_r = len;
@@ -109,11 +109,11 @@ PcmConvert::Convert24(const AudioFormat src_format,
buf = pcm_convert_to_24(format_buffer,
src_format.format,
src_buffer, src_size, &len);
- if (buf == NULL) {
+ if (buf == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %s to 24 bit is not implemented",
sample_format_to_string(src_format.format));
- return NULL;
+ return nullptr;
}
if (src_format.channels != dest_format.channels) {
@@ -121,13 +121,13 @@ PcmConvert::Convert24(const AudioFormat src_format,
dest_format.channels,
src_format.channels,
buf, len, &len);
- if (buf == NULL) {
+ if (buf == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %u to %u channels "
"is not implemented",
src_format.channels,
dest_format.channels);
- return NULL;
+ return nullptr;
}
}
@@ -136,8 +136,8 @@ PcmConvert::Convert24(const AudioFormat src_format,
src_format.sample_rate, buf, len,
dest_format.sample_rate, &len,
error);
- if (buf == NULL)
- return NULL;
+ if (buf == nullptr)
+ return nullptr;
}
*dest_size_r = len;
@@ -158,11 +158,11 @@ PcmConvert::Convert32(const AudioFormat src_format,
buf = pcm_convert_to_32(format_buffer,
src_format.format,
src_buffer, src_size, &len);
- if (buf == NULL) {
+ if (buf == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %s to 32 bit is not implemented",
sample_format_to_string(src_format.format));
- return NULL;
+ return nullptr;
}
if (src_format.channels != dest_format.channels) {
@@ -170,13 +170,13 @@ PcmConvert::Convert32(const AudioFormat src_format,
dest_format.channels,
src_format.channels,
buf, len, &len);
- if (buf == NULL) {
+ if (buf == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %u to %u channels "
"is not implemented",
src_format.channels,
dest_format.channels);
- return NULL;
+ return nullptr;
}
}
@@ -185,7 +185,7 @@ PcmConvert::Convert32(const AudioFormat src_format,
src_format.sample_rate, buf, len,
dest_format.sample_rate, &len,
error);
- if (buf == NULL)
+ if (buf == nullptr)
return buf;
}
@@ -209,11 +209,11 @@ PcmConvert::ConvertFloat(const AudioFormat src_format,
buffer = pcm_convert_to_float(format_buffer,
src_format.format,
buffer, size, &size);
- if (buffer == NULL) {
+ if (buffer == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %s to float is not implemented",
sample_format_to_string(src_format.format));
- return NULL;
+ return nullptr;
}
/* convert channels */
@@ -223,13 +223,13 @@ PcmConvert::ConvertFloat(const AudioFormat src_format,
dest_format.channels,
src_format.channels,
buffer, size, &size);
- if (buffer == NULL) {
+ if (buffer == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %u to %u channels "
"is not implemented",
src_format.channels,
dest_format.channels);
- return NULL;
+ return nullptr;
}
}
@@ -242,8 +242,8 @@ PcmConvert::ConvertFloat(const AudioFormat src_format,
buffer, size,
dest_format.sample_rate,
&size, error);
- if (buffer == NULL)
- return NULL;
+ if (buffer == nullptr)
+ return nullptr;
}
*dest_size_r = size;
@@ -263,10 +263,10 @@ PcmConvert::Convert(AudioFormat src_format,
const float *f = dsd.ToFloat(src_format.channels,
false, (const uint8_t *)src,
src_size, &f_size);
- if (f == NULL) {
+ if (f == nullptr) {
error.Set(pcm_convert_domain,
"DSD to PCM conversion failed");
- return NULL;
+ return nullptr;
}
float_format = src_format;
@@ -302,6 +302,6 @@ PcmConvert::Convert(AudioFormat src_format,
error.Format(pcm_convert_domain,
"PCM conversion to %s is not implemented",
sample_format_to_string(dest_format.format));
- return NULL;
+ return nullptr;
}
}
diff --git a/src/pcm/PcmExport.cxx b/src/pcm/PcmExport.cxx
index 74b642569..f6ce1e661 100644
--- a/src/pcm/PcmExport.cxx
+++ b/src/pcm/PcmExport.cxx
@@ -87,7 +87,7 @@ PcmExport::Export(const void *data, size_t size, size_t &dest_size_r)
const uint8_t *src8 = (const uint8_t *)data;
const uint8_t *src_end8 = src8 + size;
uint8_t *dest = (uint8_t *)pack_buffer.Get(dest_size);
- assert(dest != NULL);
+ assert(dest != nullptr);
pcm_pack_24(dest, (const int32_t *)src8,
(const int32_t *)src_end8);
@@ -114,7 +114,7 @@ PcmExport::Export(const void *data, size_t size, size_t &dest_size_r)
assert(reverse_endian >= 2);
uint8_t *dest = (uint8_t *)reverse_buffer.Get(size);
- assert(dest != NULL);
+ assert(dest != nullptr);
const uint8_t *src = (const uint8_t *)data;
const uint8_t *src_end = src + size;
diff --git a/src/pcm/PcmFormat.cxx b/src/pcm/PcmFormat.cxx
index 9df800d44..68ab1f2ec 100644
--- a/src/pcm/PcmFormat.cxx
+++ b/src/pcm/PcmFormat.cxx
@@ -214,7 +214,7 @@ pcm_convert_to_16(PcmBuffer &buffer, PcmDither &dither,
dest_size_r);
}
- return NULL;
+ return nullptr;
}
static void
@@ -319,7 +319,7 @@ pcm_convert_to_24(PcmBuffer &buffer,
dest_size_r);
}
- return NULL;
+ return nullptr;
}
static void
@@ -430,7 +430,7 @@ pcm_convert_to_32(PcmBuffer &buffer,
dest_size_r);
}
- return NULL;
+ return nullptr;
}
template<SampleFormat F, class Traits=SampleTraits<F>>
@@ -540,5 +540,5 @@ pcm_convert_to_float(PcmBuffer &buffer,
return (const float *)src;
}
- return NULL;
+ return nullptr;
}
diff --git a/src/playlist/AsxPlaylistPlugin.cxx b/src/playlist/AsxPlaylistPlugin.cxx
index 23985cad8..94198b8c3 100644
--- a/src/playlist/AsxPlaylistPlugin.cxx
+++ b/src/playlist/AsxPlaylistPlugin.cxx
@@ -75,11 +75,11 @@ static const gchar *
get_attribute(const gchar **attribute_names, const gchar **attribute_values,
const gchar *name)
{
- for (unsigned i = 0; attribute_names[i] != NULL; ++i)
+ for (unsigned i = 0; attribute_names[i] != nullptr; ++i)
if (StringEqualsCaseASCII(attribute_names[i], name))
return attribute_values[i];
- return NULL;
+ return nullptr;
}
static void
@@ -106,7 +106,7 @@ asx_start_element(gcc_unused GMarkupParseContext *context,
const gchar *href = get_attribute(attribute_names,
attribute_values,
"href");
- if (href != NULL) {
+ if (href != nullptr) {
/* create new song object, and copy
the existing tag over; we cannot
replace the existing song's URI,
@@ -114,9 +114,9 @@ asx_start_element(gcc_unused GMarkupParseContext *context,
immutable */
Song *song = Song::NewRemote(href);
- if (parser->song != NULL) {
+ if (parser->song != nullptr) {
song->tag = parser->song->tag;
- parser->song->tag = NULL;
+ parser->song->tag = nullptr;
parser->song->Free();
}
@@ -172,7 +172,7 @@ asx_text(gcc_unused GMarkupParseContext *context,
case AsxParser::ENTRY:
if (parser->tag != TAG_NUM_OF_ITEM_TYPES) {
- if (parser->song->tag == NULL)
+ if (parser->song->tag == nullptr)
parser->song->tag = new Tag();
parser->song->tag->AddItem(parser->tag,
text, text_len);
@@ -213,7 +213,7 @@ asx_open_stream(InputStream &is)
size_t nbytes;
bool success;
Error error2;
- GError *error = NULL;
+ GError *error = nullptr;
/* parse the ASX XML file */
@@ -227,7 +227,7 @@ asx_open_stream(InputStream &is)
if (error2.IsDefined()) {
g_markup_parse_context_free(context);
LogError(error2);
- return NULL;
+ return nullptr;
}
break;
@@ -240,7 +240,7 @@ asx_open_stream(InputStream &is)
"XML parser failed: %s", error->message);
g_error_free(error);
g_markup_parse_context_free(context);
- return NULL;
+ return nullptr;
}
}
@@ -250,7 +250,7 @@ asx_open_stream(InputStream &is)
"XML parser failed: %s", error->message);
g_error_free(error);
g_markup_parse_context_free(context);
- return NULL;
+ return nullptr;
}
parser.songs.reverse();
@@ -264,12 +264,12 @@ asx_open_stream(InputStream &is)
static const char *const asx_suffixes[] = {
"asx",
- NULL
+ nullptr
};
static const char *const asx_mime_types[] = {
"video/x-ms-asf",
- NULL
+ nullptr
};
const struct playlist_plugin asx_playlist_plugin = {
diff --git a/src/playlist/CuePlaylistPlugin.cxx b/src/playlist/CuePlaylistPlugin.cxx
index 0ec030a54..42a43bbad 100644
--- a/src/playlist/CuePlaylistPlugin.cxx
+++ b/src/playlist/CuePlaylistPlugin.cxx
@@ -52,14 +52,14 @@ Song *
CuePlaylist::NextSong()
{
Song *song = parser.Get();
- if (song != NULL)
+ if (song != nullptr)
return song;
std::string line;
while (tis.ReadLine(line)) {
parser.Feed(line.c_str());
song = parser.Get();
- if (song != NULL)
+ if (song != nullptr)
return song;
}
@@ -69,12 +69,12 @@ CuePlaylist::NextSong()
static const char *const cue_playlist_suffixes[] = {
"cue",
- NULL
+ nullptr
};
static const char *const cue_playlist_mime_types[] = {
"application/x-cue",
- NULL
+ nullptr
};
const struct playlist_plugin cue_playlist_plugin = {
diff --git a/src/playlist/EmbeddedCuePlaylistPlugin.cxx b/src/playlist/EmbeddedCuePlaylistPlugin.cxx
index b21d78daa..d758650eb 100644
--- a/src/playlist/EmbeddedCuePlaylistPlugin.cxx
+++ b/src/playlist/EmbeddedCuePlaylistPlugin.cxx
@@ -97,7 +97,7 @@ embcue_playlist_open_uri(const char *uri,
{
if (!PathTraits::IsAbsoluteUTF8(uri))
/* only local files supported */
- return NULL;
+ return nullptr;
const auto path_fs = AllocatedPath::FromUTF8(uri);
if (path_fs.IsNull())
@@ -115,7 +115,7 @@ embcue_playlist_open_uri(const char *uri,
if (playlist->cuesheet.empty()) {
/* no "CUESHEET" tag found */
delete playlist;
- return NULL;
+ return nullptr;
}
playlist->filename = PathTraits::GetBaseUTF8(uri);
@@ -130,13 +130,13 @@ Song *
EmbeddedCuePlaylist::NextSong()
{
Song *song = parser->Get();
- if (song != NULL)
+ if (song != nullptr)
return song;
while (*next != 0) {
const char *line = next;
char *eol = strpbrk(next, "\r\n");
- if (eol != NULL) {
+ if (eol != nullptr) {
/* null-terminate the line */
*eol = 0;
next = eol + 1;
@@ -147,13 +147,13 @@ EmbeddedCuePlaylist::NextSong()
parser->Feed(line);
song = parser->Get();
- if (song != NULL)
+ if (song != nullptr)
return song->ReplaceURI(filename.c_str());
}
parser->Finish();
song = parser->Get();
- if (song != NULL)
+ if (song != nullptr)
song = song->ReplaceURI(filename.c_str());
return song;
}
@@ -167,7 +167,7 @@ static const char *const embcue_playlist_suffixes[] = {
"ape",
"wv",
"ogg", "oga",
- NULL
+ nullptr
};
const struct playlist_plugin embcue_playlist_plugin = {
diff --git a/src/playlist/M3uPlaylistPlugin.cxx b/src/playlist/M3uPlaylistPlugin.cxx
index 20b192cf5..3f99bdfdf 100644
--- a/src/playlist/M3uPlaylistPlugin.cxx
+++ b/src/playlist/M3uPlaylistPlugin.cxx
@@ -50,7 +50,7 @@ M3uPlaylist::NextSong()
do {
if (!tis.ReadLine(line))
- return NULL;
+ return nullptr;
line_s = line.c_str();
line_s = strchug_fast(line_s);
@@ -61,12 +61,12 @@ M3uPlaylist::NextSong()
static const char *const m3u_suffixes[] = {
"m3u",
- NULL
+ nullptr
};
static const char *const m3u_mime_types[] = {
"audio/x-mpegurl",
- NULL
+ nullptr
};
const struct playlist_plugin m3u_playlist_plugin = {
diff --git a/src/playlist/PlsPlaylistPlugin.cxx b/src/playlist/PlsPlaylistPlugin.cxx
index 46143225b..b6c723b5a 100644
--- a/src/playlist/PlsPlaylistPlugin.cxx
+++ b/src/playlist/PlsPlaylistPlugin.cxx
@@ -39,21 +39,21 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
{
gchar *value;
int length;
- GError *error = NULL;
+ GError *error = nullptr;
int num_entries = g_key_file_get_integer(keyfile, "playlist",
"NumberOfEntries", &error);
if (error) {
FormatError(pls_domain,
"Invalid PLS file: '%s'", error->message);
g_error_free(error);
- error = NULL;
+ error = nullptr;
/* Hack to work around shoutcast failure to comform to spec */
num_entries = g_key_file_get_integer(keyfile, "playlist",
"numberofentries", &error);
if (error) {
g_error_free(error);
- error = NULL;
+ error = nullptr;
}
}
@@ -78,27 +78,27 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
sprintf(key, "Title%u", num_entries);
value = g_key_file_get_string(keyfile, "playlist", key,
&error);
- if(error == NULL && value){
- if (song->tag == NULL)
+ if(error == nullptr && value){
+ if (song->tag == nullptr)
song->tag = new Tag();
song->tag->AddItem(TAG_TITLE, value);
}
/* Ignore errors? Most likely value not present */
if(error) g_error_free(error);
- error = NULL;
+ error = nullptr;
g_free(value);
sprintf(key, "Length%u", num_entries);
length = g_key_file_get_integer(keyfile, "playlist", key,
&error);
- if(error == NULL && length > 0){
- if (song->tag == NULL)
+ if(error == nullptr && length > 0){
+ if (song->tag == nullptr)
song->tag = new Tag();
song->tag->time = length;
}
/* Ignore errors? Most likely value not present */
if(error) g_error_free(error);
- error = NULL;
+ error = nullptr;
songs.emplace_front(song);
num_entries--;
@@ -109,7 +109,7 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
static SongEnumerator *
pls_open_stream(InputStream &is)
{
- GError *error = NULL;
+ GError *error = nullptr;
Error error2;
size_t nbytes;
char buffer[1024];
@@ -123,7 +123,7 @@ pls_open_stream(InputStream &is)
if (nbytes == 0) {
if (error2.IsDefined()) {
LogError(error2);
- return NULL;
+ return nullptr;
}
break;
@@ -135,7 +135,7 @@ pls_open_stream(InputStream &is)
if (kf_data.empty()) {
LogWarning(pls_domain, "KeyFile parser failed: No Data");
- return NULL;
+ return nullptr;
}
keyfile = g_key_file_new();
@@ -148,7 +148,7 @@ pls_open_stream(InputStream &is)
"KeyFile parser failed: %s", error->message);
g_error_free(error);
g_key_file_free(keyfile);
- return NULL;
+ return nullptr;
}
std::forward_list<SongPointer> songs;
@@ -161,12 +161,12 @@ pls_open_stream(InputStream &is)
static const char *const pls_suffixes[] = {
"pls",
- NULL
+ nullptr
};
static const char *const pls_mime_types[] = {
"audio/x-scpls",
- NULL
+ nullptr
};
const struct playlist_plugin pls_playlist_plugin = {
diff --git a/src/playlist/RssPlaylistPlugin.cxx b/src/playlist/RssPlaylistPlugin.cxx
index 43ad68cf6..e2a44bfd3 100644
--- a/src/playlist/RssPlaylistPlugin.cxx
+++ b/src/playlist/RssPlaylistPlugin.cxx
@@ -74,11 +74,11 @@ static const gchar *
get_attribute(const gchar **attribute_names, const gchar **attribute_values,
const gchar *name)
{
- for (unsigned i = 0; attribute_names[i] != NULL; ++i)
+ for (unsigned i = 0; attribute_names[i] != nullptr; ++i)
if (StringEqualsCaseASCII(attribute_names[i], name))
return attribute_values[i];
- return NULL;
+ return nullptr;
}
static void
@@ -105,7 +105,7 @@ rss_start_element(gcc_unused GMarkupParseContext *context,
const gchar *href = get_attribute(attribute_names,
attribute_values,
"url");
- if (href != NULL) {
+ if (href != nullptr) {
/* create new song object, and copy
the existing tag over; we cannot
replace the existing song's URI,
@@ -113,9 +113,9 @@ rss_start_element(gcc_unused GMarkupParseContext *context,
immutable */
Song *song = Song::NewRemote(href);
- if (parser->song != NULL) {
+ if (parser->song != nullptr) {
song->tag = parser->song->tag;
- parser->song->tag = NULL;
+ parser->song->tag = nullptr;
parser->song->Free();
}
@@ -169,7 +169,7 @@ rss_text(gcc_unused GMarkupParseContext *context,
case RssParser::ITEM:
if (parser->tag != TAG_NUM_OF_ITEM_TYPES) {
- if (parser->song->tag == NULL)
+ if (parser->song->tag == nullptr)
parser->song->tag = new Tag();
parser->song->tag->AddItem(parser->tag,
text, text_len);
@@ -210,7 +210,7 @@ rss_open_stream(InputStream &is)
size_t nbytes;
bool success;
Error error2;
- GError *error = NULL;
+ GError *error = nullptr;
/* parse the RSS XML file */
@@ -224,7 +224,7 @@ rss_open_stream(InputStream &is)
if (error2.IsDefined()) {
g_markup_parse_context_free(context);
LogError(error2);
- return NULL;
+ return nullptr;
}
break;
@@ -237,7 +237,7 @@ rss_open_stream(InputStream &is)
"XML parser failed: %s", error->message);
g_error_free(error);
g_markup_parse_context_free(context);
- return NULL;
+ return nullptr;
}
}
@@ -247,7 +247,7 @@ rss_open_stream(InputStream &is)
"XML parser failed: %s", error->message);
g_error_free(error);
g_markup_parse_context_free(context);
- return NULL;
+ return nullptr;
}
parser.songs.reverse();
@@ -261,13 +261,13 @@ rss_open_stream(InputStream &is)
static const char *const rss_suffixes[] = {
"rss",
- NULL
+ nullptr
};
static const char *const rss_mime_types[] = {
"application/rss+xml",
"text/xml",
- NULL
+ nullptr
};
const struct playlist_plugin rss_playlist_plugin = {
diff --git a/src/playlist/SoundCloudPlaylistPlugin.cxx b/src/playlist/SoundCloudPlaylistPlugin.cxx
index f9c030a21..f6797b14d 100644
--- a/src/playlist/SoundCloudPlaylistPlugin.cxx
+++ b/src/playlist/SoundCloudPlaylistPlugin.cxx
@@ -68,10 +68,10 @@ soundcloud_resolve(const char* uri) {
if (g_str_has_prefix(uri, "http://")) {
u = g_strdup(uri);
} else if (g_str_has_prefix(uri, "soundcloud.com")) {
- u = g_strconcat("http://", uri, NULL);
+ u = g_strconcat("http://", uri, nullptr);
} else {
/* assume it's just a path on soundcloud.com */
- u = g_strconcat("http://soundcloud.com/", uri, NULL);
+ u = g_strconcat("http://soundcloud.com/", uri, nullptr);
}
ru = g_strconcat("http://api.soundcloud.com/resolve.json?url=",
@@ -95,7 +95,7 @@ const char* key_str[] = {
"duration",
"title",
"stream_url",
- NULL,
+ nullptr,
};
struct parse_data {
@@ -141,12 +141,12 @@ static int handle_string(void *ctx, const unsigned char* stringval,
switch (data->key) {
case Title:
- if (data->title != NULL)
+ if (data->title != nullptr)
g_free(data->title);
data->title = g_strndup(s, stringlen);
break;
case Stream_URL:
- if (data->stream_url != NULL)
+ if (data->stream_url != nullptr)
g_free(data->stream_url);
data->stream_url = g_strndup(s, stringlen);
data->got_url = 1;
@@ -216,7 +216,7 @@ static int handle_end_map(void *ctx)
Tag *t = new Tag();
t->time = data->duration / 1000;
- if (data->title != NULL)
+ if (data->title != nullptr)
t->AddItem(TAG_NAME, data->title);
s->tag = t;
@@ -226,17 +226,17 @@ static int handle_end_map(void *ctx)
}
static yajl_callbacks parse_callbacks = {
- NULL,
- NULL,
+ nullptr,
+ nullptr,
handle_integer,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
handle_string,
handle_start_map,
handle_mapkey,
handle_end_map,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
};
/**
@@ -255,7 +255,7 @@ soundcloud_parse_json(const char *url, yajl_handle hand,
Error error;
InputStream *input_stream = InputStream::Open(url, mutex, cond,
error);
- if (input_stream == NULL) {
+ if (input_stream == nullptr) {
if (error.IsDefined())
LogError(error);
return -1;
@@ -348,10 +348,10 @@ soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond)
"incompatible scheme for soundcloud plugin: %s",
scheme);
g_free(s);
- return NULL;
+ return nullptr;
}
- char *u = NULL;
+ char *u = nullptr;
if (strcmp(arg, "track") == 0) {
u = g_strconcat("http://api.soundcloud.com/tracks/",
rest, ".json?client_id=",
@@ -367,34 +367,34 @@ soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond)
}
g_free(s);
- if (u == NULL) {
+ if (u == nullptr) {
LogWarning(soundcloud_domain, "unknown soundcloud URI");
- return NULL;
+ return nullptr;
}
yajl_handle hand;
struct parse_data data;
data.got_url = 0;
- data.title = NULL;
- data.stream_url = NULL;
+ data.title = nullptr;
+ data.stream_url = nullptr;
#ifdef HAVE_YAJL1
- hand = yajl_alloc(&parse_callbacks, NULL, NULL, (void *) &data);
+ hand = yajl_alloc(&parse_callbacks, nullptr, nullptr, (void *) &data);
#else
- hand = yajl_alloc(&parse_callbacks, NULL, (void *) &data);
+ hand = yajl_alloc(&parse_callbacks, nullptr, (void *) &data);
#endif
int ret = soundcloud_parse_json(u, hand, mutex, cond);
g_free(u);
yajl_free(hand);
- if (data.title != NULL)
+ if (data.title != nullptr)
g_free(data.title);
- if (data.stream_url != NULL)
+ if (data.stream_url != nullptr)
g_free(data.stream_url);
if (ret == -1)
- return NULL;
+ return nullptr;
data.songs.reverse();
return new MemorySongEnumerator(std::move(data.songs));
@@ -402,7 +402,7 @@ soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond)
static const char *const soundcloud_schemes[] = {
"soundcloud",
- NULL
+ nullptr
};
const struct playlist_plugin soundcloud_playlist_plugin = {
diff --git a/src/playlist/XspfPlaylistPlugin.cxx b/src/playlist/XspfPlaylistPlugin.cxx
index 75991cfd4..dcfab5a80 100644
--- a/src/playlist/XspfPlaylistPlugin.cxx
+++ b/src/playlist/XspfPlaylistPlugin.cxx
@@ -94,7 +94,7 @@ xspf_start_element(gcc_unused GMarkupParseContext *context,
case XspfParser::TRACKLIST:
if (strcmp(element_name, "track") == 0) {
parser->state = XspfParser::TRACK;
- parser->song = NULL;
+ parser->song = nullptr;
parser->tag = TAG_NUM_OF_ITEM_TYPES;
}
@@ -148,7 +148,7 @@ xspf_end_element(gcc_unused GMarkupParseContext *context,
case XspfParser::TRACK:
if (strcmp(element_name, "track") == 0) {
- if (parser->song != NULL)
+ if (parser->song != nullptr)
parser->songs.emplace_front(parser->song);
parser->state = XspfParser::TRACKLIST;
@@ -177,9 +177,9 @@ xspf_text(gcc_unused GMarkupParseContext *context,
break;
case XspfParser::TRACK:
- if (parser->song != NULL &&
+ if (parser->song != nullptr &&
parser->tag != TAG_NUM_OF_ITEM_TYPES) {
- if (parser->song->tag == NULL)
+ if (parser->song->tag == nullptr)
parser->song->tag = new Tag();
parser->song->tag->AddItem(parser->tag, text, text_len);
}
@@ -187,7 +187,7 @@ xspf_text(gcc_unused GMarkupParseContext *context,
break;
case XspfParser::LOCATION:
- if (parser->song == NULL) {
+ if (parser->song == nullptr) {
char *uri = g_strndup(text, text_len);
parser->song = Song::NewRemote(uri);
g_free(uri);
@@ -210,7 +210,7 @@ xspf_parser_destroy(gpointer data)
{
XspfParser *parser = (XspfParser *)data;
- if (parser->state >= XspfParser::TRACK && parser->song != NULL)
+ if (parser->state >= XspfParser::TRACK && parser->song != nullptr)
parser->song->Free();
}
@@ -228,7 +228,7 @@ xspf_open_stream(InputStream &is)
size_t nbytes;
bool success;
Error error2;
- GError *error = NULL;
+ GError *error = nullptr;
/* parse the XSPF XML file */
@@ -242,7 +242,7 @@ xspf_open_stream(InputStream &is)
if (error2.IsDefined()) {
g_markup_parse_context_free(context);
LogError(error2);
- return NULL;
+ return nullptr;
}
break;
@@ -255,7 +255,7 @@ xspf_open_stream(InputStream &is)
"XML parser failed: %s", error->message);
g_error_free(error);
g_markup_parse_context_free(context);
- return NULL;
+ return nullptr;
}
}
@@ -265,7 +265,7 @@ xspf_open_stream(InputStream &is)
"XML parser failed: %s", error->message);
g_error_free(error);
g_markup_parse_context_free(context);
- return NULL;
+ return nullptr;
}
parser.songs.reverse();
@@ -279,12 +279,12 @@ xspf_open_stream(InputStream &is)
static const char *const xspf_suffixes[] = {
"xspf",
- NULL
+ nullptr
};
static const char *const xspf_mime_types[] = {
"application/xspf+xml",
- NULL
+ nullptr
};
const struct playlist_plugin xspf_playlist_plugin = {
diff --git a/src/protocol/Result.cxx b/src/protocol/Result.cxx
index 48feee4d4..17b553c34 100644
--- a/src/protocol/Result.cxx
+++ b/src/protocol/Result.cxx
@@ -36,14 +36,14 @@ void
command_error_v(Client &client, enum ack error,
const char *fmt, va_list args)
{
- assert(current_command != NULL);
+ assert(current_command != nullptr);
client_printf(client, "ACK [%i@%i] {%s} ",
(int)error, command_list_num, current_command);
client_vprintf(client, fmt, args);
client_puts(client, "\n");
- current_command = NULL;
+ current_command = nullptr;
}
void
diff --git a/src/tag/Tag.hxx b/src/tag/Tag.hxx
index 4d8f1a4e8..5846e7a9d 100644
--- a/src/tag/Tag.hxx
+++ b/src/tag/Tag.hxx
@@ -131,7 +131,7 @@ struct Tag {
static Tag *Merge(const Tag &base, const Tag &add);
/**
- * Merges the data from two tags. Any of the two may be NULL. Both
+ * Merges the data from two tags. Any of the two may be nullptr. Both
* are freed by this function.
*
* @return a newly allocated tag
@@ -140,8 +140,8 @@ struct Tag {
static Tag *MergeReplace(Tag *base, Tag *add);
/**
- * Returns the first value of the specified tag type, or NULL if none
- * is present in this tag object.
+ * Returns the first value of the specified tag type, or
+ * nullptr if none is present in this tag object.
*/
gcc_pure
const char *GetValue(TagType type) const;
diff --git a/src/tag/TagId3.hxx b/src/tag/TagId3.hxx
index 44d890337..749166116 100644
--- a/src/tag/TagId3.hxx
+++ b/src/tag/TagId3.hxx
@@ -42,7 +42,7 @@ tag_id3_import(struct id3_tag *);
* Loads the ID3 tags from the file into a libid3tag object. The
* return value must be freed with id3_tag_delete().
*
- * @return NULL on error or if no ID3 tag was found in the file (no
+ * @return nullptr on error or if no ID3 tag was found in the file (no
* Error will be set)
*/
struct id3_tag *