diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2021-02-02 15:20:17 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2021-02-02 15:20:17 +0300 |
commit | 33bf320ee712fab44aeba68f9fd3c672c9414b4f (patch) | |
tree | 1d3e711619a33b652bb2096c9d997ef0e9f7c88b | |
parent | 1d77bfa3867f98cf59beca149026a013668c06b7 (diff) |
Fix lots of warnings on x86 windows.
4 files changed, 20 insertions, 20 deletions
diff --git a/include/llfio/v2.0/detail/impl/fast_random_file_handle.ipp b/include/llfio/v2.0/detail/impl/fast_random_file_handle.ipp index 4429592e..200e4df6 100644 --- a/include/llfio/v2.0/detail/impl/fast_random_file_handle.ipp +++ b/include/llfio/v2.0/detail/impl/fast_random_file_handle.ipp @@ -123,10 +123,10 @@ fast_random_file_handle::io_result<fast_random_file_handle::buffers_type> fast_r } if(p == &blk) { - memcpy(buffer.data() + i, ((const char *) p) + thisblockoffset, thisblocklen); + memcpy(buffer.data() + i, ((const char *) p) + thisblockoffset, (size_type) thisblocklen); } reqs.offset += thisblocklen; - i += thisblocklen; + i += (size_type) thisblocklen; togo -= thisblocklen; if(togo == 0) { diff --git a/include/llfio/v2.0/detail/impl/windows/file_handle.ipp b/include/llfio/v2.0/detail/impl/windows/file_handle.ipp index 43bbf4df..8c065f68 100644 --- a/include/llfio/v2.0/detail/impl/windows/file_handle.ipp +++ b/include/llfio/v2.0/detail/impl/windows/file_handle.ipp @@ -441,7 +441,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte extent.length = mycurrentlength - extent.offset; } LLFIO_DEADLINE_TO_SLEEP_INIT(d); - const extent_type blocksize = utils::file_buffer_default_size(); + const size_type blocksize = utils::file_buffer_default_size(); byte *buffer = nullptr; auto unbufferh = make_scope_exit([&]() noexcept { if(buffer != nullptr) @@ -663,7 +663,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte for(extent_type thisoffset = 0; thisoffset < item.src.length; thisoffset += blocksize) { bool done = false; - const auto thisblock = std::min(blocksize, item.src.length - thisoffset); + const auto thisblock = std::min((extent_type) blocksize, item.src.length - thisoffset); if(duplicate_extents && item.op == workitem::clone_extents) { typedef struct _DUPLICATE_EXTENTS_DATA @@ -713,7 +713,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte buffer = utils::page_allocator<byte>().allocate(blocksize); } deadline nd; - buffer_type b(buffer, thisblock); + buffer_type b(buffer, (size_type) thisblock); LLFIO_DEADLINE_TO_PARTIAL_DEADLINE(nd, d); OUTCOME_TRY(auto readed, read({{&b, 1}, item.src.offset + thisoffset}, nd)); buffer_dirty = true; @@ -807,10 +807,10 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte buffer = utils::page_allocator<byte>().allocate(blocksize); } deadline nd; - const_buffer_type cb(buffer, thisblock); + const_buffer_type cb(buffer, (size_type) thisblock); if(buffer_dirty) { - memset(buffer, 0, thisblock); + memset(buffer, 0, (size_type) thisblock); buffer_dirty = false; } LLFIO_DEADLINE_TO_PARTIAL_DEADLINE(nd, d); diff --git a/include/llfio/v2.0/detail/impl/windows/map_handle.ipp b/include/llfio/v2.0/detail/impl/windows/map_handle.ipp index dd17d754..f1996484 100644 --- a/include/llfio/v2.0/detail/impl/windows/map_handle.ipp +++ b/include/llfio/v2.0/detail/impl/windows/map_handle.ipp @@ -455,7 +455,7 @@ static inline result<void> win32_maps_apply(byte *addr, size_t bytes, win32_map_ /* mbi.RegionSize will be that from mbi.BaseAddress to end of a reserved region, so clamp to region size originally requested. */ - OUTCOME_TRY(f(reinterpret_cast<byte *>(mbi.BaseAddress), std::min(mbi.RegionSize, bytes))); + OUTCOME_TRY(f(reinterpret_cast<byte *>(mbi.BaseAddress), std::min((size_t) mbi.RegionSize, bytes))); } addr += mbi.RegionSize; if(mbi.RegionSize < bytes) @@ -597,13 +597,13 @@ map_handle::io_result<map_handle::const_buffers_type> map_handle::_do_barrier(ma // If nvram and not syncing metadata, use lightweight barrier if(kind <= barrier_kind::wait_data_only && is_nvram()) { - auto synced = nvram_barrier({addr, bytes}); + auto synced = nvram_barrier({addr, (size_type) bytes}); if(synced.size() >= bytes) { return {reqs.buffers}; } } - OUTCOME_TRYV(win32_maps_apply(addr, bytes, win32_map_sought::committed, [](byte *addr, size_t bytes) -> result<void> { + OUTCOME_TRYV(win32_maps_apply(addr, (size_type) bytes, win32_map_sought::committed, [](byte *addr, size_t bytes) -> result<void> { if(FlushViewOfFile(addr, static_cast<SIZE_T>(bytes)) == 0) { return win32_error(); @@ -684,7 +684,7 @@ result<map_handle> map_handle::map(section_handle §ion, size_type bytes, ext ret.value()._addr = static_cast<byte *>(addr); ret.value()._offset = offset; ret.value()._reservation = _bytes; - ret.value()._length = section.length().value() - offset; + ret.value()._length = (size_type) (section.length().value() - offset); ret.value()._pagesize = pagesize; // Make my handle borrow the native handle of my backing storage ret.value()._v.h = section.backing_native_handle().h; @@ -754,7 +754,7 @@ result<map_handle::size_type> map_handle::truncate(size_type newsize, bool /* un // If newsize isn't exactly a previous extension, this will fail, same as for the VirtualAlloc case OUTCOME_TRY(win32_release_file_allocations(_addr + newsize, _reservation - newsize)); _reservation = newsize; - _length = (length - _offset < newsize) ? (length - _offset) : newsize; // length of backing, not reservation + _length = (size_type)((length - _offset < newsize) ? (length - _offset) : newsize); // length of backing, not reservation return _reservation; } // Try to map an additional part of the section directly after this map @@ -772,7 +772,7 @@ result<map_handle::size_type> map_handle::truncate(size_type newsize, bool /* un return ntkernel_error(ntstat); } _reservation += _bytes; - _length = (length - _offset < newsize) ? (length - _offset) : newsize; // length of backing, not reservation + _length = (size_type)((length - _offset < newsize) ? (length - _offset) : newsize); // length of backing, not reservation return _reservation; } diff --git a/include/llfio/v2.0/detail/impl/windows/mapped_file_handle.ipp b/include/llfio/v2.0/detail/impl/windows/mapped_file_handle.ipp index beef8cb8..6afece64 100644 --- a/include/llfio/v2.0/detail/impl/windows/mapped_file_handle.ipp +++ b/include/llfio/v2.0/detail/impl/windows/mapped_file_handle.ipp @@ -39,7 +39,7 @@ result<mapped_file_handle::size_type> mapped_file_handle::reserve(size_type rese } if(reservation == 0) { - reservation = length; + reservation = (size_type) length; } if(!_sh.is_valid()) { @@ -66,7 +66,7 @@ result<mapped_file_handle::size_type> mapped_file_handle::reserve(size_type rese } else if(map_size > length) { - map_size = length; + map_size = (size_type) length; } OUTCOME_TRYV(_mh.close()); OUTCOME_TRY(auto &&mh, map_handle::map(_sh, map_size, 0, mapflags)); @@ -117,7 +117,7 @@ result<mapped_file_handle::extent_type> mapped_file_handle::truncate(extent_type OUTCOME_TRY(auto &&ret, file_handle::truncate(newsize)); if(newsize > _reservation) { - _reservation = newsize; + _reservation = (size_type) newsize; } // Reserve now we have resized, it'll create a new section for the new size OUTCOME_TRYV(reserve(_reservation)); @@ -149,13 +149,13 @@ result<mapped_file_handle::extent_type> mapped_file_handle::truncate(extent_type // Have we exceeded the reservation? If so, reserve a new reservation which will recreate the map. if(newsize > _reservation) { - OUTCOME_TRY(auto &&ret, reserve(newsize)); + OUTCOME_TRY(auto &&ret, reserve((size_type) newsize)); return ret; } size = newsize; } // Adjust the map to reflect the new size of the section - _mh._length = size; + _mh._length = (size_type) size; return newsize; } @@ -183,13 +183,13 @@ result<mapped_file_handle::extent_type> mapped_file_handle::update_map() noexcep if(size >= length) { // Section is already the same size as the file, or is as big as it can go - _mh._length = length; + _mh._length = (size_type) length; return length; } // Nobody appears to have extended the section to match the file yet OUTCOME_TRYV(_sh.truncate(length)); // Adjust the map to reflect the new size of the section - _mh._length = length; + _mh._length = (size_type) length; return length; } |