From f82321c1dd70c2c52134c187a7d89fe62e7765e6 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 29 Nov 2010 02:48:40 +0000 Subject: [PATCH] add a backwards compatible lazy_bdecode() --- include/libtorrent/lazy_entry.hpp | 8 ++++++++ src/lazy_bdecode.cpp | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/libtorrent/lazy_entry.hpp b/include/libtorrent/lazy_entry.hpp index 1fc5c09bd..5b5b7c83c 100644 --- a/include/libtorrent/lazy_entry.hpp +++ b/include/libtorrent/lazy_entry.hpp @@ -58,6 +58,14 @@ namespace libtorrent , lazy_entry& ret, error_code& ec, int* error_pos = 0 , int depth_limit = 1000, int item_limit = 1000000); +#ifndef TORRENT_NO_DEPRECATE + // for backwards compatibility, does not report error code + // deprecated in 0.16 + TORRENT_DEPRECATED_PREFIX + TORRENT_EXPORT int lazy_bdecode(char const* start, char const* end + , lazy_entry& ret, int depth_limit = 1000, int item_limit = 1000000) TORRENT_DEPRECATED; +#endif + struct pascal_string { pascal_string(char const* p, int l): len(l), ptr(p) {} diff --git a/src/lazy_bdecode.cpp b/src/lazy_bdecode.cpp index 09d8f0e39..acf2bc323 100644 --- a/src/lazy_bdecode.cpp +++ b/src/lazy_bdecode.cpp @@ -77,6 +77,16 @@ namespace libtorrent return start; } +#ifndef TORRENT_NO_DEPRECATE + int lazy_bdecode(char const* start, char const* end + , lazy_entry& ret, int depth_limit, int item_limit) + { + error_code ec; + int pos; + return lazy_bdecode(start, end, ret, ec, &pos, depth_limit, item_limit); + } +#endif + // return 0 = success int lazy_bdecode(char const* start, char const* end, lazy_entry& ret , error_code& ec, int* error_pos, int depth_limit, int item_limit)