From bf496c6b14e73c1aee4d4d4a93ba77a947fb6bf8 Mon Sep 17 00:00:00 2001 From: arvidn Date: Fri, 2 Nov 2018 10:46:16 +0100 Subject: [PATCH] use span for picker_log_alert --- include/libtorrent/alert_types.hpp | 2 +- src/alert.cpp | 8 ++++---- src/request_blocks.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 1c52d9471..4dfc48b6c 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -2675,7 +2675,7 @@ TORRENT_VERSION_NAMESPACE_2 // internal picker_log_alert(aux::stack_allocator& alloc, torrent_handle const& h , tcp::endpoint const& ep, peer_id const& peer_id, picker_flags_t flags - , piece_block const* blocks, int num_blocks); + , span blocks); TORRENT_DEFINE_ALERT(picker_log_alert, 89) diff --git a/src/alert.cpp b/src/alert.cpp index 3934339ef..797177899 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -2220,12 +2220,12 @@ namespace { picker_log_alert::picker_log_alert(aux::stack_allocator& alloc, torrent_handle const& h , tcp::endpoint const& ep, peer_id const& peer_id, picker_flags_t const flags - , piece_block const* blocks, int num_blocks) + , span blocks) : peer_alert(alloc, h, ep, peer_id) , picker_flags(flags) - , m_array_idx(alloc.copy_buffer({reinterpret_cast(blocks) - , aux::numeric_cast(num_blocks) * sizeof(piece_block)})) - , m_num_blocks(num_blocks) + , m_array_idx(alloc.copy_buffer({reinterpret_cast(blocks.data()) + , blocks.size() * int(sizeof(piece_block))})) + , m_num_blocks(int(blocks.size())) {} std::vector picker_log_alert::blocks() const diff --git a/src/request_blocks.cpp b/src/request_blocks.cpp index eda95362a..65f6611f8 100644 --- a/src/request_blocks.cpp +++ b/src/request_blocks.cpp @@ -175,7 +175,7 @@ namespace libtorrent { && !interesting_pieces.empty()) { t.alerts().emplace_alert(t.get_handle(), c.remote() - , c.pid(), flags, &interesting_pieces[0], int(interesting_pieces.size())); + , c.pid(), flags, interesting_pieces); } c.peer_log(peer_log_alert::info, "PIECE_PICKER" , "prefer_contiguous: %d picked: %d"