Even more MSVC-specific warnings that evaded detection in CI

fix-osga-rotate-wildly
AnyOldName3 9 months ago
parent 82bc6674dc
commit da8150e2e4

@ -132,9 +132,9 @@ const MWState::Slot* MWState::Character::createSlot(const ESM::SavedGame& profil
void MWState::Character::deleteSlot(const Slot* slot) void MWState::Character::deleteSlot(const Slot* slot)
{ {
int index = slot - mSlots.data(); std::ptrdiff_t index = slot - mSlots.data();
if (index < 0 || index >= static_cast<int>(mSlots.size())) if (index < 0 || static_cast<std::size_t>(index) >= mSlots.size())
{ {
// sanity check; not entirely reliable // sanity check; not entirely reliable
throw std::logic_error("slot not found"); throw std::logic_error("slot not found");
@ -147,9 +147,9 @@ void MWState::Character::deleteSlot(const Slot* slot)
const MWState::Slot* MWState::Character::updateSlot(const Slot* slot, const ESM::SavedGame& profile) const MWState::Slot* MWState::Character::updateSlot(const Slot* slot, const ESM::SavedGame& profile)
{ {
int index = slot - mSlots.data(); std::ptrdiff_t index = slot - mSlots.data();
if (index < 0 || index >= static_cast<int>(mSlots.size())) if (index < 0 || static_cast<std::size_t>(index) >= mSlots.size())
{ {
// sanity check; not entirely reliable // sanity check; not entirely reliable
throw std::logic_error("slot not found"); throw std::logic_error("slot not found");

@ -94,7 +94,7 @@ namespace ESM
mDataTypes |= DATA_VHGT; mDataTypes |= DATA_VHGT;
break; break;
case fourCC("WNAM"): case fourCC("WNAM"):
esm.getHExact(mWnam.data(), mWnam.size()); esm.getHExact(mWnam.data(), static_cast<int>(mWnam.size()));
mDataTypes |= DATA_WNAM; mDataTypes |= DATA_WNAM;
break; break;
case fourCC("VCLR"): case fourCC("VCLR"):
@ -206,7 +206,7 @@ namespace ESM
mLandData = std::make_unique<LandData>(); mLandData = std::make_unique<LandData>();
mLandData->mHeightOffset = 0; mLandData->mHeightOffset = 0;
std::fill(std::begin(mLandData->mHeights), std::end(mLandData->mHeights), 0); std::fill(std::begin(mLandData->mHeights), std::end(mLandData->mHeights), 0.0f);
mLandData->mMinHeight = 0; mLandData->mMinHeight = 0;
mLandData->mMaxHeight = 0; mLandData->mMaxHeight = 0;
for (int i = 0; i < LAND_NUM_VERTS; ++i) for (int i = 0; i < LAND_NUM_VERTS; ++i)

@ -87,7 +87,7 @@ namespace ESM
esm.writeHNT("DATA", mFlags); esm.writeHNT("DATA", mFlags);
esm.writeHNT("NNAM", mChanceNone); esm.writeHNT("NNAM", mChanceNone);
esm.writeHNT<uint32_t>("INDX", mList.size()); esm.writeHNT<uint32_t>("INDX", static_cast<int>(mList.size()));
for (const auto& item : mList) for (const auto& item : mList)
{ {

@ -150,7 +150,7 @@ namespace ESM
if (!hasHeader) if (!hasHeader)
esm.fail("Missing SCHD subrecord"); esm.fail("Missing SCHD subrecord");
// Reported script data size is not always trustworthy, so override it with actual data size // Reported script data size is not always trustworthy, so override it with actual data size
mData.mScriptDataSize = mScriptData.size(); mData.mScriptDataSize = static_cast<uint32_t>(mScriptData.size());
} }
void Script::save(ESMWriter& esm, bool isDeleted) const void Script::save(ESMWriter& esm, bool isDeleted) const

@ -83,8 +83,8 @@ namespace ESM4
stream.next_in = reinterpret_cast<Bytef*>(compressed.data()); stream.next_in = reinterpret_cast<Bytef*>(compressed.data());
stream.next_out = reinterpret_cast<Bytef*>(decompressed.data()); stream.next_out = reinterpret_cast<Bytef*>(decompressed.data());
stream.avail_in = compressed.size(); stream.avail_in = static_cast<uInt>(compressed.size());
stream.avail_out = decompressed.size(); stream.avail_out = static_cast<uInt>(decompressed.size());
if (const int ec = inflateInit(&stream); ec != Z_OK) if (const int ec = inflateInit(&stream); ec != Z_OK)
return getError("inflateInit error", ec, stream.msg); return getError("inflateInit error", ec, stream.msg);
@ -112,9 +112,9 @@ namespace ESM4
const auto prevTotalIn = stream.total_in; const auto prevTotalIn = stream.total_in;
const auto prevTotalOut = stream.total_out; const auto prevTotalOut = stream.total_out;
stream.next_in = reinterpret_cast<Bytef*>(compressed.data()); stream.next_in = reinterpret_cast<Bytef*>(compressed.data());
stream.avail_in = std::min(blockSize, compressed.size()); stream.avail_in = static_cast<uInt>(std::min(blockSize, compressed.size()));
stream.next_out = reinterpret_cast<Bytef*>(decompressed.data()); stream.next_out = reinterpret_cast<Bytef*>(decompressed.data());
stream.avail_out = std::min(blockSize, decompressed.size()); stream.avail_out = static_cast<uInt>(std::min(blockSize, decompressed.size()));
const int ec = inflate(&stream, Z_NO_FLUSH); const int ec = inflate(&stream, Z_NO_FLUSH);
if (ec == Z_STREAM_END) if (ec == Z_STREAM_END)
break; break;

Loading…
Cancel
Save