mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-29 04:20:29 +00:00
Merge branch 'goddamnit-there-are-more' into 'master'
Even more MSVC-specific warnings that evaded detection in CI See merge request OpenMW/openmw!3968
This commit is contained in:
commit
bf708acfac
@ -87,7 +87,7 @@ namespace MWDialogue
|
|||||||
// some keywords might be longer variations of other keywords, so we definitely need a list of
|
// some keywords might be longer variations of other keywords, so we definitely need a list of
|
||||||
// candidates the first element in the pair is length of the match, i.e. depth from the first character
|
// candidates the first element in the pair is length of the match, i.e. depth from the first character
|
||||||
// on
|
// on
|
||||||
std::vector<typename std::pair<int, typename Entry::childen_t::const_iterator>> candidates;
|
std::vector<typename std::pair<std::ptrdiff_t, typename Entry::childen_t::const_iterator>> candidates;
|
||||||
|
|
||||||
while ((j + 1) != end)
|
while ((j + 1) != end)
|
||||||
{
|
{
|
||||||
@ -148,11 +148,11 @@ namespace MWDialogue
|
|||||||
// resolve overlapping keywords
|
// resolve overlapping keywords
|
||||||
while (!matches.empty())
|
while (!matches.empty())
|
||||||
{
|
{
|
||||||
int longestKeywordSize = 0;
|
std::size_t longestKeywordSize = 0;
|
||||||
typename std::vector<Match>::iterator longestKeyword = matches.begin();
|
typename std::vector<Match>::iterator longestKeyword = matches.begin();
|
||||||
for (typename std::vector<Match>::iterator it = matches.begin(); it != matches.end(); ++it)
|
for (typename std::vector<Match>::iterator it = matches.begin(); it != matches.end(); ++it)
|
||||||
{
|
{
|
||||||
int size = it->mEnd - it->mBeg;
|
std::size_t size = it->mEnd - it->mBeg;
|
||||||
if (size > longestKeywordSize)
|
if (size > longestKeywordSize)
|
||||||
{
|
{
|
||||||
longestKeywordSize = size;
|
longestKeywordSize = size;
|
||||||
@ -199,7 +199,7 @@ namespace MWDialogue
|
|||||||
|
|
||||||
void seed_impl(std::string_view keyword, value_t value, size_t depth, Entry& entry)
|
void seed_impl(std::string_view keyword, value_t value, size_t depth, Entry& entry)
|
||||||
{
|
{
|
||||||
int ch = Misc::StringUtils::toLower(keyword.at(depth));
|
auto ch = Misc::StringUtils::toLower(keyword.at(depth));
|
||||||
|
|
||||||
typename Entry::childen_t::iterator j = entry.mChildren.find(ch);
|
typename Entry::childen_t::iterator j = entry.mChildren.find(ch);
|
||||||
|
|
||||||
|
@ -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");
|
||||||
|
@ -36,7 +36,7 @@ namespace
|
|||||||
(result.emplace_back(makeString(args)), ...);
|
(result.emplace_back(makeString(args)), ...);
|
||||||
for (int i = 1; i <= std::numeric_limits<char>::max(); ++i)
|
for (int i = 1; i <= std::numeric_limits<char>::max(); ++i)
|
||||||
if (i != '&' && i != '"' && i != ' ' && i != '\n')
|
if (i != '&' && i != '"' && i != ' ' && i != '\n')
|
||||||
result.push_back(std::string(1, i));
|
result.push_back(std::string(1, static_cast<char>(i)));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ namespace
|
|||||||
const std::int64_t value = 1099511627776;
|
const std::int64_t value = 1099511627776;
|
||||||
EXPECT_EQ(execute(*mDb, insert, value), 1);
|
EXPECT_EQ(execute(*mDb, insert, value), 1);
|
||||||
Statement select(*mDb, GetAll("ints"));
|
Statement select(*mDb, GetAll("ints"));
|
||||||
std::vector<std::tuple<int>> result;
|
std::vector<std::tuple<std::int64_t>> result;
|
||||||
request(*mDb, select, std::back_inserter(result), std::numeric_limits<std::size_t>::max());
|
request(*mDb, select, std::back_inserter(result), std::numeric_limits<std::size_t>::max());
|
||||||
EXPECT_THAT(result, ElementsAre(std::tuple(value)));
|
EXPECT_THAT(result, ElementsAre(std::tuple(value)));
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ namespace
|
|||||||
const std::int64_t value = 1099511627776;
|
const std::int64_t value = 1099511627776;
|
||||||
EXPECT_EQ(execute(*mDb, insert, value), 1);
|
EXPECT_EQ(execute(*mDb, insert, value), 1);
|
||||||
Statement select(*mDb, GetExact<std::int64_t>("ints"));
|
Statement select(*mDb, GetExact<std::int64_t>("ints"));
|
||||||
std::vector<std::tuple<int>> result;
|
std::vector<std::tuple<std::int64_t>> result;
|
||||||
request(*mDb, select, std::back_inserter(result), std::numeric_limits<std::size_t>::max(), value);
|
request(*mDb, select, std::back_inserter(result), std::numeric_limits<std::size_t>::max(), value);
|
||||||
EXPECT_THAT(result, ElementsAre(std::tuple(value)));
|
EXPECT_THAT(result, ElementsAre(std::tuple(value)));
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ namespace
|
|||||||
{
|
{
|
||||||
std::string input;
|
std::string input;
|
||||||
for (int c = 1; c <= std::numeric_limits<char>::max(); ++c)
|
for (int c = 1; c <= std::numeric_limits<char>::max(); ++c)
|
||||||
input.push_back(c);
|
input.push_back(static_cast<char>(c));
|
||||||
Utf8Encoder encoder(FromType::CP437);
|
Utf8Encoder encoder(FromType::CP437);
|
||||||
const std::string_view result = encoder.getUtf8(input);
|
const std::string_view result = encoder.getUtf8(input);
|
||||||
EXPECT_EQ(result.data(), input.data());
|
EXPECT_EQ(result.data(), input.data());
|
||||||
@ -99,7 +99,7 @@ namespace
|
|||||||
{
|
{
|
||||||
std::string input;
|
std::string input;
|
||||||
for (int c = 1; c <= std::numeric_limits<char>::max(); ++c)
|
for (int c = 1; c <= std::numeric_limits<char>::max(); ++c)
|
||||||
input.push_back(c);
|
input.push_back(static_cast<char>(c));
|
||||||
Utf8Encoder encoder(FromType::CP437);
|
Utf8Encoder encoder(FromType::CP437);
|
||||||
const std::string_view result = encoder.getLegacyEnc(input);
|
const std::string_view result = encoder.getLegacyEnc(input);
|
||||||
EXPECT_EQ(result.data(), input.data());
|
EXPECT_EQ(result.data(), input.data());
|
||||||
|
@ -244,16 +244,16 @@ namespace ESM
|
|||||||
skipHString();
|
skipHString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESMReader::getHExact(void* p, int size)
|
void ESMReader::getHExact(void* p, std::size_t size)
|
||||||
{
|
{
|
||||||
getSubHeader();
|
getSubHeader();
|
||||||
if (size != static_cast<int>(mCtx.leftSub))
|
if (size != mCtx.leftSub)
|
||||||
reportSubSizeMismatch(size, mCtx.leftSub);
|
reportSubSizeMismatch(size, mCtx.leftSub);
|
||||||
getExact(p, size);
|
getExact(p, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the given number of bytes from a named subrecord
|
// Read the given number of bytes from a named subrecord
|
||||||
void ESMReader::getHNExact(void* p, int size, NAME name)
|
void ESMReader::getHNExact(void* p, std::size_t size, NAME name)
|
||||||
{
|
{
|
||||||
getSubNameIs(name);
|
getSubNameIs(name);
|
||||||
getHExact(p, size);
|
getHExact(p, size);
|
||||||
@ -326,10 +326,10 @@ namespace ESM
|
|||||||
skip(mCtx.leftSub);
|
skip(mCtx.leftSub);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESMReader::skipHSubSize(int size)
|
void ESMReader::skipHSubSize(std::size_t size)
|
||||||
{
|
{
|
||||||
skipHSub();
|
skipHSub();
|
||||||
if (static_cast<int>(mCtx.leftSub) != size)
|
if (mCtx.leftSub != size)
|
||||||
reportSubSizeMismatch(mCtx.leftSub, size);
|
reportSubSizeMismatch(mCtx.leftSub, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,10 +238,10 @@ namespace ESM
|
|||||||
void skipHRefId();
|
void skipHRefId();
|
||||||
|
|
||||||
// Read the given number of bytes from a subrecord
|
// Read the given number of bytes from a subrecord
|
||||||
void getHExact(void* p, int size);
|
void getHExact(void* p, std::size_t size);
|
||||||
|
|
||||||
// Read the given number of bytes from a named subrecord
|
// Read the given number of bytes from a named subrecord
|
||||||
void getHNExact(void* p, int size, NAME name);
|
void getHNExact(void* p, std::size_t size, NAME name);
|
||||||
|
|
||||||
ESM::FormId getFormId(bool wide = false, NAME tag = "FRMR");
|
ESM::FormId getFormId(bool wide = false, NAME tag = "FRMR");
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ namespace ESM
|
|||||||
void skipHSub();
|
void skipHSub();
|
||||||
|
|
||||||
// Skip sub record and check its size
|
// Skip sub record and check its size
|
||||||
void skipHSubSize(int size);
|
void skipHSubSize(std::size_t size);
|
||||||
|
|
||||||
// Skip all subrecords until the given subrecord or no more subrecords remaining
|
// Skip all subrecords until the given subrecord or no more subrecords remaining
|
||||||
void skipHSubUntil(NAME name);
|
void skipHSubUntil(NAME name);
|
||||||
|
@ -25,7 +25,7 @@ namespace ESM
|
|||||||
|
|
||||||
// Loads data and marks it as loaded. Return true if data is actually loaded from reader, false otherwise
|
// Loads data and marks it as loaded. Return true if data is actually loaded from reader, false otherwise
|
||||||
// including the case when data is already loaded.
|
// including the case when data is already loaded.
|
||||||
bool condLoad(ESMReader& reader, int flags, int& targetFlags, int dataFlag, void* ptr, unsigned int size)
|
bool condLoad(ESMReader& reader, int flags, int& targetFlags, int dataFlag, void* ptr, std::size_t size)
|
||||||
{
|
{
|
||||||
if ((targetFlags & dataFlag) == 0 && (flags & dataFlag) != 0)
|
if ((targetFlags & dataFlag) == 0 && (flags & dataFlag) != 0)
|
||||||
{
|
{
|
||||||
@ -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("INDX", static_cast<uint32_t>(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…
x
Reference in New Issue
Block a user