diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-04-20 00:50:22 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-04-20 00:50:22 +0000 |
| commit | 3505201f3333c937b5b870d70019d400c722a69f (patch) | |
| tree | def64ac6be50375e43da5e3e91eb443dd4c171fc /src/UTPexExtensionMessage.cc | |
| parent | 99733a84e2102739ee7c9de08ffae9e9216b6003 (diff) | |
2008-04-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten SharedHandle. Now copy constructor taking raw pointer
has
keyword explicit and SharedHandle's default constructor
initializes
its internal obj to null, old implementation initializes it
using
obj's default constructor.
To assign null, write SharedHandle<T> x(...); x.reset();
TODO: test/SharedHandleTest.cc needs more tests.
* src/SharedHandle.h
Diffstat (limited to 'src/UTPexExtensionMessage.cc')
| -rw-r--r-- | src/UTPexExtensionMessage.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/UTPexExtensionMessage.cc b/src/UTPexExtensionMessage.cc index 603b38d6..5139ece3 100644 --- a/src/UTPexExtensionMessage.cc +++ b/src/UTPexExtensionMessage.cc @@ -52,14 +52,13 @@ namespace aria2 { const std::string UTPexExtensionMessage::EXTENSION_NAME = "ut_pex"; UTPexExtensionMessage::UTPexExtensionMessage(uint8_t extensionMessageID): - _extensionMessageID(extensionMessageID), - _btContext(0) {} + _extensionMessageID(extensionMessageID) {} UTPexExtensionMessage::~UTPexExtensionMessage() {} std::string UTPexExtensionMessage::getBencodedData() { - SharedHandle<Dictionary> d = new Dictionary(); + SharedHandle<Dictionary> d(new Dictionary()); std::pair<std::string, std::string> freshPeerPair = createCompactPeerListAndFlag(_freshPeers); std::pair<std::string, std::string> droppedPeerPair = createCompactPeerListAndFlag(_droppedPeers); d->put("added", new Data(freshPeerPair.first)); @@ -129,8 +128,8 @@ UTPexExtensionMessage::create(const BtContextHandle& btContext, throw new DlAbortEx(MSG_TOO_SMALL_PAYLOAD_SIZE, EXTENSION_NAME.c_str(), len); } - UTPexExtensionMessageHandle msg = new UTPexExtensionMessage(*data); - SharedHandle<MetaEntry> root = MetaFileUtil::bdecoding(data+1, len-1); + UTPexExtensionMessageHandle msg(new UTPexExtensionMessage(*data)); + SharedHandle<MetaEntry> root(MetaFileUtil::bdecoding(data+1, len-1)); if(root.isNull()) { return msg; } |
