diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-07-26 21:07:10 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-07-26 21:07:10 +0900 |
| commit | 01e1fdaf495342ae8735ec74eb57f912fa67d535 (patch) | |
| tree | e5573e8aa7f3786d8364c76cabf5397f7473ed2f /src/bencode2.h | |
| parent | 7176107414f73d7fe0cfd7d5ce516aa41a2f0b22 (diff) | |
Parse torrent file on the fly if --follow-torrent=mem is given
In this changes, Bencode parser in bencode2 is removed and the request
is delegated to BencodeParser.
Diffstat (limited to 'src/bencode2.h')
| -rw-r--r-- | src/bencode2.h | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/bencode2.h b/src/bencode2.h index bfc95de6..7da4c2fd 100644 --- a/src/bencode2.h +++ b/src/bencode2.h @@ -38,7 +38,6 @@ #include "common.h" #include <string> -#include <iosfwd> #include "ValueBase.h" @@ -46,28 +45,15 @@ namespace aria2 { namespace bencode2 { -const size_t MAX_STRUCTURE_DEPTH = 100; +// Decode the data whose length is len. +SharedHandle<ValueBase> decode(const unsigned char* data, size_t len); -// Decode the data in [first, last). -SharedHandle<ValueBase> decode -(std::string::const_iterator first, - std::string::const_iterator last); +SharedHandle<ValueBase> decode(const std::string& data); -// Decode the data in [first, last). After decode is done +// Decode the data whose length is len. After decode is done // successfully, return the bencoded string length in end. -SharedHandle<ValueBase> decode -(std::string::const_iterator first, - std::string::const_iterator last, - size_t& end); - -SharedHandle<ValueBase> decode -(const unsigned char* first, - const unsigned char* last); - -SharedHandle<ValueBase> decode -(const unsigned char* first, - const unsigned char* last, - size_t& end); +SharedHandle<ValueBase> decode(const unsigned char* data, size_t len, + size_t& end); SharedHandle<ValueBase> decodeFromFile(const std::string& filename); |
