diff options
Diffstat (limited to 'src/bencode2.cc')
| -rw-r--r-- | src/bencode2.cc | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/bencode2.cc b/src/bencode2.cc index 81b14403..8c3dab16 100644 --- a/src/bencode2.cc +++ b/src/bencode2.cc @@ -47,25 +47,25 @@ namespace aria2 { namespace bencode2 { -std::shared_ptr<ValueBase> decode(const unsigned char* data, size_t len) +std::unique_ptr<ValueBase> decode(const unsigned char* data, size_t len) { size_t end; return decode(data, len, end); } -std::shared_ptr<ValueBase> decode(const std::string& data) +std::unique_ptr<ValueBase> decode(const std::string& data) { size_t end; return decode(reinterpret_cast<const unsigned char*>(data.c_str()), data.size(), end); } -std::shared_ptr<ValueBase> decode(const unsigned char* data, size_t len, - size_t& end) +std::unique_ptr<ValueBase> decode(const unsigned char* data, size_t len, + size_t& end) { ssize_t error; bittorrent::ValueBaseBencodeParser parser; - std::shared_ptr<ValueBase> res = + auto res = parser.parseFinal(reinterpret_cast<const char*>(data), len, error); if(error < 0) { throw DL_ABORT_EX2(fmt("Bencode decoding failed: error=%d", @@ -130,11 +130,6 @@ std::string encode(const ValueBase* vlb) return visitor.getResult(); } -std::string encode(const std::shared_ptr<ValueBase>& vlb) -{ - return encode(vlb.get()); -} - } // namespace bencode2 } // namespace aria2 |
