diff --git a/lib/FileIOFILE.cpp b/lib/FileIOFILE.cpp index e3a4531..f3a411c 100644 --- a/lib/FileIOFILE.cpp +++ b/lib/FileIOFILE.cpp @@ -69,8 +69,11 @@ public: } uint64_t write(const void* buf, uint64_t length) { - if (FTell(fp) + length > m_maxWriteSize) - LogModule.report(LogVisor::FatalError, _S("write operation exceeds file's %" PRIi64 "-byte limit"), m_maxWriteSize); + if (m_maxWriteSize >= 0) + { + if (FTell(fp) + length > m_maxWriteSize) + LogModule.report(LogVisor::FatalError, _S("write operation exceeds file's %" PRIi64 "-byte limit"), m_maxWriteSize); + } return fwrite(buf, 1, length, fp); } uint64_t copyFromDisc(IPartReadStream& discio, uint64_t length) diff --git a/lib/FileIOWin32.cpp b/lib/FileIOWin32.cpp index b186132..662c82a 100644 --- a/lib/FileIOWin32.cpp +++ b/lib/FileIOWin32.cpp @@ -72,11 +72,14 @@ public: } uint64_t write(const void* buf, uint64_t length) { - LARGE_INTEGER li = {}; - LARGE_INTEGER res; - SetFilePointerEx(fp, li, &res, FILE_CURRENT); - if (res.QuadPart + int64_t(length) > m_maxWriteSize) - LogModule.report(LogVisor::FatalError, _S("write operation exceeds file's %" PRIi64 "-byte limit"), m_maxWriteSize); + if (m_maxWriteSize >= 0) + { + LARGE_INTEGER li = {}; + LARGE_INTEGER res; + SetFilePointerEx(fp, li, &res, FILE_CURRENT); + if (res.QuadPart + int64_t(length) > m_maxWriteSize) + LogModule.report(LogVisor::FatalError, _S("write operation exceeds file's %" PRIi64 "-byte limit"), m_maxWriteSize); + } DWORD ret = 0; WriteFile(fp, buf, length, &ret, nullptr);