From 33495c44a8354c35877b5139c1ffa8e64193ed5e Mon Sep 17 00:00:00 2001 From: stickz Date: Sat, 21 Dec 2024 21:22:52 -0500 Subject: [PATCH] fix -Wclass-memaccess warning likely generates the exact same code. Reference: https://github.com/rakshasa/libtorrent/pull/280 --- libtorrent/rak/partial_queue.h | 5 +++-- rtorrent/rak/partial_queue.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libtorrent/rak/partial_queue.h b/libtorrent/rak/partial_queue.h index 6650a6339..0ab268832 100644 --- a/libtorrent/rak/partial_queue.h +++ b/libtorrent/rak/partial_queue.h @@ -37,6 +37,7 @@ #ifndef RAK_PARTIAL_QUEUE_H #define RAK_PARTIAL_QUEUE_H +#include #include #include #include @@ -107,7 +108,7 @@ class partial_queue { size_type m_index; size_type m_ceiling; - size_pair_type m_layers[num_layers]; + std::array m_layers; }; inline void @@ -137,7 +138,7 @@ partial_queue::clear() { m_index = 0; m_ceiling = ceiling(num_layers - 1); - std::memset(m_layers, 0, num_layers * sizeof(size_pair_type)); + m_layers = {}; } inline bool diff --git a/rtorrent/rak/partial_queue.h b/rtorrent/rak/partial_queue.h index 6650a6339..0ab268832 100644 --- a/rtorrent/rak/partial_queue.h +++ b/rtorrent/rak/partial_queue.h @@ -37,6 +37,7 @@ #ifndef RAK_PARTIAL_QUEUE_H #define RAK_PARTIAL_QUEUE_H +#include #include #include #include @@ -107,7 +108,7 @@ class partial_queue { size_type m_index; size_type m_ceiling; - size_pair_type m_layers[num_layers]; + std::array m_layers; }; inline void @@ -137,7 +138,7 @@ partial_queue::clear() { m_index = 0; m_ceiling = ceiling(num_layers - 1); - std::memset(m_layers, 0, num_layers * sizeof(size_pair_type)); + m_layers = {}; } inline bool