Fix some unused variable warnings when asserts are disabled

This commit is contained in:
Jonathan G Rennison 2023-11-20 23:59:08 +00:00
parent 0d4d4a9cac
commit 154df0bb7d
4 changed files with 7 additions and 7 deletions

View File

@ -16,7 +16,7 @@
* @param bytes_to_write The amount of bytes we want to try to write.
* @return True iff the given amount of bytes can be written to the packet.
*/
static bool BufferCanWriteToPacket(const std::vector<byte> &buffer, size_t limit, size_t bytes_to_write)
[[maybe_unused]] static bool BufferCanWriteToPacket(const std::vector<byte> &buffer, size_t limit, size_t bytes_to_write)
{
return buffer.size() + bytes_to_write <= limit;
}

View File

@ -595,13 +595,13 @@ static void Save_SLXI()
if (extra_data_length > 0) {
SlWriteUint32(extra_data_length);
size_t written = SlGetBytesWritten();
[[maybe_unused]] size_t written = SlGetBytesWritten();
info->save_proc(info, false);
assert(SlGetBytesWritten() == written + extra_data_length);
}
if (chunk_count > 0) {
SlWriteUint32(chunk_count);
size_t written = SlGetBytesWritten();
[[maybe_unused]] size_t written = SlGetBytesWritten();
WriteChunkIdList(info->chunk_list, false);
assert(SlGetBytesWritten() == written + (chunk_count * 4));
}

View File

@ -1135,11 +1135,11 @@ void *GetRawSprite(SpriteID sprite, SpriteType type, uint8 zoom_levels, Allocato
/* Load the sprite, if it is not loaded, yet */
if (sc->GetPtr() == nullptr) {
void *ptr = ReadSprite(sc, sprite, type, AllocSprite, nullptr, zoom_levels);
[[maybe_unused]] void *ptr = ReadSprite(sc, sprite, type, AllocSprite, nullptr, zoom_levels);
assert(ptr == _last_sprite_allocation.GetPtr());
sc->Assign(std::move(_last_sprite_allocation));
} else if ((sc->total_missing_zoom_levels & zoom_levels) != 0) {
void *ptr = ReadSprite(sc, sprite, type, AllocSprite, nullptr, sc->total_missing_zoom_levels & zoom_levels);
[[maybe_unused]] void *ptr = ReadSprite(sc, sprite, type, AllocSprite, nullptr, sc->total_missing_zoom_levels & zoom_levels);
assert(ptr == _last_sprite_allocation.GetPtr());
sc->Append(std::move(_last_sprite_allocation));
}

View File

@ -5601,8 +5601,8 @@ static void CheckOverflow(int &test, int &other, int max, int mult)
test = max;
}
static const uint X_DIRS = (1 << DIR_NE) | (1 << DIR_SW);
static const uint Y_DIRS = (1 << DIR_SE) | (1 << DIR_NW);
[[maybe_unused]] static const uint X_DIRS = (1 << DIR_NE) | (1 << DIR_SW);
[[maybe_unused]] static const uint Y_DIRS = (1 << DIR_SE) | (1 << DIR_NW);
static const uint HORZ_DIRS = (1 << DIR_W) | (1 << DIR_E);
//static const uint VERT_DIRS = (1 << DIR_N) | (1 << DIR_S);