Skip to content

Commit

Permalink
windows fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Oct 28, 2024
1 parent 14b1a7c commit 9db5186
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,29 @@ namespace libtorrent::aux {

return int(bytes_written);
}

int pwritev_all(handle_type const handle
, span<span<char const> const> bufs
, std::int64_t file_offset
, error_code& ec)
{
TORRENT_ASSERT(bufs.size() > 0);
if (bufs.size() == 1)
return pwrite_all(handle, bufs[0], file_offset, ec);

int ret = 0;
// TODO: if we have more than 1 buffer, coalesce into a single buffer
// and a single call
for (auto const b : bufs)
{
int r = pwrite_all(handle, b, file_offset, ec);
if (ec) return -1;
TORRENT_ASSERT(r > 0);
file_offset += r;
ret += r;
}
return ret;
}
#else

int pread_all(handle_type const handle
Expand Down

0 comments on commit 9db5186

Please sign in to comment.