fix gcc warnings and missing header files in makefiles

This commit is contained in:
Arvid Norberg 2015-04-26 00:51:44 +00:00
parent 821e34c795
commit f0336017d1
19 changed files with 71 additions and 42 deletions

View File

@ -180,6 +180,8 @@ endif (build_tests)
include_directories(${includes})
add_definitions(-DTORRENT_BUILDING_LIBRARY)
if (encryption)
list(APPEND sources pe_crypto asio_ssl)
if(NOT DEFINED OPENSSL_INCLUDE_DIR OR NOT DEFINED OPENSSL_LIBRARIES)

View File

@ -228,6 +228,12 @@ rule linking ( properties * )
rule warnings ( properties * )
{
local result ;
if <warnings>off in $(properties)
{
return $(result) ;
}
if <toolset>clang in $(properties)
|| <toolset>darwin in $(properties)
{
@ -747,6 +753,7 @@ lib torrent
: # requirements
<include>./ed25519/src
<threading>multi
<define>TORRENT_BUILDING_LIBRARY
<link>shared:<define>TORRENT_BUILDING_SHARED
<define>BOOST_NO_DEPRECATED

View File

@ -668,7 +668,7 @@ std::string path_to_url(std::string f)
f = path_append(cwd, f);
}
for (int i = 0; i < f.size(); ++i)
for (int i = 0; i < int(f.size()); ++i)
{
#ifdef TORRENT_WINDOWS
if (f[i] == '\\') ret.push_back('/');

View File

@ -262,7 +262,7 @@ void torrent_view::print_tabs()
}
pos += snprintf(str + pos, sizeof(str) - pos, "\x1b[K");
if (m_width + 1 < sizeof(str))
if (m_width + 1 < int(sizeof(str)))
str[m_width + 1] = '\0';
print(str);
}
@ -272,15 +272,14 @@ void torrent_view::print_headers()
set_cursor_pos(0, 1);
char str[400];
int pos = 0;
// print title bar for torrent list
pos = snprintf(str, sizeof(str)
snprintf(str, sizeof(str)
, " %-3s %-50s %-35s %-17s %-17s %-11s %-6s %-6s %-4s\x1b[K"
, "#", "Name", "Progress", "Download", "Upload", "Peers (D:S)"
, "Down", "Up", "Flags");
if (m_width + 1 < sizeof(str))
if (m_width + 1 < int(sizeof(str)))
str[m_width + 1] = '\0';
print(str);
@ -337,7 +336,7 @@ void torrent_view::print_torrent(lt::torrent_status const& s, bool selected)
pos += snprintf(str + pos, sizeof(str) - pos, "\x1b[K");
if (m_width + 1 < sizeof(str))
if (m_width + 1 < int(sizeof(str)))
str[m_width + 1] = '\0';
print(str);

View File

@ -101,9 +101,11 @@ nobase_include_HEADERS = \
proxy_base.hpp \
puff.hpp \
random.hpp \
receive_buffer.hpp \
resolve_links.hpp \
resolver.hpp \
resolver_interface.hpp \
request_blocks.hpp \
rss.hpp \
session.hpp \
session_settings.hpp \

View File

@ -267,6 +267,7 @@ namespace libtorrent {
time_point m_timestamp;
};
// TODO: 3 delete this functionality
#ifndef BOOST_NO_EXCEPTIONS
#ifndef TORRENT_NO_DEPRECATE
struct TORRENT_DEPRECATED TORRENT_EXPORT unhandled_alert : std::exception

View File

@ -91,7 +91,10 @@ POSSIBILITY OF SUCH DAMAGE.
#if defined __GNUC__
# if __GNUC__ >= 3
// deprecation markup is only enabled when libtorrent
// headers are included by clients, not while building
// libtorrent itself
# if __GNUC__ >= 3 && !defined TORRENT_BUILDING_LIBRARY
# define TORRENT_DEPRECATED __attribute__ ((deprecated))
# endif
@ -116,7 +119,12 @@ POSSIBILITY OF SUCH DAMAGE.
// '_vsnprintf': This function or variable may be unsafe
#pragma warning(disable:4996)
#define TORRENT_DEPRECATED __declspec(deprecated)
// deprecation markup is only enabled when libtorrent
// headers are included by clients, not while building
// libtorrent itself
#if !defined TORRENT_BUILDING_LIBRARY
# define TORRENT_DEPRECATED __declspec(deprecated)
#endif
#endif

View File

@ -453,29 +453,36 @@ namespace libtorrent
TORRENT_EXPORT void set_piece_hashes(create_torrent& t, std::wstring const& p
, boost::function<void(int)> f, error_code& ec);
TORRENT_EXPORT void set_piece_hashes_deprecated(create_torrent& t
, std::wstring const& p
, boost::function<void(int)> f, error_code& ec);
#ifndef BOOST_NO_EXCEPTIONS
template <class Fun>
TORRENT_DEPRECATED
void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t, std::wstring const& p, Fun f)
void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t
, std::wstring const& p, Fun f)
{
error_code ec;
set_piece_hashes(t, p, f, ec);
set_piece_hashes_deprecated(t, p, f, ec);
if (ec) throw libtorrent_exception(ec);
}
TORRENT_DEPRECATED
inline void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t, std::wstring const& p)
inline void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t
, std::wstring const& p)
{
error_code ec;
set_piece_hashes(t, p, detail::nop, ec);
set_piece_hashes_deprecated(t, p, detail::nop, ec);
if (ec) throw libtorrent_exception(ec);
}
#endif
TORRENT_DEPRECATED
inline void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t, std::wstring const& p, error_code& ec)
inline void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t
, std::wstring const& p, error_code& ec)
{
set_piece_hashes(t, p, detail::nop, ec);
set_piece_hashes_deprecated(t, p, detail::nop, ec);
}
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING

View File

@ -1343,7 +1343,7 @@ namespace libtorrent
// again the next time.
time_duration announce_interval;
#else
// leave this here for ABI stability
// hidden
time_duration deprecated_announce_interval_;
#endif

View File

@ -146,17 +146,11 @@ libtorrent_rasterbar_la_SOURCES = \
$(KADEMLIA_SOURCES) \
$(ASIO_OPENSSL_SOURCES)
#libtorrent_rasterbar_la_LDFLAGS = $(LDFLAGS) -version-info $(INTERFACE_VERSION_INFO)
libtorrent_rasterbar_la_LDFLAGS = -version-info $(INTERFACE_VERSION_INFO)
#libtorrent_rasterbar_la_LIBADD = @BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_THREAD_LIB@ @OPENSSL_LIBS@
libtorrent_rasterbar_la_LIBADD = @BOOST_SYSTEM_LIB@ @OPENSSL_LIBS@
#AM_CXXFLAGS= -ftemplate-depth-100 -I$(top_srcdir)/include @DEBUGFLAGS@ @OPENSSL_INCLUDES@
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/ed25519/src @DEBUGFLAGS@ @OPENSSL_INCLUDES@
AM_CPPFLAGS = -DTORRENT_BUILDING_LIBRARY -I$(top_srcdir)/include -I$(top_srcdir)/ed25519/src @DEBUGFLAGS@ @OPENSSL_INCLUDES@
AM_CFLAGS = -I$(top_srcdir)/ed25519/src -std=c99
#AM_CFLAGS= -I$(top_srcdir)/include @DEBUGFLAGS@
#AM_LDFLAGS = $(LDFLAGS) @BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_THREAD_LIB@ @OPENSSL_LDFLAGS@ @OPENSSL_LIBS@
AM_LDFLAGS = @OPENSSL_LDFLAGS@

View File

