minor rearranging and comments

This commit is contained in:
Arvid Norberg 2013-07-19 16:30:26 +00:00
parent 3264ec5d40
commit 3fcd67b574
11 changed files with 26 additions and 14 deletions

View File

@ -45,7 +45,7 @@ namespace libtorrent
{ {
class torrent_info; class torrent_info;
struct add_torrent_params struct TORRENT_EXPORT add_torrent_params
{ {
add_torrent_params(storage_constructor_type sc = default_storage_constructor) add_torrent_params(storage_constructor_type sc = default_storage_constructor)
: version(LIBTORRENT_VERSION_NUM) : version(LIBTORRENT_VERSION_NUM)

View File

@ -40,13 +40,8 @@ std::string demangle(char const* name);
TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth = 0); TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth = 0);
#endif #endif
#if (!defined TORRENT_DEBUG && !TORRENT_RELEASE_ASSERTS) \ #if (defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS) \
|| TORRENT_NO_ASSERTS && !TORRENT_NO_ASSERTS
#define TORRENT_ASSERT(a) do {} while(false)
#define TORRENT_ASSERT_VAL(a, b) do {} while(false)
#else
#if TORRENT_PRODUCTION_ASSERTS #if TORRENT_PRODUCTION_ASSERTS
extern char const* libtorrent_assert_log; extern char const* libtorrent_assert_log;
@ -74,7 +69,12 @@ TORRENT_EXPORT void assert_fail(const char* expr, int line, char const* file
#define TORRENT_ASSERT_VAL(x, y) assert(x) #define TORRENT_ASSERT_VAL(x, y) assert(x)
#endif #endif
#endif #else // TORRENT_DEBUG || TORENT_RELEASE_ASSERTS && !TORRENT_NO_ASSERTS
#define TORRENT_ASSERT(a) do {} while(false)
#define TORRENT_ASSERT_VAL(a, b) do {} while(false)
#endif // TORRENT_DEBUG || TORENT_RELEASE_ASSERTS && !TORRENT_NO_ASSERTS
#endif #endif

View File

@ -163,9 +163,7 @@ namespace libtorrent
private: private:
#ifndef TORRENT_DEBUG #ifdef TORRENT_DEBUG
data_type m_type;
#else
// the bitfield is used so that the m_type_queried // the bitfield is used so that the m_type_queried
// field still fits, so that the ABI is the same for // field still fits, so that the ABI is the same for
// debug builds and release builds. It appears to be // debug builds and release builds. It appears to be
@ -182,6 +180,8 @@ namespace libtorrent
// exceptions are used. // exceptions are used.
mutable bool m_type_queried:1; mutable bool m_type_queried:1;
protected: protected:
#else
data_type m_type;
#endif // TORRENT_DEBUG #endif // TORRENT_DEBUG
#if (defined(_MSC_VER) && _MSC_VER < 1310) || TORRENT_COMPLETE_TYPES_REQUIRED #if (defined(_MSC_VER) && _MSC_VER < 1310) || TORRENT_COMPLETE_TYPES_REQUIRED

View File

@ -108,6 +108,7 @@ namespace libtorrent
int mode; int mode;
}; };
// TODO: why are all these functions exported?
enum stat_flags_t { dont_follow_links = 1 }; enum stat_flags_t { dont_follow_links = 1 };
TORRENT_EXPORT void stat_file(std::string f, file_status* s TORRENT_EXPORT void stat_file(std::string f, file_status* s
, error_code& ec, int flags = 0); , error_code& ec, int flags = 0);

View File

@ -71,6 +71,7 @@ namespace libtorrent
// it's smaller and optimized for smaller memory // it's smaller and optimized for smaller memory
// footprint, as opposed to file_entry, which is // footprint, as opposed to file_entry, which is
// optimized for convenience // optimized for convenience
// TODO: does this really need to be exported?
struct TORRENT_EXPORT internal_file_entry struct TORRENT_EXPORT internal_file_entry
{ {
friend class file_storage; friend class file_storage;

View File

@ -53,6 +53,8 @@ namespace libtorrent
typedef boost::function<void(int, address, int, error_code const&)> portmap_callback_t; typedef boost::function<void(int, address, int, error_code const&)> portmap_callback_t;
typedef boost::function<void(char const*)> log_callback_t; typedef boost::function<void(char const*)> log_callback_t;
// TODO: 3 should this really be a public symbol?
// also, make this a shared_ptr instead
class TORRENT_EXPORT natpmp : public intrusive_ptr_base<natpmp> class TORRENT_EXPORT natpmp : public intrusive_ptr_base<natpmp>
{ {
public: public:

View File

@ -58,6 +58,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent namespace libtorrent
{ {
// TODO: 3 rename this to sha1_hash
class TORRENT_EXPORT big_number class TORRENT_EXPORT big_number
{ {
// the number of bytes of the number // the number of bytes of the number

View File

@ -98,6 +98,7 @@ namespace libtorrent
// workaround for microsofts // workaround for microsofts
// hardware exceptions that makes // hardware exceptions that makes
// it hard to debug stuff // it hard to debug stuff
// TODO: 3 make this an implementation detail
#ifdef _MSC_VER #ifdef _MSC_VER
struct TORRENT_EXPORT eh_initializer struct TORRENT_EXPORT eh_initializer
{ {
@ -128,6 +129,8 @@ namespace libtorrent
#define TORRENT_LOGPATH_ARG_DEFAULT #define TORRENT_LOGPATH_ARG_DEFAULT
#endif #endif
// Once it's created, the session object will spawn the main thread that will do all the work.
// The main thread will be idle as long it doesn't have any torrents to participate in.
class TORRENT_EXPORT session: public boost::noncopyable, aux::eh_initializer class TORRENT_EXPORT session: public boost::noncopyable, aux::eh_initializer
{ {
public: public:

View File

@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent namespace libtorrent
{ {
// TODO: 3 do these two really need to be exposed to users?
TORRENT_EXPORT char const* time_now_string(); TORRENT_EXPORT char const* time_now_string();
TORRENT_EXPORT std::string log_time(); TORRENT_EXPORT std::string log_time();
@ -64,6 +65,7 @@ namespace libtorrent
namespace aux namespace aux
{ {
// TODO: 3 move these to time.cpp
TORRENT_EXPORT boost::int64_t performance_counter_to_microseconds(boost::int64_t pc); TORRENT_EXPORT boost::int64_t performance_counter_to_microseconds(boost::int64_t pc);
TORRENT_EXPORT boost::int64_t microseconds_to_performance_counter(boost::int64_t ms); TORRENT_EXPORT boost::int64_t microseconds_to_performance_counter(boost::int64_t ms);
} }

View File

@ -235,6 +235,7 @@ namespace libtorrent
typedef libtorrent_exception invalid_torrent_file; typedef libtorrent_exception invalid_torrent_file;
#endif #endif
// TODO: 3 should this really be a public symbol?
int TORRENT_EXPORT load_file(std::string const& filename int TORRENT_EXPORT load_file(std::string const& filename
, std::vector<char>& v, error_code& ec, int limit = 8000000); , std::vector<char>& v, error_code& ec, int limit = 8000000);
@ -420,8 +421,7 @@ namespace libtorrent
bool is_merkle_torrent() const { return !m_merkle_tree.empty(); } bool is_merkle_torrent() const { return !m_merkle_tree.empty(); }
// if we're logging member offsets, we need access to them // if we're logging member offsets, we need access to them
#if defined TORRENT_DEBUG \ #if !defined TORRENT_LOGGING \
&& !defined TORRENT_LOGGING \
&& !defined TORRENT_VERBOSE_LOGGING \ && !defined TORRENT_VERBOSE_LOGGING \
&& !defined TORRENT_ERROR_LOGGING && !defined TORRENT_ERROR_LOGGING
private: private:

View File

@ -99,6 +99,8 @@ namespace libtorrent
typedef boost::function<void(int, address, int, error_code const&)> portmap_callback_t; typedef boost::function<void(int, address, int, error_code const&)> portmap_callback_t;
typedef boost::function<void(char const*)> log_callback_t; typedef boost::function<void(char const*)> log_callback_t;
// TODO: 3 should this really be a public symbol?
// also, make this a shared_ptr instead
class TORRENT_EXPORT upnp : public intrusive_ptr_base<upnp> class TORRENT_EXPORT upnp : public intrusive_ptr_base<upnp>
{ {
public: public: