*: use `auto`

This commit is contained in:
Max Kellermann 2020-02-01 13:55:08 +01:00
parent 4f22f4d357
commit 72ec641f0d
51 changed files with 87 additions and 87 deletions

View File

@ -194,7 +194,7 @@ icy_parse_tag(
size_t size_t
IcyMetaDataParser::Meta(const void *data, size_t length) noexcept 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(IsDefined());
assert(data_rest == 0); assert(data_rest == 0);
@ -254,7 +254,7 @@ IcyMetaDataParser::Meta(const void *data, size_t length) noexcept
size_t size_t
IcyMetaDataParser::ParseInPlace(void *data, size_t length) noexcept 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; uint8_t *dest = dest0;
const uint8_t *src = dest0; const uint8_t *src = dest0;

View File

@ -172,7 +172,7 @@ InitStorage(Instance &instance, EventLoop &event_loop,
if (storage == nullptr) if (storage == nullptr)
return; return;
CompositeStorage *composite = new CompositeStorage(); auto *composite = new CompositeStorage();
instance.storage = composite; instance.storage = composite;
composite->Mount("", std::move(storage)); composite->Mount("", std::move(storage));
} }

View File

@ -67,7 +67,7 @@ client_new(EventLoop &loop, Partition &partition,
(void)fd.Write(GREETING, sizeof(GREETING) - 1); (void)fd.Write(GREETING, sizeof(GREETING) - 1);
const unsigned num = next_client_num++; 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, permission,
num); num);

View File

