commit e0d2611: [Minor] Fix build on 32bit platforms

Vsevolod Stakhov vsevolod at rspamd.com
Fri Nov 11 21:21:03 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-11-11 21:18:42 +0000
URL: https://github.com/rspamd/rspamd/commit/e0d26115416a146503eb2ae73e2e3d9acf58622a (HEAD -> master)

[Minor] Fix build on 32bit platforms

---
 src/libutil/cxx/file_util.cxx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libutil/cxx/file_util.cxx b/src/libutil/cxx/file_util.cxx
index e3b3a2605..4536fa97b 100644
--- a/src/libutil/cxx/file_util.cxx
+++ b/src/libutil/cxx/file_util.cxx
@@ -198,7 +198,7 @@ auto raii_mmaped_file::mmap_shared(raii_file &&file,
 	}
 	/* Update stat on file to ensure it is up-to-date */
 	file.update_stat();
-	map = mmap(nullptr, file.get_size() - offset, flags, MAP_SHARED, file.get_fd(), offset);
+	map = mmap(nullptr, (std::size_t)(file.get_size() - offset), flags, MAP_SHARED, file.get_fd(), offset);
 
 	if (map == MAP_FAILED) {
 		return tl::make_unexpected(error { fmt::format("cannot mmap file {}: {}",
@@ -206,7 +206,7 @@ auto raii_mmaped_file::mmap_shared(raii_file &&file,
 
 	}
 
-	return raii_mmaped_file{std::move(file), map,  file.get_size() - offset};
+	return raii_mmaped_file{std::move(file), map,  (std::size_t)(file.get_size() - offset)};
 }
 
 auto raii_mmaped_file::mmap_shared(const char *fname, int open_flags,


More information about the Commits mailing list