@ -219,6 +219,14 @@ namespace libtorrent
wchar_utf8(p, utf8);
set_piece_hashes(t, utf8, f, ec);
}
void set_piece_hashes_deprecated(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

View File

@ -333,7 +333,6 @@ node_entry const* routing_table::next_refresh()
// a missing prefix for that bucket
node_entry* candidate = NULL;
int bucket_idx = -1;
// this will have a bias towards pinging nodes close to us first.
int idx = m_buckets.size() - 1;
@ -349,7 +348,6 @@ node_entry const* routing_table::next_refresh()
if (j->last_queried == min_time())
{
bucket_idx = idx;
candidate = &*j;
goto out;
}
@ -357,7 +355,6 @@ node_entry const* routing_table::next_refresh()
if (candidate == NULL || j->last_queried < candidate->last_queried)
{
candidate = &*j;
bucket_idx = idx;
}
}
}

View File

@ -274,8 +274,8 @@ void traversal_algorithm::finished(observer_ptr o)
o->flags |= observer::flag_alive;
++m_responses;
TORRENT_ASSERT(m_invoke_count > 0);
--m_invoke_count;
TORRENT_ASSERT(m_invoke_count >= 0);
bool is_done = add_requests();
if (is_done) done();
}
@ -285,8 +285,6 @@ void traversal_algorithm::finished(observer_ptr o)
// So, if this is true, don't make another request
void traversal_algorithm::failed(observer_ptr o, int flags)
{
TORRENT_ASSERT(m_invoke_count >= 0);
// don't tell the routing table about
// node ids that we just generated ourself
if ((o->flags & observer::flag_no_id) == 0)
@ -337,8 +335,8 @@ void traversal_algorithm::failed(observer_ptr o, int flags)
#endif
++m_timeouts;
TORRENT_ASSERT(m_invoke_count > 0);
--m_invoke_count;
TORRENT_ASSERT(m_invoke_count >= 0);
}
if (flags & prevent_request)
@ -450,7 +448,7 @@ bool traversal_algorithm::add_requests()
o->flags |= observer::flag_queried;
if (invoke(*i))
{
TORRENT_ASSERT(m_invoke_count >= 0);
TORRENT_ASSERT(m_invoke_count < (std::numeric_limits<boost::uint16_t>::max)());
++m_invoke_count;
++outstanding;
}

View File

@ -314,6 +314,7 @@ namespace libtorrent
, int& produce
, int& packet_size)
{
TORRENT_UNUSED(consume);
if (!m_decrypt) return;
int bytes_processed = 0;

View File

@ -501,7 +501,6 @@ namespace libtorrent
, end(m_downloads[j].end()); i != end; ++i)
{
TORRENT_ASSERT(m_piece_map[i->index].download_queue() == j);
bool blocks_requested = false;
int num_blocks = blocks_in_piece(i->index);
int num_requested = 0;
int num_finished = 0;
@ -522,7 +521,6 @@ namespace libtorrent
else if (info[k].state == block_info::state_requested)
{
++num_requested;
blocks_requested = true;
TORRENT_ASSERT(info[k].num_peers > 0);
}
else if (info[k].state == block_info::state_writing)

View File

@ -125,6 +125,7 @@ namespace libtorrent
#endif
}
#ifdef TORRENT_USE_OPENSSL
namespace {
void on_close_socket(socket_type* s, boost::shared_ptr<void>)
@ -137,6 +138,7 @@ namespace libtorrent
}
} // anonymous namespace
#endif
// the second argument is a shared pointer to an object that
// will keep the socket (s) alive for the duration of the async operation

View File

