Browse Source

Fix MSVC related warnings with sdl2

pull/8045/head
obligaron 9 months ago committed by Gleb Mazovetskiy
parent
commit
98f097997c
  1. 4
      Source/msg.cpp
  2. 2
      test/text_render_integration_test.cpp
  3. 4
      test/vision_test.cpp

4
Source/msg.cpp

@ -770,7 +770,7 @@ void DeltaImportData(_cmd_id cmd, uint32_t recvOffset, int pnum)
#ifdef USE_PKWARE
if (sgRecvBuf[0] != std::byte { 0 }) {
deltaSize = PkwareDecompress(&sgRecvBuf[1], deltaSize, sizeof(sgRecvBuf) - 1);
deltaSize = PkwareDecompress(&sgRecvBuf[1], static_cast<uint32_t>(deltaSize), sizeof(sgRecvBuf) - 1);
if (deltaSize == 0) {
Log("PKWare decompression failure, dropping player {}", pnum);
SNetDropPlayer(pnum, LEAVE_DROP);
@ -3303,7 +3303,7 @@ bool ValidateCmdSize(size_t requiredCmdSize, size_t maxCmdSize, size_t playerId)
return true;
Log("Suspiciously small packet size, dropping player {}", playerId);
SNetDropPlayer(playerId, LEAVE_DROP);
SNetDropPlayer(static_cast<uint8_t>(playerId), LEAVE_DROP);
return false;
}

2
test/text_render_integration_test.cpp

@ -226,7 +226,7 @@ std::vector<std::byte> ReadFile(const std::string &path)
SDL_RWops *rwops = SDL_RWFromFile(path.c_str(), "rb");
std::vector<std::byte> result;
if (rwops == nullptr) return result;
const size_t size = SDL_RWsize(rwops);
const size_t size = static_cast<size_t>(SDL_RWsize(rwops));
result.resize(size);
SDL_RWread(rwops, result.data(), size, 1);
SDL_RWclose(rwops);

4
test/vision_test.cpp

@ -86,7 +86,11 @@ void dumpVisibleEnv()
}
sz += snprintf(buf + sz, sizeof(buf) - sz, "\n");
}
#ifdef _WIN32
_write(2, buf, sz);
#else
write(2, buf, sz);
#endif
}
// This test case checks the visibility of surrounding objects

Loading…
Cancel
Save