mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-05 00:08:00 +03:00
Merge branch 'size' into 'master'
Reduce a bit the size of getHT See merge request OpenMW/openmw!975
This commit is contained in:
commit
f9667683e7
2 changed files with 9 additions and 6 deletions
|
@ -198,7 +198,7 @@ void ESMReader::skipHSubSize(int size)
|
||||||
{
|
{
|
||||||
skipHSub();
|
skipHSub();
|
||||||
if (static_cast<int> (mCtx.leftSub) != size)
|
if (static_cast<int> (mCtx.leftSub) != size)
|
||||||
fail("skipHSubSize() mismatch");
|
reportSubSizeMismatch(mCtx.leftSub, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESMReader::skipHSubUntil(const char *name)
|
void ESMReader::skipHSubUntil(const char *name)
|
||||||
|
|
|
@ -134,11 +134,7 @@ public:
|
||||||
{
|
{
|
||||||
getSubHeader();
|
getSubHeader();
|
||||||
if (mCtx.leftSub != sizeof(X))
|
if (mCtx.leftSub != sizeof(X))
|
||||||
{
|
reportSubSizeMismatch(sizeof(X), mCtx.leftSub);
|
||||||
fail("getHT(): subrecord size mismatch,requested "
|
|
||||||
+ std::to_string(sizeof(X)) + ", got"
|
|
||||||
+ std::to_string(mCtx.leftSub));
|
|
||||||
}
|
|
||||||
getT(x);
|
getT(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,6 +257,13 @@ public:
|
||||||
size_t getFileSize() const { return mFileSize; }
|
size_t getFileSize() const { return mFileSize; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
[[noreturn]] void reportSubSizeMismatch(size_t want, size_t got) {
|
||||||
|
fail("subrecord size mismatch, requested " +
|
||||||
|
std::to_string(want) +
|
||||||
|
", got" +
|
||||||
|
std::to_string(got));
|
||||||
|
}
|
||||||
|
|
||||||
void clearCtx();
|
void clearCtx();
|
||||||
|
|
||||||
Files::IStreamPtr mEsm;
|
Files::IStreamPtr mEsm;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue