diff options
51 files changed, 87 insertions, 87 deletions
diff --git a/src/IcyMetaDataParser.cxx b/src/IcyMetaDataParser.cxx index 3c5ebff12..1a0168aa3 100644 --- a/src/IcyMetaDataParser.cxx +++ b/src/IcyMetaDataParser.cxx @@ -194,7 +194,7 @@ icy_parse_tag( size_t IcyMetaDataParser::Meta(const void *data, size_t length) noexcept { - const unsigned char *p = (const unsigned char *)data; + const auto *p = (const unsigned char *)data; assert(IsDefined()); assert(data_rest == 0); @@ -254,7 +254,7 @@ IcyMetaDataParser::Meta(const void *data, size_t length) noexcept size_t IcyMetaDataParser::ParseInPlace(void *data, size_t length) noexcept { - uint8_t *const dest0 = (uint8_t *)data; + auto *const dest0 = (uint8_t *)data; uint8_t *dest = dest0; const uint8_t *src = dest0; diff --git a/src/Main.cxx b/src/Main.cxx index eec9d6154..0c20fb6cd 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -172,7 +172,7 @@ InitStorage(Instance &instance, EventLoop &event_loop, if (storage == nullptr) return; - CompositeStorage *composite = new CompositeStorage(); + auto *composite = new CompositeStorage(); instance.storage = composite; composite->Mount("", std::move(storage)); } diff --git a/src/client/New.cxx b/src/client/New.cxx index 1f92c63c3..87a5c8e7a 100644 --- a/src/client/New.cxx +++ b/src/client/New.cxx @@ -67,7 +67,7 @@ client_new(EventLoop &loop, Partition &partition, (void)fd.Write(GREETING, sizeof(GREETING) - 1); const unsigned num = next_client_num++; - Client *client = new Client(loop, partition, std::move(fd), uid, + auto *client = new Client(loop, partition, std::move(fd), uid, permission, num); diff --git a/src/command/StickerCommands.cxx b/src/command/StickerCommands.cxx index 95a1e702b..0f2b4a71e 100644 --- a/src/command/StickerCommands.cxx +++ b/src/command/StickerCommands.cxx @@ -42,7 +42,7 @@ static void sticker_song_find_print_cb(const LightSong &song, const char *value, void *user_data) { - struct sticker_song_find_data *data = + auto *data = (struct sticker_song_find_data *)user_data; song_print_uri(data->r, song); diff --git a/src/config/File.cxx b/src/config/File.cxx index f7f9c5c55..bf89beefa 100644 --- a/src/config/File.cxx +++ b/src/config/File.cxx @@ -112,7 +112,7 @@ ReadConfigBlock(ConfigData &config_data, BufferedReader &reader, const char *name, ConfigBlockOption o, Tokenizer &tokenizer) { - const unsigned i = unsigned(o); + const auto i = unsigned(o); const ConfigTemplate &option = config_block_templates[i]; if (option.deprecated) @@ -144,7 +144,7 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader, const char *name, ConfigOption o, Tokenizer &tokenizer) { - const unsigned i = unsigned(o); + const auto i = unsigned(o); const ConfigTemplate &option = config_param_templates[i]; if (option.deprecated) diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx index 073b516b2..c3dfae850 100644 --- a/src/db/plugins/ProxyDatabasePlugin.cxx +++ b/src/db/plugins/ProxyDatabasePlugin.cxx @@ -584,7 +584,7 @@ ProxyDatabase::OnSocketReady(gcc_unused unsigned flags) noexcept return true; } - unsigned idle = (unsigned)mpd_recv_idle(connection, false); + auto idle = (unsigned)mpd_recv_idle(connection, false); if (idle == 0) { try { CheckError(connection); @@ -666,7 +666,7 @@ ProxyDatabase::ReturnSong(const LightSong *_song) const noexcept { assert(_song != nullptr); - AllocatedProxySong *song = (AllocatedProxySong *) + auto *song = (AllocatedProxySong *) const_cast<LightSong *>(_song); delete song; } diff --git a/src/db/plugins/simple/Directory.cxx b/src/db/plugins/simple/Directory.cxx index d88b6bb61..e478b6d06 100644 --- a/src/db/plugins/simple/Directory.cxx +++ b/src/db/plugins/simple/Directory.cxx @@ -83,7 +83,7 @@ Directory::CreateChild(const char *name_utf8) noexcept ? std::string(name_utf8) : PathTraitsUTF8::Build(GetPath(), name_utf8); - Directory *child = new Directory(std::move(path_utf8), this); + auto *child = new Directory(std::move(path_utf8), this); children.push_back(*child); return child; } diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx index 441f8cefd..6145d535e 100644 --- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx +++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx @@ -177,7 +177,7 @@ UpnpDatabase::ReturnSong(const LightSong *_song) const noexcept { assert(_song != nullptr); - UpnpSong *song = (UpnpSong *)const_cast<LightSong *>(_song); + auto *song = (UpnpSong *)const_cast<LightSong *>(_song); delete song; } diff --git a/src/db/update/InotifySource.cxx b/src/db/update/InotifySource.cxx index e674ed395..4ee0d6afc 100644 --- a/src/db/update/InotifySource.cxx +++ b/src/db/update/InotifySource.cxx @@ -47,7 +47,7 @@ InotifySource::OnSocketReady(gcc_unused unsigned flags) noexcept while (true) { const size_t remaining = end - p; - const struct inotify_event *event = + const auto *event = (const struct inotify_event *)p; if (remaining < sizeof(*event) || remaining < sizeof(*event) + event->len) diff --git a/src/decoder/Bridge.cxx b/src/decoder/Bridge.cxx index c14724a04..27d1a577a 100644 --- a/src/decoder/Bridge.cxx +++ b/src/decoder/Bridge.cxx @@ -480,7 +480,7 @@ DecoderBridge::SubmitData(InputStream *is, if (dc.end_time.IsPositive()) { /* enforce the given end time */ - const uint64_t end_frame = + const auto end_frame = dc.end_time.ToScale<uint64_t>(dc.in_audio_format.sample_rate); if (absolute_frame >= end_frame) return DecoderCommand::STOP; diff --git a/src/decoder/DecoderAPI.cxx b/src/decoder/DecoderAPI.cxx index 3d0b551c0..be3a9c680 100644 --- a/src/decoder/DecoderAPI.cxx +++ b/src/decoder/DecoderAPI.cxx @@ -46,7 +46,7 @@ bool decoder_read_full(DecoderClient *client, InputStream &is, void *_buffer, size_t size) { - uint8_t *buffer = (uint8_t *)_buffer; + auto *buffer = (uint8_t *)_buffer; while (size > 0) { size_t nbytes = decoder_read(client, is, buffer, size); diff --git a/src/decoder/plugins/AudiofileDecoderPlugin.cxx b/src/decoder/plugins/AudiofileDecoderPlugin.cxx index cc7c7f8aa..63ecff3ca 100644 --- a/src/decoder/plugins/AudiofileDecoderPlugin.cxx +++ b/src/decoder/plugins/AudiofileDecoderPlugin.cxx @@ -209,10 +209,10 @@ audiofile_stream_decode(DecoderClient &client, InputStream &is) const auto audio_format = CheckAudioFormat(fh); const auto total_time = audiofile_get_duration(fh); - const uint16_t kbit_rate = (uint16_t) + const auto kbit_rate = (uint16_t) (is.GetSize() * uint64_t(8) / total_time.ToMS()); - const unsigned frame_size = (unsigned) + const auto frame_size = (unsigned) afGetVirtualFrameSize(fh, AF_DEFAULT_TRACK, true); client.Ready(audio_format, true, total_time); diff --git a/src/decoder/plugins/DsdLib.cxx b/src/decoder/plugins/DsdLib.cxx index b2c17a137..d19de96a1 100644 --- a/src/decoder/plugins/DsdLib.cxx +++ b/src/decoder/plugins/DsdLib.cxx @@ -133,7 +133,7 @@ dsdlib_tag_id3(InputStream &is, TagHandler &handler, const id3_length_t count = count64; - id3_byte_t *const id3_buf = new id3_byte_t[count]; + auto *const id3_buf = new id3_byte_t[count]; if (id3_buf == nullptr) return; diff --git a/src/decoder/plugins/FaadDecoderPlugin.cxx b/src/decoder/plugins/FaadDecoderPlugin.cxx index 407fa1c73..c56ae7608 100644 --- a/src/decoder/plugins/FaadDecoderPlugin.cxx +++ b/src/decoder/plugins/FaadDecoderPlugin.cxx @@ -72,7 +72,7 @@ adts_find_frame(DecoderBuffer &buffer) return 0; /* find the 0xff marker */ - const uint8_t *p = (const uint8_t *) + const auto *p = (const uint8_t *) memchr(data.data, 0xff, data.size); if (p == nullptr) { /* no marker - discard the buffer */ diff --git a/src/decoder/plugins/FlacInput.cxx b/src/decoder/plugins/FlacInput.cxx index a9830cd7e..94bbf9ca1 100644 --- a/src/decoder/plugins/FlacInput.cxx +++ b/src/decoder/plugins/FlacInput.cxx @@ -102,7 +102,7 @@ FlacInput::Read(gcc_unused const FLAC__StreamDecoder *flac_decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) { - FlacInput *i = (FlacInput *)client_data; + auto *i = (FlacInput *)client_data; return i->Read(buffer, bytes); } @@ -111,7 +111,7 @@ FLAC__StreamDecoderSeekStatus FlacInput::Seek(gcc_unused const FLAC__StreamDecoder *flac_decoder, FLAC__uint64 absolute_byte_offset, void *client_data) { - FlacInput *i = (FlacInput *)client_data; + auto *i = (FlacInput *)client_data; return i->Seek(absolute_byte_offset); } @@ -120,7 +120,7 @@ FLAC__StreamDecoderTellStatus FlacInput::Tell(gcc_unused const FLAC__StreamDecoder *flac_decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) { - FlacInput *i = (FlacInput *)client_data; + auto *i = (FlacInput *)client_data; return i->Tell(absolute_byte_offset); } @@ -129,7 +129,7 @@ FLAC__StreamDecoderLengthStatus FlacInput::Length(gcc_unused const FLAC__StreamDecoder *flac_decoder, FLAC__uint64 *stream_length, void *client_data) { - FlacInput *i = (FlacInput *)client_data; + auto *i = (FlacInput *)client_data; return i->Length(stream_length); } @@ -138,7 +138,7 @@ FLAC__bool FlacInput::Eof(gcc_unused const FLAC__StreamDecoder *flac_decoder, void *client_data) { - FlacInput *i = (FlacInput *)client_data; + auto *i = (FlacInput *)client_data; return i->Eof(); } @@ -147,7 +147,7 @@ void FlacInput::Error(gcc_unused const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) { - FlacInput *i = (FlacInput *)client_data; + auto *i = (FlacInput *)client_data; i->Error(status); } diff --git a/src/decoder/plugins/MpcdecDecoderPlugin.cxx b/src/decoder/plugins/MpcdecDecoderPlugin.cxx index ce86a15bf..c19aee75c 100644 --- a/src/decoder/plugins/MpcdecDecoderPlugin.cxx +++ b/src/decoder/plugins/MpcdecDecoderPlugin.cxx @@ -50,7 +50,7 @@ using MpcdecSampleTraits = SampleTraits<mpcdec_sample_format>; static mpc_int32_t mpc_read_cb(mpc_reader *reader, void *ptr, mpc_int32_t size) { - struct mpc_decoder_data *data = + auto *data = (struct mpc_decoder_data *)reader->data; return decoder_read(data->client, data->is, ptr, size); @@ -59,7 +59,7 @@ mpc_read_cb(mpc_reader *reader, void *ptr, mpc_int32_t size) static mpc_bool_t mpc_seek_cb(mpc_reader *reader, mpc_int32_t offset) { - struct mpc_decoder_data *data = + auto *data = (struct mpc_decoder_data *)reader->data; try { @@ -73,7 +73,7 @@ mpc_seek_cb(mpc_reader *reader, mpc_int32_t offset) static mpc_int32_t mpc_tell_cb(mpc_reader *reader) { - struct mpc_decoder_data *data = + auto *data = (struct mpc_decoder_data *)reader->data; return (long)data->is.GetOffset(); @@ -82,7 +82,7 @@ mpc_tell_cb(mpc_reader *reader) static mpc_bool_t mpc_canseek_cb(mpc_reader *reader) { - struct mpc_decoder_data *data = + auto *data = (struct mpc_decoder_data *)reader->data; return data->is.IsSeekable(); @@ -91,7 +91,7 @@ mpc_canseek_cb(mpc_reader *reader) static mpc_int32_t mpc_getsize_cb(mpc_reader *reader) { - struct mpc_decoder_data *data = + auto *data = (struct mpc_decoder_data *)reader->data; if (!data->is.KnownSize()) diff --git a/src/decoder/plugins/OpusHead.cxx b/src/decoder/plugins/OpusHead.cxx index 81706173c..eddf05b73 100644 --- a/src/decoder/plugins/OpusHead.cxx +++ b/src/decoder/plugins/OpusHead.cxx @@ -33,7 +33,7 @@ struct OpusHead { bool ScanOpusHeader(const void *data, size_t size, unsigned &channels_r) { - const OpusHead *h = (const OpusHead *)data; + const auto *h = (const OpusHead *)data; if (size < 19 || (h->version & 0xf0) != 0) return false; diff --git a/src/decoder/plugins/VorbisDecoderPlugin.cxx b/src/decoder/plugins/VorbisDecoderPlugin.cxx index 125ec95f2..c6aea76d7 100644 --- a/src/decoder/plugins/VorbisDecoderPlugin.cxx +++ b/src/decoder/plugins/VorbisDecoderPlugin.cxx @@ -146,7 +146,7 @@ void VorbisDecoder::OnOggBeginning(const ogg_packet &_packet) { /* libvorbis wants non-const packets */ - ogg_packet &packet = const_cast<ogg_packet &>(_packet); + auto &packet = const_cast<ogg_packet &>(_packet); ReinitVorbis(); @@ -251,7 +251,7 @@ void VorbisDecoder::OnOggPacket(const ogg_packet &_packet) { /* libvorbis wants non-const packets */ - ogg_packet &packet = const_cast<ogg_packet &>(_packet); + auto &packet = const_cast<ogg_packet &>(_packet); if (remaining_header_packets > 0) { if (vorbis_synthesis_headerin(&vi, &vc, &packet) != 0) diff --git a/src/decoder/plugins/WavpackDecoderPlugin.cxx b/src/decoder/plugins/WavpackDecoderPlugin.cxx index 2dc66b76d..a79f0997b 100644 --- a/src/decoder/plugins/WavpackDecoderPlugin.cxx +++ b/src/decoder/plugins/WavpackDecoderPlugin.cxx @@ -127,7 +127,7 @@ template<typename T> static void format_samples_int(void *buffer, uint32_t count) { - int32_t *src = (int32_t *)buffer; + auto *src = (int32_t *)buffer; T *dst = (T *)buffer; /* * The asserts like the following one are because we do the @@ -368,7 +368,7 @@ wavpack_input_read_bytes(void *id, void *data, int32_t bcount) int32_t WavpackInput::ReadBytes(void *data, size_t bcount) { - uint8_t *buf = (uint8_t *)data; + auto *buf = (uint8_t *)data; int32_t i = 0; if (last_byte != EOF) { diff --git a/src/encoder/plugins/LameEncoderPlugin.cxx b/src/encoder/plugins/LameEncoderPlugin.cxx index fef90a135..6b06d2ad6 100644 --- a/src/encoder/plugins/LameEncoderPlugin.cxx +++ b/src/encoder/plugins/LameEncoderPlugin.cxx @@ -166,7 +166,7 @@ LameEncoder::~LameEncoder() noexcept void LameEncoder::Write(const void *data, size_t length) { - const int16_t *src = (const int16_t*)data; + const auto *src = (const int16_t*)data; assert(output_begin == output_end); diff --git a/src/encoder/plugins/OpusEncoderPlugin.cxx b/src/encoder/plugins/OpusEncoderPlugin.cxx index 1cb345aa6..233f03799 100644 --- a/src/encoder/plugins/OpusEncoderPlugin.cxx +++ b/src/encoder/plugins/OpusEncoderPlugin.cxx @@ -248,7 +248,7 @@ OpusEncoder::WriteSilence(unsigned fill_frames) void OpusEncoder::Write(const void *_data, size_t length) { - const uint8_t *data = (const uint8_t *)_data; + const auto *data = (const uint8_t *)_data; if (lookahead > 0) { /* generate some silence at the beginning of the @@ -323,7 +323,7 @@ OpusEncoder::GenerateTags(const Tag *tag) noexcept } } - unsigned char *comments = new unsigned char[comments_size]; + auto *comments = new unsigned char[comments_size]; unsigned char *p = comments; memcpy(comments, "OpusTags", 8); diff --git a/src/encoder/plugins/ShineEncoderPlugin.cxx b/src/encoder/plugins/ShineEncoderPlugin.cxx index cc427d700..93c9c9ed5 100644 --- a/src/encoder/plugins/ShineEncoderPlugin.cxx +++ b/src/encoder/plugins/ShineEncoderPlugin.cxx @@ -167,7 +167,7 @@ ShineEncoder::WriteChunk(bool flush) void ShineEncoder::Write(const void *_data, size_t length) { - const int16_t *data = (const int16_t*)_data; + const auto *data = (const int16_t*)_data; length /= sizeof(*data) * audio_format.channels; size_t written = 0; diff --git a/src/encoder/plugins/TwolameEncoderPlugin.cxx b/src/encoder/plugins/TwolameEncoderPlugin.cxx index 70bf5249c..7952f12c7 100644 --- a/src/encoder/plugins/TwolameEncoderPlugin.cxx +++ b/src/encoder/plugins/TwolameEncoderPlugin.cxx @@ -186,7 +186,7 @@ TwolameEncoder::~TwolameEncoder() noexcept void TwolameEncoder::Write(const void *data, size_t length) { - const int16_t *src = (const int16_t*)data; + const auto *src = (const int16_t*)data; assert(output_buffer_position == output_buffer_length); diff --git a/src/filter/plugins/ChainFilterPlugin.cxx b/src/filter/plugins/ChainFilterPlugin.cxx index 73742b30a..ba4a000dd 100644 --- a/src/filter/plugins/ChainFilterPlugin.cxx +++ b/src/filter/plugins/ChainFilterPlugin.cxx @@ -181,7 +181,7 @@ void filter_chain_append(PreparedFilter &_chain, const char *name, std::unique_ptr<PreparedFilter> filter) noexcept { - PreparedChainFilter &chain = (PreparedChainFilter &)_chain; + auto &chain = (PreparedChainFilter &)_chain; chain.Append(name, std::move(filter)); } diff --git a/src/filter/plugins/ConvertFilterPlugin.cxx b/src/filter/plugins/ConvertFilterPlugin.cxx index 8e599683c..28f35e03a 100644 --- a/src/filter/plugins/ConvertFilterPlugin.cxx +++ b/src/filter/plugins/ConvertFilterPlugin.cxx @@ -130,7 +130,7 @@ convert_filter_new(const AudioFormat in_audio_format, void convert_filter_set(Filter *_filter, AudioFormat out_audio_format) { - ConvertFilter *filter = (ConvertFilter *)_filter; + auto *filter = (ConvertFilter *)_filter; filter->Set(out_audio_format); } diff --git a/src/filter/plugins/NormalizeFilterPlugin.cxx b/src/filter/plugins/NormalizeFilterPlugin.cxx index bd315c91b..a8cf182cd 100644 --- a/src/filter/plugins/NormalizeFilterPlugin.cxx +++ b/src/filter/plugins/NormalizeFilterPlugin.cxx @@ -69,7 +69,7 @@ PreparedNormalizeFilter::Open(AudioFormat &audio_format) ConstBuffer<void> NormalizeFilter::FilterPCM(ConstBuffer<void> src) { - int16_t *dest = (int16_t *)buffer.Get(src.size); + auto *dest = (int16_t *)buffer.Get(src.size); memcpy(dest, src.data, src.size); Compressor_Process_int16(compressor, dest, src.size / 2); diff --git a/src/filter/plugins/RouteFilterPlugin.cxx b/src/filter/plugins/RouteFilterPlugin.cxx index 82c1880c9..15cf522e3 100644 --- a/src/filter/plugins/RouteFilterPlugin.cxx +++ b/src/filter/plugins/RouteFilterPlugin.cxx @@ -230,14 +230,14 @@ RouteFilter::FilterPCM(ConstBuffer<void> src) const size_t bytes_per_frame_per_channel = input_format.GetSampleSize(); // A moving pointer that always refers to channel 0 in the input, at the currently handled frame - const uint8_t *base_source = (const uint8_t *)src.data; + const auto *base_source = (const uint8_t *)src.data; // Grow our reusable buffer, if needed, and set the moving pointer const size_t result_size = number_of_frames * output_frame_size; void *const result = output_buffer.Get(result_size); // A moving pointer that always refers to the currently filled channel of the currently handled frame, in the output - uint8_t *chan_destination = (uint8_t *)result; + auto *chan_destination = (uint8_t *)result; // Perform our copy operations, with N input channels and M output channels for (unsigned int s=0; s<number_of_frames; ++s) { diff --git a/src/filter/plugins/VolumeFilterPlugin.cxx b/src/filter/plugins/VolumeFilterPlugin.cxx index 7d6dbd726..2b21e7103 100644 --- a/src/filter/plugins/VolumeFilterPlugin.cxx +++ b/src/filter/plugins/VolumeFilterPlugin.cxx @@ -73,7 +73,7 @@ volume_filter_prepare() noexcept unsigned volume_filter_get(const Filter *_filter) noexcept { - const VolumeFilter *filter = + const auto *filter = (const VolumeFilter *)_filter; return filter->GetVolume(); @@ -82,7 +82,7 @@ volume_filter_get(const Filter *_filter) noexcept void volume_filter_set(Filter *_filter, unsigned volume) noexcept { - VolumeFilter *filter = (VolumeFilter *)_filter; + auto *filter = (VolumeFilter *)_filter; filter->SetVolume(volume); } diff --git a/src/fs/io/AutoGunzipReader.cxx b/src/fs/io/AutoGunzipReader.cxx index a5bbd7516..ce311809d 100644 --- a/src/fs/io/AutoGunzipReader.cxx +++ b/src/fs/io/AutoGunzipReader.cxx @@ -36,7 +36,7 @@ IsGzip(const uint8_t data[4]) noexcept inline void AutoGunzipReader::Detect() { - const uint8_t *data = (const uint8_t *)peek.Peek(4); + const auto *data = (const uint8_t *)peek.Peek(4); if (data == nullptr) { next = &peek; return; diff --git a/src/input/InputStream.cxx b/src/input/InputStream.cxx index 3e184d901..0ca298f5b 100644 --- a/src/input/InputStream.cxx +++ b/src/input/InputStream.cxx @@ -124,7 +124,7 @@ InputStream::LockRead(void *ptr, size_t _size) void InputStream::ReadFull(std::unique_lock<Mutex> &lock, void *_ptr, size_t _size) { - uint8_t *ptr = (uint8_t *)_ptr; + auto *ptr = (uint8_t *)_ptr; size_t nbytes_total = 0; while (_size > 0) { diff --git a/src/lib/nfs/Connection.cxx b/src/lib/nfs/Connection.cxx index 8b0651c7c..e51ebf509 100644 --- a/src/lib/nfs/Connection.cxx +++ b/src/lib/nfs/Connection.cxx @@ -160,7 +160,7 @@ NfsConnection::CancellableCallback::Callback(int err, void *data) noexcept assert(close_fh == nullptr); if (err >= 0) { - struct nfsfh *fh = (struct nfsfh *)data; + auto *fh = (struct nfsfh *)data; connection.Close(fh); } } else if (close_fh != nullptr) @@ -574,7 +574,7 @@ void NfsConnection::MountCallback(int status, nfs_context *nfs, void *data, void *private_data) noexcept { - NfsConnection *c = (NfsConnection *)private_data; + auto *c = (NfsConnection *)private_data; c->MountCallback(status, nfs, data); } diff --git a/src/lib/xiph/FlacIOHandle.cxx b/src/lib/xiph/FlacIOHandle.cxx index 1f4ab0974..1b523fcef 100644 --- a/src/lib/xiph/FlacIOHandle.cxx +++ b/src/lib/xiph/FlacIOHandle.cxx @@ -28,7 +28,7 @@ static size_t FlacIORead(void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle) { - InputStream *is = (InputStream *)handle; + auto *is = (InputStream *)handle; uint8_t *const p0 = (uint8_t *)ptr, *p = p0, *const end = p0 + size * nmemb; @@ -70,7 +70,7 @@ FlacIORead(void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle) static int FlacIOSeek(FLAC__IOHandle handle, FLAC__int64 _offset, int whence) { - InputStream *is = (InputStream *)handle; + auto *is = (InputStream *)handle; offset_type offset = _offset; switch (whence) { @@ -104,7 +104,7 @@ FlacIOSeek(FLAC__IOHandle handle, FLAC__int64 _offset, int whence) static FLAC__int64 FlacIOTell(FLAC__IOHandle handle) { - InputStream *is = (InputStream *)handle; + auto *is = (InputStream *)handle; return is->GetOffset(); } @@ -112,7 +112,7 @@ FlacIOTell(FLAC__IOHandle handle) static int FlacIOEof(FLAC__IOHandle handle) { - InputStream *is = (InputStream *)handle; + auto *is = (InputStream *)handle; return is->LockIsEOF(); } diff --git a/src/mixer/plugins/AlsaMixerPlugin.cxx b/src/mixer/plugins/AlsaMixerPlugin.cxx index 827035364..e3d774194 100644 --- a/src/mixer/plugins/AlsaMixerPlugin.cxx +++ b/src/mixer/plugins/AlsaMixerPlugin.cxx @@ -177,7 +177,7 @@ alsa_mixer_init(EventLoop &event_loop, gcc_unused AudioOutput &ao, MixerListener &listener, const ConfigBlock &block) { - AlsaMixer *am = new AlsaMixer(event_loop, listener); + auto *am = new AlsaMixer(event_loop, listener); am->Configure(block); return am; diff --git a/src/mixer/plugins/PulseMixerPlugin.cxx b/src/mixer/plugins/PulseMixerPlugin.cxx index 8bb5571d5..9bea8116d 100644 --- a/src/mixer/plugins/PulseMixerPlugin.cxx +++ b/src/mixer/plugins/PulseMixerPlugin.cxx @@ -108,7 +108,7 @@ static void pulse_mixer_volume_cb(gcc_unused pa_context *context, const pa_sink_input_info *i, int eol, void *userdata) { - PulseMixer *pm = (PulseMixer *)userdata; + auto *pm = (PulseMixer *)userdata; pm->VolumeCallback(i, eol); } @@ -187,9 +187,9 @@ pulse_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao, MixerListener &listener, const ConfigBlock &block) { - PulseOutput &po = (PulseOutput &)ao; + auto &po = (PulseOutput &)ao; float scale = parse_volume_scale_factor(block.GetBlockValue("scale_volume")); - PulseMixer *pm = new PulseMixer(po, listener, scale); + auto *pm = new PulseMixer(po, listener, scale); pulse_output_set_mixer(po, *pm); diff --git a/src/mixer/plugins/SoftwareMixerPlugin.cxx b/src/mixer/plugins/SoftwareMixerPlugin.cxx index b76bb0bc0..a78ddd6f9 100644 --- a/src/mixer/plugins/SoftwareMixerPlugin.cxx +++ b/src/mixer/plugins/SoftwareMixerPlugin.cxx @@ -108,6 +108,6 @@ SoftwareMixer::SetFilter(Filter *_filter) noexcept void software_mixer_set_filter(Mixer &mixer, Filter *filter) noexcept { - SoftwareMixer &sm = (SoftwareMixer &)mixer; + auto &sm = (SoftwareMixer &)mixer; sm.SetFilter(filter); } diff --git a/src/net/ToString.cxx b/src/net/ToString.cxx index bd229031c..a09c377e5 100644 --- a/src/net/ToString.cxx +++ b/src/net/ToString.cxx @@ -56,7 +56,7 @@ static std::string LocalAddressToString(const struct sockaddr_un &s_un, size_t size) noexcept { - const size_t prefix_size = (size_t) + const auto prefix_size = (size_t) ((struct sockaddr_un *)nullptr)->sun_path; assert(size >= prefix_size); diff --git a/src/output/plugins/JackOutputPlugin.cxx b/src/output/plugins/JackOutputPlugin.cxx index b1fa741c1..d9c8634f4 100644 --- a/src/output/plugins/JackOutputPlugin.cxx +++ b/src/output/plugins/JackOutputPlugin.cxx @@ -283,7 +283,7 @@ MultiReadAdvance(ConstBuffer<jack_ringbuffer_t *> buffers, static void WriteSilence(jack_port_t &port, jack_nframes_t nframes) { - jack_default_audio_sample_t *out = + auto *out = (jack_default_audio_sample_t *) jack_port_get_buffer(&port, nframes); if (out == nullptr) @@ -313,7 +313,7 @@ static void Copy(jack_port_t &dest, jack_nframes_t nframes, jack_ringbuffer_t &src, jack_nframes_t available) { - jack_default_audio_sample_t *out = + auto *out = (jack_default_audio_sample_t *) jack_port_get_buffer(&dest, nframes); if (out == nullptr) diff --git a/src/output/plugins/PulseOutputPlugin.cxx b/src/output/plugins/PulseOutputPlugin.cxx index a776db75a..7bc4f3c31 100644 --- a/src/output/plugins/PulseOutputPlugin.cxx +++ b/src/output/plugins/PulseOutputPlugin.cxx @@ -326,9 +326,9 @@ inline void PulseOutput::OnServerLayoutChanged(pa_subscription_event_type_t t, uint32_t idx) { - pa_subscription_event_type_t facility = + auto facility = pa_subscription_event_type_t(t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK); - pa_subscription_event_type_t type = + auto type = pa_subscription_event_type_t(t & PA_SUBSCRIPTION_EVENT_TYPE_MASK); if (mixer != nullptr && diff --git a/src/output/plugins/RecorderOutputPlugin.cxx b/src/output/plugins/RecorderOutputPlugin.cxx index 8623eeb34..77fd709a5 100644 --- a/src/output/plugins/RecorderOutputPlugin.cxx +++ b/src/output/plugins/RecorderOutputPlugin.cxx @@ -251,7 +251,7 @@ RecorderOutput::ReopenFormat(AllocatedPath &&new_path) assert(path.IsNull()); assert(file == nullptr); - FileOutputStream *new_file = new FileOutputStream(new_path); + auto *new_file = new FileOutputStream(new_path); AudioFormat new_audio_format = effective_audio_format; diff --git a/src/pcm/Export.cxx b/src/pcm/Export.cxx index cc4bc3500..76b25d09c 100644 --- a/src/pcm/Export.cxx +++ b/src/pcm/Export.cxx @@ -297,7 +297,7 @@ PcmExport::Export(ConstBuffer<void> data) noexcept const auto src = ConstBuffer<int32_t>::FromVoid(data); const size_t num_samples = src.size; const size_t dest_size = num_samples * 3; - uint8_t *dest = (uint8_t *)pack_buffer.Get(dest_size); + auto *dest = (uint8_t *)pack_buffer.Get(dest_size); assert(dest != nullptr); pcm_pack_24(dest, src.begin(), src.end()); @@ -307,7 +307,7 @@ PcmExport::Export(ConstBuffer<void> data) noexcept } else if (shift8) { const auto src = ConstBuffer<int32_t>::FromVoid(data); - uint32_t *dest = (uint32_t *)pack_buffer.Get(data.size); + auto *dest = (uint32_t *)pack_buffer.Get(data.size); data.data = dest; for (auto i : src) @@ -319,7 +319,7 @@ PcmExport::Export(ConstBuffer<void> data) noexcept const auto src = ConstBuffer<uint8_t>::FromVoid(data); - uint8_t *dest = (uint8_t *)reverse_buffer.Get(data.size); + auto *dest = (uint8_t *)reverse_buffer.Get(data.size); assert(dest != nullptr); data.data = dest; diff --git a/src/pcm/Pack.cxx b/src/pcm/Pack.cxx index fa6b739f6..0ec6aa3df 100644 --- a/src/pcm/Pack.cxx +++ b/src/pcm/Pack.cxx @@ -23,7 +23,7 @@ static void pack_sample(uint8_t *dest, const int32_t *src0) noexcept { - const uint8_t *src = (const uint8_t *)src0; + const auto *src = (const uint8_t *)src0; if (IsBigEndian()) ++src; diff --git a/src/pcm/PcmDsd.cxx b/src/pcm/PcmDsd.cxx index a75a09089..7111c22cb 100644 --- a/src/pcm/PcmDsd.cxx +++ b/src/pcm/PcmDsd.cxx @@ -33,7 +33,7 @@ PcmDsd::ToFloat(unsigned channels, ConstBuffer<uint8_t> src) noexcept const size_t num_samples = src.size; const size_t num_frames = src.size / channels; - float *dest = buffer.GetT<float>(num_samples); + auto *dest = buffer.GetT<float>(num_samples); dsd2pcm.Translate(channels, num_frames, src.data, dest); return { dest, num_samples }; diff --git a/src/pcm/SoxrResampler.cxx b/src/pcm/SoxrResampler.cxx index 87349be40..c70c99647 100644 --- a/src/pcm/SoxrResampler.cxx +++ b/src/pcm/SoxrResampler.cxx @@ -157,7 +157,7 @@ SoxrPcmResampler::Resample(ConstBuffer<void> src) /* always round up: worst case output buffer size */ const size_t o_frames = size_t(n_frames * ratio) + 1; - float *output_buffer = (float *)buffer.Get(o_frames * frame_size); + auto *output_buffer = (float *)buffer.Get(o_frames * frame_size); size_t i_done, o_done; soxr_error_t e = soxr_process(soxr, src.data, n_frames, &i_done, @@ -174,7 +174,7 @@ SoxrPcmResampler::Flush() const size_t frame_size = channels * sizeof(float); const size_t o_frames = 1024; - float *output_buffer = (float *)buffer.Get(o_frames * frame_size); + auto *output_buffer = (float *)buffer.Get(o_frames * frame_size); size_t o_done; soxr_error_t e = soxr_process(soxr, nullptr, 0, nullptr, diff --git a/src/playlist/plugins/AsxPlaylistPlugin.cxx b/src/playlist/plugins/AsxPlaylistPlugin.cxx index 1384b4073..b4eeba8df 100644 --- a/src/playlist/plugins/AsxPlaylistPlugin.cxx +++ b/src/playlist/plugins/AsxPlaylistPlugin.cxx @@ -65,7 +65,7 @@ static void XMLCALL asx_start_element(void *user_data, const XML_Char *element_name, const XML_Char **atts) { - AsxParser *parser = (AsxParser *)user_data; + auto *parser = (AsxParser *)user_data; switch (parser->state) { case AsxParser::ROOT: @@ -97,7 +97,7 @@ asx_start_element(void *user_data, const XML_Char *element_name, static void XMLCALL asx_end_element(void *user_data, const XML_Char *element_name) { - AsxParser *parser = (AsxParser *)user_data; + auto *parser = (AsxParser *)user_data; switch (parser->state) { case AsxParser::ROOT: @@ -120,7 +120,7 @@ asx_end_element(void *user_data, const XML_Char *element_name) static void XMLCALL asx_char_data(void *user_data, const XML_Char *s, int len) { - AsxParser *parser = (AsxParser *)user_data; + auto *parser = (AsxParser *)user_data; switch (parser->state) { case AsxParser::ROOT: diff --git a/src/playlist/plugins/RssPlaylistPlugin.cxx b/src/playlist/plugins/RssPlaylistPlugin.cxx index 4fe42efb2..0c0f66e1b 100644 --- a/src/playlist/plugins/RssPlaylistPlugin.cxx +++ b/src/playlist/plugins/RssPlaylistPlugin.cxx @@ -65,7 +65,7 @@ static void XMLCALL rss_start_element(void *user_data, const XML_Char *element_name, const XML_Char **atts) { - RssParser *parser = (RssParser *)user_data; + auto *parser = (RssParser *)user_data; switch (parser->state) { case RssParser::ROOT: @@ -95,7 +95,7 @@ rss_start_element(void *user_data, const XML_Char *element_name, static void XMLCALL rss_end_element(void *user_data, const XML_Char *element_name) { - RssParser *parser = (RssParser *)user_data; + auto *parser = (RssParser *)user_data; switch (parser->state) { case RssParser::ROOT: @@ -118,7 +118,7 @@ rss_end_element(void *user_data, const XML_Char *element_name) static void XMLCALL rss_char_data(void *user_data, const XML_Char *s, int len) { - RssParser *parser = (RssParser *)user_data; + auto *parser = (RssParser *)user_data; switch (parser->state) { case RssParser::ROOT: diff --git a/src/playlist/plugins/XspfPlaylistPlugin.cxx b/src/playlist/plugins/XspfPlaylistPlugin.cxx index a9fbbde5b..8e31b4883 100644 --- a/src/playlist/plugins/XspfPlaylistPlugin.cxx +++ b/src/playlist/plugins/XspfPlaylistPlugin.cxx @@ -68,7 +68,7 @@ static void XMLCALL xspf_start_element(void *user_data, const XML_Char *element_name, gcc_unused const XML_Char **atts) { - XspfParser *parser = (XspfParser *)user_data; + auto *parser = (XspfParser *)user_data; switch (parser->state) { case XspfParser::ROOT: @@ -118,7 +118,7 @@ xspf_start_element(void *user_data, const XML_Char *element_name, static void XMLCALL xspf_end_element(void *user_data, const XML_Char *element_name) { - XspfParser *parser = (XspfParser *)user_data; + auto *parser = (XspfParser *)user_data; switch (parser->state) { case XspfParser::ROOT: @@ -157,7 +157,7 @@ xspf_end_element(void *user_data, const XML_Char *element_name) static void XMLCALL xspf_char_data(void *user_data, const XML_Char *s, int len) { - XspfParser *parser = (XspfParser *)user_data; + auto *parser = (XspfParser *)user_data; switch (parser->state) { case XspfParser::ROOT: diff --git a/src/sticker/SongSticker.cxx b/src/sticker/SongSticker.cxx index 7f2858c3d..545728290 100644 --- a/src/sticker/SongSticker.cxx +++ b/src/sticker/SongSticker.cxx @@ -87,7 +87,7 @@ struct sticker_song_find_data { static void sticker_song_find_cb(const char *uri, const char *value, void *user_data) { - struct sticker_song_find_data *data = + auto *data = (struct sticker_song_find_data *)user_data; if (memcmp(uri, data->base_uri, data->base_uri_length) != 0) diff --git a/src/storage/plugins/NfsStorage.cxx b/src/storage/plugins/NfsStorage.cxx index bf482a6ec..c7cdbfdba 100644 --- a/src/storage/plugins/NfsStorage.cxx +++ b/src/storage/plugins/NfsStorage.cxx @@ -358,7 +358,7 @@ protected: void HandleResult(gcc_unused unsigned status, void *data) noexcept override { - struct nfsdir *const dir = (struct nfsdir *)data; + auto *const dir = (struct nfsdir *)data; CollectEntries(dir); connection.CloseDirectory(dir); diff --git a/src/system/FileDescriptor.cxx b/src/system/FileDescriptor.cxx index 2e53c8086..8639d9dbf 100644 --- a/src/system/FileDescriptor.cxx +++ b/src/system/FileDescriptor.cxx @@ -290,7 +290,7 @@ FileDescriptor::GetSize() const noexcept void FileDescriptor::FullRead(void *_buffer, size_t length) { - uint8_t *buffer = (uint8_t *)_buffer; + auto *buffer = (uint8_t *)_buffer; while (length > 0) { ssize_t nbytes = Read(buffer, length); diff --git a/test/TestRewindInputStream.cxx b/test/TestRewindInputStream.cxx index b105924c2..7420bb853 100644 --- a/test/TestRewindInputStream.cxx +++ b/test/TestRewindInputStream.cxx @@ -43,7 +43,7 @@ TEST(RewindInputStream, Basic) { Mutex mutex; - StringInputStream *sis = + auto *sis = new StringInputStream("foo://", mutex, "foo bar"); EXPECT_TRUE(sis->IsReady()); diff --git a/test/test_pcm_format.cxx b/test/test_pcm_format.cxx index 5ff65dc6a..8d27a4b20 100644 --- a/test/test_pcm_format.cxx +++ b/test/test_pcm_format.cxx @@ -94,7 +94,7 @@ TEST(PcmTest, FormatFloat16) EXPECT_EQ(src[i], d[i]); /* check if clamping works */ - float *writable = const_cast<float *>(f.data); + auto *writable = const_cast<float *>(f.data); *writable++ = 1.01; *writable++ = 10; *writable++ = -1.01; @@ -140,7 +140,7 @@ TEST(PcmTest, FormatFloat32) EXPECT_NEAR(src[i], d[i], error); /* check if clamping works */ - float *writable = const_cast<float *>(f.data); + auto *writable = const_cast<float *>(f.data); *writable++ = 1.01; *writable++ = 10; *writable++ = -1.01; |