@ -42,7 +42,7 @@ static void
sticker_song_find_print_cb(const LightSong &song, const char *value, sticker_song_find_print_cb(const LightSong &song, const char *value,
void *user_data) void *user_data)
{ {
struct sticker_song_find_data *data = auto *data =
(struct sticker_song_find_data *)user_data; (struct sticker_song_find_data *)user_data;
song_print_uri(data->r, song); song_print_uri(data->r, song);

View File

@ -112,7 +112,7 @@ ReadConfigBlock(ConfigData &config_data, BufferedReader &reader,
const char *name, ConfigBlockOption o, const char *name, ConfigBlockOption o,
Tokenizer &tokenizer) Tokenizer &tokenizer)
{ {
const unsigned i = unsigned(o); const auto i = unsigned(o);
const ConfigTemplate &option = config_block_templates[i]; const ConfigTemplate &option = config_block_templates[i];
if (option.deprecated) if (option.deprecated)
@ -144,7 +144,7 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader,
const char *name, ConfigOption o, const char *name, ConfigOption o,
Tokenizer &tokenizer) Tokenizer &tokenizer)
{ {
const unsigned i = unsigned(o); const auto i = unsigned(o);
const ConfigTemplate &option = config_param_templates[i]; const ConfigTemplate &option = config_param_templates[i];
if (option.deprecated) if (option.deprecated)

View File

@ -584,7 +584,7 @@ ProxyDatabase::OnSocketReady(gcc_unused unsigned flags) noexcept
return true; return true;
} }
unsigned idle = (unsigned)mpd_recv_idle(connection, false); auto idle = (unsigned)mpd_recv_idle(connection, false);
if (idle == 0) { if (idle == 0) {
try { try {
CheckError(connection); CheckError(connection);
@ -666,7 +666,7 @@ ProxyDatabase::ReturnSong(const LightSong *_song) const noexcept
{ {
assert(_song != nullptr); assert(_song != nullptr);
AllocatedProxySong *song = (AllocatedProxySong *) auto *song = (AllocatedProxySong *)
const_cast<LightSong *>(_song); const_cast<LightSong *>(_song);
delete song; delete song;
} }

View File

@ -83,7 +83,7 @@ Directory::CreateChild(const char *name_utf8) noexcept
? std::string(name_utf8) ? std::string(name_utf8)
: PathTraitsUTF8::Build(GetPath(), 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); children.push_back(*child);
return child; return child;
} }

View File

@ -177,7 +177,7 @@ UpnpDatabase::ReturnSong(const LightSong *_song) const noexcept
{ {
assert(_song != nullptr); assert(_song != nullptr);
UpnpSong *song = (UpnpSong *)const_cast<LightSong *>(_song); auto *song = (UpnpSong *)const_cast<LightSong *>(_song);
delete song; delete song;
} }

View File

@ -47,7 +47,7 @@ InotifySource::OnSocketReady(gcc_unused unsigned flags) noexcept
while (true) { while (true) {
const size_t remaining = end - p; const size_t remaining = end - p;
const struct inotify_event *event = const auto *event =
(const struct inotify_event *)p; (const struct inotify_event *)p;
if (remaining < sizeof(*event) || if (remaining < sizeof(*event) ||
remaining < sizeof(*event) + event->len) remaining < sizeof(*event) + event->len)

View File

@ -480,7 +480,7 @@ DecoderBridge::SubmitData(InputStream *is,
if (dc.end_time.IsPositive()) { if (dc.end_time.IsPositive()) {
/* enforce the given end time */ /* 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); dc.end_time.ToScale<uint64_t>(dc.in_audio_format.sample_rate);
if (absolute_frame >= end_frame) if (absolute_frame >= end_frame)
return DecoderCommand::STOP; return DecoderCommand::STOP;

View File

@ -46,7 +46,7 @@ bool
decoder_read_full(DecoderClient *client, InputStream &is, decoder_read_full(DecoderClient *client, InputStream &is,
void *_buffer, size_t size) void *_buffer, size_t size)
{ {
uint8_t *buffer = (uint8_t *)_buffer; auto *buffer = (uint8_t *)_buffer;
while (size > 0) { while (size > 0) {
size_t nbytes = decoder_read(client, is, buffer, size); size_t nbytes = decoder_read(client, is, buffer, size);

View File

@ -209,10 +209,10 @@ audiofile_stream_decode(DecoderClient &client, InputStream &is)
const auto audio_format = CheckAudioFormat(fh); const auto audio_format = CheckAudioFormat(fh);
const auto total_time = audiofile_get_duration(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()); (is.GetSize() * uint64_t(8) / total_time.ToMS());
const unsigned frame_size = (unsigned) const auto frame_size = (unsigned)
afGetVirtualFrameSize(fh, AF_DEFAULT_TRACK, true); afGetVirtualFrameSize(fh, AF_DEFAULT_TRACK, true);
client.Ready(audio_format, true, total_time); client.Ready(audio_format, true, total_time);

View File

@ -133,7 +133,7 @@ dsdlib_tag_id3(InputStream &is, TagHandler &handler,
const id3_length_t count = count64; 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) if (id3_buf == nullptr)
return; return;

View File

@ -72,7 +72,7 @@ adts_find_frame(DecoderBuffer &buffer)
return 0; return 0;
/* find the 0xff marker */ /* find the 0xff marker */
const uint8_t *p = (const uint8_t *) const auto *p = (const uint8_t *)
memchr(data.data, 0xff, data.size); memchr(data.data, 0xff, data.size);
if (p == nullptr) { if (p == nullptr) {
/* no marker - discard the buffer */ /* no marker - discard the buffer */

View File

@ -102,7 +102,7 @@ FlacInput::Read(gcc_unused const FLAC__StreamDecoder *flac_decoder,
FLAC__byte buffer[], size_t *bytes, FLAC__byte buffer[], size_t *bytes,
void *client_data) void *client_data)
{ {
FlacInput *i = (FlacInput *)client_data; auto *i = (FlacInput *)client_data;
return i->Read(buffer, bytes); return i->Read(buffer, bytes);
} }
@ -111,7 +111,7 @@ FLAC__StreamDecoderSeekStatus
FlacInput::Seek(gcc_unused const FLAC__StreamDecoder *flac_decoder, FlacInput::Seek(gcc_unused const FLAC__StreamDecoder *flac_decoder,
FLAC__uint64 absolute_byte_offset, void *client_data) FLAC__uint64 absolute_byte_offset, void *client_data)
{ {
FlacInput *i = (FlacInput *)client_data; auto *i = (FlacInput *)client_data;
return i->Seek(absolute_byte_offset); return i->Seek(absolute_byte_offset);
} }
@ -120,7 +120,7 @@ FLAC__StreamDecoderTellStatus
FlacInput::Tell(gcc_unused const FLAC__StreamDecoder *flac_decoder, FlacInput::Tell(gcc_unused const FLAC__StreamDecoder *flac_decoder,
FLAC__uint64 *absolute_byte_offset, void *client_data) FLAC__uint64 *absolute_byte_offset, void *client_data)
{ {
FlacInput *i = (FlacInput *)client_data; auto *i = (FlacInput *)client_data;
return i->Tell(absolute_byte_offset); return i->Tell(absolute_byte_offset);
} }
@ -129,7 +129,7 @@ FLAC__StreamDecoderLengthStatus
FlacInput::Length(gcc_unused const FLAC__StreamDecoder *flac_decoder, FlacInput::Length(gcc_unused const FLAC__StreamDecoder *flac_decoder,
FLAC__uint64 *stream_length, void *client_data) FLAC__uint64 *stream_length, void *client_data)
{ {
FlacInput *i = (FlacInput *)client_data; auto *i = (FlacInput *)client_data;
return i->Length(stream_length); return i->Length(stream_length);
} }
@ -138,7 +138,7 @@ FLAC__bool
FlacInput::Eof(gcc_unused const FLAC__StreamDecoder *flac_decoder, FlacInput::Eof(gcc_unused const FLAC__StreamDecoder *flac_decoder,
void *client_data) void *client_data)
{ {
FlacInput *i = (FlacInput *)client_data; auto *i = (FlacInput *)client_data;
return i->Eof(); return i->Eof();
} }
@ -147,7 +147,7 @@ void
FlacInput::Error(gcc_unused const FLAC__StreamDecoder *decoder, FlacInput::Error(gcc_unused const FLAC__StreamDecoder *decoder,
FLAC__StreamDecoderErrorStatus status, void *client_data) FLAC__StreamDecoderErrorStatus status, void *client_data)
{ {
FlacInput *i = (FlacInput *)client_data; auto *i = (FlacInput *)client_data;
i->Error(status); i->Error(status);
} }

View File

@ -50,7 +50,7 @@ using MpcdecSampleTraits = SampleTraits<mpcdec_sample_format>;
static mpc_int32_t static mpc_int32_t
mpc_read_cb(mpc_reader *reader, void *ptr, mpc_int32_t size) 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; (struct mpc_decoder_data *)reader->data;
return decoder_read(data->client, data->is, ptr, size); 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 static mpc_bool_t
mpc_seek_cb(mpc_reader *reader, mpc_int32_t offset) mpc_seek_cb(mpc_reader *reader, mpc_int32_t offset)
{ {
struct mpc_decoder_data *data = auto *data =
(struct mpc_decoder_data *)reader->data; (struct mpc_decoder_data *)reader->data;
try { try {
@ -73,7 +73,7 @@ mpc_seek_cb(mpc_reader *reader, mpc_int32_t offset)
static mpc_int32_t static mpc_int32_t
mpc_tell_cb(mpc_reader *reader) mpc_tell_cb(mpc_reader *reader)
{ {
struct mpc_decoder_data *data = auto *data =
(struct mpc_decoder_data *)reader->data; (struct mpc_decoder_data *)reader->data;
return (long)data->is.GetOffset(); return (long)data->is.GetOffset();
@ -82,7 +82,7 @@ mpc_tell_cb(mpc_reader *reader)
static mpc_bool_t static mpc_bool_t
mpc_canseek_cb(mpc_reader *reader) mpc_canseek_cb(mpc_reader *reader)
{ {
struct mpc_decoder_data *data = auto *data =
(struct mpc_decoder_data *)reader->data; (struct mpc_decoder_data *)reader->data;
return data->is.IsSeekable(); return data->is.IsSeekable();
@ -91,7 +91,7 @@ mpc_canseek_cb(mpc_reader *reader)
static mpc_int32_t static mpc_int32_t
mpc_getsize_cb(mpc_reader *reader) mpc_getsize_cb(mpc_reader *reader)
{ {
struct mpc_decoder_data *data = auto *data =
(struct mpc_decoder_data *)reader->data; (struct mpc_decoder_data *)reader->data;
if (!data->is.KnownSize()) if (!data->is.KnownSize())

View File

@ -33,7 +33,7 @@ struct OpusHead {
bool bool
ScanOpusHeader(const void *data, size_t size, unsigned &channels_r) 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) if (size < 19 || (h->version & 0xf0) != 0)
return false; return false;

View File

@ -146,7 +146,7 @@ void
VorbisDecoder::OnOggBeginning(const ogg_packet &_packet) VorbisDecoder::OnOggBeginning(const ogg_packet &_packet)
{ {
/* libvorbis wants non-const packets */ /* libvorbis wants non-const packets */
ogg_packet &packet = const_cast<ogg_packet &>(_packet); auto &packet = const_cast<ogg_packet &>(_packet);
ReinitVorbis(); ReinitVorbis();
@ -251,7 +251,7 @@ void
VorbisDecoder::OnOggPacket(const ogg_packet &_packet) VorbisDecoder::OnOggPacket(const ogg_packet &_packet)
{ {
/* libvorbis wants non-const packets */ /* 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 (remaining_header_packets > 0) {
if (vorbis_synthesis_headerin(&vi, &vc, &packet) != 0) if (vorbis_synthesis_headerin(&vi, &vc, &packet) != 0)

View File

@ -127,7 +127,7 @@ template<typename T>
static void static void
format_samples_int(void *buffer, uint32_t count) format_samples_int(void *buffer, uint32_t count)
{ {
int32_t *src = (int32_t *)buffer; auto *src = (int32_t *)buffer;
T *dst = (T *)buffer; T *dst = (T *)buffer;
/* /*
* The asserts like the following one are because we do the * 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 int32_t
WavpackInput::ReadBytes(void *data, size_t bcount) WavpackInput::ReadBytes(void *data, size_t bcount)
{ {
uint8_t *buf = (uint8_t *)data; auto *buf = (uint8_t *)data;
int32_t i = 0; int32_t i = 0;
if (last_byte != EOF) { if (last_byte != EOF) {

View File

@ -166,7 +166,7 @@ LameEncoder::~LameEncoder() noexcept
void void
LameEncoder::Write(const void *data, size_t length) 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); assert(output_begin == output_end);

View File

@ -248,7 +248,7 @@ OpusEncoder::WriteSilence(unsigned fill_frames)
void void
OpusEncoder::Write(const void *_data, size_t length) 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) { if (lookahead > 0) {
/* generate some silence at the beginning of the /* 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; unsigned char *p = comments;
memcpy(comments, "OpusTags", 8); memcpy(comments, "OpusTags", 8);

View File

@ -167,7 +167,7 @@ ShineEncoder::WriteChunk(bool flush)
void void
ShineEncoder::Write(const void *_data, size_t length) 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; length /= sizeof(*data) * audio_format.channels;
size_t written = 0; size_t written = 0;

View File

@ -186,7 +186,7 @@ TwolameEncoder::~TwolameEncoder() noexcept
void void
TwolameEncoder::Write(const void *data, size_t length) 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); assert(output_buffer_position == output_buffer_length);

View File

@ -181,7 +181,7 @@ void
filter_chain_append(PreparedFilter &_chain, const char *name, filter_chain_append(PreparedFilter &_chain, const char *name,
std::unique_ptr<PreparedFilter> filter) noexcept std::unique_ptr<PreparedFilter> filter) noexcept
{ {
PreparedChainFilter &chain = (PreparedChainFilter &)_chain; auto &chain = (PreparedChainFilter &)_chain;
chain.Append(name, std::move(filter)); chain.Append(name, std::move(filter));
} }

View File

@ -130,7 +130,7 @@ convert_filter_new(const AudioFormat in_audio_format,
void void
convert_filter_set(Filter *_filter, AudioFormat out_audio_format) convert_filter_set(Filter *_filter, AudioFormat out_audio_format)
{ {
ConvertFilter *filter = (ConvertFilter *)_filter; auto *filter = (ConvertFilter *)_filter;
filter->Set(out_audio_format); filter->Set(out_audio_format);
} }

View File

@ -69,7 +69,7 @@ PreparedNormalizeFilter::Open(AudioFormat &audio_format)
ConstBuffer<void> ConstBuffer<void>
NormalizeFilter::FilterPCM(ConstBuffer<void> src) 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); memcpy(dest, src.data, src.size);
Compressor_Process_int16(compressor, dest, src.size / 2); Compressor_Process_int16(compressor, dest, src.size / 2);

View File

@ -230,14 +230,14 @@ RouteFilter::FilterPCM(ConstBuffer<void> src)
const size_t bytes_per_frame_per_channel = input_format.GetSampleSize(); 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 // 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 // Grow our reusable buffer, if needed, and set the moving pointer
const size_t result_size = number_of_frames * output_frame_size; const size_t result_size = number_of_frames * output_frame_size;
void *const result = output_buffer.Get(result_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 // 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 // Perform our copy operations, with N input channels and M output channels
for (unsigned int s=0; s<number_of_frames; ++s) { for (unsigned int s=0; s<number_of_frames; ++s) {

View File

@ -73,7 +73,7 @@ volume_filter_prepare() noexcept
unsigned unsigned
volume_filter_get(const Filter *_filter) noexcept volume_filter_get(const Filter *_filter) noexcept
{ {
const VolumeFilter *filter = const auto *filter =
(const VolumeFilter *)_filter; (const VolumeFilter *)_filter;
return filter->GetVolume(); return filter->GetVolume();
@ -82,7 +82,7 @@ volume_filter_get(const Filter *_filter) noexcept
void void
volume_filter_set(Filter *_filter, unsigned volume) noexcept volume_filter_set(Filter *_filter, unsigned volume) noexcept
{ {
VolumeFilter *filter = (VolumeFilter *)_filter; auto *filter = (VolumeFilter *)_filter;
filter->SetVolume(volume); filter->SetVolume(volume);
} }

View File

@ -36,7 +36,7 @@ IsGzip(const uint8_t data[4]) noexcept
inline void inline void
AutoGunzipReader::Detect() AutoGunzipReader::Detect()
{ {
const uint8_t *data = (const uint8_t *)peek.Peek(4); const auto *data = (const uint8_t *)peek.Peek(4);
if (data == nullptr) { if (data == nullptr) {
next = &peek; next = &peek;
return; return;

View File

@ -124,7 +124,7 @@ InputStream::LockRead(void *ptr, size_t _size)
void void
InputStream::ReadFull(std::unique_lock<Mutex> &lock, void *_ptr, size_t _size) 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; size_t nbytes_total = 0;
while (_size > 0) { while (_size > 0) {

View File

@ -160,7 +160,7 @@ NfsConnection::CancellableCallback::Callback(int err, void *data) noexcept
assert(close_fh == nullptr); assert(close_fh == nullptr);
if (err >= 0) { if (err >= 0) {
struct nfsfh *fh = (struct nfsfh *)data; auto *fh = (struct nfsfh *)data;
connection.Close(fh); connection.Close(fh);
} }
} else if (close_fh != nullptr) } else if (close_fh != nullptr)
@ -574,7 +574,7 @@ void
NfsConnection::MountCallback(int status, nfs_context *nfs, void *data, NfsConnection::MountCallback(int status, nfs_context *nfs, void *data,
void *private_data) noexcept void *private_data) noexcept
{ {
NfsConnection *c = (NfsConnection *)private_data; auto *c = (NfsConnection *)private_data;
c->MountCallback(status, nfs, data); c->MountCallback(status, nfs, data);
} }

View File

@ -28,7 +28,7 @@
static size_t static size_t
FlacIORead(void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle) 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, uint8_t *const p0 = (uint8_t *)ptr, *p = p0,
*const end = p0 + size * nmemb; *const end = p0 + size * nmemb;
@ -70,7 +70,7 @@ FlacIORead(void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle)
static int static int
FlacIOSeek(FLAC__IOHandle handle, FLAC__int64 _offset, int whence) FlacIOSeek(FLAC__IOHandle handle, FLAC__int64 _offset, int whence)
{ {
InputStream *is = (InputStream *)handle; auto *is = (InputStream *)handle;
offset_type offset = _offset; offset_type offset = _offset;
switch (whence) { switch (whence) {
@ -104,7 +104,7 @@ FlacIOSeek(FLAC__IOHandle handle, FLAC__int64 _offset, int whence)
static FLAC__int64 static FLAC__int64
FlacIOTell(FLAC__IOHandle handle) FlacIOTell(FLAC__IOHandle handle)
{ {
InputStream *is = (InputStream *)handle; auto *is = (InputStream *)handle;
return is->GetOffset(); return is->GetOffset();
} }
@ -112,7 +112,7 @@ FlacIOTell(FLAC__IOHandle handle)
static int static int
FlacIOEof(FLAC__IOHandle handle) FlacIOEof(FLAC__IOHandle handle)
{ {
InputStream *is = (InputStream *)handle; auto *is = (InputStream *)handle;
return is->LockIsEOF(); return is->LockIsEOF();
} }

View File

@ -177,7 +177,7 @@ alsa_mixer_init(EventLoop &event_loop, gcc_unused AudioOutput &ao,
MixerListener &listener, MixerListener &listener,
const ConfigBlock &block) const ConfigBlock &block)
{ {
AlsaMixer *am = new AlsaMixer(event_loop, listener); auto *am = new AlsaMixer(event_loop, listener);
am->Configure(block); am->Configure(block);
return am; return am;

View File

@ -108,7 +108,7 @@ static void
pulse_mixer_volume_cb(gcc_unused pa_context *context, const pa_sink_input_info *i, pulse_mixer_volume_cb(gcc_unused pa_context *context, const pa_sink_input_info *i,
int eol, void *userdata) int eol, void *userdata)
{ {
PulseMixer *pm = (PulseMixer *)userdata; auto *pm = (PulseMixer *)userdata;
pm->VolumeCallback(i, eol); pm->VolumeCallback(i, eol);
} }
@ -187,9 +187,9 @@ pulse_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao,
MixerListener &listener, MixerListener &listener,
const ConfigBlock &block) const ConfigBlock &block)
{ {
PulseOutput &po = (PulseOutput &)ao; auto &po = (PulseOutput &)ao;
float scale = parse_volume_scale_factor(block.GetBlockValue("scale_volume")); 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); pulse_output_set_mixer(po, *pm);

View File

@ -108,6 +108,6 @@ SoftwareMixer::SetFilter(Filter *_filter) noexcept
void void
software_mixer_set_filter(Mixer &mixer, Filter *filter) noexcept software_mixer_set_filter(Mixer &mixer, Filter *filter) noexcept
{ {
SoftwareMixer &sm = (SoftwareMixer &)mixer; auto &sm = (SoftwareMixer &)mixer;
sm.SetFilter(filter); sm.SetFilter(filter);
} }

View File

@ -56,7 +56,7 @@
static std::string static std::string
LocalAddressToString(const struct sockaddr_un &s_un, size_t size) noexcept 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; ((struct sockaddr_un *)nullptr)->sun_path;
assert(size >= prefix_size); assert(size >= prefix_size);

View File

@ -283,7 +283,7 @@ MultiReadAdvance(ConstBuffer<jack_ringbuffer_t *> buffers,
static void static void
WriteSilence(jack_port_t &port, jack_nframes_t nframes) WriteSilence(jack_port_t &port, jack_nframes_t nframes)
{ {
jack_default_audio_sample_t *out = auto *out =
(jack_default_audio_sample_t *) (jack_default_audio_sample_t *)
jack_port_get_buffer(&port, nframes); jack_port_get_buffer(&port, nframes);
if (out == nullptr) if (out == nullptr)
@ -313,7 +313,7 @@ static void
Copy(jack_port_t &dest, jack_nframes_t nframes, Copy(jack_port_t &dest, jack_nframes_t nframes,
jack_ringbuffer_t &src, jack_nframes_t available) jack_ringbuffer_t &src, jack_nframes_t available)
{ {
jack_default_audio_sample_t *out = auto *out =
(jack_default_audio_sample_t *) (jack_default_audio_sample_t *)
jack_port_get_buffer(&dest, nframes); jack_port_get_buffer(&dest, nframes);
if (out == nullptr) if (out == nullptr)

View File

@ -326,9 +326,9 @@ inline void
PulseOutput::OnServerLayoutChanged(pa_subscription_event_type_t t, PulseOutput::OnServerLayoutChanged(pa_subscription_event_type_t t,
uint32_t idx) 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(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); pa_subscription_event_type_t(t & PA_SUBSCRIPTION_EVENT_TYPE_MASK);
if (mixer != nullptr && if (mixer != nullptr &&

View File

@ -251,7 +251,7 @@ RecorderOutput::ReopenFormat(AllocatedPath &&new_path)
assert(path.IsNull()); assert(path.IsNull());
assert(file == nullptr); assert(file == nullptr);
FileOutputStream *new_file = new FileOutputStream(new_path); auto *new_file = new FileOutputStream(new_path);
AudioFormat new_audio_format = effective_audio_format; AudioFormat new_audio_format = effective_audio_format;

View File

@ -297,7 +297,7 @@ PcmExport::Export(ConstBuffer<void> data) noexcept
const auto src = ConstBuffer<int32_t>::FromVoid(data); const auto src = ConstBuffer<int32_t>::FromVoid(data);
const size_t num_samples = src.size; const size_t num_samples = src.size;
const size_t dest_size = num_samples * 3; 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); assert(dest != nullptr);
pcm_pack_24(dest, src.begin(), src.end()); pcm_pack_24(dest, src.begin(), src.end());
@ -307,7 +307,7 @@ PcmExport::Export(ConstBuffer<void> data) noexcept
} else if (shift8) { } else if (shift8) {
const auto src = ConstBuffer<int32_t>::FromVoid(data); 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; data.data = dest;
for (auto i : src) for (auto i : src)
@ -319,7 +319,7 @@ PcmExport::Export(ConstBuffer<void> data) noexcept
const auto src = ConstBuffer<uint8_t>::FromVoid(data); 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); assert(dest != nullptr);
data.data = dest; data.data = dest;

View File

@ -23,7 +23,7 @@
static void static void
pack_sample(uint8_t *dest, const int32_t *src0) noexcept 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()) if (IsBigEndian())
++src; ++src;

View File

@ -33,7 +33,7 @@ PcmDsd::ToFloat(unsigned channels, ConstBuffer<uint8_t> src) noexcept
const size_t num_samples = src.size; const size_t num_samples = src.size;
const size_t num_frames = src.size / channels; 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); dsd2pcm.Translate(channels, num_frames, src.data, dest);
return { dest, num_samples }; return { dest, num_samples };

View File

@ -157,7 +157,7 @@ SoxrPcmResampler::Resample(ConstBuffer<void> src)
/* always round up: worst case output buffer size */ /* always round up: worst case output buffer size */
const size_t o_frames = size_t(n_frames * ratio) + 1; 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; size_t i_done, o_done;
soxr_error_t e = soxr_process(soxr, src.data, n_frames, &i_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 frame_size = channels * sizeof(float);
const size_t o_frames = 1024; 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; size_t o_done;
soxr_error_t e = soxr_process(soxr, nullptr, 0, nullptr, soxr_error_t e = soxr_process(soxr, nullptr, 0, nullptr,

View File

@ -65,7 +65,7 @@ static void XMLCALL
asx_start_element(void *user_data, const XML_Char *element_name, asx_start_element(void *user_data, const XML_Char *element_name,
const XML_Char **atts) const XML_Char **atts)
{ {
AsxParser *parser = (AsxParser *)user_data; auto *parser = (AsxParser *)user_data;
switch (parser->state) { switch (parser->state) {
case AsxParser::ROOT: case AsxParser::ROOT:
@ -97,7 +97,7 @@ asx_start_element(void *user_data, const XML_Char *element_name,
static void XMLCALL static void XMLCALL
asx_end_element(void *user_data, const XML_Char *element_name) asx_end_element(void *user_data, const XML_Char *element_name)
{ {
AsxParser *parser = (AsxParser *)user_data; auto *parser = (AsxParser *)user_data;
switch (parser->state) { switch (parser->state) {
case AsxParser::ROOT: case AsxParser::ROOT:
@ -120,7 +120,7 @@ asx_end_element(void *user_data, const XML_Char *element_name)
static void XMLCALL static void XMLCALL
asx_char_data(void *user_data, const XML_Char *s, int len) 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) { switch (parser->state) {
case AsxParser::ROOT: case AsxParser::ROOT:

View File

@ -65,7 +65,7 @@ static void XMLCALL
rss_start_element(void *user_data, const XML_Char *element_name, rss_start_element(void *user_data, const XML_Char *element_name,
const XML_Char **atts) const XML_Char **atts)
{ {
RssParser *parser = (RssParser *)user_data; auto *parser = (RssParser *)user_data;
switch (parser->state) { switch (parser->state) {
case RssParser::ROOT: case RssParser::ROOT:
@ -95,7 +95,7 @@ rss_start_element(void *user_data, const XML_Char *element_name,
static void XMLCALL static void XMLCALL
rss_end_element(void *user_data, const XML_Char *element_name) rss_end_element(void *user_data, const XML_Char *element_name)
{ {
RssParser *parser = (RssParser *)user_data; auto *parser = (RssParser *)user_data;
switch (parser->state) { switch (parser->state) {
case RssParser::ROOT: case RssParser::ROOT:
@ -118,7 +118,7 @@ rss_end_element(void *user_data, const XML_Char *element_name)
static void XMLCALL static void XMLCALL
rss_char_data(void *user_data, const XML_Char *s, int len) 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) { switch (parser->state) {
case RssParser::ROOT: case RssParser::ROOT:

View File

@ -68,7 +68,7 @@ static void XMLCALL
xspf_start_element(void *user_data, const XML_Char *element_name, xspf_start_element(void *user_data, const XML_Char *element_name,
gcc_unused const XML_Char **atts) gcc_unused const XML_Char **atts)
{ {
XspfParser *parser = (XspfParser *)user_data; auto *parser = (XspfParser *)user_data;
switch (parser->state) { switch (parser->state) {
case XspfParser::ROOT: case XspfParser::ROOT:
@ -118,7 +118,7 @@ xspf_start_element(void *user_data, const XML_Char *element_name,
static void XMLCALL static void XMLCALL
xspf_end_element(void *user_data, const XML_Char *element_name) xspf_end_element(void *user_data, const XML_Char *element_name)
{ {
XspfParser *parser = (XspfParser *)user_data; auto *parser = (XspfParser *)user_data;
switch (parser->state) { switch (parser->state) {
case XspfParser::ROOT: case XspfParser::ROOT:
@ -157,7 +157,7 @@ xspf_end_element(void *user_data, const XML_Char *element_name)
static void XMLCALL static void XMLCALL
xspf_char_data(void *user_data, const XML_Char *s, int len) 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) { switch (parser->state) {
case XspfParser::ROOT: case XspfParser::ROOT:

View File

@ -87,7 +87,7 @@ struct sticker_song_find_data {
static void static void
sticker_song_find_cb(const char *uri, const char *value, void *user_data) 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; (struct sticker_song_find_data *)user_data;
if (memcmp(uri, data->base_uri, data->base_uri_length) != 0) if (memcmp(uri, data->base_uri, data->base_uri_length) != 0)

View File

@ -358,7 +358,7 @@ protected:
void HandleResult(gcc_unused unsigned status, void HandleResult(gcc_unused unsigned status,
void *data) noexcept override { void *data) noexcept override {
struct nfsdir *const dir = (struct nfsdir *)data; auto *const dir = (struct nfsdir *)data;
CollectEntries(dir); CollectEntries(dir);
connection.CloseDirectory(dir); connection.CloseDirectory(dir);

View File

@ -290,7 +290,7 @@ FileDescriptor::GetSize() const noexcept
void void
FileDescriptor::FullRead(void *_buffer, size_t length) FileDescriptor::FullRead(void *_buffer, size_t length)
{ {
uint8_t *buffer = (uint8_t *)_buffer; auto *buffer = (uint8_t *)_buffer;
while (length > 0) { while (length > 0) {
ssize_t nbytes = Read(buffer, length); ssize_t nbytes = Read(buffer, length);

View File

@ -43,7 +43,7 @@ TEST(RewindInputStream, Basic)
{ {
Mutex mutex; Mutex mutex;
StringInputStream *sis = auto *sis =
new StringInputStream("foo://", mutex, new StringInputStream("foo://", mutex,
"foo bar"); "foo bar");
EXPECT_TRUE(sis->IsReady()); EXPECT_TRUE(sis->IsReady());

View File

@ -94,7 +94,7 @@ TEST(PcmTest, FormatFloat16)
EXPECT_EQ(src[i], d[i]); EXPECT_EQ(src[i], d[i]);
/* check if clamping works */ /* check if clamping works */
float *writable = const_cast<float *>(f.data); auto *writable = const_cast<float *>(f.data);
*writable++ = 1.01; *writable++ = 1.01;
*writable++ = 10; *writable++ = 10;
*writable++ = -1.01; *writable++ = -1.01;
@ -140,7 +140,7 @@ TEST(PcmTest, FormatFloat32)
EXPECT_NEAR(src[i], d[i], error); EXPECT_NEAR(src[i], d[i], error);
/* check if clamping works */ /* check if clamping works */
float *writable = const_cast<float *>(f.data); auto *writable = const_cast<float *>(f.data);
*writable++ = 1.01; *writable++ = 1.01;
*writable++ = 10; *writable++ = 10;
*writable++ = -1.01; *writable++ = -1.01;