From bfb0897b54bc79e079b38b6da660018e70d9be5e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 3 Dec 2016 12:13:45 +0100 Subject: [PATCH] filter/ReplayGain: convert pointers to references --- src/filter/plugins/ReplayGainFilterPlugin.cxx | 18 +++++++++--------- src/filter/plugins/ReplayGainFilterPlugin.hxx | 6 +++--- src/output/Init.cxx | 2 +- src/output/OutputThread.cxx | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/filter/plugins/ReplayGainFilterPlugin.cxx b/src/filter/plugins/ReplayGainFilterPlugin.cxx index f51e50b68..1e5116548 100644 --- a/src/filter/plugins/ReplayGainFilterPlugin.cxx +++ b/src/filter/plugins/ReplayGainFilterPlugin.cxx @@ -189,26 +189,26 @@ const FilterPlugin replay_gain_filter_plugin = { }; void -replay_gain_filter_set_mixer(PreparedFilter *_filter, Mixer *mixer, +replay_gain_filter_set_mixer(PreparedFilter &_filter, Mixer *mixer, unsigned base) { - PreparedReplayGainFilter *filter = (PreparedReplayGainFilter *)_filter; + auto &filter = (PreparedReplayGainFilter &)_filter; - filter->SetMixer(mixer, base); + filter.SetMixer(mixer, base); } void -replay_gain_filter_set_info(Filter *_filter, const ReplayGainInfo *info) +replay_gain_filter_set_info(Filter &_filter, const ReplayGainInfo *info) { - ReplayGainFilter *filter = (ReplayGainFilter *)_filter; + auto &filter = (ReplayGainFilter &)_filter; - filter->SetInfo(info); + filter.SetInfo(info); } void -replay_gain_filter_set_mode(Filter *_filter, ReplayGainMode mode) +replay_gain_filter_set_mode(Filter &_filter, ReplayGainMode mode) { - ReplayGainFilter *filter = (ReplayGainFilter *)_filter; + auto &filter = (ReplayGainFilter &)_filter; - filter->SetMode(mode); + filter.SetMode(mode); } diff --git a/src/filter/plugins/ReplayGainFilterPlugin.hxx b/src/filter/plugins/ReplayGainFilterPlugin.hxx index 734f864af..c72c5d9e7 100644 --- a/src/filter/plugins/ReplayGainFilterPlugin.hxx +++ b/src/filter/plugins/ReplayGainFilterPlugin.hxx @@ -35,7 +35,7 @@ class Mixer; * (including). */ void -replay_gain_filter_set_mixer(PreparedFilter *_filter, Mixer *mixer, +replay_gain_filter_set_mixer(PreparedFilter &_filter, Mixer *mixer, unsigned base); /** @@ -45,9 +45,9 @@ replay_gain_filter_set_mixer(PreparedFilter *_filter, Mixer *mixer, * gain data is available for the current song */ void -replay_gain_filter_set_info(Filter *filter, const ReplayGainInfo *info); +replay_gain_filter_set_info(Filter &filter, const ReplayGainInfo *info); void -replay_gain_filter_set_mode(Filter *filter, ReplayGainMode mode); +replay_gain_filter_set_mode(Filter &filter, ReplayGainMode mode); #endif diff --git a/src/output/Init.cxx b/src/output/Init.cxx index 41a3fbba7..5d912ba37 100644 --- a/src/output/Init.cxx +++ b/src/output/Init.cxx @@ -249,7 +249,7 @@ audio_output_setup(EventLoop &event_loop, AudioOutput &ao, if (strcmp(replay_gain_handler, "mixer") == 0) { if (ao.mixer != nullptr) - replay_gain_filter_set_mixer(ao.prepared_replay_gain_filter, + replay_gain_filter_set_mixer(*ao.prepared_replay_gain_filter, ao.mixer, 100); else FormatError(output_domain, diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx index 53bdc3490..b9d7a43a9 100644 --- a/src/output/OutputThread.cxx +++ b/src/output/OutputThread.cxx @@ -349,11 +349,11 @@ ao_chunk_data(AudioOutput *ao, const MusicChunk *chunk, assert(data.size % ao->in_audio_format.GetFrameSize() == 0); if (!data.IsEmpty() && replay_gain_filter != nullptr) { - replay_gain_filter_set_mode(replay_gain_filter, + replay_gain_filter_set_mode(*replay_gain_filter, ao->replay_gain_mode); if (chunk->replay_gain_serial != *replay_gain_serial_p) { - replay_gain_filter_set_info(replay_gain_filter, + replay_gain_filter_set_info(*replay_gain_filter, chunk->replay_gain_serial != 0 ? &chunk->replay_gain_info : nullptr);