diff --git a/Jamfile b/Jamfile index cf9b1ea5d..9635d0dca 100755 --- a/Jamfile +++ b/Jamfile @@ -25,13 +25,6 @@ REQUIREMENTS = msvc-7.1:/Zc:wchar_t msvc:WIN32 -# gcc switches - - gcc:-Wno-unused-variable - -# darwin switches - - darwin:-Wno-unused-variable ; USAGE_REQUIREMENTS = @@ -83,8 +76,8 @@ ZLIB_SOURCES = if [ os.name ] = NT { - lib winsock : : wsock32.lib ; - REQUIREMENTS += winsock ; +# lib wsock32 : : wsock32.lib ; + REQUIREMENTS += wsock32.lib ; SOURCES += file_win.cpp ; } else diff --git a/examples/Jamfile b/examples/Jamfile index fab7379a6..a8862970b 100755 --- a/examples/Jamfile +++ b/examples/Jamfile @@ -1,28 +1,29 @@ +use-project /torrent : .. ; exe client_test : client_test.cpp - ..//torrent + /torrent : -# multi + multi : debug release ; exe simple_client : simple_client.cpp - ..//torrent + /torrent : -# multi + multi : debug release ; exe dump_torrent : dump_torrent.cpp - ..//torrent + /torrent : -# multi + multi : debug release ; diff --git a/include/libtorrent/invariant_check.hpp b/include/libtorrent/invariant_check.hpp index 2c119d7ca..c6eacf338 100755 --- a/include/libtorrent/invariant_check.hpp +++ b/include/libtorrent/invariant_check.hpp @@ -5,7 +5,6 @@ #ifndef TORRENT_INVARIANT_ACCESS_HPP_INCLUDED #define TORRENT_INVARIANT_ACCESS_HPP_INCLUDED -#include #include namespace libtorrent @@ -69,7 +68,9 @@ namespace libtorrent #ifndef NDEBUG #define INVARIANT_CHECK \ - invariant_checker const& _invariant_check = make_invariant_checker(*this) + invariant_checker const& _invariant_check = make_invariant_checker(*this); \ + (void)_invariant_check; \ + do {} while (false) #else #define INVARIANT_CHECK do {} while (false) #endif diff --git a/include/libtorrent/version.hpp b/include/libtorrent/version.hpp new file mode 100755 index 000000000..0b7c5adb4 --- /dev/null +++ b/include/libtorrent/version.hpp @@ -0,0 +1,38 @@ +/* + +Copyright (c) 2003, Arvid Norberg +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution. + * Neither the name of the author nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +*/ + +#ifndef TORRENT_VERSION_HPP_INCLUDED +#define TORRENT_VERSION_HPP_INCLUDED + +#define LIBTORRENT_VERSION "0.1.0.0" + +#endif diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index e0fc9fd8e..c7f0e60bb 100755 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -43,6 +43,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/alert_types.hpp" #include "libtorrent/invariant_check.hpp" #include "libtorrent/io.hpp" +#include "libtorrent/version.hpp" #if defined(_MSC_VER) && _MSC_VER < 1300 #define for if (false) {} else for @@ -907,7 +908,9 @@ namespace libtorrent try { entry e = bdecode(m_recv_buffer.begin()+1, m_recv_buffer.end()); +#ifndef NDEBUG entry::dictionary_type& extensions = e.dict(); +#endif for (int i = 0; i < num_supported_extensions; ++i) { @@ -1515,7 +1518,7 @@ namespace libtorrent #ifndef NDEBUG (*m_logger) << "sending libtorrent version\n"; #endif - int ret = m_socket->send("libtorrent version 0.1.0.0\n", 27); + m_socket->send("libtorrent version " LIBTORRENT_VERSION "\n", 27); throw protocol_error("closing"); } #ifndef NDEBUG diff --git a/src/session.cpp b/src/session.cpp index f71085280..4bbf5c0de 100755 --- a/src/session.cpp +++ b/src/session.cpp @@ -707,6 +707,7 @@ namespace libtorrent { namespace detail ++j) { torrent* p = boost::get_pointer(j->second); + assert(p); } #endif if (i != m_torrents.end()) return boost::get_pointer(i->second); diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index 67bfc654b..6064f2220 100755 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -346,8 +346,7 @@ namespace libtorrent static_cast(t->torrent_file().piece_length()) / t->block_size(); ret["blocks per piece"] = num_blocks_per_piece; - // num unfinished pieces - int num_unfinished = (int)q.size(); + // unfinished pieces ret["unfinished"] = entry::list_type(); entry::list_type& up = ret["unfinished"].list();