*: 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

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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 */

View File

@@ -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);
}

View File

@@ -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())

View File

@@ -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;

View File

@@ -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)

View File

@@ -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) {