remove mmap/munmap checks

Just check the header

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2023-02-06 21:18:09 -08:00
parent 2ddf00e7a2
commit 0f30198d9b
4 changed files with 4 additions and 12 deletions

View File

@ -35,12 +35,6 @@
#define EXV_ICONV_CONST
#endif
// Define if you have the mmap function.
#cmakedefine EXV_HAVE_MMAP
// Define if you have the munmap function.
#cmakedefine EXV_HAVE_MUNMAP
// Define if you have the zlib library.
#cmakedefine EXV_HAVE_LIBZ

View File

@ -23,8 +23,6 @@ set(EXV_HAVE_ICONV ${ICONV_FOUND})
set(EXV_HAVE_LIBZ ${ZLIB_FOUND})
set(EXV_HAVE_BROTLI ${BROTLI_FOUND})
check_cxx_symbol_exists(mmap sys/mman.h EXV_HAVE_MMAP )
check_cxx_symbol_exists(munmap sys/mman.h EXV_HAVE_MUNMAP )
check_cxx_symbol_exists(strerror_r string.h EXV_HAVE_STRERROR_R )
check_cxx_source_compiles( "

View File

@ -197,7 +197,7 @@ FileIo::~FileIo() {
int FileIo::munmap() {
int rc = 0;
if (p_->pMappedArea_) {
#if defined EXV_HAVE_MMAP && defined EXV_HAVE_MUNMAP
#if __has_include(<sys/mman.h>)
if (::munmap(p_->pMappedArea_, p_->mappedLength_) != 0) {
rc = 1;
}
@ -238,7 +238,7 @@ byte* FileIo::mmap(bool isWriteable) {
if (p_->isWriteable_ && p_->switchMode(Impl::opWrite) != 0) {
throw Error(ErrorCode::kerFailedToMapFileForReadWrite, path(), strError());
}
#if defined EXV_HAVE_MMAP && defined EXV_HAVE_MUNMAP
#if __has_include(<sys/mman.h>)
int prot = PROT_READ;
if (p_->isWriteable_) {
prot |= PROT_WRITE;

View File

@ -352,11 +352,11 @@ void Exiv2::dumpLibraryInfo(std::ostream& os, const std::vector<std::regex>& key
have_strings = 1;
#endif
#ifdef EXV_HAVE_MMAP
#if __has_include(<sys/mman.h>)
have_mmap = 1;
#endif
#ifdef EXV_HAVE_MUNMAP
#if __has_include(<sys/mman.h>)
have_munmap = 1;
#endif