clean up symbol exports

This commit is contained in:
Arvid Norberg 2015-01-01 20:25:39 +00:00
parent c2a05228fd
commit f77e12ac04
17 changed files with 128 additions and 102 deletions

View File

@ -106,6 +106,7 @@ nobase_include_HEADERS = \
session_settings.hpp \
session_status.hpp \
settings_pack.hpp \
sha1.hpp \
sha1_hash.hpp \
size_type.hpp \
sliding_average.hpp \

View File

@ -34,13 +34,15 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_CRC32C_HPP_INCLUDE
#include <boost/cstdint.hpp>
#include "libtorrent/export.hpp"
namespace libtorrent
{
// this is the crc32c (Castagnoli) polynomial
boost::uint32_t crc32c_32(boost::uint32_t v);
boost::uint32_t crc32c(boost::uint64_t const* v, int num_words);
TORRENT_EXTRA_EXPORT boost::uint32_t crc32c_32(boost::uint32_t v);
TORRENT_EXTRA_EXPORT boost::uint32_t crc32c(boost::uint64_t const* v
, int num_words);
}
#endif

View File

@ -354,20 +354,7 @@ namespace libtorrent
namespace detail
{
inline bool default_pred(std::string const&) { return true; }
inline bool ignore_subdir(std::string const& leaf)
{ return leaf == ".." || leaf == "."; }
inline void nop(int) {}
int get_file_attributes(std::string const& p);
std::string get_symlink_path(std::string const& p);
// internal
TORRENT_EXPORT void add_files_impl(file_storage& fs, std::string const& p
, std::string const& l, boost::function<bool(std::string)> pred
, boost::uint32_t flags);
}
// Adds the file specified by ``path`` to the file_storage object. In case ``path``
@ -387,15 +374,10 @@ namespace libtorrent
//
// The ``flags`` argument should be the same as the flags passed to the `create_torrent`_
// constructor.
template <class Pred> void add_files(file_storage& fs, std::string const& file, Pred p, boost::uint32_t flags = 0)
{
detail::add_files_impl(fs, parent_path(complete(file)), filename(file), p, flags);
}
inline void add_files(file_storage& fs, std::string const& file, boost::uint32_t flags = 0)
{
detail::add_files_impl(fs, parent_path(complete(file)), filename(file)
, detail::default_pred, flags);
}
TORRENT_EXPORT void add_files(file_storage& fs, std::string const& file
, boost::function<bool(std::string)> p, boost::uint32_t flags = 0);
TORRENT_EXPORT void add_files(file_storage& fs, std::string const& file
, boost::uint32_t flags = 0);
// This function will assume that the files added to the torrent file exists at path
// ``p``, read those files and hash the content and set the hashes in the ``create_torrent``
@ -436,32 +418,17 @@ namespace libtorrent
// and pass in utf8 strings
#ifndef TORRENT_NO_DEPRECATE
template <class Pred>
TORRENT_DEPRECATED_PREFIX
void TORRENT_DEPRECATED add_files(file_storage& fs, std::wstring const& wfile, Pred p, boost::uint32_t flags = 0)
{
std::string utf8;
wchar_utf8(wfile, utf8);
detail::add_files_impl(fs, parent_path(complete(utf8))
, filename(utf8), p, flags);
}
TORRENT_EXPORT void add_files(file_storage& fs, std::wstring const& wfile
, boost::function<bool(std::string)> p, boost::uint32_t flags = 0) TORRENT_DEPRECATED;
TORRENT_DEPRECATED_PREFIX
inline void TORRENT_DEPRECATED add_files(file_storage& fs, std::wstring const& wfile, boost::uint32_t flags = 0)
{
std::string utf8;
wchar_utf8(wfile, utf8);
detail::add_files_impl(fs, parent_path(complete(utf8))
, filename(utf8), detail::default_pred, flags);
}
TORRENT_EXPORT void add_files(file_storage& fs, std::wstring const& wfile
, boost::uint32_t flags = 0) TORRENT_DEPRECATED;
inline void set_piece_hashes(create_torrent& t, std::wstring const& p, boost::function<void(int)> f
, error_code& ec)
{
std::string utf8;
wchar_utf8(p, utf8);
set_piece_hashes(t, utf8, f, ec);
}
TORRENT_DEPRECATED_PREFIX
TORRENT_EXPORT void set_piece_hashes(create_torrent& t, std::wstring const& p
, boost::function<void(int)> f, error_code& ec) TORRENT_DEPRECATED;
#ifndef BOOST_NO_EXCEPTIONS
template <class Fun>

View File

@ -85,5 +85,12 @@ POSSIBILITY OF SUCH DAMAGE.
# define TORRENT_EXTRA_EXPORT
#endif
// only export this type if deprecated functions are enabled
#ifdef TORRENT_NO_DEPRECATE
#define TORRENT_DEPRECATED_EXPORT
#else
#define TORRENT_DEPRECATED_EXPORT TORRENT_EXPORT
#endif
#endif

