diff --git a/libethereum/Account.h b/libethereum/Account.h index 87fc82b6c..4ab98e3ab 100644 --- a/libethereum/Account.h +++ b/libethereum/Account.h @@ -152,8 +152,7 @@ public: h256 codeHash() const { assert(!isFreshCode()); return m_codeHash; } /// Sets the code of the account. Must only be called when isFreshCode() returns true. - void setCode(bytes&& _code) { assert(isFreshCode()); m_codeCache = _code; changed(); } - void setCode(bytes const& _code) { assert(isFreshCode()); m_codeCache = _code; changed(); } + void setCode(bytes&& _code) { assert(isFreshCode()); m_codeCache = std::move(_code); changed(); } /// @returns true if the account's code is available through code(). bool codeCacheValid() const { return m_codeHash == EmptySHA3 || m_codeHash == c_contractConceptionCodeHash || m_codeCache.size(); } @@ -206,4 +205,3 @@ private: } } - diff --git a/libethereum/VerifiedBlock.h b/libethereum/VerifiedBlock.h index 5d1efb7d0..8bac12f90 100644 --- a/libethereum/VerifiedBlock.h +++ b/libethereum/VerifiedBlock.h @@ -47,7 +47,7 @@ struct VerifiedBlock VerifiedBlock(BlockInfo&& _bi) { - verified.info = _bi; + verified.info = std::move(_bi); } VerifiedBlock(VerifiedBlock&& _other): diff --git a/libevm/ExtVMFace.cpp b/libevm/ExtVMFace.cpp index ad419d2a3..f4614d669 100644 --- a/libevm/ExtVMFace.cpp +++ b/libevm/ExtVMFace.cpp @@ -21,22 +21,20 @@ #include "ExtVMFace.h" -using namespace std; using namespace dev; using namespace dev::eth; -ExtVMFace::ExtVMFace(Address _myAddress, Address _caller, Address _origin, u256 _value, u256 _gasPrice, bytesConstRef _data, bytes const& _code, h256 const& _codeHash, BlockInfo const& _previousBlock, BlockInfo const& _currentBlock, LastHashes const& _lh, unsigned _depth): +ExtVMFace::ExtVMFace(Address _myAddress, Address _caller, Address _origin, u256 _value, u256 _gasPrice, bytesConstRef _data, bytes _code, h256 const& _codeHash, BlockInfo const& _previousBlock, BlockInfo const& _currentBlock, LastHashes const& _lh, unsigned _depth): myAddress(_myAddress), caller(_caller), origin(_origin), value(_value), gasPrice(_gasPrice), data(_data), - code(_code), + code(std::move(_code)), codeHash(_codeHash), lastHashes(_lh), previousBlock(_previousBlock), currentBlock(_currentBlock), depth(_depth) {} - diff --git a/libevm/ExtVMFace.h b/libevm/ExtVMFace.h index f6cab376a..94c8e2fef 100644 --- a/libevm/ExtVMFace.h +++ b/libevm/ExtVMFace.h @@ -161,7 +161,7 @@ public: ExtVMFace() = default; /// Full constructor. - ExtVMFace(Address _myAddress, Address _caller, Address _origin, u256 _value, u256 _gasPrice, bytesConstRef _data, bytes const& _code, h256 const& _codeHash, BlockInfo const& _previousBlock, BlockInfo const& _currentBlock, LastHashes const& _lh, unsigned _depth); + ExtVMFace(Address _myAddress, Address _caller, Address _origin, u256 _value, u256 _gasPrice, bytesConstRef _data, bytes _code, h256 const& _codeHash, BlockInfo const& _previousBlock, BlockInfo const& _currentBlock, LastHashes const& _lh, unsigned _depth); virtual ~ExtVMFace() = default; diff --git a/libp2p/Session.cpp b/libp2p/Session.cpp index 803824558..9a981786d 100644 --- a/libp2p/Session.cpp +++ b/libp2p/Session.cpp @@ -256,9 +256,8 @@ bool Session::checkPacket(bytesConstRef _msg) void Session::send(bytes&& _msg) { - clog(NetLeft) << RLP(bytesConstRef(&_msg).cropped(1)); - bytesConstRef msg(&_msg); + clog(NetLeft) << RLP(msg.cropped(1)); if (!checkPacket(msg)) clog(NetWarn) << "INVALID PACKET CONSTRUCTED!"; @@ -268,7 +267,7 @@ void Session::send(bytes&& _msg) bool doWrite = false; { Guard l(x_writeQueue); - m_writeQueue.push_back(_msg); + m_writeQueue.push_back(std::move(_msg)); doWrite = (m_writeQueue.size() == 1); } @@ -387,7 +386,7 @@ void Session::doRead() drop(BadProtocol); return; } - + /// read padded frame and mac auto tlen = header.length + header.padding + h128::size; ba::async_read(m_socket->ref(), boost::asio::buffer(m_data, tlen), [this, self, header, tlen](boost::system::error_code ec, std::size_t length) diff --git a/libtestutils/StateLoader.cpp b/libtestutils/StateLoader.cpp index 9eff30b29..235f1c573 100644 --- a/libtestutils/StateLoader.cpp +++ b/libtestutils/StateLoader.cpp @@ -1,16 +1,16 @@ /* This file is part of cpp-ethereum. - + cpp-ethereum is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + cpp-ethereum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see . */ @@ -36,10 +36,10 @@ StateLoader::StateLoader(Json::Value const& _json, std::string const& _dbPath): Address address = Address(name); bytes code = fromHex(o["code"].asString().substr(2)); - if (code.size()) + if (!code.empty()) { m_state.m_cache[address] = Account(u256(o["balance"].asString()), Account::ContractConception); - m_state.m_cache[address].setCode(code); + m_state.m_cache[address].setCode(std::move(code)); } else m_state.m_cache[address] = Account(u256(o["balance"].asString()), Account::NormalCreation); diff --git a/mix/DebuggingStateWrapper.h b/mix/DebuggingStateWrapper.h index 37bc194fb..c80aecdd8 100644 --- a/mix/DebuggingStateWrapper.h +++ b/mix/DebuggingStateWrapper.h @@ -69,7 +69,7 @@ class QSolState: public QObject public: QSolState(QObject* _parent, QVariantMap&& _storage, QVariantList&& _callStack, QVariantMap&& _locals, int _start, int _end, QString _sourceName): - QObject(_parent), m_storage(_storage), m_callStack(_callStack), m_locals(_locals), m_start(_start), m_end(_end), m_sourceName(_sourceName) + QObject(_parent), m_storage(std::move(_storage)), m_callStack(std::move(_callStack)), m_locals(std::move(_locals)), m_start(_start), m_end(_end), m_sourceName(_sourceName) { } private: @@ -92,7 +92,7 @@ class QCode: public QObject Q_PROPERTY(QString documentId MEMBER m_document CONSTANT) public: - QCode(QObject* _owner, QString const& _address, QVariantList&& _instrunctions): QObject(_owner), m_instructions(_instrunctions), m_address(_address) {} + QCode(QObject* _owner, QString const& _address, QVariantList&& _instrunctions): QObject(_owner), m_instructions(std::move(_instrunctions)), m_address(_address) {} void setDocument(QString const& _documentId) { m_document = _documentId; } private: @@ -110,7 +110,7 @@ class QCallData: public QObject Q_PROPERTY(QVariantList items MEMBER m_items CONSTANT) public: - QCallData(QObject* _owner, QVariantList&& _items): QObject(_owner), m_items(_items) {} + QCallData(QObject* _owner, QVariantList&& _items): QObject(_owner), m_items(std::move(_items)) {} private: QVariantList m_items; @@ -126,7 +126,7 @@ class QDebugData: public QObject public: QDebugData() { } - void setStates(QVariantList&& _states) { m_states = _states; } + void setStates(QVariantList&& _states) { m_states = std::move(_states); } private: QVariantList m_states; diff --git a/mix/HttpServer.h b/mix/HttpServer.h index 50a345747..606fa4ff1 100644 --- a/mix/HttpServer.h +++ b/mix/HttpServer.h @@ -46,7 +46,7 @@ class HttpRequest: public QObject private: HttpRequest(QObject* _parent, QUrl&& _url, QString&& _content, QVariantMap&& _headers): - QObject(_parent), m_url(_url), m_content(_content), m_headers(_headers) + QObject(_parent), m_url(std::move(_url)), m_content(std::move(_content)), m_headers(std::move(_headers)) { } diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index b3dee72ec..9a1b16935 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -199,10 +199,10 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state, stateOptio stateOptions.m_bHasCode = true; } - if (code.size()) + if (!code.empty()) { _state.m_cache[address] = Account(balance, Account::ContractConception); - _state.m_cache[address].setCode(code); + _state.m_cache[address].setCode(std::move(code)); } else _state.m_cache[address] = Account(balance, Account::NormalCreation);