Skip to content

Commit

Permalink
Qualify calls to std::move (clang 15) (mfontanini#488)
Browse files Browse the repository at this point in the history
Co-authored-by: Ed Catmur <edward.catmur@mavensecurities.com>
  • Loading branch information
ecatmur and ecatmur authored Apr 30, 2023
1 parent e2a14d8 commit b7e61f4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/tins/rawpdu.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class TINS_API RawPDU : public PDU {
* \param data The payload to use.
*/
RawPDU(payload_type&& data)
: payload_(move(data)) { }
: payload_(std::move(data)) { }
#endif // TINS_IS_CXX11

/**
Expand Down
10 changes: 4 additions & 6 deletions src/tcp_ip/data_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@

#include <tins/detail/sequence_number_helpers.h>

using std::move;

using Tins::Internals::seq_compare;

namespace Tins {
Expand Down Expand Up @@ -67,7 +65,7 @@ bool DataTracker::process_payload(uint32_t seq, payload_type payload) {
}
bool added_some = false;
// Store this payload
store_payload(seq, move(payload));
store_payload(seq, std::move(payload));
// Keep looping while the fragments seq is lower or equal to our seq
buffered_payload_type::iterator iter = buffered_payload_.find(seq_number_);
while (iter != buffered_payload_.end() && seq_compare(iter->first, seq_number_) <= 0) {
Expand All @@ -85,7 +83,7 @@ bool DataTracker::process_payload(uint32_t seq, payload_type payload) {
payload.begin(),
payload.begin() + (seq_number_ - iter->first)
);
store_payload(seq_number_, move(iter->second));
store_payload(seq_number_, std::move(iter->second));
iter = erase_iterator(iter);
}
else {
Expand Down Expand Up @@ -158,14 +156,14 @@ void DataTracker::store_payload(uint32_t seq, payload_type payload) {
// New segment, store it
if (iter == buffered_payload_.end()) {
total_buffered_bytes_ += payload.size();
buffered_payload_.insert(make_pair(seq, move(payload)));
buffered_payload_.insert(make_pair(seq, std::move(payload)));
}
else if (iter->second.size() < payload.size()) {
// Increment by the diff between sizes
total_buffered_bytes_ += (payload.size() - iter->second.size());
// If we already have payload on this position but it's a shorter
// chunk than the new one, replace it
iter->second = move(payload);
iter->second = std::move(payload);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/tcp_ip/flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void Flow::process_packet(PDU& pdu) {
}

// can process either way, since it will abort immediately if not needed
if (data_tracker_.process_payload(tcp->seq(), move(raw->payload()))) {
if (data_tracker_.process_payload(tcp->seq(), std::move(raw->payload()))) {
if (on_data_callback_) {
on_data_callback_(*this);
}
Expand Down

0 comments on commit b7e61f4

Please sign in to comment.