View File

@ -150,16 +150,16 @@ namespace libtorrent
// internal used by create_torrent.hpp
TORRENT_EXPORT std::string parent_path(std::string const& f);
TORRENT_EXTRA_EXPORT std::string parent_path(std::string const& f);
TORRENT_EXTRA_EXPORT bool has_parent_path(std::string const& f);
TORRENT_EXTRA_EXPORT char const* filename_cstr(char const* f);
// internal used by create_torrent.hpp
TORRENT_EXPORT std::string filename(std::string const& f);
TORRENT_EXTRA_EXPORT std::string filename(std::string const& f);
TORRENT_EXTRA_EXPORT std::string combine_path(std::string const& lhs
, std::string const& rhs);
// internal used by create_torrent.hpp
TORRENT_EXPORT std::string complete(std::string const& f);
TORRENT_EXTRA_EXPORT std::string complete(std::string const& f);
TORRENT_EXTRA_EXPORT bool is_complete(std::string const& f);
TORRENT_EXTRA_EXPORT std::string current_working_directory();
#if TORRENT_USE_UNC_PATHS

View File

@ -46,6 +46,9 @@ namespace libtorrent
{
struct file;
// TODO: 3 the file_entry should be deprecated and add_file() should be
// thought through a bit better
// information about a file in a file_storage
struct TORRENT_EXPORT file_entry
{
@ -104,13 +107,6 @@ namespace libtorrent
bool symlink_attribute:1;
};
// only export this type if deprecated functions are enabled
#ifdef TORRENT_NO_DEPRECATED
#define TORRENT_DEPRECATED_EXPORT
#else
#define TORRENT_DEPRECATED_EXPORT TORRENT_EXPORT
#endif
// internal
struct TORRENT_DEPRECATED_EXPORT internal_file_entry
{
@ -236,7 +232,7 @@ namespace libtorrent
// hidden
file_storage();
// hidden
~file_storage() {}
~file_storage();
// returns true if the piece length has been initialized
// on the file_storage. This is typically taken as a proxy

View File

@ -54,22 +54,7 @@ extern "C"
}
#else
// from sha1.cpp
namespace libtorrent
{
struct TORRENT_EXTRA_EXPORT sha_ctx
{
boost::uint32_t state[5];
boost::uint32_t count[2];
boost::uint8_t buffer[64];
};
TORRENT_EXTRA_EXPORT void SHA1_init(sha_ctx* context);
TORRENT_EXTRA_EXPORT void SHA1_update(sha_ctx* context, boost::uint8_t const* data, boost::uint32_t len);
TORRENT_EXTRA_EXPORT void SHA1_final(boost::uint8_t* digest, sha_ctx* context);
} // namespace libtorrent
#include "libtorrent/sha1.hpp"
#endif
namespace libtorrent

View File

@ -0,0 +1,38 @@
/*
SHA-1 C++ conversion
original version:
SHA-1 in C
By Steve Reid <sreid@sea-to-sky.net>
100% Public Domain
changelog at the end of sha1.cpp
*/
#ifndef TORRENT_SHA1_HPP_INCLUDED
#define TORRENT_SHA1_HPP_INCLUDED
#include "libtorrent/config.hpp"
#include <boost/cstdint.hpp>
namespace libtorrent
{
struct TORRENT_EXTRA_EXPORT sha_ctx
{
boost::uint32_t state[5];
boost::uint32_t count[2];
boost::uint8_t buffer[64];
};
// we don't want these to clash with openssl's libcrypto
TORRENT_EXTRA_EXPORT void SHA1_init(sha_ctx* context);
TORRENT_EXTRA_EXPORT void SHA1_update(sha_ctx* context
, boost::uint8_t const* data
, boost::uint32_t len);
TORRENT_EXTRA_EXPORT void SHA1_final(boost::uint8_t* digest, sha_ctx* context);
}
#endif

View File

@ -559,7 +559,7 @@ namespace libtorrent
void file_progress(std::vector<boost::int64_t>& fp, int flags = 0);
#ifndef TORRENT_NO_DEPRECATED
#ifndef TORRENT_NO_DEPRECATE
void use_interface(std::string net_interface);
#endif

View File

@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_UTF8_HPP_INCLUDED
#define TORRENT_UTF8_HPP_INCLUDED
#include "libtorrent/config.hpp"
#include "libtorrent/export.hpp"
// on windows we need these functions for
// convert_to_native and convert_from_native
@ -66,9 +66,9 @@ namespace libtorrent
// string (``wide``). ``wchar_utf8`` converts a wide character string
// (``wide``) to a UTF-8 string (``utf8``). The return value is one of
// the enumeration values from utf8_conv_result_t.
TORRENT_EXPORT utf8_conv_result_t utf8_wchar(
TORRENT_EXTRA_EXPORT utf8_conv_result_t utf8_wchar(
const std::string &utf8, std::wstring &wide);
TORRENT_EXPORT utf8_conv_result_t wchar_utf8(
TORRENT_EXTRA_EXPORT utf8_conv_result_t wchar_utf8(
const std::wstring &wide, std::string &utf8);
}
#endif // !BOOST_NO_STD_WSTRING

View File

@ -55,6 +55,11 @@ namespace libtorrent
namespace detail
{
inline bool default_pred(std::string const&) { return true; }
inline bool ignore_subdir(std::string const& leaf)
{ return leaf == ".." || leaf == "."; }
int get_file_attributes(std::string const& p)
{
#ifdef TORRENT_WINDOWS
@ -153,6 +158,49 @@ namespace libtorrent
}
} // detail namespace
#if TORRENT_USE_WSTRING
#ifndef TORRENT_NO_DEPRECATE
void add_files(file_storage& fs, std::wstring const& wfile
, boost::function<bool(std::string)> p, boost::uint32_t flags)
{
std::string utf8;
wchar_utf8(wfile, utf8);
detail::add_files_impl(fs, parent_path(complete(utf8))
, filename(utf8), p, flags);
}
void add_files(file_storage& fs
, std::wstring const& wfile, boost::uint32_t flags)
{
std::string utf8;
wchar_utf8(wfile, utf8);
detail::add_files_impl(fs, parent_path(complete(utf8))
, filename(utf8), detail::default_pred, flags);
}
void set_piece_hashes(create_torrent& t, std::wstring const& p
, boost::function<void(int)> f, error_code& ec)
{
std::string utf8;
wchar_utf8(p, utf8);
set_piece_hashes(t, utf8, f, ec);
}
#endif
#endif
void add_files(file_storage& fs, std::string const& file
, boost::function<bool(std::string)> p, boost::uint32_t flags)
{
detail::add_files_impl(fs, parent_path(complete(file)), filename(file), p, flags);
}
void add_files(file_storage& fs, std::string const& file, boost::uint32_t flags)
{
detail::add_files_impl(fs, parent_path(complete(file)), filename(file)
, detail::default_pred, flags);
}
void on_hash(disk_io_job const* j, create_torrent* t
, boost::shared_ptr<piece_manager> storage, disk_io_thread* iothread
, int* piece_counter, int* completed_piece

View File

@ -47,6 +47,8 @@ namespace libtorrent
, m_num_files(0)
{}
file_storage::~file_storage() {}
void file_storage::reserve(int num_files)
{
m_files.reserve(num_files);

View File

@ -31,6 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/hasher.hpp"
#include "libtorrent/sha1.hpp"
namespace libtorrent
{

View File

@ -34,12 +34,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/session_settings.hpp"
#include "libtorrent/socket_type.hpp"
#include "libtorrent/utp_socket_manager.hpp"
#include "libtorrent/instantiate_connection.hpp"
#include <boost/shared_ptr.hpp>
#include <stdexcept>
namespace libtorrent
{
TORRENT_EXPORT bool instantiate_connection(io_service& ios
bool instantiate_connection(io_service& ios
, proxy_settings const& ps, socket_type& s
, void* ssl_context
, utp_socket_manager* sm

View File

@ -83,9 +83,6 @@ using libtorrent::aux::session_impl;
namespace libtorrent
{
TORRENT_EXPORT void TORRENT_LINK_TEST_NAME() {}
TORRENT_EXPORT void min_memory_usage(settings_pack& set)
{
// receive data directly into disk buffers

View File

@ -13,33 +13,14 @@ changelog at the end of the file.
#include <cstdio>
#include <cstring>
// if you don't want boost
// replace with
// #include <stdint.h>
// typedef uint32_t u32;
// typedef uint8_t u8;
#include "libtorrent/sha1.hpp"
#include <boost/cstdint.hpp>
typedef boost::uint32_t u32;
typedef boost::uint8_t u8;
#include "libtorrent/config.hpp"
namespace libtorrent
{
struct TORRENT_EXPORT sha_ctx
{
u32 state[5];
u32 count[2];
u8 buffer[64];
};
// we don't want these to clash with openssl's libcrypto
TORRENT_EXPORT void SHA1_init(sha_ctx* context);
TORRENT_EXPORT void SHA1_update(sha_ctx* context, u8 const* data, u32 len);
TORRENT_EXPORT void SHA1_final(u8* digest, sha_ctx* context);
namespace
{
union CHAR64LONG16

View File

@ -2679,7 +2679,7 @@ namespace libtorrent
m_num_checked_pieces = 0;
}
#ifndef TORRENT_NO_DEPRECATED
#ifndef TORRENT_NO_DEPRECATE
void torrent::use_interface(std::string net_interfaces)
{
settings_pack* p = new settings_pack;