diff --git a/apps/openmw/mwstate/character.cpp b/apps/openmw/mwstate/character.cpp index 9a3bc46742..a486ff4bec 100644 --- a/apps/openmw/mwstate/character.cpp +++ b/apps/openmw/mwstate/character.cpp @@ -132,9 +132,9 @@ const MWState::Slot* MWState::Character::createSlot(const ESM::SavedGame& profil 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(mSlots.size())) + if (index < 0 || static_cast(index) >= mSlots.size()) { // sanity check; not entirely reliable 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) { - int index = slot - mSlots.data(); + std::ptrdiff_t index = slot - mSlots.data(); - if (index < 0 || index >= static_cast(mSlots.size())) + if (index < 0 || static_cast(index) >= mSlots.size()) { // sanity check; not entirely reliable throw std::logic_error("slot not found"); diff --git a/components/esm3/loadland.cpp b/components/esm3/loadland.cpp index 98e07b530f..006510f21b 100644 --- a/components/esm3/loadland.cpp +++ b/components/esm3/loadland.cpp @@ -94,7 +94,7 @@ namespace ESM mDataTypes |= DATA_VHGT; break; case fourCC("WNAM"): - esm.getHExact(mWnam.data(), mWnam.size()); + esm.getHExact(mWnam.data(), static_cast(mWnam.size())); mDataTypes |= DATA_WNAM; break; case fourCC("VCLR"): @@ -206,7 +206,7 @@ namespace ESM mLandData = std::make_unique(); 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->mMaxHeight = 0; for (int i = 0; i < LAND_NUM_VERTS; ++i) diff --git a/components/esm3/loadlevlist.cpp b/components/esm3/loadlevlist.cpp index 627edbadce..766fd42054 100644 --- a/components/esm3/loadlevlist.cpp +++ b/components/esm3/loadlevlist.cpp @@ -87,7 +87,7 @@ namespace ESM esm.writeHNT("DATA", mFlags); esm.writeHNT("NNAM", mChanceNone); - esm.writeHNT("INDX", mList.size()); + esm.writeHNT("INDX", static_cast(mList.size())); for (const auto& item : mList) { diff --git a/components/esm3/loadscpt.cpp b/components/esm3/loadscpt.cpp index 2eb272fe8b..ae56a7b4f4 100644 --- a/components/esm3/loadscpt.cpp +++ b/components/esm3/loadscpt.cpp @@ -150,7 +150,7 @@ namespace ESM if (!hasHeader) esm.fail("Missing SCHD subrecord"); // Reported script data size is not always trustworthy, so override it with actual data size - mData.mScriptDataSize = mScriptData.size(); + mData.mScriptDataSize = static_cast(mScriptData.size()); } void Script::save(ESMWriter& esm, bool isDeleted) const diff --git a/components/esm4/reader.cpp b/components/esm4/reader.cpp index 9811cf6103..2d9a929bb2 100644 --- a/components/esm4/reader.cpp +++ b/components/esm4/reader.cpp @@ -83,8 +83,8 @@ namespace ESM4 stream.next_in = reinterpret_cast(compressed.data()); stream.next_out = reinterpret_cast(decompressed.data()); - stream.avail_in = compressed.size(); - stream.avail_out = decompressed.size(); + stream.avail_in = static_cast(compressed.size()); + stream.avail_out = static_cast(decompressed.size()); if (const int ec = inflateInit(&stream); ec != Z_OK) return getError("inflateInit error", ec, stream.msg); @@ -112,9 +112,9 @@ namespace ESM4 const auto prevTotalIn = stream.total_in; const auto prevTotalOut = stream.total_out; stream.next_in = reinterpret_cast(compressed.data()); - stream.avail_in = std::min(blockSize, compressed.size()); + stream.avail_in = static_cast(std::min(blockSize, compressed.size())); stream.next_out = reinterpret_cast(decompressed.data()); - stream.avail_out = std::min(blockSize, decompressed.size()); + stream.avail_out = static_cast(std::min(blockSize, decompressed.size())); const int ec = inflate(&stream, Z_NO_FLUSH); if (ec == Z_STREAM_END) break;