Add #error so the build fails if mmap isn't supported.

This commit is contained in:
Kevin Backhouse 2022-10-23 15:14:09 +01:00 committed by Rosen Penev
parent 5cabd97373
commit 335e13251e

View File

@ -203,6 +203,7 @@ int FileIo::munmap() {
CloseHandle(p_->hFile_);
p_->hFile_ = 0;
#else
#error Platforms without mmap are not supported. See https://github.com/Exiv2/exiv2/issues/2380
if (p_->isWriteable_) {
seek(0, BasicIo::beg);
write(p_->pMappedArea_, p_->mappedLength_);
@ -275,6 +276,7 @@ byte* FileIo::mmap(bool isWriteable) {
}
p_->pMappedArea_ = static_cast<byte*>(rc);
#else
#error Platforms without mmap are not supported. See https://github.com/Exiv2/exiv2/issues/2380
// Workaround for platforms without mmap: Read the file into memory
byte* buf = new byte[p_->mappedLength_];
const long offset = std::ftell(p_->fp_);