From: Frederic Suter Date: Mon, 7 Aug 2017 19:30:20 +0000 (+0200) Subject: codacy X-Git-Tag: v3_17~231 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/8579400ae5e0389b237a2b52e9ea62bebbe1f4d9 codacy --- diff --git a/examples/s4u/app-bittorrent/s4u_peer.cpp b/examples/s4u/app-bittorrent/s4u_peer.cpp index 04bb2e4074..659a4aa4e3 100644 --- a/examples/s4u/app-bittorrent/s4u_peer.cpp +++ b/examples/s4u/app-bittorrent/s4u_peer.cpp @@ -657,7 +657,7 @@ bool Peer::hasCompletedPiece(unsigned int piece) int Peer::getFirstMissingBlockFrom(int piece) { for (unsigned int i = 0; i < PIECES_BLOCKS; i++) - if (!(bitfield_blocks & 1ULL << (piece * PIECES_BLOCKS + i))) + if (not(bitfield_blocks & 1ULL << (piece * PIECES_BLOCKS + i))) return i; return -1; } diff --git a/examples/s4u/app-bittorrent/s4u_peer.hpp b/examples/s4u/app-bittorrent/s4u_peer.hpp index c37eca901d..6e33e58858 100644 --- a/examples/s4u/app-bittorrent/s4u_peer.hpp +++ b/examples/s4u/app-bittorrent/s4u_peer.hpp @@ -61,11 +61,11 @@ public: void updateInterestedAfterReceive(); void updateChokedPeers(); - bool hasNotPiece(unsigned int piece) { return !(bitfield_ & 1U << piece); } + bool hasNotPiece(unsigned int piece) { return not(bitfield_ & 1U << piece); } bool hasCompletedPiece(unsigned int piece); unsigned int countPieces(unsigned int bitfield); /** Check that a piece is not currently being download by the peer. */ - bool isNotDownloadingPiece(unsigned int piece) { return !(current_pieces & 1U << piece); } + bool isNotDownloadingPiece(unsigned int piece) { return not(current_pieces & 1U << piece); } int partiallyDownloadedPiece(Connection* remote_peer); void updatePiecesCountFromBitfield(unsigned int bitfield); void removeCurrentPiece(Connection* remote_peer, unsigned int current_piece); diff --git a/examples/s4u/app-bittorrent/s4u_tracker.hpp b/examples/s4u/app-bittorrent/s4u_tracker.hpp index b342b7aeef..1e43850935 100644 --- a/examples/s4u/app-bittorrent/s4u_tracker.hpp +++ b/examples/s4u/app-bittorrent/s4u_tracker.hpp @@ -29,6 +29,7 @@ class TrackerAnswer { std::set* peers; // the peer list the peer has asked for. public: explicit TrackerAnswer(int interval) : interval(interval) { peers = new std::set; } + TrackerAnswer(const TrackerAnswer&) = delete; ~TrackerAnswer() { delete peers; }; void addPeer(int peer) { peers->insert(peer); } std::set* getPeers() { return peers; } @@ -42,7 +43,6 @@ class Tracker { public: explicit Tracker(std::vector args); - Tracker(const Tracker&) = delete; void operator()(); };