Skip to content

Commit

Permalink
fix warnings in new versions of clang
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Feb 1, 2024
1 parent 3770d17 commit 30f5b93
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
10 changes: 10 additions & 0 deletions include/libtorrent/aux_/heterogeneous_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ POSSIBILITY OF SUCH DAMAGE.
#include <sanitizer/common_interface_defs.h>
#endif

#ifdef __clang__
// disable these warnings until this class is re-worked in a way clang likes
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

namespace libtorrent {
namespace aux {

Expand Down Expand Up @@ -297,4 +303,8 @@ namespace aux {
};
} // namespace libtorrent

#ifdef __clang__
#pragma clang diagnostic pop
#endif

#endif
10 changes: 10 additions & 0 deletions include/libtorrent/bitfield.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ POSSIBILITY OF SUCH DAMAGE.
#include <cstring> // for memset and memcpy
#include <cstdint> // uint32_t

#ifdef __clang__
// disable these warnings until this class is re-worked in a way clang likes
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

namespace libtorrent {

// The bitfield type stores any number of bits as a bitfield
Expand Down Expand Up @@ -332,4 +338,8 @@ namespace libtorrent {
};
}

#ifdef __clang__
#pragma clang diagnostic pop
#endif

#endif // TORRENT_BITFIELD_HPP_INCLUDED
3 changes: 2 additions & 1 deletion include/libtorrent/stat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.

#include "libtorrent/config.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/aux_/array.hpp"

namespace libtorrent {

Expand Down Expand Up @@ -279,7 +280,7 @@ namespace libtorrent {

private:

stat_channel m_stat[num_channels];
aux::array<stat_channel, num_channels> m_stat;
};

}
Expand Down
3 changes: 0 additions & 3 deletions src/torrent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10366,7 +10366,6 @@ namespace {
int num_peers = 0;
int num_downloaders = 0;
int missing_pieces = 0;
int num_interested = 0;
for (auto const p : m_connections)
{
TORRENT_INCREMENT(m_iterating_connections);
Expand All @@ -10382,8 +10381,6 @@ namespace {
if (p->share_mode()) continue;
if (p->upload_only()) continue;

if (p->is_peer_interested()) ++num_interested;

++num_downloaders;
missing_pieces += pieces_in_torrent - p->num_have_pieces();
}
Expand Down

0 comments on commit 30f5b93

Please sign in to comment.