[cppcheck] use const for several variables

Found with constVariable

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-03-23 20:17:24 -07:00
parent 637840264a
commit f319f88df4
3 changed files with 15 additions and 15 deletions

View File

@ -56,8 +56,8 @@ struct SndfileInputStream {
static sf_count_t
sndfile_vio_get_filelen(void *user_data)
{
SndfileInputStream &sis = *(SndfileInputStream *)user_data;
const InputStream &is = sis.is;
const auto &sis = *(SndfileInputStream *)user_data;
const auto &is = sis.is;
if (!is.KnownSize())
return -1;
@ -120,8 +120,8 @@ sndfile_vio_write([[maybe_unused]] const void *ptr,
static sf_count_t
sndfile_vio_tell(void *user_data)
{
SndfileInputStream &sis = *(SndfileInputStream *)user_data;
const InputStream &is = sis.is;
const auto &sis = *(SndfileInputStream *)user_data;
const auto &is = sis.is;
return is.GetOffset();
}

View File

@ -398,21 +398,21 @@ WavpackInput::ReadBytes(void *data, size_t bcount)
static int64_t
wavpack_input_get_pos(void *id)
{
WavpackInput &wpi = *wpin(id);
const auto &wpi = *wpin(id);
return wpi.GetPos();
}
static int
wavpack_input_set_pos_abs(void *id, int64_t pos)
{
WavpackInput &wpi = *wpin(id);
auto &wpi = *wpin(id);
return wpi.SetPosAbs(pos);
}
static int
wavpack_input_set_pos_rel(void *id, int64_t delta, int mode)
{
WavpackInput &wpi = *wpin(id);
auto &wpi = *wpin(id);
return wpi.SetPosRel(delta, mode);
}
@ -421,21 +421,21 @@ wavpack_input_set_pos_rel(void *id, int64_t delta, int mode)
static uint32_t
wavpack_input_get_pos(void *id)
{
WavpackInput &wpi = *wpin(id);
const auto &wpi = *wpin(id);
return wpi.GetPos();
}
static int
wavpack_input_set_pos_abs(void *id, uint32_t pos)
{
WavpackInput &wpi = *wpin(id);
auto &wpi = *wpin(id);
return wpi.SetPosAbs(pos);
}
static int
wavpack_input_set_pos_rel(void *id, int32_t delta, int mode)
{
WavpackInput &wpi = *wpin(id);
auto &wpi = *wpin(id);
return wpi.SetPosRel(delta, mode);
}
@ -444,7 +444,7 @@ wavpack_input_set_pos_rel(void *id, int32_t delta, int mode)
static int
wavpack_input_push_back_byte(void *id, int c)
{
WavpackInput &wpi = *wpin(id);
auto &wpi = *wpin(id);
return wpi.PushBackByte(c);
}
@ -453,7 +453,7 @@ wavpack_input_push_back_byte(void *id, int c)
static int64_t
wavpack_input_get_length(void *id)
{
WavpackInput &wpi = *wpin(id);
const auto &wpi = *wpin(id);
return wpi.GetLength();
}
@ -462,7 +462,7 @@ wavpack_input_get_length(void *id)
static uint32_t
wavpack_input_get_length(void *id)
{
WavpackInput &wpi = *wpin(id);
const auto &wpi = *wpin(id);
return wpi.GetLength();
}
@ -471,7 +471,7 @@ wavpack_input_get_length(void *id)
static int
wavpack_input_can_seek(void *id)
{
WavpackInput &wpi = *wpin(id);
const auto &wpi = *wpin(id);
return wpi.CanSeek();
}

View File

@ -63,7 +63,7 @@ PollGroupPoll::Remove(int fd) noexcept
{
auto item_iter = items.find(fd);
assert(item_iter != items.end());
auto &item = item_iter->second;
const auto &item = item_iter->second;
size_t index = item.index;
size_t last_index = poll_events.size() - 1;
if (index != last_index) {