Mark move constructors/assignment operators noexcept.

This commit is contained in:
levlam 2021-10-18 14:36:15 +03:00
parent f35afe23c8
commit 81b38d5607
57 changed files with 143 additions and 145 deletions

View File

@ -24,7 +24,7 @@ class ConnectionManager : public Actor {
ConnectionToken(const ConnectionToken &) = delete;
ConnectionToken &operator=(const ConnectionToken &) = delete;
ConnectionToken(ConnectionToken &&) = default;
ConnectionToken &operator=(ConnectionToken &&other) {
ConnectionToken &operator=(ConnectionToken &&other) noexcept {
reset();
connection_manager_ = std::move(other.connection_manager_);
return *this;

View File

@ -640,9 +640,9 @@ Client::Response Client::execute(Request &&request) {
return response;
}
Client::Client(Client &&other) noexcept = default;
Client &Client::operator=(Client &&other) noexcept = default;
Client::~Client() = default;
Client::Client(Client &&other) = default;
Client &Client::operator=(Client &&other) = default;
ClientManager::ClientManager() : impl_(std::make_unique<Impl>()) {
}
@ -682,9 +682,9 @@ void ClientManager::set_log_message_callback(int max_verbosity_level, LogMessage
}
}
ClientManager::ClientManager(ClientManager &&other) noexcept = default;
ClientManager &ClientManager::operator=(ClientManager &&other) noexcept = default;
ClientManager::~ClientManager() = default;
ClientManager::ClientManager(ClientManager &&other) = default;
ClientManager &ClientManager::operator=(ClientManager &&other) = default;
ClientManager *ClientManager::get_manager_singleton() {
static ClientManager client_manager;

View File

@ -119,12 +119,12 @@ class Client final {
/**
* Move constructor.
*/
Client(Client &&other);
Client(Client &&other) noexcept;
/**
* Move assignment operator.
*/
Client &operator=(Client &&other);
Client &operator=(Client &&other) noexcept;
private:
class Impl;
@ -267,12 +267,12 @@ class ClientManager final {
/**
* Move constructor.
*/
ClientManager(ClientManager &&other);
ClientManager(ClientManager &&other) noexcept;
/**
* Move assignment operator.
*/
ClientManager &operator=(ClientManager &&other);
ClientManager &operator=(ClientManager &&other) noexcept;
/**
* Returns a pointer to a singleton ClientManager instance.

View File

@ -26,9 +26,9 @@ void ClientActor::request(uint64 id, td_api::object_ptr<td_api::Function> reques
ClientActor::~ClientActor() = default;
ClientActor::ClientActor(ClientActor &&other) = default;
ClientActor::ClientActor(ClientActor &&other) noexcept = default;
ClientActor &ClientActor::operator=(ClientActor &&other) = default;
ClientActor &ClientActor::operator=(ClientActor &&other) noexcept = default;
td_api::object_ptr<td_api::Object> ClientActor::execute(td_api::object_ptr<td_api::Function> request) {
return Td::static_request(std::move(request));

View File

@ -69,14 +69,15 @@ class ClientActor final : public Actor {
/**
* Move constructor.
*/
ClientActor(ClientActor &&other);
ClientActor(ClientActor &&other) noexcept;
/**
* Move assignment operator.
*/
ClientActor &operator=(ClientActor &&other);
ClientActor &operator=(ClientActor &&other) noexcept;
ClientActor(const ClientActor &other) = delete;
ClientActor &operator=(const ClientActor &other) = delete;
private:

View File

@ -365,8 +365,8 @@ class FileExternalGenerateActor final : public FileGenerateActor {
};
FileGenerateManager::Query::~Query() = default;
FileGenerateManager::Query::Query(Query &&other) = default;
FileGenerateManager::Query &FileGenerateManager::Query::operator=(Query &&other) = default;
FileGenerateManager::Query::Query(Query &&other) noexcept = default;
FileGenerateManager::Query &FileGenerateManager::Query::operator=(Query &&other) noexcept = default;
static Status check_mtime(std::string &conversion, CSlice original_path) {
if (original_path.empty()) {

View File

@ -51,8 +51,8 @@ class FileGenerateManager final : public Actor {
Query() = default;
Query(const Query &other) = delete;
Query &operator=(const Query &other) = delete;
Query(Query &&other);
Query &operator=(Query &&other);
Query(Query &&other) noexcept;
Query &operator=(Query &&other) noexcept;
~Query();
ActorOwn<FileGenerateActor> worker_;

View File

@ -780,10 +780,10 @@ struct PartialLocalFileLocationPtr {
*location_ = *other.location_;
return *this;
}
PartialLocalFileLocationPtr(PartialLocalFileLocationPtr &&other)
PartialLocalFileLocationPtr(PartialLocalFileLocationPtr &&other) noexcept
: location_(make_unique<PartialLocalFileLocation>(std::move(*other.location_))) {
}
PartialLocalFileLocationPtr &operator=(PartialLocalFileLocationPtr &&other) {
PartialLocalFileLocationPtr &operator=(PartialLocalFileLocationPtr &&other) noexcept {
*location_ = std::move(*other.location_);
return *this;
}

View File

@ -130,7 +130,7 @@ ConnectionCreator::ConnectionCreator(ActorShared<> parent) : parent_(std::move(p
ConnectionCreator::ConnectionCreator(ConnectionCreator &&other) = default;
ConnectionCreator &ConnectionCreator::operator=(ConnectionCreator &&other) = default;
ConnectionCreator &ConnectionCreator::operator=(ConnectionCreator &&other) noexcept = default;
ConnectionCreator::~ConnectionCreator() = default;

View File

@ -54,7 +54,7 @@ class ConnectionCreator final : public NetQueryCallback {
public:
explicit ConnectionCreator(ActorShared<> parent);
ConnectionCreator(ConnectionCreator &&other);
ConnectionCreator &operator=(ConnectionCreator &&other);
ConnectionCreator &operator=(ConnectionCreator &&other) noexcept;
~ConnectionCreator() final;
void on_dc_options(DcOptions new_dc_options);

View File

@ -300,10 +300,10 @@ class NetQuery final : public TsListNode<NetQueryDebug> {
movable_atomic() = default;
movable_atomic(T &&x) : std::atomic<T>(std::forward<T>(x)) {
}
movable_atomic(movable_atomic &&other) {
movable_atomic(movable_atomic &&other) noexcept {
this->store(other.load(std::memory_order_relaxed), std::memory_order_relaxed);
}
movable_atomic &operator=(movable_atomic &&other) {
movable_atomic &operator=(movable_atomic &&other) noexcept {
this->store(other.load(std::memory_order_relaxed), std::memory_order_relaxed);
return *this;
}

View File

@ -24,8 +24,8 @@ class Actor : public ObserverBase {
Actor() = default;
Actor(const Actor &) = delete;
Actor &operator=(const Actor &) = delete;
Actor(Actor &&other);
Actor &operator=(Actor &&other);
Actor(Actor &&other) noexcept;
Actor &operator=(Actor &&other) noexcept;
~Actor() override {
if (!empty()) {
do_stop();

View File

@ -20,14 +20,14 @@
namespace td {
inline Actor::Actor(Actor &&other) {
inline Actor::Actor(Actor &&other) noexcept {
CHECK(info_.empty());
info_ = std::move(other.info_);
if (!empty()) {
info_->on_actor_moved(this);
}
}
inline Actor &Actor::operator=(Actor &&other) {
inline Actor &Actor::operator=(Actor &&other) noexcept {
CHECK(info_.empty());
info_ = std::move(other.info_);
if (!empty()) {

View File

@ -25,10 +25,10 @@ class ActorId {
ActorId() = default;
ActorId(const ActorId &other) = default;
ActorId &operator=(const ActorId &other) = default;
ActorId(ActorId &&other) : ptr_(other.ptr_) {
ActorId(ActorId &&other) noexcept : ptr_(other.ptr_) {
other.ptr_.clear();
}
ActorId &operator=(ActorId &&other) {
ActorId &operator=(ActorId &&other) noexcept {
if (&other == this) {
return *this;
}
@ -85,8 +85,8 @@ class ActorOwn {
explicit ActorOwn(ActorOwn<OtherActorType> &&other);
template <class OtherActorType>
ActorOwn &operator=(ActorOwn<OtherActorType> &&other);
ActorOwn(ActorOwn &&other);
ActorOwn &operator=(ActorOwn &&other);
ActorOwn(ActorOwn &&other) noexcept;
ActorOwn &operator=(ActorOwn &&other) noexcept;
ActorOwn(const ActorOwn &other) = delete;
ActorOwn &operator=(const ActorOwn &other) = delete;
~ActorOwn();
@ -121,8 +121,8 @@ class ActorShared {
ActorShared(ActorOwn<OtherActorType> &&other);
template <class OtherActorType>
ActorShared &operator=(ActorShared<OtherActorType> &&other);
ActorShared(ActorShared &&other);
ActorShared &operator=(ActorShared &&other);
ActorShared(ActorShared &&other) noexcept;
ActorShared &operator=(ActorShared &&other) noexcept;
ActorShared(const ActorShared &other) = delete;
ActorShared &operator=(const ActorShared &other) = delete;
~ActorShared();

View File

@ -62,10 +62,10 @@ ActorOwn<ActorType> &ActorOwn<ActorType>::operator=(ActorOwn<OtherActorType> &&o
}
template <class ActorType>
ActorOwn<ActorType>::ActorOwn(ActorOwn &&other) : id_(other.release()) {
ActorOwn<ActorType>::ActorOwn(ActorOwn &&other) noexcept : id_(other.release()) {
}
template <class ActorType>
ActorOwn<ActorType> &ActorOwn<ActorType>::operator=(ActorOwn &&other) {
ActorOwn<ActorType> &ActorOwn<ActorType>::operator=(ActorOwn &&other) noexcept {
reset(other.release());
return *this;
}
@ -127,10 +127,10 @@ ActorShared<ActorType> &ActorShared<ActorType>::operator=(ActorShared<OtherActor
}
template <class ActorType>
ActorShared<ActorType>::ActorShared(ActorShared &&other) : id_(other.release()), token_(other.token_) {
ActorShared<ActorType>::ActorShared(ActorShared &&other) noexcept : id_(other.release()), token_(other.token_) {
}
template <class ActorType>
ActorShared<ActorType> &ActorShared<ActorType>::operator=(ActorShared &&other) {
ActorShared<ActorType> &ActorShared<ActorType>::operator=(ActorShared &&other) noexcept {
reset(other.release());
token_ = other.token_;
return *this;

View File

@ -166,10 +166,10 @@ class Event {
}
Event(const Event &other) = delete;
Event &operator=(const Event &) = delete;
Event(Event &&other) : type(other.type), link_token(other.link_token), data(other.data) {
Event(Event &&other) noexcept : type(other.type), link_token(other.link_token), data(other.data) {
other.type = Type::NoType;
}
Event &operator=(Event &&other) {
Event &operator=(Event &&other) noexcept {
destroy();
type = other.type;
link_token = other.link_token;

View File

@ -71,14 +71,14 @@ class X {
X(const X &) {
sb << "[cnstr_copy]";
}
X(X &&) {
X(X &&) noexcept {
sb << "[cnstr_move]";
}
X &operator=(const X &) {
sb << "[set_copy]";
return *this;
}
X &operator=(X &&) {
X &operator=(X &&) noexcept {
sb << "[set_move]";
return *this;
}

View File

@ -505,8 +505,8 @@ int strm_write(BIO *b, const char *buf, int len) {
} // namespace detail
SslStream::SslStream() = default;
SslStream::SslStream(SslStream &&) = default;
SslStream &SslStream::operator=(SslStream &&) = default;
SslStream::SslStream(SslStream &&) noexcept = default;
SslStream &SslStream::operator=(SslStream &&) noexcept = default;
SslStream::~SslStream() = default;
Result<SslStream> SslStream::create(CSlice host, CSlice cert_file, VerifyPeer verify_peer,

View File

@ -19,8 +19,8 @@ class SslStreamImpl;
class SslStream {
public:
SslStream();
SslStream(SslStream &&);
SslStream &operator=(SslStream &&);
SslStream(SslStream &&) noexcept;
SslStream &operator=(SslStream &&) noexcept;
~SslStream();
enum class VerifyPeer { On, Off };

View File

@ -40,9 +40,8 @@ class BigNumContext::Impl {
BigNumContext::BigNumContext() : impl_(make_unique<Impl>()) {
}
BigNumContext::BigNumContext(BigNumContext &&other) = default;
BigNumContext &BigNumContext::operator=(BigNumContext &&other) = default;
BigNumContext::BigNumContext(BigNumContext &&other) noexcept = default;
BigNumContext &BigNumContext::operator=(BigNumContext &&other) noexcept = default;
BigNumContext::~BigNumContext() = default;
class BigNum::Impl {
@ -78,10 +77,8 @@ BigNum &BigNum::operator=(const BigNum &other) {
return *this;
}
BigNum::BigNum(BigNum &&other) = default;
BigNum &BigNum::operator=(BigNum &&other) = default;
BigNum::BigNum(BigNum &&other) noexcept = default;
BigNum &BigNum::operator=(BigNum &&other) noexcept = default;
BigNum::~BigNum() = default;
BigNum BigNum::from_binary(Slice str) {

View File

@ -21,8 +21,8 @@ class BigNumContext {
BigNumContext();
BigNumContext(const BigNumContext &other) = delete;
BigNumContext &operator=(const BigNumContext &other) = delete;
BigNumContext(BigNumContext &&other);
BigNumContext &operator=(BigNumContext &&other);
BigNumContext(BigNumContext &&other) noexcept;
BigNumContext &operator=(BigNumContext &&other) noexcept;
~BigNumContext();
private:
@ -37,8 +37,8 @@ class BigNum {
BigNum();
BigNum(const BigNum &other);
BigNum &operator=(const BigNum &other);
BigNum(BigNum &&other);
BigNum &operator=(BigNum &&other);
BigNum(BigNum &&other) noexcept;
BigNum &operator=(BigNum &&other) noexcept;
~BigNum();
static BigNum from_binary(Slice str);

View File

@ -66,8 +66,8 @@ class BufferedFd final : public BufferedFdBase<FdT> {
public:
BufferedFd();
explicit BufferedFd(FdT &&fd_);
BufferedFd(BufferedFd &&);
BufferedFd &operator=(BufferedFd &&);
BufferedFd(BufferedFd &&) noexcept;
BufferedFd &operator=(BufferedFd &&) noexcept;
BufferedFd(const BufferedFd &) = delete;
BufferedFd &operator=(const BufferedFd &) = delete;
~BufferedFd();
@ -163,12 +163,12 @@ BufferedFd<FdT>::BufferedFd(FdT &&fd_) : Parent(std::move(fd_)) {
}
template <class FdT>
BufferedFd<FdT>::BufferedFd(BufferedFd &&from) {
BufferedFd<FdT>::BufferedFd(BufferedFd &&from) noexcept {
*this = std::move(from);
}
template <class FdT>
BufferedFd<FdT> &BufferedFd<FdT>::operator=(BufferedFd &&from) {
BufferedFd<FdT> &BufferedFd<FdT>::operator=(BufferedFd &&from) noexcept {
FdT::operator=(std::move(static_cast<FdT &>(from)));
input_reader_ = std::move(from.input_reader_);
input_writer_ = std::move(from.input_writer_);

View File

@ -225,11 +225,11 @@ class ByteFlowSource final : public ByteFlowInterface {
ByteFlowSource() = default;
explicit ByteFlowSource(ChainBufferReader *buffer) : buffer_(buffer) {
}
ByteFlowSource(ByteFlowSource &&other) : buffer_(other.buffer_), parent_(other.parent_) {
ByteFlowSource(ByteFlowSource &&other) noexcept : buffer_(other.buffer_), parent_(other.parent_) {
other.buffer_ = nullptr;
other.parent_ = nullptr;
}
ByteFlowSource &operator=(ByteFlowSource &&other) {
ByteFlowSource &operator=(ByteFlowSource &&other) noexcept {
buffer_ = other.buffer_;
parent_ = other.parent_;
other.buffer_ = nullptr;

View File

@ -37,9 +37,9 @@ class CancellationToken {
class CancellationTokenSource {
public:
CancellationTokenSource() = default;
CancellationTokenSource(CancellationTokenSource &&other) : token_(std::move(other.token_)) {
CancellationTokenSource(CancellationTokenSource &&other) noexcept : token_(std::move(other.token_)) {
}
CancellationTokenSource &operator=(CancellationTokenSource &&other) {
CancellationTokenSource &operator=(CancellationTokenSource &&other) noexcept {
cancel();
token_ = std::move(other.token_);
return *this;

View File

@ -130,11 +130,11 @@ void Gzip::clear() {
Gzip::Gzip() : impl_(make_unique<Impl>()) {
}
Gzip::Gzip(Gzip &&other) : Gzip() {
Gzip::Gzip(Gzip &&other) noexcept : Gzip() {
swap(other);
}
Gzip &Gzip::operator=(Gzip &&other) {
Gzip &Gzip::operator=(Gzip &&other) noexcept {
CHECK(this != &other);
clear();
swap(other);

View File

@ -20,8 +20,8 @@ class Gzip {
Gzip();
Gzip(const Gzip &) = delete;
Gzip &operator=(const Gzip &) = delete;
Gzip(Gzip &&other);
Gzip &operator=(Gzip &&other);
Gzip(Gzip &&other) noexcept;
Gzip &operator=(Gzip &&other) noexcept;
~Gzip();
enum class Mode { Empty, Encode, Decode };

View File

@ -459,10 +459,10 @@ class JsonValue final : private Jsonable {
~JsonValue() {
destroy();
}
JsonValue(JsonValue &&other) : JsonValue() {
JsonValue(JsonValue &&other) noexcept : JsonValue() {
init(std::move(other));
}
JsonValue &operator=(JsonValue &&other) {
JsonValue &operator=(JsonValue &&other) noexcept {
if (&other == this) {
return *this;
}

View File

@ -24,7 +24,7 @@ struct ListNode {
ListNode(const ListNode &) = delete;
ListNode &operator=(const ListNode &) = delete;
ListNode(ListNode &&other) {
ListNode(ListNode &&other) noexcept {
if (other.empty()) {
clear();
} else {
@ -32,7 +32,7 @@ struct ListNode {
}
}
ListNode &operator=(ListNode &&other) {
ListNode &operator=(ListNode &&other) noexcept {
if (this == &other) {
return *this;
}

View File

@ -14,10 +14,10 @@ class MovableValue {
MovableValue() = default;
MovableValue(T val) : val_(val) {
}
MovableValue(MovableValue &&other) : val_(other.val_) {
MovableValue(MovableValue &&other) noexcept : val_(other.val_) {
other.clear();
}
MovableValue &operator=(MovableValue &&other) {
MovableValue &operator=(MovableValue &&other) noexcept {
if (this != &other) {
val_ = other.val_;
other.clear();

View File

@ -84,11 +84,11 @@ class ObjectPool {
OwnerPtr() = default;
OwnerPtr(const OwnerPtr &) = delete;
OwnerPtr &operator=(const OwnerPtr &) = delete;
OwnerPtr(OwnerPtr &&other) : storage_(other.storage_), parent_(other.parent_) {
OwnerPtr(OwnerPtr &&other) noexcept : storage_(other.storage_), parent_(other.parent_) {
other.storage_ = nullptr;
other.parent_ = nullptr;
}
OwnerPtr &operator=(OwnerPtr &&other) {
OwnerPtr &operator=(OwnerPtr &&other) noexcept {
if (this != &other) {
storage_ = other.storage_;
parent_ = other.parent_;

View File

@ -23,10 +23,10 @@ class ParserImpl {
public:
explicit ParserImpl(SliceT data) : ptr_(data.begin()), end_(data.end()), status_() {
}
ParserImpl(ParserImpl &&other) : ptr_(other.ptr_), end_(other.end_), status_(std::move(other.status_)) {
ParserImpl(ParserImpl &&other) noexcept : ptr_(other.ptr_), end_(other.end_), status_(std::move(other.status_)) {
other.clear();
}
ParserImpl &operator=(ParserImpl &&other) {
ParserImpl &operator=(ParserImpl &&other) noexcept {
if (&other == this) {
return *this;
}

View File

@ -115,10 +115,10 @@ class SharedPtr {
reset(other.raw_);
return *this;
}
SharedPtr(SharedPtr &&other) : raw_(other.raw_) {
SharedPtr(SharedPtr &&other) noexcept : raw_(other.raw_) {
other.raw_ = nullptr;
}
SharedPtr &operator=(SharedPtr &&other) {
SharedPtr &operator=(SharedPtr &&other) noexcept {
reset(other.raw_);
other.raw_ = nullptr;
return *this;

View File

@ -423,14 +423,14 @@ class Result {
}
Result(const Result &) = delete;
Result &operator=(const Result &) = delete;
Result(Result &&other) : status_(std::move(other.status_)) {
Result(Result &&other) noexcept : status_(std::move(other.status_)) {
if (status_.is_ok()) {
new (&value_) T(std::move(other.value_));
other.value_.~T();
}
other.status_ = Status::Error<-2>();
}
Result &operator=(Result &&other) {
Result &operator=(Result &&other) noexcept {
CHECK(this != &other);
if (status_.is_ok()) {
value_.~T();

View File

@ -35,7 +35,7 @@ class TsListNode : protected ListNode {
TsListNode(const TsListNode &) = delete;
TsListNode &operator=(const TsListNode &) = delete;
TsListNode(TsListNode &&other) {
TsListNode(TsListNode &&other) noexcept {
other.validate();
if (other.empty()) {
data_ = std::move(other.data_);
@ -48,7 +48,7 @@ class TsListNode : protected ListNode {
other.validate();
}
TsListNode &operator=(TsListNode &&other) {
TsListNode &operator=(TsListNode &&other) noexcept {
validate();
if (this == &other) {
return *this;

View File

@ -115,7 +115,7 @@ class Variant {
Variant(const Variant &other) {
other.visit([&](auto &&value) { this->init_empty(std::forward<decltype(value)>(value)); });
}
Variant &operator=(Variant &&other) {
Variant &operator=(Variant &&other) noexcept {
clear();
other.visit([&](auto &&value) { this->init_empty(std::forward<decltype(value)>(value)); });
return *this;

View File

@ -118,10 +118,10 @@ class BufferSlice {
}
BufferSlice(const BufferSlice &other) = delete;
BufferSlice &operator=(const BufferSlice &other) = delete;
BufferSlice(BufferSlice &&other) : BufferSlice(std::move(other.buffer_), other.begin_, other.end_) {
BufferSlice(BufferSlice &&other) noexcept : BufferSlice(std::move(other.buffer_), other.begin_, other.end_) {
debug_untrack(); // yes, debug_untrack
}
BufferSlice &operator=(BufferSlice &&other) {
BufferSlice &operator=(BufferSlice &&other) noexcept {
if (this == &other) {
return *this;
}

View File

@ -396,8 +396,8 @@ struct AesState::Impl {
};
AesState::AesState() = default;
AesState::AesState(AesState &&from) = default;
AesState &AesState::operator=(AesState &&from) = default;
AesState::AesState(AesState &&from) noexcept = default;
AesState &AesState::operator=(AesState &&from) noexcept = default;
AesState::~AesState() = default;
void AesState::init(Slice key, bool encrypt) {
@ -515,8 +515,8 @@ class AesIgeStateImpl {
};
AesIgeState::AesIgeState() = default;
AesIgeState::AesIgeState(AesIgeState &&from) = default;
AesIgeState &AesIgeState::operator=(AesIgeState &&from) = default;
AesIgeState::AesIgeState(AesIgeState &&from) noexcept = default;
AesIgeState &AesIgeState::operator=(AesIgeState &&from) noexcept = default;
AesIgeState::~AesIgeState() = default;
void AesIgeState::init(Slice key, Slice iv, bool encrypt) {
@ -580,8 +580,8 @@ AesCbcState::AesCbcState(Slice key256, Slice iv128) : raw_{SecureString(key256),
CHECK(raw_.iv.size() == 16);
}
AesCbcState::AesCbcState(AesCbcState &&from) = default;
AesCbcState &AesCbcState::operator=(AesCbcState &&from) = default;
AesCbcState::AesCbcState(AesCbcState &&from) noexcept = default;
AesCbcState &AesCbcState::operator=(AesCbcState &&from) noexcept = default;
AesCbcState::~AesCbcState() = default;
void AesCbcState::encrypt(Slice from, MutableSlice to) {
@ -634,8 +634,8 @@ struct AesCtrState::Impl {
};
AesCtrState::AesCtrState() = default;
AesCtrState::AesCtrState(AesCtrState &&from) = default;
AesCtrState &AesCtrState::operator=(AesCtrState &&from) = default;
AesCtrState::AesCtrState(AesCtrState &&from) noexcept = default;
AesCtrState &AesCtrState::operator=(AesCtrState &&from) noexcept = default;
AesCtrState::~AesCtrState() = default;
void AesCtrState::init(Slice key, Slice iv) {
@ -762,13 +762,13 @@ class Sha256State::Impl {
Sha256State::Sha256State() = default;
Sha256State::Sha256State(Sha256State &&other) {
Sha256State::Sha256State(Sha256State &&other) noexcept {
impl_ = std::move(other.impl_);
is_inited_ = other.is_inited_;
other.is_inited_ = false;
}
Sha256State &Sha256State::operator=(Sha256State &&other) {
Sha256State &Sha256State::operator=(Sha256State &&other) noexcept {
Sha256State copy(std::move(other));
using std::swap;
swap(impl_, copy.impl_);

View File

@ -26,8 +26,8 @@ class AesState {
AesState();
AesState(const AesState &from) = delete;
AesState &operator=(const AesState &from) = delete;
AesState(AesState &&from);
AesState &operator=(AesState &&from);
AesState(AesState &&from) noexcept;
AesState &operator=(AesState &&from) noexcept;
~AesState();
void init(Slice key, bool encrypt);
@ -51,8 +51,8 @@ class AesIgeState {
AesIgeState();
AesIgeState(const AesIgeState &from) = delete;
AesIgeState &operator=(const AesIgeState &from) = delete;
AesIgeState(AesIgeState &&from);
AesIgeState &operator=(AesIgeState &&from);
AesIgeState(AesIgeState &&from) noexcept;
AesIgeState &operator=(AesIgeState &&from) noexcept;
~AesIgeState();
void init(Slice key, Slice iv, bool encrypt);
@ -73,8 +73,8 @@ class AesCtrState {
AesCtrState();
AesCtrState(const AesCtrState &from) = delete;
AesCtrState &operator=(const AesCtrState &from) = delete;
AesCtrState(AesCtrState &&from);
AesCtrState &operator=(AesCtrState &&from);
AesCtrState(AesCtrState &&from) noexcept;
AesCtrState &operator=(AesCtrState &&from) noexcept;
~AesCtrState();
void init(Slice key, Slice iv);
@ -93,8 +93,8 @@ class AesCbcState {
AesCbcState(Slice key256, Slice iv128);
AesCbcState(const AesCbcState &from) = delete;
AesCbcState &operator=(const AesCbcState &from) = delete;
AesCbcState(AesCbcState &&from);
AesCbcState &operator=(AesCbcState &&from);
AesCbcState(AesCbcState &&from) noexcept;
AesCbcState &operator=(AesCbcState &&from) noexcept;
~AesCbcState();
void encrypt(Slice from, MutableSlice to);
@ -131,8 +131,8 @@ class Sha256State {
Sha256State();
Sha256State(const Sha256State &other) = delete;
Sha256State &operator=(const Sha256State &other) = delete;
Sha256State(Sha256State &&other);
Sha256State &operator=(Sha256State &&other);
Sha256State(Sha256State &&other) noexcept;
Sha256State &operator=(Sha256State &&other) noexcept;
~Sha256State();
void init();

View File

@ -108,8 +108,8 @@ class FileFdImpl {
} // namespace detail
FileFd::FileFd() = default;
FileFd::FileFd(FileFd &&) = default;
FileFd &FileFd::operator=(FileFd &&) = default;
FileFd::FileFd(FileFd &&) noexcept = default;
FileFd &FileFd::operator=(FileFd &&) noexcept = default;
FileFd::~FileFd() = default;
FileFd::FileFd(unique_ptr<detail::FileFdImpl> impl) : impl_(std::move(impl)) {

View File

@ -20,13 +20,13 @@
namespace td {
namespace detail {
class FileFdImpl;
}
} // namespace detail
class FileFd {
public:
FileFd();
FileFd(FileFd &&);
FileFd &operator=(FileFd &&);
FileFd(FileFd &&) noexcept;
FileFd &operator=(FileFd &&) noexcept;
~FileFd();
FileFd(const FileFd &) = delete;
FileFd &operator=(const FileFd &) = delete;

View File

@ -91,8 +91,8 @@ Result<MemoryMapping> MemoryMapping::create_from_file(const FileFd &file_fd, con
#endif
}
MemoryMapping::MemoryMapping(MemoryMapping &&other) = default;
MemoryMapping &MemoryMapping::operator=(MemoryMapping &&other) = default;
MemoryMapping::MemoryMapping(MemoryMapping &&other) noexcept = default;
MemoryMapping &MemoryMapping::operator=(MemoryMapping &&other) noexcept = default;
MemoryMapping::~MemoryMapping() = default;
MemoryMapping::MemoryMapping(unique_ptr<Impl> impl) : impl_(std::move(impl)) {

View File

@ -39,8 +39,8 @@ class MemoryMapping {
MemoryMapping(const MemoryMapping &other) = delete;
const MemoryMapping &operator=(const MemoryMapping &other) = delete;
MemoryMapping(MemoryMapping &&other);
MemoryMapping &operator=(MemoryMapping &&other);
MemoryMapping(MemoryMapping &&other) noexcept;
MemoryMapping &operator=(MemoryMapping &&other) noexcept;
~MemoryMapping();
private:

View File

@ -26,11 +26,11 @@ class RwMutex {
}
RwMutex(const RwMutex &) = delete;
RwMutex &operator=(const RwMutex &) = delete;
RwMutex(RwMutex &&other) {
RwMutex(RwMutex &&other) noexcept {
init();
other.clear();
}
RwMutex &operator=(RwMutex &&other) {
RwMutex &operator=(RwMutex &&other) noexcept {
other.clear();
return *this;
}

View File

@ -282,8 +282,8 @@ void ServerSocketFdImplDeleter::operator()(ServerSocketFdImpl *impl) {
} // namespace detail
ServerSocketFd::ServerSocketFd() = default;
ServerSocketFd::ServerSocketFd(ServerSocketFd &&) = default;
ServerSocketFd &ServerSocketFd::operator=(ServerSocketFd &&) = default;
ServerSocketFd::ServerSocketFd(ServerSocketFd &&) noexcept = default;
ServerSocketFd &ServerSocketFd::operator=(ServerSocketFd &&) noexcept = default;
ServerSocketFd::~ServerSocketFd() = default;
ServerSocketFd::ServerSocketFd(unique_ptr<detail::ServerSocketFdImpl> impl) : impl_(impl.release()) {
}

View File

@ -29,8 +29,8 @@ class ServerSocketFd {
ServerSocketFd();
ServerSocketFd(const ServerSocketFd &) = delete;
ServerSocketFd &operator=(const ServerSocketFd &) = delete;
ServerSocketFd(ServerSocketFd &&);
ServerSocketFd &operator=(ServerSocketFd &&);
ServerSocketFd(ServerSocketFd &&) noexcept;
ServerSocketFd &operator=(ServerSocketFd &&) noexcept;
~ServerSocketFd();
static Result<ServerSocketFd> open(int32 port, CSlice addr = CSlice("0.0.0.0")) TD_WARN_UNUSED_RESULT;

View File

@ -609,8 +609,8 @@ Status init_socket_options(NativeFd &native_fd) {
} // namespace detail
SocketFd::SocketFd() = default;
SocketFd::SocketFd(SocketFd &&) = default;
SocketFd &SocketFd::operator=(SocketFd &&) = default;
SocketFd::SocketFd(SocketFd &&) noexcept = default;
SocketFd &SocketFd::operator=(SocketFd &&) noexcept = default;
SocketFd::~SocketFd() = default;
SocketFd::SocketFd(unique_ptr<detail::SocketFdImpl> impl) : impl_(impl.release()) {

View File

@ -33,8 +33,8 @@ class SocketFd {
SocketFd();
SocketFd(const SocketFd &) = delete;
SocketFd &operator=(const SocketFd &) = delete;
SocketFd(SocketFd &&);
SocketFd &operator=(SocketFd &&);
SocketFd(SocketFd &&) noexcept;
SocketFd &operator=(SocketFd &&) noexcept;
~SocketFd();
static Result<SocketFd> open(const IPAddress &address) TD_WARN_UNUSED_RESULT;

View File

@ -229,8 +229,8 @@ void BufferedStdinImplDeleter::operator()(BufferedStdinImpl *impl) {
BufferedStdin::BufferedStdin() : impl_(make_unique<detail::BufferedStdinImpl>().release()) {
}
BufferedStdin::BufferedStdin(BufferedStdin &&) = default;
BufferedStdin &BufferedStdin::operator=(BufferedStdin &&) = default;
BufferedStdin::BufferedStdin(BufferedStdin &&) noexcept = default;
BufferedStdin &BufferedStdin::operator=(BufferedStdin &&) noexcept = default;
BufferedStdin::~BufferedStdin() = default;
ChainBufferReader &BufferedStdin::input_buffer() {

View File

@ -34,8 +34,8 @@ class BufferedStdin {
BufferedStdin();
BufferedStdin(const BufferedStdin &) = delete;
BufferedStdin &operator=(const BufferedStdin &) = delete;
BufferedStdin(BufferedStdin &&);
BufferedStdin &operator=(BufferedStdin &&);
BufferedStdin(BufferedStdin &&) noexcept;
BufferedStdin &operator=(BufferedStdin &&) noexcept;
~BufferedStdin();
ChainBufferReader &input_buffer();
PollableFdInfo &get_poll_info();

View File

@ -738,8 +738,8 @@ void UdpSocketFdImplDeleter::operator()(UdpSocketFdImpl *impl) {
} // namespace detail
UdpSocketFd::UdpSocketFd() = default;
UdpSocketFd::UdpSocketFd(UdpSocketFd &&) = default;
UdpSocketFd &UdpSocketFd::operator=(UdpSocketFd &&) = default;
UdpSocketFd::UdpSocketFd(UdpSocketFd &&) noexcept = default;
UdpSocketFd &UdpSocketFd::operator=(UdpSocketFd &&) noexcept = default;
UdpSocketFd::~UdpSocketFd() = default;
PollableFdInfo &UdpSocketFd::get_poll_info() {
return impl_->get_poll_info();

View File

@ -38,8 +38,8 @@ struct UdpMessage {
class UdpSocketFd {
public:
UdpSocketFd();
UdpSocketFd(UdpSocketFd &&);
UdpSocketFd &operator=(UdpSocketFd &&);
UdpSocketFd(UdpSocketFd &&) noexcept;
UdpSocketFd &operator=(UdpSocketFd &&) noexcept;
~UdpSocketFd();
UdpSocketFd(const UdpSocketFd &) = delete;

View File

@ -33,8 +33,8 @@ class EventFdLinuxImpl {
};
EventFdLinux::EventFdLinux() = default;
EventFdLinux::EventFdLinux(EventFdLinux &&) = default;
EventFdLinux &EventFdLinux::operator=(EventFdLinux &&) = default;
EventFdLinux::EventFdLinux(EventFdLinux &&) noexcept = default;
EventFdLinux &EventFdLinux::operator=(EventFdLinux &&) noexcept = default;
EventFdLinux::~EventFdLinux() = default;
void EventFdLinux::init() {

View File

@ -24,8 +24,8 @@ class EventFdLinux final : public EventFdBase {
public:
EventFdLinux();
EventFdLinux(EventFdLinux &&);
EventFdLinux &operator=(EventFdLinux &&);
EventFdLinux(EventFdLinux &&) noexcept;
EventFdLinux &operator=(EventFdLinux &&) noexcept;
~EventFdLinux();
void init() final;

View File

@ -134,14 +134,14 @@ NativeFd::NativeFd(Socket socket) : fd_(reinterpret_cast<Fd>(socket)), is_socket
}
#endif
NativeFd::NativeFd(NativeFd &&other) : fd_(other.fd_) {
NativeFd::NativeFd(NativeFd &&other) noexcept : fd_(other.fd_) {
#if TD_PORT_WINDOWS
is_socket_ = other.is_socket_;
#endif
other.fd_ = empty_fd();
}
NativeFd &NativeFd::operator=(NativeFd &&other) {
NativeFd &NativeFd::operator=(NativeFd &&other) noexcept {
CHECK(this != &other);
close();
fd_ = other.fd_;

View File

@ -34,8 +34,8 @@ class NativeFd {
#endif
NativeFd(const NativeFd &) = delete;
NativeFd &operator=(const NativeFd &) = delete;
NativeFd(NativeFd &&other);
NativeFd &operator=(NativeFd &&other);
NativeFd(NativeFd &&other) noexcept;
NativeFd &operator=(NativeFd &&other) noexcept;
~NativeFd();
explicit operator bool() const;

View File

@ -151,7 +151,7 @@ class PollableFdInfo final : private ListNode {
#if TD_PORT_WINDOWS
auto lock = observer_lock_.lock();
#endif
CHECK(!observer_);
CHECK(observer_ == nullptr);
observer_ = observer;
}
void clear_observer() {
@ -165,7 +165,7 @@ class PollableFdInfo final : private ListNode {
auto lock = observer_lock_.lock();
#endif
VLOG(fd) << native_fd() << " notify " << tag("observer", observer_);
if (observer_) {
if (observer_ != nullptr) {
observer_->notify();
}
}

View File

@ -33,7 +33,7 @@ class ThreadPthread {
ThreadPthread &operator=(const ThreadPthread &other) = delete;
ThreadPthread(ThreadPthread &&other) noexcept : is_inited_(std::move(other.is_inited_)), thread_(other.thread_) {
}
ThreadPthread &operator=(ThreadPthread &&other) {
ThreadPthread &operator=(ThreadPthread &&other) noexcept {
join();
is_inited_ = std::move(other.is_inited_);
thread_ = other.thread_;