1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-01 06:09:42 +00:00

Read when need to skip few bytes

This commit is contained in:
elsid 2022-04-11 01:44:07 +02:00
parent 7ebf9a3c45
commit 6481324eb1
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40

View file

@ -265,7 +265,14 @@ public:
// them from native encoding to UTF8 in the process. // them from native encoding to UTF8 in the process.
std::string getString(int size); std::string getString(int size);
void skip(int bytes) { mEsm->seekg(getFileOffset()+bytes); }; void skip(std::size_t bytes)
{
char buffer[4096];
if (bytes > std::size(buffer))
mEsm->seekg(getFileOffset() + bytes);
else
mEsm->read(buffer, bytes);
}
/// Used for error handling /// Used for error handling
[[noreturn]] void fail(const std::string &msg); [[noreturn]] void fail(const std::string &msg);