*: use nullptr instead of NULL
This commit is contained in:
parent
4728735acf
commit
20597b3632
@ -41,7 +41,7 @@ void initAudioConfig(void)
|
|||||||
{
|
{
|
||||||
const struct config_param *param = config_get_param(CONF_AUDIO_OUTPUT_FORMAT);
|
const struct config_param *param = config_get_param(CONF_AUDIO_OUTPUT_FORMAT);
|
||||||
|
|
||||||
if (param == NULL)
|
if (param == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Error error;
|
Error error;
|
||||||
|
@ -305,7 +305,7 @@ sample_format_to_string(SampleFormat format);
|
|||||||
*
|
*
|
||||||
* @param af the #audio_format object
|
* @param af the #audio_format object
|
||||||
* @param s a buffer to print into
|
* @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
|
gcc_pure gcc_malloc
|
||||||
const char *
|
const char *
|
||||||
|
@ -31,7 +31,7 @@ static bool
|
|||||||
AddToQueue(Partition &partition, Song &song, Error &error)
|
AddToQueue(Partition &partition, Song &song, Error &error)
|
||||||
{
|
{
|
||||||
PlaylistResult result =
|
PlaylistResult result =
|
||||||
partition.playlist.AppendSong(partition.pc, &song, NULL);
|
partition.playlist.AppendSong(partition.pc, &song, nullptr);
|
||||||
if (result != PlaylistResult::SUCCESS) {
|
if (result != PlaylistResult::SUCCESS) {
|
||||||
error.Set(playlist_domain, int(result), "Playlist error");
|
error.Set(playlist_domain, int(result), "Playlist error");
|
||||||
return false;
|
return false;
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
* @param audio_format the audio format of incoming data; the
|
* @param audio_format the audio format of incoming data; the
|
||||||
* plugin may modify the object to enforce another input
|
* plugin may modify the object to enforce another input
|
||||||
* format
|
* format
|
||||||
* @param error location to store the error occurring, or NULL
|
* @param error location to store the error occurring, or nullptr
|
||||||
* to ignore errors.
|
* to ignore errors.
|
||||||
* @return the format of outgoing data or
|
* @return the format of outgoing data or
|
||||||
* AudioFormat::Undefined() on error
|
* AudioFormat::Undefined() on error
|
||||||
@ -60,10 +60,10 @@ public:
|
|||||||
* @param src the input buffer
|
* @param src the input buffer
|
||||||
* @param src_size the size of #src_buffer in bytes
|
* @param src_size the size of #src_buffer in bytes
|
||||||
* @param dest_size_r the size of the returned buffer
|
* @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.
|
* to ignore errors.
|
||||||
* @return the destination buffer on success (will be
|
* @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
|
* error
|
||||||
*/
|
*/
|
||||||
virtual const void *FilterPCM(const void *src, size_t src_size,
|
virtual const void *FilterPCM(const void *src, size_t src_size,
|
||||||
|
@ -156,7 +156,7 @@ map_to_relative_path(const char *path_utf8)
|
|||||||
AllocatedPath
|
AllocatedPath
|
||||||
map_uri_fs(const char *uri)
|
map_uri_fs(const char *uri)
|
||||||
{
|
{
|
||||||
assert(uri != NULL);
|
assert(uri != nullptr);
|
||||||
assert(*uri != '/');
|
assert(*uri != '/');
|
||||||
|
|
||||||
if (music_dir_fs.IsNull())
|
if (music_dir_fs.IsNull())
|
||||||
@ -186,7 +186,7 @@ map_directory_child_fs(const Directory &directory, const char *name)
|
|||||||
assert(!music_dir_fs.IsNull());
|
assert(!music_dir_fs.IsNull());
|
||||||
|
|
||||||
/* check for invalid or unauthorized base names */
|
/* 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)
|
strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
|
||||||
return AllocatedPath::Null();
|
return AllocatedPath::Null();
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ const struct audio_output_plugin *const audio_output_plugins[] = {
|
|||||||
#ifdef ENABLE_WINMM_OUTPUT
|
#ifdef ENABLE_WINMM_OUTPUT
|
||||||
&winmm_output_plugin,
|
&winmm_output_plugin,
|
||||||
#endif
|
#endif
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct audio_output_plugin *
|
const struct audio_output_plugin *
|
||||||
@ -96,5 +96,5 @@ audio_output_plugin_get(const char *name)
|
|||||||
if (strcmp(plugin->name, name) == 0)
|
if (strcmp(plugin->name, name) == 0)
|
||||||
return plugin;
|
return plugin;
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,6 @@ audio_output_plugin_get(const char *name);
|
|||||||
#define audio_output_plugins_for_each(plugin) \
|
#define audio_output_plugins_for_each(plugin) \
|
||||||
for (const struct audio_output_plugin *plugin, \
|
for (const struct audio_output_plugin *plugin, \
|
||||||
*const*output_plugin_iterator = &audio_output_plugins[0]; \
|
*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
|
#endif
|
||||||
|
@ -61,7 +61,7 @@ replay_gain_get_mode_string(void)
|
|||||||
bool
|
bool
|
||||||
replay_gain_set_mode_string(const char *p)
|
replay_gain_set_mode_string(const char *p)
|
||||||
{
|
{
|
||||||
assert(p != NULL);
|
assert(p != nullptr);
|
||||||
|
|
||||||
if (strcmp(p, "off") == 0)
|
if (strcmp(p, "off") == 0)
|
||||||
replay_gain_mode = REPLAY_GAIN_OFF;
|
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);
|
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())) {
|
!replay_gain_set_mode_string(param->value.c_str())) {
|
||||||
FormatFatalError("replaygain value \"%s\" at line %i is invalid\n",
|
FormatFatalError("replaygain value \"%s\" at line %i is invalid\n",
|
||||||
param->value.c_str(), param->line);
|
param->value.c_str(), param->line);
|
||||||
|
@ -129,7 +129,7 @@ handle_lsinfo(Client &client, int argc, char *argv[])
|
|||||||
return print_error(client, error);
|
return print_error(client, error);
|
||||||
|
|
||||||
Song *song = Song::LoadFile(path_utf8, nullptr);
|
Song *song = Song::LoadFile(path_utf8, nullptr);
|
||||||
if (song == NULL) {
|
if (song == nullptr) {
|
||||||
command_error(client, ACK_ERROR_NO_EXIST,
|
command_error(client, ACK_ERROR_NO_EXIST,
|
||||||
"No such file");
|
"No such file");
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
@ -310,7 +310,7 @@ handle_config(Client &client,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *path = mapper_get_music_directory_utf8();
|
const char *path = mapper_get_music_directory_utf8();
|
||||||
if (path != NULL)
|
if (path != nullptr)
|
||||||
client_printf(client, "music_directory: %s\n", path);
|
client_printf(client, "music_directory: %s\n", path);
|
||||||
|
|
||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
|
@ -111,7 +111,7 @@ CommandResult
|
|||||||
handle_status(Client &client,
|
handle_status(Client &client,
|
||||||
gcc_unused int argc, gcc_unused char *argv[])
|
gcc_unused int argc, gcc_unused char *argv[])
|
||||||
{
|
{
|
||||||
const char *state = NULL;
|
const char *state = nullptr;
|
||||||
int updateJobId;
|
int updateJobId;
|
||||||
int song;
|
int song;
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ ProxyDatabase::Create(const config_param ¶m, Error &error)
|
|||||||
ProxyDatabase *db = new ProxyDatabase();
|
ProxyDatabase *db = new ProxyDatabase();
|
||||||
if (!db->Configure(param, error)) {
|
if (!db->Configure(param, error)) {
|
||||||
delete db;
|
delete db;
|
||||||
db = NULL;
|
db = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return db;
|
return db;
|
||||||
@ -149,9 +149,9 @@ ProxyDatabase::Configure(const config_param ¶m, gcc_unused Error &error)
|
|||||||
bool
|
bool
|
||||||
ProxyDatabase::Open(Error &error)
|
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);
|
port, 0);
|
||||||
if (connection == NULL) {
|
if (connection == nullptr) {
|
||||||
error.Set(libmpdclient_domain, (int)MPD_ERROR_OOM, "Out of memory");
|
error.Set(libmpdclient_domain, (int)MPD_ERROR_OOM, "Out of memory");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ Copy(TagBuilder &tag, TagType d_tag,
|
|||||||
|
|
||||||
for (unsigned i = 0;; ++i) {
|
for (unsigned i = 0;; ++i) {
|
||||||
const char *value = mpd_song_get_tag(song, s_tag, i);
|
const char *value = mpd_song_get_tag(song, s_tag, i);
|
||||||
if (value == NULL)
|
if (value == nullptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
tag.AddItem(d_tag, value);
|
tag.AddItem(d_tag, value);
|
||||||
@ -339,7 +339,7 @@ ReceiveEntities(struct mpd_connection *connection)
|
|||||||
{
|
{
|
||||||
std::list<ProxyEntity> entities;
|
std::list<ProxyEntity> entities;
|
||||||
struct mpd_entity *entity;
|
struct mpd_entity *entity;
|
||||||
while ((entity = mpd_recv_entity(connection)) != NULL)
|
while ((entity = mpd_recv_entity(connection)) != nullptr)
|
||||||
entities.push_back(ProxyEntity(entity));
|
entities.push_back(ProxyEntity(entity));
|
||||||
|
|
||||||
mpd_response_finish(connection);
|
mpd_response_finish(connection);
|
||||||
|
@ -72,7 +72,7 @@ adplug_file_decode(Decoder &decoder, const char *path_fs)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
opl.update(buffer, frames_per_buffer);
|
opl.update(buffer, frames_per_buffer);
|
||||||
cmd = decoder_data(decoder, NULL,
|
cmd = decoder_data(decoder, nullptr,
|
||||||
buffer, sizeof(buffer),
|
buffer, sizeof(buffer),
|
||||||
0);
|
0);
|
||||||
} while (cmd == DecoderCommand::NONE);
|
} while (cmd == DecoderCommand::NONE);
|
||||||
|
@ -314,7 +314,7 @@ dsf_scan_stream(InputStream &is,
|
|||||||
{
|
{
|
||||||
/* check DSF metadata */
|
/* check DSF metadata */
|
||||||
DsfMetaData metadata;
|
DsfMetaData metadata;
|
||||||
if (!dsf_read_metadata(NULL, is, &metadata))
|
if (!dsf_read_metadata(nullptr, is, &metadata))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AudioFormat audio_format;
|
AudioFormat audio_format;
|
||||||
@ -338,12 +338,12 @@ dsf_scan_stream(InputStream &is,
|
|||||||
|
|
||||||
static const char *const dsf_suffixes[] = {
|
static const char *const dsf_suffixes[] = {
|
||||||
"dsf",
|
"dsf",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const dsf_mime_types[] = {
|
static const char *const dsf_mime_types[] = {
|
||||||
"application/x-dsf",
|
"application/x-dsf",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct DecoderPlugin dsf_decoder_plugin = {
|
const struct DecoderPlugin dsf_decoder_plugin = {
|
||||||
|
@ -32,7 +32,7 @@ static const struct tag_table ffmpeg_tags[] = {
|
|||||||
{ "album_artist-sort", TAG_ALBUM_ARTIST_SORT },
|
{ "album_artist-sort", TAG_ALBUM_ARTIST_SORT },
|
||||||
|
|
||||||
/* sentinel */
|
/* sentinel */
|
||||||
{ NULL, TAG_NUM_OF_ITEM_TYPES }
|
{ nullptr, TAG_NUM_OF_ITEM_TYPES }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -40,9 +40,9 @@ ffmpeg_copy_metadata(TagType type,
|
|||||||
AVDictionary *m, const char *name,
|
AVDictionary *m, const char *name,
|
||||||
const struct tag_handler *handler, void *handler_ctx)
|
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,
|
tag_handler_invoke_tag(handler, handler_ctx,
|
||||||
type, mt->value);
|
type, mt->value);
|
||||||
}
|
}
|
||||||
@ -51,9 +51,9 @@ static void
|
|||||||
ffmpeg_scan_pairs(AVDictionary *dict,
|
ffmpeg_scan_pairs(AVDictionary *dict,
|
||||||
const struct tag_handler *handler, void *handler_ctx)
|
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,
|
tag_handler_invoke_pair(handler, handler_ctx,
|
||||||
i->key, i->value);
|
i->key, i->value);
|
||||||
}
|
}
|
||||||
@ -67,10 +67,10 @@ ffmpeg_scan_dictionary(AVDictionary *dict,
|
|||||||
handler, handler_ctx);
|
handler, handler_ctx);
|
||||||
|
|
||||||
for (const struct tag_table *i = ffmpeg_tags;
|
for (const struct tag_table *i = ffmpeg_tags;
|
||||||
i->name != NULL; ++i)
|
i->name != nullptr; ++i)
|
||||||
ffmpeg_copy_metadata(i->type, dict, i->name,
|
ffmpeg_copy_metadata(i->type, dict, i->name,
|
||||||
handler, handler_ctx);
|
handler, handler_ctx);
|
||||||
|
|
||||||
if (handler->pair != NULL)
|
if (handler->pair != nullptr)
|
||||||
ffmpeg_scan_pairs(dict, handler, handler_ctx);
|
ffmpeg_scan_pairs(dict, handler, handler_ctx);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ vorbis_comment_value(const char *comment, const char *needle)
|
|||||||
comment[len] == '=')
|
comment[len] == '=')
|
||||||
return comment + len + 1;
|
return comment + len + 1;
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -91,7 +91,7 @@ vorbis_copy_comment(const char *comment,
|
|||||||
const char *value;
|
const char *value;
|
||||||
|
|
||||||
value = vorbis_comment_value(comment, name);
|
value = vorbis_comment_value(comment, name);
|
||||||
if (value != NULL) {
|
if (value != nullptr) {
|
||||||
tag_handler_invoke_tag(handler, handler_ctx, tag_type, value);
|
tag_handler_invoke_tag(handler, handler_ctx, tag_type, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -103,11 +103,11 @@ static void
|
|||||||
vorbis_scan_comment(const char *comment,
|
vorbis_scan_comment(const char *comment,
|
||||||
const struct tag_handler *handler, void *handler_ctx)
|
const struct tag_handler *handler, void *handler_ctx)
|
||||||
{
|
{
|
||||||
if (handler->pair != NULL) {
|
if (handler->pair != nullptr) {
|
||||||
char *name = g_strdup((const char*)comment);
|
char *name = g_strdup((const char*)comment);
|
||||||
char *value = strchr(name, '=');
|
char *value = strchr(name, '=');
|
||||||
|
|
||||||
if (value != NULL && value > name) {
|
if (value != nullptr && value > name) {
|
||||||
*value++ = 0;
|
*value++ = 0;
|
||||||
tag_handler_invoke_pair(handler, handler_ctx,
|
tag_handler_invoke_pair(handler, handler_ctx,
|
||||||
name, value);
|
name, value);
|
||||||
@ -116,7 +116,7 @@ vorbis_scan_comment(const char *comment,
|
|||||||
g_free(name);
|
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,
|
if (vorbis_copy_comment(comment, i->name, i->type,
|
||||||
handler, handler_ctx))
|
handler, handler_ctx))
|
||||||
return;
|
return;
|
||||||
|
@ -133,9 +133,9 @@ vorbis_is_open(struct vorbis_input_stream *vis, OggVorbis_File *vf,
|
|||||||
vis->input_stream = &input_stream;
|
vis->input_stream = &input_stream;
|
||||||
vis->seekable = input_stream.CheapSeeking();
|
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 (ret < 0) {
|
||||||
if (decoder == NULL ||
|
if (decoder == nullptr ||
|
||||||
decoder_get_command(*decoder) == DecoderCommand::NONE)
|
decoder_get_command(*decoder) == DecoderCommand::NONE)
|
||||||
FormatWarning(vorbis_domain,
|
FormatWarning(vorbis_domain,
|
||||||
"Failed to open Ogg Vorbis stream: %s",
|
"Failed to open Ogg Vorbis stream: %s",
|
||||||
@ -191,7 +191,7 @@ vorbis_stream_decode(Decoder &decoder,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const vorbis_info *vi = ov_info(&vf, -1);
|
const vorbis_info *vi = ov_info(&vf, -1);
|
||||||
if (vi == NULL) {
|
if (vi == nullptr) {
|
||||||
LogWarning(vorbis_domain, "ov_info() has failed");
|
LogWarning(vorbis_domain, "ov_info() has failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ vorbis_stream_decode(Decoder &decoder,
|
|||||||
|
|
||||||
if (current_section != prev_section) {
|
if (current_section != prev_section) {
|
||||||
vi = ov_info(&vf, -1);
|
vi = ov_info(&vf, -1);
|
||||||
if (vi == NULL) {
|
if (vi == nullptr) {
|
||||||
LogWarning(vorbis_domain,
|
LogWarning(vorbis_domain,
|
||||||
"ov_info() has failed");
|
"ov_info() has failed");
|
||||||
break;
|
break;
|
||||||
@ -309,7 +309,7 @@ vorbis_scan_stream(InputStream &is,
|
|||||||
struct vorbis_input_stream vis;
|
struct vorbis_input_stream vis;
|
||||||
OggVorbis_File vf;
|
OggVorbis_File vf;
|
||||||
|
|
||||||
if (!vorbis_is_open(&vis, &vf, NULL, is))
|
if (!vorbis_is_open(&vis, &vf, nullptr, is))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
tag_handler_invoke_duration(handler, handler_ctx,
|
tag_handler_invoke_duration(handler, handler_ctx,
|
||||||
@ -323,7 +323,7 @@ vorbis_scan_stream(InputStream &is,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *const vorbis_suffixes[] = {
|
static const char *const vorbis_suffixes[] = {
|
||||||
"ogg", "oga", NULL
|
"ogg", "oga", nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const vorbis_mime_types[] = {
|
static const char *const vorbis_mime_types[] = {
|
||||||
@ -335,7 +335,7 @@ static const char *const vorbis_mime_types[] = {
|
|||||||
"audio/x-ogg",
|
"audio/x-ogg",
|
||||||
"audio/x-vorbis",
|
"audio/x-vorbis",
|
||||||
"audio/x-vorbis+ogg",
|
"audio/x-vorbis+ogg",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct DecoderPlugin vorbis_decoder_plugin = {
|
const struct DecoderPlugin vorbis_decoder_plugin = {
|
||||||
|
@ -230,7 +230,7 @@ guint
|
|||||||
EventLoop::AddIdle(GSourceFunc function, gpointer data)
|
EventLoop::AddIdle(GSourceFunc function, gpointer data)
|
||||||
{
|
{
|
||||||
GSource *source = g_idle_source_new();
|
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());
|
guint id = g_source_attach(source, GetContext());
|
||||||
g_source_unref(source);
|
g_source_unref(source);
|
||||||
return id;
|
return id;
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
* Add a listener on a port on all interfaces.
|
* Add a listener on a port on all interfaces.
|
||||||
*
|
*
|
||||||
* @param port the TCP port
|
* @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
|
* ignore errors
|
||||||
* @return true on success
|
* @return true on success
|
||||||
*/
|
*/
|
||||||
@ -87,7 +87,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param hostname the host name to be resolved
|
* @param hostname the host name to be resolved
|
||||||
* @param port the TCP port
|
* @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
|
* ignore errors
|
||||||
* @return true on success
|
* @return true on success
|
||||||
*/
|
*/
|
||||||
@ -97,7 +97,7 @@ public:
|
|||||||
* Add a listener on a Unix domain socket.
|
* Add a listener on a Unix domain socket.
|
||||||
*
|
*
|
||||||
* @param path the absolute socket path
|
* @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
|
* ignore errors
|
||||||
* @return true on success
|
* @return true on success
|
||||||
*/
|
*/
|
||||||
|
@ -152,8 +152,8 @@ ChainFilter::FilterPCM(const void *src, size_t src_size,
|
|||||||
into the current one */
|
into the current one */
|
||||||
src = child.filter->FilterPCM(src, src_size, &src_size,
|
src = child.filter->FilterPCM(src, src_size, &src_size,
|
||||||
error);
|
error);
|
||||||
if (src == NULL)
|
if (src == nullptr)
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return the output of the last filter */
|
/* return the output of the last filter */
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetMixer(Mixer *_mixer, unsigned _base) {
|
void SetMixer(Mixer *_mixer, unsigned _base) {
|
||||||
assert(_mixer == NULL || (_base > 0 && _base <= 100));
|
assert(_mixer == nullptr || (_base > 0 && _base <= 100));
|
||||||
|
|
||||||
mixer = _mixer;
|
mixer = _mixer;
|
||||||
base = _base;
|
base = _base;
|
||||||
@ -89,7 +89,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetInfo(const ReplayGainInfo *_info) {
|
void SetInfo(const ReplayGainInfo *_info) {
|
||||||
if (_info != NULL) {
|
if (_info != nullptr) {
|
||||||
info = *_info;
|
info = *_info;
|
||||||
info.Complete();
|
info.Complete();
|
||||||
} else
|
} else
|
||||||
@ -137,7 +137,7 @@ ReplayGainFilter::Update()
|
|||||||
} else
|
} else
|
||||||
volume = PCM_VOLUME_1;
|
volume = PCM_VOLUME_1;
|
||||||
|
|
||||||
if (mixer != NULL) {
|
if (mixer != nullptr) {
|
||||||
/* update the hardware mixer volume */
|
/* update the hardware mixer volume */
|
||||||
|
|
||||||
unsigned _volume = (volume * base) / PCM_VOLUME_1;
|
unsigned _volume = (volume * base) / PCM_VOLUME_1;
|
||||||
@ -198,7 +198,7 @@ ReplayGainFilter::FilterPCM(const void *src, size_t src_size,
|
|||||||
volume);
|
volume);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
error.Set(replay_gain_domain, "pcm_volume() has failed");
|
error.Set(replay_gain_domain, "pcm_volume() has failed");
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
|
@ -28,7 +28,7 @@ class Mixer;
|
|||||||
/**
|
/**
|
||||||
* Enables or disables the hardware mixer for applying replay gain.
|
* 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
|
* volume
|
||||||
* @param base the base volume level for scale=1.0, between 1 and 100
|
* @param base the base volume level for scale=1.0, between 1 and 100
|
||||||
* (including).
|
* (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.
|
* 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
|
* gain data is available for the current song
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
|
@ -48,8 +48,8 @@ static bool
|
|||||||
IsSupportedCharset(const char *charset)
|
IsSupportedCharset(const char *charset)
|
||||||
{
|
{
|
||||||
/* convert a space to check if the charset is valid */
|
/* convert a space to check if the charset is valid */
|
||||||
char *test = g_convert(" ", 1, charset, "UTF-8", NULL, NULL, NULL);
|
char *test = g_convert(" ", 1, charset, "UTF-8", nullptr, nullptr, nullptr);
|
||||||
if (test == NULL)
|
if (test == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
g_free(test);
|
g_free(test);
|
||||||
@ -59,7 +59,7 @@ IsSupportedCharset(const char *charset)
|
|||||||
void
|
void
|
||||||
SetFSCharset(const char *charset)
|
SetFSCharset(const char *charset)
|
||||||
{
|
{
|
||||||
assert(charset != NULL);
|
assert(charset != nullptr);
|
||||||
|
|
||||||
if (!IsSupportedCharset(charset))
|
if (!IsSupportedCharset(charset))
|
||||||
FormatFatalError("invalid filesystem charset: %s", charset);
|
FormatFatalError("invalid filesystem charset: %s", charset);
|
||||||
|
@ -38,15 +38,15 @@
|
|||||||
void
|
void
|
||||||
ConfigureFS()
|
ConfigureFS()
|
||||||
{
|
{
|
||||||
const char *charset = NULL;
|
const char *charset = nullptr;
|
||||||
|
|
||||||
charset = config_get_string(CONF_FS_CHARSET, NULL);
|
charset = config_get_string(CONF_FS_CHARSET, nullptr);
|
||||||
if (charset == NULL) {
|
if (charset == nullptr) {
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
const gchar **encodings;
|
const gchar **encodings;
|
||||||
g_get_filename_charsets(&encodings);
|
g_get_filename_charsets(&encodings);
|
||||||
|
|
||||||
if (encodings[0] != NULL && *encodings[0] != '\0')
|
if (encodings[0] != nullptr && *encodings[0] != '\0')
|
||||||
charset = encodings[0];
|
charset = encodings[0];
|
||||||
#else
|
#else
|
||||||
/* Glib claims that file system encoding is always utf-8
|
/* Glib claims that file system encoding is always utf-8
|
||||||
|
@ -48,7 +48,7 @@ input_archive_open(const char *pathname,
|
|||||||
InputStream *is;
|
InputStream *is;
|
||||||
|
|
||||||
if (!PathTraits::IsAbsoluteFS(pathname))
|
if (!PathTraits::IsAbsoluteFS(pathname))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
char *pname = g_strdup(pathname);
|
char *pname = g_strdup(pathname);
|
||||||
// archive_lookup will modify pname when true is returned
|
// archive_lookup will modify pname when true is returned
|
||||||
@ -57,7 +57,7 @@ input_archive_open(const char *pathname,
|
|||||||
FormatDebug(archive_domain,
|
FormatDebug(archive_domain,
|
||||||
"not an archive, lookup %s failed", pname);
|
"not an archive, lookup %s failed", pname);
|
||||||
g_free(pname);
|
g_free(pname);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check which archive plugin to use (by ext)
|
//check which archive plugin to use (by ext)
|
||||||
@ -66,13 +66,13 @@ input_archive_open(const char *pathname,
|
|||||||
FormatWarning(archive_domain,
|
FormatWarning(archive_domain,
|
||||||
"can't handle archive %s", archive);
|
"can't handle archive %s", archive);
|
||||||
g_free(pname);
|
g_free(pname);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto file = archive_file_open(arplug, archive, error);
|
auto file = archive_file_open(arplug, archive, error);
|
||||||
if (file == NULL) {
|
if (file == nullptr) {
|
||||||
g_free(pname);
|
g_free(pname);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//setup fileops
|
//setup fileops
|
||||||
|
@ -131,26 +131,26 @@ input_despotify_open(const char *url,
|
|||||||
struct ds_track *track;
|
struct ds_track *track;
|
||||||
|
|
||||||
if (!g_str_has_prefix(url, "spt://"))
|
if (!g_str_has_prefix(url, "spt://"))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
session = mpd_despotify_get_session();
|
session = mpd_despotify_get_session();
|
||||||
if (!session)
|
if (!session)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
ds_link = despotify_link_from_uri(url + 6);
|
ds_link = despotify_link_from_uri(url + 6);
|
||||||
if (!ds_link) {
|
if (!ds_link) {
|
||||||
FormatDebug(despotify_domain, "Can't find %s", url);
|
FormatDebug(despotify_domain, "Can't find %s", url);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (ds_link->type != LINK_TYPE_TRACK) {
|
if (ds_link->type != LINK_TYPE_TRACK) {
|
||||||
despotify_free_link(ds_link);
|
despotify_free_link(ds_link);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
track = despotify_link_get_track(session, ds_link);
|
track = despotify_link_get_track(session, ds_link);
|
||||||
despotify_free_link(ds_link);
|
despotify_free_link(ds_link);
|
||||||
if (!track)
|
if (!track)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
DespotifyInputStream *ctx =
|
DespotifyInputStream *ctx =
|
||||||
new DespotifyInputStream(url, mutex, cond,
|
new DespotifyInputStream(url, mutex, cond,
|
||||||
@ -158,13 +158,13 @@ input_despotify_open(const char *url,
|
|||||||
|
|
||||||
if (!mpd_despotify_register_callback(callback, ctx)) {
|
if (!mpd_despotify_register_callback(callback, ctx)) {
|
||||||
delete ctx;
|
delete ctx;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (despotify_play(ctx->session, ctx->track, false) == false) {
|
if (despotify_play(ctx->session, ctx->track, false) == false) {
|
||||||
mpd_despotify_unregister_callback(callback);
|
mpd_despotify_unregister_callback(callback);
|
||||||
delete ctx;
|
delete ctx;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return &ctx->base;
|
return &ctx->base;
|
||||||
@ -213,7 +213,7 @@ input_despotify_tag(InputStream *is)
|
|||||||
DespotifyInputStream *ctx = (DespotifyInputStream *)is;
|
DespotifyInputStream *ctx = (DespotifyInputStream *)is;
|
||||||
Tag *tag = ctx->tag;
|
Tag *tag = ctx->tag;
|
||||||
|
|
||||||
ctx->tag = NULL;
|
ctx->tag = nullptr;
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ const InputPlugin rewind_input_plugin = {
|
|||||||
InputStream *
|
InputStream *
|
||||||
input_rewind_open(InputStream *is)
|
input_rewind_open(InputStream *is)
|
||||||
{
|
{
|
||||||
assert(is != NULL);
|
assert(is != nullptr);
|
||||||
assert(is->offset == 0);
|
assert(is->offset == 0);
|
||||||
|
|
||||||
if (is->seekable)
|
if (is->seekable)
|
||||||
|
@ -195,7 +195,7 @@ static snd_mixer_elem_t *
|
|||||||
alsa_mixer_lookup_elem(snd_mixer_t *handle, const char *name, unsigned idx)
|
alsa_mixer_lookup_elem(snd_mixer_t *handle, const char *name, unsigned idx)
|
||||||
{
|
{
|
||||||
for (snd_mixer_elem_t *elem = snd_mixer_first_elem(handle);
|
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 &&
|
if (snd_mixer_elem_get_type(elem) == SND_MIXER_ELEM_SIMPLE &&
|
||||||
StringEqualsCaseASCII(snd_mixer_selem_get_name(elem),
|
StringEqualsCaseASCII(snd_mixer_selem_get_name(elem),
|
||||||
name) &&
|
name) &&
|
||||||
@ -203,7 +203,7 @@ alsa_mixer_lookup_elem(snd_mixer_t *handle, const char *name, unsigned idx)
|
|||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
@ -218,8 +218,8 @@ AlsaMixer::Setup(Error &error)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = snd_mixer_selem_register(handle, NULL,
|
if ((err = snd_mixer_selem_register(handle, nullptr,
|
||||||
NULL)) < 0) {
|
nullptr)) < 0) {
|
||||||
error.Format(alsa_mixer_domain, err,
|
error.Format(alsa_mixer_domain, err,
|
||||||
"snd_mixer_selem_register() failed: %s",
|
"snd_mixer_selem_register() failed: %s",
|
||||||
snd_strerror(err));
|
snd_strerror(err));
|
||||||
@ -234,7 +234,7 @@ AlsaMixer::Setup(Error &error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
elem = alsa_mixer_lookup_elem(handle, control, index);
|
elem = alsa_mixer_lookup_elem(handle, control, index);
|
||||||
if (elem == NULL) {
|
if (elem == nullptr) {
|
||||||
error.Format(alsa_mixer_domain, 0,
|
error.Format(alsa_mixer_domain, 0,
|
||||||
"no such mixer control: %s", control);
|
"no such mixer control: %s", control);
|
||||||
return false;
|
return false;
|
||||||
@ -283,11 +283,11 @@ alsa_mixer_open(Mixer *data, Error &error)
|
|||||||
inline void
|
inline void
|
||||||
AlsaMixer::Close()
|
AlsaMixer::Close()
|
||||||
{
|
{
|
||||||
assert(handle != NULL);
|
assert(handle != nullptr);
|
||||||
|
|
||||||
delete monitor;
|
delete monitor;
|
||||||
|
|
||||||
snd_mixer_elem_set_callback(elem, NULL);
|
snd_mixer_elem_set_callback(elem, nullptr);
|
||||||
snd_mixer_close(handle);
|
snd_mixer_close(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ AlsaMixer::GetVolume(Error &error)
|
|||||||
int ret;
|
int ret;
|
||||||
long level;
|
long level;
|
||||||
|
|
||||||
assert(handle != NULL);
|
assert(handle != nullptr);
|
||||||
|
|
||||||
err = snd_mixer_handle_events(handle);
|
err = snd_mixer_handle_events(handle);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
@ -351,7 +351,7 @@ AlsaMixer::SetVolume(unsigned volume, Error &error)
|
|||||||
long level;
|
long level;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
assert(handle != NULL);
|
assert(handle != nullptr);
|
||||||
|
|
||||||
vol = volume;
|
vol = volume;
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ pulse_mixer_volume_cb(gcc_unused pa_context *context, const pa_sink_input_info *
|
|||||||
if (eol)
|
if (eol)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (i == NULL) {
|
if (i == nullptr) {
|
||||||
pulse_mixer_offline(pm);
|
pulse_mixer_offline(pm);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -92,14 +92,14 @@ pulse_mixer_update(PulseMixer *pm,
|
|||||||
{
|
{
|
||||||
pa_operation *o;
|
pa_operation *o;
|
||||||
|
|
||||||
assert(context != NULL);
|
assert(context != nullptr);
|
||||||
assert(stream != NULL);
|
assert(stream != nullptr);
|
||||||
assert(pa_stream_get_state(stream) == PA_STREAM_READY);
|
assert(pa_stream_get_state(stream) == PA_STREAM_READY);
|
||||||
|
|
||||||
o = pa_context_get_sink_input_info(context,
|
o = pa_context_get_sink_input_info(context,
|
||||||
pa_stream_get_index(stream),
|
pa_stream_get_index(stream),
|
||||||
pulse_mixer_volume_cb, pm);
|
pulse_mixer_volume_cb, pm);
|
||||||
if (o == NULL) {
|
if (o == nullptr) {
|
||||||
FormatError(pulse_mixer_domain,
|
FormatError(pulse_mixer_domain,
|
||||||
"pa_context_get_sink_input_info() failed: %s",
|
"pa_context_get_sink_input_info() failed: %s",
|
||||||
pa_strerror(pa_context_errno(context)));
|
pa_strerror(pa_context_errno(context)));
|
||||||
@ -116,12 +116,12 @@ pulse_mixer_on_connect(gcc_unused PulseMixer *pm,
|
|||||||
{
|
{
|
||||||
pa_operation *o;
|
pa_operation *o;
|
||||||
|
|
||||||
assert(context != NULL);
|
assert(context != nullptr);
|
||||||
|
|
||||||
o = pa_context_subscribe(context,
|
o = pa_context_subscribe(context,
|
||||||
(pa_subscription_mask_t)PA_SUBSCRIPTION_MASK_SINK_INPUT,
|
(pa_subscription_mask_t)PA_SUBSCRIPTION_MASK_SINK_INPUT,
|
||||||
NULL, NULL);
|
nullptr, nullptr);
|
||||||
if (o == NULL) {
|
if (o == nullptr) {
|
||||||
FormatError(pulse_mixer_domain,
|
FormatError(pulse_mixer_domain,
|
||||||
"pa_context_subscribe() failed: %s",
|
"pa_context_subscribe() failed: %s",
|
||||||
pa_strerror(pa_context_errno(context)));
|
pa_strerror(pa_context_errno(context)));
|
||||||
@ -150,7 +150,7 @@ pulse_mixer_init(void *ao, gcc_unused const config_param ¶m,
|
|||||||
{
|
{
|
||||||
PulseOutput *po = (PulseOutput *)ao;
|
PulseOutput *po = (PulseOutput *)ao;
|
||||||
|
|
||||||
if (ao == NULL) {
|
if (ao == nullptr) {
|
||||||
error.Set(pulse_mixer_domain,
|
error.Set(pulse_mixer_domain,
|
||||||
"The pulse mixer cannot work without the audio output");
|
"The pulse mixer cannot work without the audio output");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -169,7 +169,7 @@ alsa_init(const config_param ¶m, Error &error)
|
|||||||
|
|
||||||
if (!ad->Init(param, error)) {
|
if (!ad->Init(param, error)) {
|
||||||
delete ad;
|
delete ad;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
alsa_configure(ad, param);
|
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 sample_rate = audio_format.sample_rate;
|
||||||
unsigned int channels = audio_format.channels;
|
unsigned int channels = audio_format.channels;
|
||||||
int err;
|
int err;
|
||||||
const char *cmd = NULL;
|
const char *cmd = nullptr;
|
||||||
int retry = MPD_ALSA_RETRY_NR;
|
int retry = MPD_ALSA_RETRY_NR;
|
||||||
unsigned int period_time, period_time_ro;
|
unsigned int period_time, period_time_ro;
|
||||||
unsigned int buffer_time;
|
unsigned int buffer_time;
|
||||||
@ -460,7 +460,7 @@ configure_hw:
|
|||||||
audio_format.channels = (int8_t)channels;
|
audio_format.channels = (int8_t)channels;
|
||||||
|
|
||||||
err = snd_pcm_hw_params_set_rate_near(ad->pcm, hwparams,
|
err = snd_pcm_hw_params_set_rate_near(ad->pcm, hwparams,
|
||||||
&sample_rate, NULL);
|
&sample_rate, nullptr);
|
||||||
if (err < 0 || sample_rate == 0) {
|
if (err < 0 || sample_rate == 0) {
|
||||||
error.Format(alsa_output_domain, err,
|
error.Format(alsa_output_domain, err,
|
||||||
"ALSA device \"%s\" does not support %u Hz audio",
|
"ALSA device \"%s\" does not support %u Hz audio",
|
||||||
@ -493,12 +493,12 @@ configure_hw:
|
|||||||
buffer_time = ad->buffer_time;
|
buffer_time = ad->buffer_time;
|
||||||
cmd = "snd_pcm_hw_params_set_buffer_time_near";
|
cmd = "snd_pcm_hw_params_set_buffer_time_near";
|
||||||
err = snd_pcm_hw_params_set_buffer_time_near(ad->pcm, hwparams,
|
err = snd_pcm_hw_params_set_buffer_time_near(ad->pcm, hwparams,
|
||||||
&buffer_time, NULL);
|
&buffer_time, nullptr);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
err = snd_pcm_hw_params_get_buffer_time(hwparams, &buffer_time,
|
err = snd_pcm_hw_params_get_buffer_time(hwparams, &buffer_time,
|
||||||
NULL);
|
nullptr);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
buffer_time = 0;
|
buffer_time = 0;
|
||||||
}
|
}
|
||||||
@ -515,7 +515,7 @@ configure_hw:
|
|||||||
period_time = period_time_ro;
|
period_time = period_time_ro;
|
||||||
cmd = "snd_pcm_hw_params_set_period_time_near";
|
cmd = "snd_pcm_hw_params_set_period_time_near";
|
||||||
err = snd_pcm_hw_params_set_period_time_near(ad->pcm, hwparams,
|
err = snd_pcm_hw_params_set_period_time_near(ad->pcm, hwparams,
|
||||||
&period_time, NULL);
|
&period_time, nullptr);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -540,7 +540,7 @@ configure_hw:
|
|||||||
snd_pcm_uframes_t alsa_period_size;
|
snd_pcm_uframes_t alsa_period_size;
|
||||||
cmd = "snd_pcm_hw_params_get_period_size";
|
cmd = "snd_pcm_hw_params_get_period_size";
|
||||||
err = snd_pcm_hw_params_get_period_size(hwparams, &alsa_period_size,
|
err = snd_pcm_hw_params_get_period_size(hwparams, &alsa_period_size,
|
||||||
NULL);
|
nullptr);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ HttpdOutput::Configure(const config_param ¶m, Error &error)
|
|||||||
const char *encoder_name =
|
const char *encoder_name =
|
||||||
param.GetBlockValue("encoder", "vorbis");
|
param.GetBlockValue("encoder", "vorbis");
|
||||||
const auto encoder_plugin = encoder_plugin_get(encoder_name);
|
const auto encoder_plugin = encoder_plugin_get(encoder_name);
|
||||||
if (encoder_plugin == NULL) {
|
if (encoder_plugin == nullptr) {
|
||||||
error.Format(httpd_output_domain,
|
error.Format(httpd_output_domain,
|
||||||
"No such encoder: %s", encoder_name);
|
"No such encoder: %s", encoder_name);
|
||||||
return false;
|
return false;
|
||||||
@ -109,7 +109,7 @@ HttpdOutput::Configure(const config_param ¶m, Error &error)
|
|||||||
/* set up bind_to_address */
|
/* set up bind_to_address */
|
||||||
|
|
||||||
const char *bind_to_address = param.GetBlockValue("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
|
strcmp(bind_to_address, "any") != 0
|
||||||
? AddHost(bind_to_address, port, error)
|
? AddHost(bind_to_address, port, error)
|
||||||
: AddPort(port, error);
|
: AddPort(port, error);
|
||||||
@ -263,7 +263,7 @@ HttpdOutput::ReadPage()
|
|||||||
} while (size < sizeof(buffer));
|
} while (size < sizeof(buffer));
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return Page::Copy(buffer, size);
|
return Page::Copy(buffer, size);
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ HttpdOutput::Close()
|
|||||||
|
|
||||||
clients.clear();
|
clients.clear();
|
||||||
|
|
||||||
if (header != NULL)
|
if (header != nullptr)
|
||||||
header->Unref();
|
header->Unref();
|
||||||
|
|
||||||
encoder_close(encoder);
|
encoder_close(encoder);
|
||||||
@ -378,7 +378,7 @@ HttpdOutput::RemoveClient(HttpdClient &client)
|
|||||||
void
|
void
|
||||||
HttpdOutput::SendHeader(HttpdClient &client) const
|
HttpdOutput::SendHeader(HttpdClient &client) const
|
||||||
{
|
{
|
||||||
if (header != NULL)
|
if (header != nullptr)
|
||||||
client.PushPage(header);
|
client.PushPage(header);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ httpd_output_delay(struct audio_output *ao)
|
|||||||
void
|
void
|
||||||
HttpdOutput::BroadcastPage(Page *page)
|
HttpdOutput::BroadcastPage(Page *page)
|
||||||
{
|
{
|
||||||
assert(page != NULL);
|
assert(page != nullptr);
|
||||||
|
|
||||||
const ScopeLock protect(mutex);
|
const ScopeLock protect(mutex);
|
||||||
for (auto &client : clients)
|
for (auto &client : clients)
|
||||||
@ -482,7 +482,7 @@ httpd_output_pause(struct audio_output *ao)
|
|||||||
inline void
|
inline void
|
||||||
HttpdOutput::SendTag(const Tag *tag)
|
HttpdOutput::SendTag(const Tag *tag)
|
||||||
{
|
{
|
||||||
assert(tag != NULL);
|
assert(tag != nullptr);
|
||||||
|
|
||||||
if (encoder->plugin.tag != nullptr) {
|
if (encoder->plugin.tag != nullptr) {
|
||||||
/* embed encoder tags */
|
/* embed encoder tags */
|
||||||
@ -502,8 +502,8 @@ HttpdOutput::SendTag(const Tag *tag)
|
|||||||
new clients */
|
new clients */
|
||||||
|
|
||||||
Page *page = ReadPage();
|
Page *page = ReadPage();
|
||||||
if (page != NULL) {
|
if (page != nullptr) {
|
||||||
if (header != NULL)
|
if (header != nullptr)
|
||||||
header->Unref();
|
header->Unref();
|
||||||
header = page;
|
header = page;
|
||||||
BroadcastPage(page);
|
BroadcastPage(page);
|
||||||
@ -511,7 +511,7 @@ HttpdOutput::SendTag(const Tag *tag)
|
|||||||
} else {
|
} else {
|
||||||
/* use Icy-Metadata */
|
/* use Icy-Metadata */
|
||||||
|
|
||||||
if (metadata != NULL)
|
if (metadata != nullptr)
|
||||||
metadata->Unref();
|
metadata->Unref();
|
||||||
|
|
||||||
static constexpr TagType types[] = {
|
static constexpr TagType types[] = {
|
||||||
@ -520,7 +520,7 @@ HttpdOutput::SendTag(const Tag *tag)
|
|||||||
};
|
};
|
||||||
|
|
||||||
metadata = icy_server_metadata_page(*tag, &types[0]);
|
metadata = icy_server_metadata_page(*tag, &types[0]);
|
||||||
if (metadata != NULL) {
|
if (metadata != nullptr) {
|
||||||
const ScopeLock protect(mutex);
|
const ScopeLock protect(mutex);
|
||||||
for (auto &client : clients)
|
for (auto &client : clients)
|
||||||
client.PushMetaData(metadata);
|
client.PushMetaData(metadata);
|
||||||
|
@ -25,8 +25,8 @@ void *
|
|||||||
PcmBuffer::Get(size_t new_size)
|
PcmBuffer::Get(size_t new_size)
|
||||||
{
|
{
|
||||||
if (new_size == 0)
|
if (new_size == 0)
|
||||||
/* never return NULL, because NULL would be assumed to
|
/* never return nullptr, because nullptr would be
|
||||||
be an error condition */
|
assumed to be an error condition */
|
||||||
new_size = 1;
|
new_size = 1;
|
||||||
|
|
||||||
return buffer.Get(new_size);
|
return buffer.Get(new_size);
|
||||||
|
@ -42,9 +42,10 @@ public:
|
|||||||
* Get the buffer, and guarantee a minimum size. This buffer becomes
|
* Get the buffer, and guarantee a minimum size. This buffer becomes
|
||||||
* invalid with the next pcm_buffer_get() call.
|
* invalid with the next pcm_buffer_get() call.
|
||||||
*
|
*
|
||||||
* This function will never return NULL, even if size is zero, because
|
* This function will never return nullptr, even if size is
|
||||||
* the PCM library uses the NULL return value to signal "error". An
|
* zero, because the PCM library uses the nullptr return value
|
||||||
* empty destination buffer is not always an error.
|
* to signal "error". An empty destination buffer is not
|
||||||
|
* always an error.
|
||||||
*/
|
*/
|
||||||
gcc_malloc
|
gcc_malloc
|
||||||
void *Get(size_t size);
|
void *Get(size_t size);
|
||||||
|
@ -95,7 +95,7 @@ pcm_convert_channels_16(PcmBuffer &buffer,
|
|||||||
pcm_convert_channels_16_n_to_2(dest, src_channels, src,
|
pcm_convert_channels_16_n_to_2(dest, src_channels, src,
|
||||||
src_end);
|
src_end);
|
||||||
else
|
else
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ pcm_convert_channels_24(PcmBuffer &buffer,
|
|||||||
pcm_convert_channels_24_n_to_2(dest, src_channels, src,
|
pcm_convert_channels_24_n_to_2(dest, src_channels, src,
|
||||||
src_end);
|
src_end);
|
||||||
else
|
else
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ pcm_convert_channels_32(PcmBuffer &buffer,
|
|||||||
pcm_convert_channels_32_n_to_2(dest, src_channels, src,
|
pcm_convert_channels_32_n_to_2(dest, src_channels, src,
|
||||||
src_end);
|
src_end);
|
||||||
else
|
else
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ pcm_convert_channels_float(PcmBuffer &buffer,
|
|||||||
pcm_convert_channels_float_n_to_2(dest, src_channels, src,
|
pcm_convert_channels_float_n_to_2(dest, src_channels, src,
|
||||||
src_end);
|
src_end);
|
||||||
else
|
else
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
@ -60,11 +60,11 @@ PcmConvert::Convert16(const AudioFormat src_format,
|
|||||||
src_format.format,
|
src_format.format,
|
||||||
src_buffer, src_size,
|
src_buffer, src_size,
|
||||||
&len);
|
&len);
|
||||||
if (buf == NULL) {
|
if (buf == nullptr) {
|
||||||
error.Format(pcm_convert_domain,
|
error.Format(pcm_convert_domain,
|
||||||
"Conversion from %s to 16 bit is not implemented",
|
"Conversion from %s to 16 bit is not implemented",
|
||||||
sample_format_to_string(src_format.format));
|
sample_format_to_string(src_format.format));
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src_format.channels != dest_format.channels) {
|
if (src_format.channels != dest_format.channels) {
|
||||||
@ -72,13 +72,13 @@ PcmConvert::Convert16(const AudioFormat src_format,
|
|||||||
dest_format.channels,
|
dest_format.channels,
|
||||||
src_format.channels,
|
src_format.channels,
|
||||||
buf, len, &len);
|
buf, len, &len);
|
||||||
if (buf == NULL) {
|
if (buf == nullptr) {
|
||||||
error.Format(pcm_convert_domain,
|
error.Format(pcm_convert_domain,
|
||||||
"Conversion from %u to %u channels "
|
"Conversion from %u to %u channels "
|
||||||
"is not implemented",
|
"is not implemented",
|
||||||
src_format.channels,
|
src_format.channels,
|
||||||
dest_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,
|
src_format.sample_rate, buf, len,
|
||||||
dest_format.sample_rate, &len,
|
dest_format.sample_rate, &len,
|
||||||
error);
|
error);
|
||||||
if (buf == NULL)
|
if (buf == nullptr)
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
*dest_size_r = len;
|
*dest_size_r = len;
|
||||||
@ -109,11 +109,11 @@ PcmConvert::Convert24(const AudioFormat src_format,
|
|||||||
buf = pcm_convert_to_24(format_buffer,
|
buf = pcm_convert_to_24(format_buffer,
|
||||||
src_format.format,
|
src_format.format,
|
||||||
src_buffer, src_size, &len);
|
src_buffer, src_size, &len);
|
||||||
if (buf == NULL) {
|
if (buf == nullptr) {
|
||||||
error.Format(pcm_convert_domain,
|
error.Format(pcm_convert_domain,
|
||||||
"Conversion from %s to 24 bit is not implemented",
|
"Conversion from %s to 24 bit is not implemented",
|
||||||
sample_format_to_string(src_format.format));
|
sample_format_to_string(src_format.format));
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src_format.channels != dest_format.channels) {
|
if (src_format.channels != dest_format.channels) {
|
||||||
@ -121,13 +121,13 @@ PcmConvert::Convert24(const AudioFormat src_format,
|
|||||||
dest_format.channels,
|
dest_format.channels,
|
||||||
src_format.channels,
|
src_format.channels,
|
||||||
buf, len, &len);
|
buf, len, &len);
|
||||||
if (buf == NULL) {
|
if (buf == nullptr) {
|
||||||
error.Format(pcm_convert_domain,
|
error.Format(pcm_convert_domain,
|
||||||
"Conversion from %u to %u channels "
|
"Conversion from %u to %u channels "
|
||||||
"is not implemented",
|
"is not implemented",
|
||||||
src_format.channels,
|
src_format.channels,
|
||||||
dest_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,
|
src_format.sample_rate, buf, len,
|
||||||
dest_format.sample_rate, &len,
|
dest_format.sample_rate, &len,
|
||||||
error);
|
error);
|
||||||
if (buf == NULL)
|
if (buf == nullptr)
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
*dest_size_r = len;
|
*dest_size_r = len;
|
||||||
@ -158,11 +158,11 @@ PcmConvert::Convert32(const AudioFormat src_format,
|
|||||||
buf = pcm_convert_to_32(format_buffer,
|
buf = pcm_convert_to_32(format_buffer,
|
||||||
src_format.format,
|
src_format.format,
|
||||||
src_buffer, src_size, &len);
|
src_buffer, src_size, &len);
|
||||||
if (buf == NULL) {
|
if (buf == nullptr) {
|
||||||
error.Format(pcm_convert_domain,
|
error.Format(pcm_convert_domain,
|
||||||
"Conversion from %s to 32 bit is not implemented",
|
"Conversion from %s to 32 bit is not implemented",
|
||||||
sample_format_to_string(src_format.format));
|
sample_format_to_string(src_format.format));
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src_format.channels != dest_format.channels) {
|
if (src_format.channels != dest_format.channels) {
|
||||||
@ -170,13 +170,13 @@ PcmConvert::Convert32(const AudioFormat src_format,
|
|||||||
dest_format.channels,
|
dest_format.channels,
|
||||||
src_format.channels,
|
src_format.channels,
|
||||||
buf, len, &len);
|
buf, len, &len);
|
||||||
if (buf == NULL) {
|
if (buf == nullptr) {
|
||||||
error.Format(pcm_convert_domain,
|
error.Format(pcm_convert_domain,
|
||||||
"Conversion from %u to %u channels "
|
"Conversion from %u to %u channels "
|
||||||
"is not implemented",
|
"is not implemented",
|
||||||
src_format.channels,
|
src_format.channels,
|
||||||
dest_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,
|
src_format.sample_rate, buf, len,
|
||||||
dest_format.sample_rate, &len,
|
dest_format.sample_rate, &len,
|
||||||
error);
|
error);
|
||||||
if (buf == NULL)
|
if (buf == nullptr)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,11 +209,11 @@ PcmConvert::ConvertFloat(const AudioFormat src_format,
|
|||||||
buffer = pcm_convert_to_float(format_buffer,
|
buffer = pcm_convert_to_float(format_buffer,
|
||||||
src_format.format,
|
src_format.format,
|
||||||
buffer, size, &size);
|
buffer, size, &size);
|
||||||
if (buffer == NULL) {
|
if (buffer == nullptr) {
|
||||||
error.Format(pcm_convert_domain,
|
error.Format(pcm_convert_domain,
|
||||||
"Conversion from %s to float is not implemented",
|
"Conversion from %s to float is not implemented",
|
||||||
sample_format_to_string(src_format.format));
|
sample_format_to_string(src_format.format));
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* convert channels */
|
/* convert channels */
|
||||||
@ -223,13 +223,13 @@ PcmConvert::ConvertFloat(const AudioFormat src_format,
|
|||||||
dest_format.channels,
|
dest_format.channels,
|
||||||
src_format.channels,
|
src_format.channels,
|
||||||
buffer, size, &size);
|
buffer, size, &size);
|
||||||
if (buffer == NULL) {
|
if (buffer == nullptr) {
|
||||||
error.Format(pcm_convert_domain,
|
error.Format(pcm_convert_domain,
|
||||||
"Conversion from %u to %u channels "
|
"Conversion from %u to %u channels "
|
||||||
"is not implemented",
|
"is not implemented",
|
||||||
src_format.channels,
|
src_format.channels,
|
||||||
dest_format.channels);
|
dest_format.channels);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,8 +242,8 @@ PcmConvert::ConvertFloat(const AudioFormat src_format,
|
|||||||
buffer, size,
|
buffer, size,
|
||||||
dest_format.sample_rate,
|
dest_format.sample_rate,
|
||||||
&size, error);
|
&size, error);
|
||||||
if (buffer == NULL)
|
if (buffer == nullptr)
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
*dest_size_r = size;
|
*dest_size_r = size;
|
||||||
@ -263,10 +263,10 @@ PcmConvert::Convert(AudioFormat src_format,
|
|||||||
const float *f = dsd.ToFloat(src_format.channels,
|
const float *f = dsd.ToFloat(src_format.channels,
|
||||||
false, (const uint8_t *)src,
|
false, (const uint8_t *)src,
|
||||||
src_size, &f_size);
|
src_size, &f_size);
|
||||||
if (f == NULL) {
|
if (f == nullptr) {
|
||||||
error.Set(pcm_convert_domain,
|
error.Set(pcm_convert_domain,
|
||||||
"DSD to PCM conversion failed");
|
"DSD to PCM conversion failed");
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
float_format = src_format;
|
float_format = src_format;
|
||||||
@ -302,6 +302,6 @@ PcmConvert::Convert(AudioFormat src_format,
|
|||||||
error.Format(pcm_convert_domain,
|
error.Format(pcm_convert_domain,
|
||||||
"PCM conversion to %s is not implemented",
|
"PCM conversion to %s is not implemented",
|
||||||
sample_format_to_string(dest_format.format));
|
sample_format_to_string(dest_format.format));
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 *src8 = (const uint8_t *)data;
|
||||||
const uint8_t *src_end8 = src8 + size;
|
const uint8_t *src_end8 = src8 + size;
|
||||||
uint8_t *dest = (uint8_t *)pack_buffer.Get(dest_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,
|
pcm_pack_24(dest, (const int32_t *)src8,
|
||||||
(const int32_t *)src_end8);
|
(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);
|
assert(reverse_endian >= 2);
|
||||||
|
|
||||||
uint8_t *dest = (uint8_t *)reverse_buffer.Get(size);
|
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 = (const uint8_t *)data;
|
||||||
const uint8_t *src_end = src + size;
|
const uint8_t *src_end = src + size;
|
||||||
|
@ -214,7 +214,7 @@ pcm_convert_to_16(PcmBuffer &buffer, PcmDither &dither,
|
|||||||
dest_size_r);
|
dest_size_r);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -319,7 +319,7 @@ pcm_convert_to_24(PcmBuffer &buffer,
|
|||||||
dest_size_r);
|
dest_size_r);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -430,7 +430,7 @@ pcm_convert_to_32(PcmBuffer &buffer,
|
|||||||
dest_size_r);
|
dest_size_r);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<SampleFormat F, class Traits=SampleTraits<F>>
|
template<SampleFormat F, class Traits=SampleTraits<F>>
|
||||||
@ -540,5 +540,5 @@ pcm_convert_to_float(PcmBuffer &buffer,
|
|||||||
return (const float *)src;
|
return (const float *)src;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -75,11 +75,11 @@ static const gchar *
|
|||||||
get_attribute(const gchar **attribute_names, const gchar **attribute_values,
|
get_attribute(const gchar **attribute_names, const gchar **attribute_values,
|
||||||
const gchar *name)
|
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))
|
if (StringEqualsCaseASCII(attribute_names[i], name))
|
||||||
return attribute_values[i];
|
return attribute_values[i];
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -106,7 +106,7 @@ asx_start_element(gcc_unused GMarkupParseContext *context,
|
|||||||
const gchar *href = get_attribute(attribute_names,
|
const gchar *href = get_attribute(attribute_names,
|
||||||
attribute_values,
|
attribute_values,
|
||||||
"href");
|
"href");
|
||||||
if (href != NULL) {
|
if (href != nullptr) {
|
||||||
/* create new song object, and copy
|
/* create new song object, and copy
|
||||||
the existing tag over; we cannot
|
the existing tag over; we cannot
|
||||||
replace the existing song's URI,
|
replace the existing song's URI,
|
||||||
@ -114,9 +114,9 @@ asx_start_element(gcc_unused GMarkupParseContext *context,
|
|||||||
immutable */
|
immutable */
|
||||||
Song *song = Song::NewRemote(href);
|
Song *song = Song::NewRemote(href);
|
||||||
|
|
||||||
if (parser->song != NULL) {
|
if (parser->song != nullptr) {
|
||||||
song->tag = parser->song->tag;
|
song->tag = parser->song->tag;
|
||||||
parser->song->tag = NULL;
|
parser->song->tag = nullptr;
|
||||||
parser->song->Free();
|
parser->song->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ asx_text(gcc_unused GMarkupParseContext *context,
|
|||||||
|
|
||||||
case AsxParser::ENTRY:
|
case AsxParser::ENTRY:
|
||||||
if (parser->tag != TAG_NUM_OF_ITEM_TYPES) {
|
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 = new Tag();
|
||||||
parser->song->tag->AddItem(parser->tag,
|
parser->song->tag->AddItem(parser->tag,
|
||||||
text, text_len);
|
text, text_len);
|
||||||
@ -213,7 +213,7 @@ asx_open_stream(InputStream &is)
|
|||||||
size_t nbytes;
|
size_t nbytes;
|
||||||
bool success;
|
bool success;
|
||||||
Error error2;
|
Error error2;
|
||||||
GError *error = NULL;
|
GError *error = nullptr;
|
||||||
|
|
||||||
/* parse the ASX XML file */
|
/* parse the ASX XML file */
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ asx_open_stream(InputStream &is)
|
|||||||
if (error2.IsDefined()) {
|
if (error2.IsDefined()) {
|
||||||
g_markup_parse_context_free(context);
|
g_markup_parse_context_free(context);
|
||||||
LogError(error2);
|
LogError(error2);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -240,7 +240,7 @@ asx_open_stream(InputStream &is)
|
|||||||
"XML parser failed: %s", error->message);
|
"XML parser failed: %s", error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
g_markup_parse_context_free(context);
|
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);
|
"XML parser failed: %s", error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
g_markup_parse_context_free(context);
|
g_markup_parse_context_free(context);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.songs.reverse();
|
parser.songs.reverse();
|
||||||
@ -264,12 +264,12 @@ asx_open_stream(InputStream &is)
|
|||||||
|
|
||||||
static const char *const asx_suffixes[] = {
|
static const char *const asx_suffixes[] = {
|
||||||
"asx",
|
"asx",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const asx_mime_types[] = {
|
static const char *const asx_mime_types[] = {
|
||||||
"video/x-ms-asf",
|
"video/x-ms-asf",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct playlist_plugin asx_playlist_plugin = {
|
const struct playlist_plugin asx_playlist_plugin = {
|
||||||
|
@ -52,14 +52,14 @@ Song *
|
|||||||
CuePlaylist::NextSong()
|
CuePlaylist::NextSong()
|
||||||
{
|
{
|
||||||
Song *song = parser.Get();
|
Song *song = parser.Get();
|
||||||
if (song != NULL)
|
if (song != nullptr)
|
||||||
return song;
|
return song;
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
while (tis.ReadLine(line)) {
|
while (tis.ReadLine(line)) {
|
||||||
parser.Feed(line.c_str());
|
parser.Feed(line.c_str());
|
||||||
song = parser.Get();
|
song = parser.Get();
|
||||||
if (song != NULL)
|
if (song != nullptr)
|
||||||
return song;
|
return song;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,12 +69,12 @@ CuePlaylist::NextSong()
|
|||||||
|
|
||||||
static const char *const cue_playlist_suffixes[] = {
|
static const char *const cue_playlist_suffixes[] = {
|
||||||
"cue",
|
"cue",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const cue_playlist_mime_types[] = {
|
static const char *const cue_playlist_mime_types[] = {
|
||||||
"application/x-cue",
|
"application/x-cue",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct playlist_plugin cue_playlist_plugin = {
|
const struct playlist_plugin cue_playlist_plugin = {
|
||||||
|
@ -97,7 +97,7 @@ embcue_playlist_open_uri(const char *uri,
|
|||||||
{
|
{
|
||||||
if (!PathTraits::IsAbsoluteUTF8(uri))
|
if (!PathTraits::IsAbsoluteUTF8(uri))
|
||||||
/* only local files supported */
|
/* only local files supported */
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
const auto path_fs = AllocatedPath::FromUTF8(uri);
|
const auto path_fs = AllocatedPath::FromUTF8(uri);
|
||||||
if (path_fs.IsNull())
|
if (path_fs.IsNull())
|
||||||
@ -115,7 +115,7 @@ embcue_playlist_open_uri(const char *uri,
|
|||||||
if (playlist->cuesheet.empty()) {
|
if (playlist->cuesheet.empty()) {
|
||||||
/* no "CUESHEET" tag found */
|
/* no "CUESHEET" tag found */
|
||||||
delete playlist;
|
delete playlist;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
playlist->filename = PathTraits::GetBaseUTF8(uri);
|
playlist->filename = PathTraits::GetBaseUTF8(uri);
|
||||||
@ -130,13 +130,13 @@ Song *
|
|||||||
EmbeddedCuePlaylist::NextSong()
|
EmbeddedCuePlaylist::NextSong()
|
||||||
{
|
{
|
||||||
Song *song = parser->Get();
|
Song *song = parser->Get();
|
||||||
if (song != NULL)
|
if (song != nullptr)
|
||||||
return song;
|
return song;
|
||||||
|
|
||||||
while (*next != 0) {
|
while (*next != 0) {
|
||||||
const char *line = next;
|
const char *line = next;
|
||||||
char *eol = strpbrk(next, "\r\n");
|
char *eol = strpbrk(next, "\r\n");
|
||||||
if (eol != NULL) {
|
if (eol != nullptr) {
|
||||||
/* null-terminate the line */
|
/* null-terminate the line */
|
||||||
*eol = 0;
|
*eol = 0;
|
||||||
next = eol + 1;
|
next = eol + 1;
|
||||||
@ -147,13 +147,13 @@ EmbeddedCuePlaylist::NextSong()
|
|||||||
|
|
||||||
parser->Feed(line);
|
parser->Feed(line);
|
||||||
song = parser->Get();
|
song = parser->Get();
|
||||||
if (song != NULL)
|
if (song != nullptr)
|
||||||
return song->ReplaceURI(filename.c_str());
|
return song->ReplaceURI(filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
parser->Finish();
|
parser->Finish();
|
||||||
song = parser->Get();
|
song = parser->Get();
|
||||||
if (song != NULL)
|
if (song != nullptr)
|
||||||
song = song->ReplaceURI(filename.c_str());
|
song = song->ReplaceURI(filename.c_str());
|
||||||
return song;
|
return song;
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ static const char *const embcue_playlist_suffixes[] = {
|
|||||||
"ape",
|
"ape",
|
||||||
"wv",
|
"wv",
|
||||||
"ogg", "oga",
|
"ogg", "oga",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct playlist_plugin embcue_playlist_plugin = {
|
const struct playlist_plugin embcue_playlist_plugin = {
|
||||||
|
@ -50,7 +50,7 @@ M3uPlaylist::NextSong()
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
if (!tis.ReadLine(line))
|
if (!tis.ReadLine(line))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
line_s = line.c_str();
|
line_s = line.c_str();
|
||||||
line_s = strchug_fast(line_s);
|
line_s = strchug_fast(line_s);
|
||||||
@ -61,12 +61,12 @@ M3uPlaylist::NextSong()
|
|||||||
|
|
||||||
static const char *const m3u_suffixes[] = {
|
static const char *const m3u_suffixes[] = {
|
||||||
"m3u",
|
"m3u",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const m3u_mime_types[] = {
|
static const char *const m3u_mime_types[] = {
|
||||||
"audio/x-mpegurl",
|
"audio/x-mpegurl",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct playlist_plugin m3u_playlist_plugin = {
|
const struct playlist_plugin m3u_playlist_plugin = {
|
||||||
|
@ -39,21 +39,21 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
|
|||||||
{
|
{
|
||||||
gchar *value;
|
gchar *value;
|
||||||
int length;
|
int length;
|
||||||
GError *error = NULL;
|
GError *error = nullptr;
|
||||||
int num_entries = g_key_file_get_integer(keyfile, "playlist",
|
int num_entries = g_key_file_get_integer(keyfile, "playlist",
|
||||||
"NumberOfEntries", &error);
|
"NumberOfEntries", &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
FormatError(pls_domain,
|
FormatError(pls_domain,
|
||||||
"Invalid PLS file: '%s'", error->message);
|
"Invalid PLS file: '%s'", error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
error = NULL;
|
error = nullptr;
|
||||||
|
|
||||||
/* Hack to work around shoutcast failure to comform to spec */
|
/* Hack to work around shoutcast failure to comform to spec */
|
||||||
num_entries = g_key_file_get_integer(keyfile, "playlist",
|
num_entries = g_key_file_get_integer(keyfile, "playlist",
|
||||||
"numberofentries", &error);
|
"numberofentries", &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
g_error_free(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);
|
sprintf(key, "Title%u", num_entries);
|
||||||
value = g_key_file_get_string(keyfile, "playlist", key,
|
value = g_key_file_get_string(keyfile, "playlist", key,
|
||||||
&error);
|
&error);
|
||||||
if(error == NULL && value){
|
if(error == nullptr && value){
|
||||||
if (song->tag == NULL)
|
if (song->tag == nullptr)
|
||||||
song->tag = new Tag();
|
song->tag = new Tag();
|
||||||
song->tag->AddItem(TAG_TITLE, value);
|
song->tag->AddItem(TAG_TITLE, value);
|
||||||
}
|
}
|
||||||
/* Ignore errors? Most likely value not present */
|
/* Ignore errors? Most likely value not present */
|
||||||
if(error) g_error_free(error);
|
if(error) g_error_free(error);
|
||||||
error = NULL;
|
error = nullptr;
|
||||||
g_free(value);
|
g_free(value);
|
||||||
|
|
||||||
sprintf(key, "Length%u", num_entries);
|
sprintf(key, "Length%u", num_entries);
|
||||||
length = g_key_file_get_integer(keyfile, "playlist", key,
|
length = g_key_file_get_integer(keyfile, "playlist", key,
|
||||||
&error);
|
&error);
|
||||||
if(error == NULL && length > 0){
|
if(error == nullptr && length > 0){
|
||||||
if (song->tag == NULL)
|
if (song->tag == nullptr)
|
||||||
song->tag = new Tag();
|
song->tag = new Tag();
|
||||||
song->tag->time = length;
|
song->tag->time = length;
|
||||||
}
|
}
|
||||||
/* Ignore errors? Most likely value not present */
|
/* Ignore errors? Most likely value not present */
|
||||||
if(error) g_error_free(error);
|
if(error) g_error_free(error);
|
||||||
error = NULL;
|
error = nullptr;
|
||||||
|
|
||||||
songs.emplace_front(song);
|
songs.emplace_front(song);
|
||||||
num_entries--;
|
num_entries--;
|
||||||
@ -109,7 +109,7 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
|
|||||||
static SongEnumerator *
|
static SongEnumerator *
|
||||||
pls_open_stream(InputStream &is)
|
pls_open_stream(InputStream &is)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = nullptr;
|
||||||
Error error2;
|
Error error2;
|
||||||
size_t nbytes;
|
size_t nbytes;
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
@ -123,7 +123,7 @@ pls_open_stream(InputStream &is)
|
|||||||
if (nbytes == 0) {
|
if (nbytes == 0) {
|
||||||
if (error2.IsDefined()) {
|
if (error2.IsDefined()) {
|
||||||
LogError(error2);
|
LogError(error2);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -135,7 +135,7 @@ pls_open_stream(InputStream &is)
|
|||||||
|
|
||||||
if (kf_data.empty()) {
|
if (kf_data.empty()) {
|
||||||
LogWarning(pls_domain, "KeyFile parser failed: No Data");
|
LogWarning(pls_domain, "KeyFile parser failed: No Data");
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyfile = g_key_file_new();
|
keyfile = g_key_file_new();
|
||||||
@ -148,7 +148,7 @@ pls_open_stream(InputStream &is)
|
|||||||
"KeyFile parser failed: %s", error->message);
|
"KeyFile parser failed: %s", error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
g_key_file_free(keyfile);
|
g_key_file_free(keyfile);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::forward_list<SongPointer> songs;
|
std::forward_list<SongPointer> songs;
|
||||||
@ -161,12 +161,12 @@ pls_open_stream(InputStream &is)
|
|||||||
|
|
||||||
static const char *const pls_suffixes[] = {
|
static const char *const pls_suffixes[] = {
|
||||||
"pls",
|
"pls",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const pls_mime_types[] = {
|
static const char *const pls_mime_types[] = {
|
||||||
"audio/x-scpls",
|
"audio/x-scpls",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct playlist_plugin pls_playlist_plugin = {
|
const struct playlist_plugin pls_playlist_plugin = {
|
||||||
|
@ -74,11 +74,11 @@ static const gchar *
|
|||||||
get_attribute(const gchar **attribute_names, const gchar **attribute_values,
|
get_attribute(const gchar **attribute_names, const gchar **attribute_values,
|
||||||
const gchar *name)
|
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))
|
if (StringEqualsCaseASCII(attribute_names[i], name))
|
||||||
return attribute_values[i];
|
return attribute_values[i];
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -105,7 +105,7 @@ rss_start_element(gcc_unused GMarkupParseContext *context,
|
|||||||
const gchar *href = get_attribute(attribute_names,
|
const gchar *href = get_attribute(attribute_names,
|
||||||
attribute_values,
|
attribute_values,
|
||||||
"url");
|
"url");
|
||||||
if (href != NULL) {
|
if (href != nullptr) {
|
||||||
/* create new song object, and copy
|
/* create new song object, and copy
|
||||||
the existing tag over; we cannot
|
the existing tag over; we cannot
|
||||||
replace the existing song's URI,
|
replace the existing song's URI,
|
||||||
@ -113,9 +113,9 @@ rss_start_element(gcc_unused GMarkupParseContext *context,
|
|||||||
immutable */
|
immutable */
|
||||||
Song *song = Song::NewRemote(href);
|
Song *song = Song::NewRemote(href);
|
||||||
|
|
||||||
if (parser->song != NULL) {
|
if (parser->song != nullptr) {
|
||||||
song->tag = parser->song->tag;
|
song->tag = parser->song->tag;
|
||||||
parser->song->tag = NULL;
|
parser->song->tag = nullptr;
|
||||||
parser->song->Free();
|
parser->song->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ rss_text(gcc_unused GMarkupParseContext *context,
|
|||||||
|
|
||||||
case RssParser::ITEM:
|
case RssParser::ITEM:
|
||||||
if (parser->tag != TAG_NUM_OF_ITEM_TYPES) {
|
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 = new Tag();
|
||||||
parser->song->tag->AddItem(parser->tag,
|
parser->song->tag->AddItem(parser->tag,
|
||||||
text, text_len);
|
text, text_len);
|
||||||
@ -210,7 +210,7 @@ rss_open_stream(InputStream &is)
|
|||||||
size_t nbytes;
|
size_t nbytes;
|
||||||
bool success;
|
bool success;
|
||||||
Error error2;
|
Error error2;
|
||||||
GError *error = NULL;
|
GError *error = nullptr;
|
||||||
|
|
||||||
/* parse the RSS XML file */
|
/* parse the RSS XML file */
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ rss_open_stream(InputStream &is)
|
|||||||
if (error2.IsDefined()) {
|
if (error2.IsDefined()) {
|
||||||
g_markup_parse_context_free(context);
|
g_markup_parse_context_free(context);
|
||||||
LogError(error2);
|
LogError(error2);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -237,7 +237,7 @@ rss_open_stream(InputStream &is)
|
|||||||
"XML parser failed: %s", error->message);
|
"XML parser failed: %s", error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
g_markup_parse_context_free(context);
|
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);
|
"XML parser failed: %s", error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
g_markup_parse_context_free(context);
|
g_markup_parse_context_free(context);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.songs.reverse();
|
parser.songs.reverse();
|
||||||
@ -261,13 +261,13 @@ rss_open_stream(InputStream &is)
|
|||||||
|
|
||||||
static const char *const rss_suffixes[] = {
|
static const char *const rss_suffixes[] = {
|
||||||
"rss",
|
"rss",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const rss_mime_types[] = {
|
static const char *const rss_mime_types[] = {
|
||||||
"application/rss+xml",
|
"application/rss+xml",
|
||||||
"text/xml",
|
"text/xml",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct playlist_plugin rss_playlist_plugin = {
|
const struct playlist_plugin rss_playlist_plugin = {
|
||||||
|
@ -68,10 +68,10 @@ soundcloud_resolve(const char* uri) {
|
|||||||
if (g_str_has_prefix(uri, "http://")) {
|
if (g_str_has_prefix(uri, "http://")) {
|
||||||
u = g_strdup(uri);
|
u = g_strdup(uri);
|
||||||
} else if (g_str_has_prefix(uri, "soundcloud.com")) {
|
} else if (g_str_has_prefix(uri, "soundcloud.com")) {
|
||||||
u = g_strconcat("http://", uri, NULL);
|
u = g_strconcat("http://", uri, nullptr);
|
||||||
} else {
|
} else {
|
||||||
/* assume it's just a path on soundcloud.com */
|
/* 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=",
|
ru = g_strconcat("http://api.soundcloud.com/resolve.json?url=",
|
||||||
@ -95,7 +95,7 @@ const char* key_str[] = {
|
|||||||
"duration",
|
"duration",
|
||||||
"title",
|
"title",
|
||||||
"stream_url",
|
"stream_url",
|
||||||
NULL,
|
nullptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct parse_data {
|
struct parse_data {
|
||||||
@ -141,12 +141,12 @@ static int handle_string(void *ctx, const unsigned char* stringval,
|
|||||||
|
|
||||||
switch (data->key) {
|
switch (data->key) {
|
||||||
case Title:
|
case Title:
|
||||||
if (data->title != NULL)
|
if (data->title != nullptr)
|
||||||
g_free(data->title);
|
g_free(data->title);
|
||||||
data->title = g_strndup(s, stringlen);
|
data->title = g_strndup(s, stringlen);
|
||||||
break;
|
break;
|
||||||
case Stream_URL:
|
case Stream_URL:
|
||||||
if (data->stream_url != NULL)
|
if (data->stream_url != nullptr)
|
||||||
g_free(data->stream_url);
|
g_free(data->stream_url);
|
||||||
data->stream_url = g_strndup(s, stringlen);
|
data->stream_url = g_strndup(s, stringlen);
|
||||||
data->got_url = 1;
|
data->got_url = 1;
|
||||||
@ -216,7 +216,7 @@ static int handle_end_map(void *ctx)
|
|||||||
|
|
||||||
Tag *t = new Tag();
|
Tag *t = new Tag();
|
||||||
t->time = data->duration / 1000;
|
t->time = data->duration / 1000;
|
||||||
if (data->title != NULL)
|
if (data->title != nullptr)
|
||||||
t->AddItem(TAG_NAME, data->title);
|
t->AddItem(TAG_NAME, data->title);
|
||||||
s->tag = t;
|
s->tag = t;
|
||||||
|
|
||||||
@ -226,17 +226,17 @@ static int handle_end_map(void *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static yajl_callbacks parse_callbacks = {
|
static yajl_callbacks parse_callbacks = {
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
handle_integer,
|
handle_integer,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
handle_string,
|
handle_string,
|
||||||
handle_start_map,
|
handle_start_map,
|
||||||
handle_mapkey,
|
handle_mapkey,
|
||||||
handle_end_map,
|
handle_end_map,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -255,7 +255,7 @@ soundcloud_parse_json(const char *url, yajl_handle hand,
|
|||||||
Error error;
|
Error error;
|
||||||
InputStream *input_stream = InputStream::Open(url, mutex, cond,
|
InputStream *input_stream = InputStream::Open(url, mutex, cond,
|
||||||
error);
|
error);
|
||||||
if (input_stream == NULL) {
|
if (input_stream == nullptr) {
|
||||||
if (error.IsDefined())
|
if (error.IsDefined())
|
||||||
LogError(error);
|
LogError(error);
|
||||||
return -1;
|
return -1;
|
||||||
@ -348,10 +348,10 @@ soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond)
|
|||||||
"incompatible scheme for soundcloud plugin: %s",
|
"incompatible scheme for soundcloud plugin: %s",
|
||||||
scheme);
|
scheme);
|
||||||
g_free(s);
|
g_free(s);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *u = NULL;
|
char *u = nullptr;
|
||||||
if (strcmp(arg, "track") == 0) {
|
if (strcmp(arg, "track") == 0) {
|
||||||
u = g_strconcat("http://api.soundcloud.com/tracks/",
|
u = g_strconcat("http://api.soundcloud.com/tracks/",
|
||||||
rest, ".json?client_id=",
|
rest, ".json?client_id=",
|
||||||
@ -367,34 +367,34 @@ soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond)
|
|||||||
}
|
}
|
||||||
g_free(s);
|
g_free(s);
|
||||||
|
|
||||||
if (u == NULL) {
|
if (u == nullptr) {
|
||||||
LogWarning(soundcloud_domain, "unknown soundcloud URI");
|
LogWarning(soundcloud_domain, "unknown soundcloud URI");
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
yajl_handle hand;
|
yajl_handle hand;
|
||||||
struct parse_data data;
|
struct parse_data data;
|
||||||
|
|
||||||
data.got_url = 0;
|
data.got_url = 0;
|
||||||
data.title = NULL;
|
data.title = nullptr;
|
||||||
data.stream_url = NULL;
|
data.stream_url = nullptr;
|
||||||
#ifdef HAVE_YAJL1
|
#ifdef HAVE_YAJL1
|
||||||
hand = yajl_alloc(&parse_callbacks, NULL, NULL, (void *) &data);
|
hand = yajl_alloc(&parse_callbacks, nullptr, nullptr, (void *) &data);
|
||||||
#else
|
#else
|
||||||
hand = yajl_alloc(&parse_callbacks, NULL, (void *) &data);
|
hand = yajl_alloc(&parse_callbacks, nullptr, (void *) &data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ret = soundcloud_parse_json(u, hand, mutex, cond);
|
int ret = soundcloud_parse_json(u, hand, mutex, cond);
|
||||||
|
|
||||||
g_free(u);
|
g_free(u);
|
||||||
yajl_free(hand);
|
yajl_free(hand);
|
||||||
if (data.title != NULL)
|
if (data.title != nullptr)
|
||||||
g_free(data.title);
|
g_free(data.title);
|
||||||
if (data.stream_url != NULL)
|
if (data.stream_url != nullptr)
|
||||||
g_free(data.stream_url);
|
g_free(data.stream_url);
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
data.songs.reverse();
|
data.songs.reverse();
|
||||||
return new MemorySongEnumerator(std::move(data.songs));
|
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[] = {
|
static const char *const soundcloud_schemes[] = {
|
||||||
"soundcloud",
|
"soundcloud",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct playlist_plugin soundcloud_playlist_plugin = {
|
const struct playlist_plugin soundcloud_playlist_plugin = {
|
||||||
|
@ -94,7 +94,7 @@ xspf_start_element(gcc_unused GMarkupParseContext *context,
|
|||||||
case XspfParser::TRACKLIST:
|
case XspfParser::TRACKLIST:
|
||||||
if (strcmp(element_name, "track") == 0) {
|
if (strcmp(element_name, "track") == 0) {
|
||||||
parser->state = XspfParser::TRACK;
|
parser->state = XspfParser::TRACK;
|
||||||
parser->song = NULL;
|
parser->song = nullptr;
|
||||||
parser->tag = TAG_NUM_OF_ITEM_TYPES;
|
parser->tag = TAG_NUM_OF_ITEM_TYPES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ xspf_end_element(gcc_unused GMarkupParseContext *context,
|
|||||||
|
|
||||||
case XspfParser::TRACK:
|
case XspfParser::TRACK:
|
||||||
if (strcmp(element_name, "track") == 0) {
|
if (strcmp(element_name, "track") == 0) {
|
||||||
if (parser->song != NULL)
|
if (parser->song != nullptr)
|
||||||
parser->songs.emplace_front(parser->song);
|
parser->songs.emplace_front(parser->song);
|
||||||
|
|
||||||
parser->state = XspfParser::TRACKLIST;
|
parser->state = XspfParser::TRACKLIST;
|
||||||
@ -177,9 +177,9 @@ xspf_text(gcc_unused GMarkupParseContext *context,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case XspfParser::TRACK:
|
case XspfParser::TRACK:
|
||||||
if (parser->song != NULL &&
|
if (parser->song != nullptr &&
|
||||||
parser->tag != TAG_NUM_OF_ITEM_TYPES) {
|
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 = new Tag();
|
||||||
parser->song->tag->AddItem(parser->tag, text, text_len);
|
parser->song->tag->AddItem(parser->tag, text, text_len);
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ xspf_text(gcc_unused GMarkupParseContext *context,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case XspfParser::LOCATION:
|
case XspfParser::LOCATION:
|
||||||
if (parser->song == NULL) {
|
if (parser->song == nullptr) {
|
||||||
char *uri = g_strndup(text, text_len);
|
char *uri = g_strndup(text, text_len);
|
||||||
parser->song = Song::NewRemote(uri);
|
parser->song = Song::NewRemote(uri);
|
||||||
g_free(uri);
|
g_free(uri);
|
||||||
@ -210,7 +210,7 @@ xspf_parser_destroy(gpointer data)
|
|||||||
{
|
{
|
||||||
XspfParser *parser = (XspfParser *)data;
|
XspfParser *parser = (XspfParser *)data;
|
||||||
|
|
||||||
if (parser->state >= XspfParser::TRACK && parser->song != NULL)
|
if (parser->state >= XspfParser::TRACK && parser->song != nullptr)
|
||||||
parser->song->Free();
|
parser->song->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ xspf_open_stream(InputStream &is)
|
|||||||
size_t nbytes;
|
size_t nbytes;
|
||||||
bool success;
|
bool success;
|
||||||
Error error2;
|
Error error2;
|
||||||
GError *error = NULL;
|
GError *error = nullptr;
|
||||||
|
|
||||||
/* parse the XSPF XML file */
|
/* parse the XSPF XML file */
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ xspf_open_stream(InputStream &is)
|
|||||||
if (error2.IsDefined()) {
|
if (error2.IsDefined()) {
|
||||||
g_markup_parse_context_free(context);
|
g_markup_parse_context_free(context);
|
||||||
LogError(error2);
|
LogError(error2);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -255,7 +255,7 @@ xspf_open_stream(InputStream &is)
|
|||||||
"XML parser failed: %s", error->message);
|
"XML parser failed: %s", error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
g_markup_parse_context_free(context);
|
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);
|
"XML parser failed: %s", error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
g_markup_parse_context_free(context);
|
g_markup_parse_context_free(context);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.songs.reverse();
|
parser.songs.reverse();
|
||||||
@ -279,12 +279,12 @@ xspf_open_stream(InputStream &is)
|
|||||||
|
|
||||||
static const char *const xspf_suffixes[] = {
|
static const char *const xspf_suffixes[] = {
|
||||||
"xspf",
|
"xspf",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const xspf_mime_types[] = {
|
static const char *const xspf_mime_types[] = {
|
||||||
"application/xspf+xml",
|
"application/xspf+xml",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct playlist_plugin xspf_playlist_plugin = {
|
const struct playlist_plugin xspf_playlist_plugin = {
|
||||||
|
@ -36,14 +36,14 @@ void
|
|||||||
command_error_v(Client &client, enum ack error,
|
command_error_v(Client &client, enum ack error,
|
||||||
const char *fmt, va_list args)
|
const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
assert(current_command != NULL);
|
assert(current_command != nullptr);
|
||||||
|
|
||||||
client_printf(client, "ACK [%i@%i] {%s} ",
|
client_printf(client, "ACK [%i@%i] {%s} ",
|
||||||
(int)error, command_list_num, current_command);
|
(int)error, command_list_num, current_command);
|
||||||
client_vprintf(client, fmt, args);
|
client_vprintf(client, fmt, args);
|
||||||
client_puts(client, "\n");
|
client_puts(client, "\n");
|
||||||
|
|
||||||
current_command = NULL;
|
current_command = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -131,7 +131,7 @@ struct Tag {
|
|||||||
static Tag *Merge(const Tag &base, const Tag &add);
|
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.
|
* are freed by this function.
|
||||||
*
|
*
|
||||||
* @return a newly allocated tag
|
* @return a newly allocated tag
|
||||||
@ -140,8 +140,8 @@ struct Tag {
|
|||||||
static Tag *MergeReplace(Tag *base, Tag *add);
|
static Tag *MergeReplace(Tag *base, Tag *add);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first value of the specified tag type, or NULL if none
|
* Returns the first value of the specified tag type, or
|
||||||
* is present in this tag object.
|
* nullptr if none is present in this tag object.
|
||||||
*/
|
*/
|
||||||
gcc_pure
|
gcc_pure
|
||||||
const char *GetValue(TagType type) const;
|
const char *GetValue(TagType type) const;
|
||||||
|
@ -42,7 +42,7 @@ tag_id3_import(struct id3_tag *);
|
|||||||
* Loads the ID3 tags from the file into a libid3tag object. The
|
* Loads the ID3 tags from the file into a libid3tag object. The
|
||||||
* return value must be freed with id3_tag_delete().
|
* 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)
|
* Error will be set)
|
||||||
*/
|
*/
|
||||||
struct id3_tag *
|
struct id3_tag *
|
||||||
|
Loading…
Reference in New Issue
Block a user