*: use nullptr instead of NULL
This commit is contained in:
@@ -76,12 +76,12 @@ static void
|
||||
mpd_ffmpeg_log_callback(gcc_unused void *ptr, int level,
|
||||
const char *fmt, va_list vl)
|
||||
{
|
||||
const AVClass * cls = NULL;
|
||||
const AVClass * cls = nullptr;
|
||||
|
||||
if (ptr != NULL)
|
||||
if (ptr != nullptr)
|
||||
cls = *(const AVClass *const*)ptr;
|
||||
|
||||
if (cls != NULL) {
|
||||
if (cls != nullptr) {
|
||||
char domain[64];
|
||||
snprintf(domain, sizeof(domain), "%s/%s",
|
||||
ffmpeg_domain.GetName(), cls->item_name(ptr));
|
||||
@@ -155,12 +155,12 @@ mpd_ffmpeg_open_input(AVFormatContext **ic_ptr,
|
||||
AVInputFormat *fmt)
|
||||
{
|
||||
AVFormatContext *context = avformat_alloc_context();
|
||||
if (context == NULL)
|
||||
if (context == nullptr)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
context->pb = pb;
|
||||
*ic_ptr = context;
|
||||
return avformat_open_input(ic_ptr, filename, fmt, NULL);
|
||||
return avformat_open_input(ic_ptr, filename, fmt, nullptr);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -329,7 +329,7 @@ ffmpeg_sample_format(enum AVSampleFormat sample_fmt)
|
||||
char buffer[64];
|
||||
const char *name = av_get_sample_fmt_string(buffer, sizeof(buffer),
|
||||
sample_fmt);
|
||||
if (name != NULL)
|
||||
if (name != nullptr)
|
||||
FormatError(ffmpeg_domain,
|
||||
"Unsupported libavcodec SampleFormat value: %s (%d)",
|
||||
name, sample_fmt);
|
||||
@@ -373,7 +373,7 @@ static void
|
||||
ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
|
||||
{
|
||||
AVInputFormat *input_format = ffmpeg_probe(decoder, input);
|
||||
if (input_format == NULL)
|
||||
if (input_format == nullptr)
|
||||
return;
|
||||
|
||||
FormatDebug(ffmpeg_domain, "detected input format '%s' (%s)",
|
||||
@@ -386,7 +386,7 @@ ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
|
||||
}
|
||||
|
||||
//ffmpeg works with ours "fileops" helper
|
||||
AVFormatContext *format_context = NULL;
|
||||
AVFormatContext *format_context = nullptr;
|
||||
if (mpd_ffmpeg_open_input(&format_context, stream.io,
|
||||
input->uri.c_str(),
|
||||
input_format) != 0) {
|
||||
@@ -395,7 +395,7 @@ ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
|
||||
}
|
||||
|
||||
const int find_result =
|
||||
avformat_find_stream_info(format_context, NULL);
|
||||
avformat_find_stream_info(format_context, nullptr);
|
||||
if (find_result < 0) {
|
||||
LogError(ffmpeg_domain, "Couldn't find stream info");
|
||||
avformat_close_input(&format_context);
|
||||
@@ -445,7 +445,7 @@ ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
|
||||
values into AVCodecContext.channels - a change that will be
|
||||
reverted later by avcodec_decode_audio3() */
|
||||
|
||||
const int open_result = avcodec_open2(codec_context, codec, NULL);
|
||||
const int open_result = avcodec_open2(codec_context, codec, nullptr);
|
||||
if (open_result < 0) {
|
||||
LogError(ffmpeg_domain, "Could not open codec");
|
||||
avformat_close_input(&format_context);
|
||||
@@ -466,7 +466,7 @@ ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t *interleaved_buffer = NULL;
|
||||
uint8_t *interleaved_buffer = nullptr;
|
||||
int interleaved_buffer_size = 0;
|
||||
|
||||
DecoderCommand cmd;
|
||||
@@ -518,21 +518,21 @@ static bool
|
||||
ffmpeg_scan_stream(struct input_stream *is,
|
||||
const struct tag_handler *handler, void *handler_ctx)
|
||||
{
|
||||
AVInputFormat *input_format = ffmpeg_probe(NULL, is);
|
||||
if (input_format == NULL)
|
||||
AVInputFormat *input_format = ffmpeg_probe(nullptr, is);
|
||||
if (input_format == nullptr)
|
||||
return false;
|
||||
|
||||
AvioStream stream(nullptr, is);
|
||||
if (!stream.Open())
|
||||
return false;
|
||||
|
||||
AVFormatContext *f = NULL;
|
||||
AVFormatContext *f = nullptr;
|
||||
if (mpd_ffmpeg_open_input(&f, stream.io, is->uri.c_str(),
|
||||
input_format) != 0)
|
||||
return false;
|
||||
|
||||
const int find_result =
|
||||
avformat_find_stream_info(f, NULL);
|
||||
avformat_find_stream_info(f, nullptr);
|
||||
if (find_result < 0) {
|
||||
avformat_close_input(&f);
|
||||
return false;
|
||||
@@ -576,7 +576,7 @@ static const char *const ffmpeg_suffixes[] = {
|
||||
"tsp", "tta", "xa", "xvid", "uv", "uv2", "vb", "vid", "vob", "voc",
|
||||
"vp6", "vmd", "wav", "webm", "wma", "wmv", "wsaud", "wsvga", "wv",
|
||||
"wve",
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const char *const ffmpeg_mime_types[] = {
|
||||
@@ -664,7 +664,7 @@ static const char *const ffmpeg_mime_types[] = {
|
||||
plugin */
|
||||
"audio/x-mpd-ffmpeg",
|
||||
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
|
||||
const struct decoder_plugin ffmpeg_decoder_plugin = {
|
||||
|
@@ -206,7 +206,7 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
|
||||
format_samples(bytes_per_sample, chunk,
|
||||
samples_got * audio_format.channels);
|
||||
|
||||
cmd = decoder_data(decoder, NULL, chunk,
|
||||
cmd = decoder_data(decoder, nullptr, chunk,
|
||||
samples_got * output_sample_size,
|
||||
bitrate);
|
||||
}
|
||||
@@ -295,7 +295,7 @@ wavpack_scan_file(const char *fname,
|
||||
char error[ERRORLEN];
|
||||
|
||||
wpc = WavpackOpenFileInput(fname, error, OPEN_TAGS, 0);
|
||||
if (wpc == NULL) {
|
||||
if (wpc == nullptr) {
|
||||
FormatError(wavpack_domain,
|
||||
"failed to open WavPack file \"%s\": %s",
|
||||
fname, error);
|
||||
@@ -311,16 +311,16 @@ wavpack_scan_file(const char *fname,
|
||||
|
||||
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) {
|
||||
const char *name = tag_item_names[i];
|
||||
if (name != NULL)
|
||||
if (name != nullptr)
|
||||
wavpack_scan_tag_item(wpc, name, (enum tag_type)i,
|
||||
handler, handler_ctx);
|
||||
}
|
||||
|
||||
for (const struct tag_table *i = ape_tags; i->name != NULL; ++i)
|
||||
for (const struct tag_table *i = ape_tags; i->name != nullptr; ++i)
|
||||
wavpack_scan_tag_item(wpc, i->name, i->type,
|
||||
handler, handler_ctx);
|
||||
|
||||
if (handler->pair != NULL) {
|
||||
if (handler->pair != nullptr) {
|
||||
char name[64];
|
||||
|
||||
for (int i = 0, n = WavpackGetNumTagItems(wpc);
|
||||
@@ -463,7 +463,7 @@ wavpack_open_wvc(struct decoder *decoder, const char *uri,
|
||||
struct wavpack_input *wpi)
|
||||
{
|
||||
struct input_stream *is_wvc;
|
||||
char *wvc_url = NULL;
|
||||
char *wvc_url = nullptr;
|
||||
char first_byte;
|
||||
size_t nbytes;
|
||||
|
||||
@@ -471,16 +471,16 @@ wavpack_open_wvc(struct decoder *decoder, const char *uri,
|
||||
* As we use dc->utf8url, this function will be bad for
|
||||
* single files. utf8url is not absolute file path :/
|
||||
*/
|
||||
if (uri == NULL)
|
||||
if (uri == nullptr)
|
||||
return nullptr;
|
||||
|
||||
wvc_url = g_strconcat(uri, "c", NULL);
|
||||
wvc_url = g_strconcat(uri, "c", nullptr);
|
||||
|
||||
is_wvc = input_stream::Open(wvc_url, mutex, cond, IgnoreError());
|
||||
g_free(wvc_url);
|
||||
|
||||
if (is_wvc == NULL)
|
||||
return NULL;
|
||||
if (is_wvc == nullptr)
|
||||
return nullptr;
|
||||
|
||||
/*
|
||||
* And we try to buffer in order to get know
|
||||
@@ -491,7 +491,7 @@ wavpack_open_wvc(struct decoder *decoder, const char *uri,
|
||||
);
|
||||
if (nbytes == 0) {
|
||||
is_wvc->Close();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* push it back */
|
||||
@@ -516,7 +516,7 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
|
||||
is_wvc = wavpack_open_wvc(decoder, is->uri.c_str(),
|
||||
is->mutex, is->cond,
|
||||
&isp_wvc);
|
||||
if (is_wvc != NULL) {
|
||||
if (is_wvc != nullptr) {
|
||||
open_flags |= OPEN_WVC;
|
||||
can_seek &= is_wvc->seekable;
|
||||
}
|
||||
@@ -528,11 +528,11 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
|
||||
wavpack_input_init(&isp, decoder, is);
|
||||
wpc = WavpackOpenFileInputEx(
|
||||
&mpd_is_reader, &isp,
|
||||
open_flags & OPEN_WVC ? &isp_wvc : NULL,
|
||||
open_flags & OPEN_WVC ? &isp_wvc : nullptr,
|
||||
error, open_flags, 23
|
||||
);
|
||||
|
||||
if (wpc == NULL) {
|
||||
if (wpc == nullptr) {
|
||||
FormatError(wavpack_domain,
|
||||
"failed to open WavPack stream: %s", error);
|
||||
return;
|
||||
@@ -559,7 +559,7 @@ wavpack_filedecode(struct decoder *decoder, const char *fname)
|
||||
fname, error,
|
||||
OPEN_TAGS | OPEN_WVC | OPEN_NORMALIZE, 23
|
||||
);
|
||||
if (wpc == NULL) {
|
||||
if (wpc == nullptr) {
|
||||
FormatWarning(wavpack_domain,
|
||||
"failed to open WavPack file \"%s\": %s",
|
||||
fname, error);
|
||||
@@ -577,12 +577,12 @@ wavpack_filedecode(struct decoder *decoder, const char *fname)
|
||||
|
||||
static char const *const wavpack_suffixes[] = {
|
||||
"wv",
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
|
||||
static char const *const wavpack_mime_types[] = {
|
||||
"audio/x-wavpack",
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
|
||||
const struct decoder_plugin wavpack_decoder_plugin = {
|
||||
|
@@ -49,7 +49,7 @@ static bool filter_setting;
|
||||
static GKeyFile *
|
||||
sidplay_load_songlength_db(const char *path)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GError *error = nullptr;
|
||||
gchar *data;
|
||||
gsize size;
|
||||
|
||||
@@ -58,7 +58,7 @@ sidplay_load_songlength_db(const char *path)
|
||||
"unable to read songlengths file %s: %s",
|
||||
path, error->message);
|
||||
g_error_free(error);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* replace any ; comment characters with # */
|
||||
@@ -76,7 +76,7 @@ sidplay_load_songlength_db(const char *path)
|
||||
path, error->message);
|
||||
g_error_free(error);
|
||||
g_key_file_free(db);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
g_key_file_set_list_separator(db, ' ');
|
||||
@@ -88,7 +88,7 @@ sidplay_init(const config_param ¶m)
|
||||
{
|
||||
/* read the songlengths database file */
|
||||
songlength_file = param.GetBlockValue("songlength_database");
|
||||
if (songlength_file != NULL)
|
||||
if (songlength_file != nullptr)
|
||||
songlength_database = sidplay_load_songlength_db(songlength_file);
|
||||
|
||||
default_songlength = param.GetBlockValue("default_songlength", 0u);
|
||||
@@ -123,7 +123,7 @@ get_container_name(const char *path_fs)
|
||||
char *path_container=g_strdup(path_fs);
|
||||
|
||||
if(!g_pattern_match(path_with_subtune,
|
||||
strlen(path_container), path_container, NULL))
|
||||
strlen(path_container), path_container, nullptr))
|
||||
return path_container;
|
||||
|
||||
char *ptr=g_strrstr(path_container, "/" SUBTUNE_PREFIX);
|
||||
@@ -140,12 +140,12 @@ static unsigned
|
||||
get_song_num(const char *path_fs)
|
||||
{
|
||||
if(g_pattern_match(path_with_subtune,
|
||||
strlen(path_fs), path_fs, NULL)) {
|
||||
strlen(path_fs), path_fs, nullptr)) {
|
||||
char *sub=g_strrstr(path_fs, "/" SUBTUNE_PREFIX);
|
||||
if(!sub) return 1;
|
||||
|
||||
sub+=strlen("/" SUBTUNE_PREFIX);
|
||||
int song_num=strtol(sub, NULL, 10);
|
||||
int song_num=strtol(sub, nullptr, 10);
|
||||
|
||||
if (errno == EINVAL)
|
||||
return 1;
|
||||
@@ -159,7 +159,7 @@ get_song_num(const char *path_fs)
|
||||
static int
|
||||
get_song_length(const char *path_fs)
|
||||
{
|
||||
if (songlength_database == NULL)
|
||||
if (songlength_database == nullptr)
|
||||
return -1;
|
||||
|
||||
gchar *sid_file=get_container_name(path_fs);
|
||||
@@ -177,19 +177,19 @@ get_song_length(const char *path_fs)
|
||||
|
||||
gsize num_items;
|
||||
gchar **values=g_key_file_get_string_list(songlength_database,
|
||||
"Database", md5sum, &num_items, NULL);
|
||||
"Database", md5sum, &num_items, nullptr);
|
||||
if(!values || song_num>num_items) {
|
||||
g_strfreev(values);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int minutes=strtol(values[song_num-1], NULL, 10);
|
||||
int minutes=strtol(values[song_num-1], nullptr, 10);
|
||||
if(errno==EINVAL) minutes=0;
|
||||
|
||||
int seconds;
|
||||
char *ptr=strchr(values[song_num-1], ':');
|
||||
if(ptr) {
|
||||
seconds=strtol(ptr+1, NULL, 10);
|
||||
seconds=strtol(ptr+1, nullptr, 10);
|
||||
if(errno==EINVAL) seconds=0;
|
||||
} else
|
||||
seconds=0;
|
||||
@@ -207,7 +207,7 @@ sidplay_file_decode(struct decoder *decoder, const char *path_fs)
|
||||
/* load the tune */
|
||||
|
||||
char *path_container=get_container_name(path_fs);
|
||||
SidTune tune(path_container, NULL, true);
|
||||
SidTune tune(path_container, nullptr, true);
|
||||
g_free(path_container);
|
||||
if (!tune) {
|
||||
LogWarning(sidplay_domain, "failed to load file");
|
||||
@@ -307,7 +307,7 @@ sidplay_file_decode(struct decoder *decoder, const char *path_fs)
|
||||
|
||||
decoder_timestamp(decoder, (double)player.time() / timebase);
|
||||
|
||||
cmd = decoder_data(decoder, NULL, buffer, nbytes, 0);
|
||||
cmd = decoder_data(decoder, nullptr, buffer, nbytes, 0);
|
||||
|
||||
if (cmd == DecoderCommand::SEEK) {
|
||||
unsigned data_time = player.time();
|
||||
@@ -344,7 +344,7 @@ sidplay_scan_file(const char *path_fs,
|
||||
int song_num=get_song_num(path_fs);
|
||||
char *path_container=get_container_name(path_fs);
|
||||
|
||||
SidTune tune(path_container, NULL, true);
|
||||
SidTune tune(path_container, nullptr, true);
|
||||
g_free(path_container);
|
||||
if (!tune)
|
||||
return false;
|
||||
@@ -353,7 +353,7 @@ sidplay_scan_file(const char *path_fs,
|
||||
|
||||
/* title */
|
||||
const char *title;
|
||||
if (info.numberOfInfoStrings > 0 && info.infoString[0] != NULL)
|
||||
if (info.numberOfInfoStrings > 0 && info.infoString[0] != nullptr)
|
||||
title=info.infoString[0];
|
||||
else
|
||||
title="";
|
||||
@@ -369,7 +369,7 @@ sidplay_scan_file(const char *path_fs,
|
||||
tag_handler_invoke_tag(handler, handler_ctx, TAG_TITLE, title);
|
||||
|
||||
/* artist */
|
||||
if (info.numberOfInfoStrings > 1 && info.infoString[1] != NULL)
|
||||
if (info.numberOfInfoStrings > 1 && info.infoString[1] != nullptr)
|
||||
tag_handler_invoke_tag(handler, handler_ctx, TAG_ARTIST,
|
||||
info.infoString[1]);
|
||||
|
||||
@@ -389,16 +389,16 @@ sidplay_scan_file(const char *path_fs,
|
||||
static char *
|
||||
sidplay_container_scan(const char *path_fs, const unsigned int tnum)
|
||||
{
|
||||
SidTune tune(path_fs, NULL, true);
|
||||
SidTune tune(path_fs, nullptr, true);
|
||||
if (!tune)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
const SidTuneInfo &info=tune.getInfo();
|
||||
|
||||
/* Don't treat sids containing a single tune
|
||||
as containers */
|
||||
if(!all_files_are_containers && info.songs<2)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/* Construct container/tune path names, eg.
|
||||
Delta.sid/tune_001.sid */
|
||||
@@ -407,7 +407,7 @@ sidplay_container_scan(const char *path_fs, const unsigned int tnum)
|
||||
SUBTUNE_PREFIX "%03u.sid", tnum);
|
||||
return subtune;
|
||||
} else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static const char *const sidplay_suffixes[] = {
|
||||
@@ -416,7 +416,7 @@ static const char *const sidplay_suffixes[] = {
|
||||
"str",
|
||||
"prg",
|
||||
"P00",
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
|
||||
extern const struct decoder_plugin sidplay_decoder_plugin;
|
||||
@@ -424,11 +424,11 @@ const struct decoder_plugin sidplay_decoder_plugin = {
|
||||
"sidplay",
|
||||
sidplay_init,
|
||||
sidplay_finish,
|
||||
NULL, /* stream_decode() */
|
||||
nullptr, /* stream_decode() */
|
||||
sidplay_file_decode,
|
||||
sidplay_scan_file,
|
||||
NULL, /* stream_tag() */
|
||||
nullptr, /* stream_tag() */
|
||||
sidplay_container_scan,
|
||||
sidplay_suffixes,
|
||||
NULL, /* mime_types */
|
||||
nullptr, /* mime_types */
|
||||
};
|
||||
|
Reference in New Issue
Block a user