@ -888,10 +888,6 @@ namespace libtorrent
}
}
bool full_allocation_mode = false;
if (rd.dict_find_string_value("allocation") != "compact")
full_allocation_mode = true;
#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS
if (links)
{
@ -1402,7 +1398,7 @@ namespace libtorrent
}
int zero_storage::writev(file::iovec_t const* bufs, int num_bufs
, int /* piece */, int /* offset */, int /* flags */, storage_error& ec)
, int /* piece */, int /* offset */, int /* flags */, storage_error&)
{
int ret = 0;
for (int i = 0; i < num_bufs; ++i)

View File

@ -854,6 +854,7 @@ namespace libtorrent
, m_private(false)
, m_i2p(false)
{
TORRENT_UNUSED(flags);
std::pair<char const*, int> buf = torrent_file.data_section();
bdecode_node e;
if (bdecode(buf.first, buf.first + buf.second, e, ec) != 0)
@ -870,6 +871,7 @@ namespace libtorrent
, m_private(false)
, m_i2p(false)
{
TORRENT_UNUSED(flags);
std::pair<char const*, int> buf = torrent_file.data_section();
bdecode_node e;
error_code ec;
@ -1020,7 +1022,8 @@ namespace libtorrent
#endif // TORRENT_USE_WSTRING
#endif
torrent_info::torrent_info(bdecode_node const& torrent_file, error_code& ec, int flags)
torrent_info::torrent_info(bdecode_node const& torrent_file, error_code& ec
, int flags)
: m_piece_hashes(0)
, m_creation_date(0)
, m_merkle_first_leaf(0)
@ -1074,7 +1077,8 @@ namespace libtorrent
#if TORRENT_USE_WSTRING
#ifndef TORRENT_NO_DEPRECATE
torrent_info::torrent_info(std::wstring const& filename, error_code& ec, int flags)
torrent_info::torrent_info(std::wstring const& filename, error_code& ec
, int flags)
: m_piece_hashes(0)
, m_creation_date(0)
, m_merkle_first_leaf(0)
@ -1112,7 +1116,9 @@ namespace libtorrent
, m_multifile(false)
, m_private(false)
, m_i2p(false)
{}
{
TORRENT_UNUSED(flags);
}
torrent_info::~torrent_info()
{}
@ -1207,6 +1213,7 @@ namespace libtorrent
bool torrent_info::parse_info_section(bdecode_node const& info
, error_code& ec, int flags)
{
TORRENT_UNUSED(flags);
if (info.type() != bdecode_node::dict_t)
{
ec = errors::torrent_info_no_dict;

View File

@ -7,7 +7,6 @@ test_programs = \
test_torrent_info \
test_recheck \
test_stat_cache \
test_policy \
test_part_file \
test_file \
test_file_storage \
@ -29,6 +28,7 @@ test_programs = \
test_metadata_extension \
test_pe_crypto \
test_peer_classes \
test_peer_list \
test_peer_priority \
test_pex \
test_piece_picker \
@ -141,12 +141,12 @@ libtest_la_SOURCES = main.cpp \
swarm_suite.cpp \
test_utils.cpp
test_alert_manager_SOURCES = test_alert_manager.cpp
test_bitfield_SOURCES = test_bitfield.cpp
test_crc32_SOURCES = test_crc32.cpp
test_torrent_info_SOURCES = test_torrent_info.cpp
test_recheck_SOURCES = test_recheck.cpp
test_stat_cache_SOURCES = test_stat_cache.cpp
test_policy_SOURCES = test_policy.cpp
test_part_file_SOURCES = test_part_file.cpp
test_file_SOURCES = test_file.cpp
test_file_storage_SOURCES = test_file_storage.cpp
@ -161,6 +161,7 @@ test_block_cache_SOURCES = test_block_cache.cpp
test_checking_SOURCES = test_checking.cpp
test_fast_extension_SOURCES = test_fast_extension.cpp
test_hasher_SOURCES = test_hasher.cpp
test_heterogeneous_queue_SOURCES = test_heterogeneous_queue.cpp
test_http_connection_SOURCES = test_http_connection.cpp
test_ip_filter_SOURCES = test_ip_filter.cpp
test_lsd_SOURCES = test_lsd.cpp
@ -168,6 +169,7 @@ test_metadata_extension_SOURCES = test_metadata_extension.cpp
test_peer_priority_SOURCES = test_peer_priority.cpp
test_pe_crypto_SOURCES = test_pe_crypto.cpp
test_peer_classes_SOURCES = test_peer_classes.cpp
test_peer_list_SOURCES = test_peer_list.cpp
test_pex_SOURCES = test_pex.cpp
test_piece_picker_SOURCES = test_piece_picker.cpp
test_xml_SOURCES = test_xml.cpp