From 9d54db9c4477d8e9b2c8bf897e700236666cbe1c Mon Sep 17 00:00:00 2001 From: Oliver Schonrock Date: Tue, 17 Dec 2024 15:07:12 +0000 Subject: [PATCH] casts to remove warnings in WIN32 mode --- include/mio/detail/mmap.ipp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/mio/detail/mmap.ipp b/include/mio/detail/mmap.ipp index 90adabb..19cbb93 100644 --- a/include/mio/detail/mmap.ipp +++ b/include/mio/detail/mmap.ipp @@ -44,13 +44,13 @@ namespace win { /** Returns the 4 upper bytes of an 8-byte integer. */ inline DWORD int64_high(int64_t n) noexcept { - return n >> 32; + return static_cast(n >> 32); } /** Returns the 4 lower bytes of an 8-byte integer. */ inline DWORD int64_low(int64_t n) noexcept { - return n & 0xffffffff; + return static_cast(n & 0xffffffff); } inline std::wstring s_2_ws(const std::string& s) @@ -61,7 +61,7 @@ inline std::wstring s_2_ws(const std::string& s) ret.resize(s.size()); int wide_char_count = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), static_cast(s.size()), &ret[0], static_cast(s.size())); - ret.resize(wide_char_count); + ret.resize(static_cast(wide_char_count)); } return ret; } @@ -108,7 +108,7 @@ inline std::error_code last_error() noexcept { std::error_code error; #ifdef _WIN32 - error.assign(GetLastError(), std::system_category()); + error.assign(static_cast(GetLastError()), std::system_category()); #else error.assign(errno, std::system_category()); #endif @@ -148,7 +148,7 @@ inline size_t query_file_size(file_handle_type handle, std::error_code& error) error = detail::last_error(); return 0; } - return static_cast(file_size.QuadPart); + return static_cast(file_size.QuadPart); #else // POSIX struct stat sbuf; if(::fstat(handle, &sbuf) == -1) @@ -194,7 +194,7 @@ inline mmap_context memory_map(const file_handle_type file_handle, const int64_t mode == access_mode::read ? FILE_MAP_READ : FILE_MAP_WRITE, win::int64_high(aligned_offset), win::int64_low(aligned_offset), - length_to_map)); + static_cast(length_to_map))); if(mapping_start == nullptr) { // Close file handle if mapping it failed.