Browse Source

Clang-tidy: modernize-use-auto

pull/2243/head
Anders Jenbo 5 years ago
parent
commit
ec8d7bebe2
  1. 4
      Source/encrypt.cpp
  2. 2
      Source/engine/animationinfo.cpp
  3. 2
      Source/missiles.cpp
  4. 2
      Source/storm/storm_sdl_rw.cpp
  5. 2
      Source/sync.cpp
  6. 2
      Source/utils/soundsample.cpp

4
Source/encrypt.cpp

@ -71,7 +71,7 @@ void InitHash()
static unsigned int PkwareBufferRead(char *buf, unsigned int *size, void *param) // NOLINT(readability-non-const-parameter)
{
TDataInfo *pInfo = (TDataInfo *)param;
auto *pInfo = (TDataInfo *)param;
uint32_t sSize;
if (*size >= pInfo->size - pInfo->srcOffset) {
@ -88,7 +88,7 @@ static unsigned int PkwareBufferRead(char *buf, unsigned int *size, void *param)
static void PkwareBufferWrite(char *buf, unsigned int *size, void *param) // NOLINT(readability-non-const-parameter)
{
TDataInfo *pInfo = (TDataInfo *)param;
auto *pInfo = (TDataInfo *)param;
memcpy(pInfo->destData + pInfo->destOffset, buf, *size);
pInfo->destOffset += *size;

2
Source/engine/animationinfo.cpp

@ -23,7 +23,7 @@ int AnimationInfo::GetFrameToUseForRendering() const
if (CurrentFrame > RelevantFramesForDistributing)
return CurrentFrame;
float ticksSinceSequenceStarted = (float)TicksSinceSequenceStarted;
auto ticksSinceSequenceStarted = (float)TicksSinceSequenceStarted;
if (TicksSinceSequenceStarted < 0) {
ticksSinceSequenceStarted = 0.0F;
Log("GetFrameToUseForRendering: Invalid TicksSinceSequenceStarted {}", TicksSinceSequenceStarted);

2
Source/missiles.cpp

@ -4683,7 +4683,7 @@ void MI_Cbolt(int i)
if (missile[i]._miVar3 == 0) {
constexpr int bpath[16] = { -1, 0, 1, -1, 0, 1, -1, -1, 0, 0, 1, 1, 0, 1, -1, 0 };
Direction md = static_cast<Direction>(missile[i]._miVar2);
auto md = static_cast<Direction>(missile[i]._miVar2);
switch (bpath[missile[i]._mirnd]) {
case -1:
md = left[md];

2
Source/storm/storm_sdl_rw.cpp

@ -78,7 +78,7 @@ static int SFileRwClose(struct SDL_RWops *context)
SDL_RWops *SFileRw_FromStormHandle(HANDLE handle)
{
SDL_RWops *result = new SDL_RWops();
auto *result = new SDL_RWops();
std::memset(result, 0, sizeof(*result));
#ifndef USE_SDL1

2
Source/sync.cpp

@ -249,7 +249,7 @@ uint32_t sync_update(int pnum, const byte *pbBuf)
{
uint16_t wLen;
TSyncHeader *pHdr = (TSyncHeader *)pbBuf;
auto *pHdr = (TSyncHeader *)pbBuf;
pbBuf += sizeof(*pHdr);
if (pHdr->bCmd != CMD_SYNCDATA) {

2
Source/utils/soundsample.cpp

@ -60,7 +60,7 @@ float PanLogToLinear(int logPan)
float VolumeLogToLinear(int logVolume, int logMin, int logMax)
{
const float logScaled = math::Remap<float>(logMin, logMax, MillibelMin, MillibelMax, logVolume);
const auto logScaled = math::Remap<float>(logMin, logMax, MillibelMin, MillibelMax, logVolume);
const auto linVolume = std::pow(LogBase, static_cast<float>(logScaled) / VolumeScale);
return linVolume;
}

Loading…
Cancel
Save