merged changes from RC_1_0

This commit is contained in:
Arvid Norberg 2014-11-29 01:53:22 +00:00
parent 5cb49da3cf
commit f98c7223b2
5 changed files with 20 additions and 7 deletions

View File

@ -36,6 +36,8 @@ POSSIBILITY OF SUCH DAMAGE.
#ifdef TORRENT_WINDOWS
#include <direct.h> // for _mkdir
#include <sys/types.h> // for _stat
#include <sys/stat.h>
#endif
#ifdef _MSC_VER

View File

@ -61,7 +61,12 @@ public:
return begin[index];
}
int left() const { TORRENT_ASSERT(end >= begin); return end - begin; }
int left() const
{
TORRENT_ASSERT(end >= begin);
TORRENT_ASSERT(end - begin < INT_MAX);
return int(end - begin);
}
char* begin;
char* end;
@ -87,11 +92,16 @@ public:
bool operator==(const const_interval& p_interval)
{
return (begin == p_interval.begin
&& end == p_interval.end);
return begin == p_interval.begin
&& end == p_interval.end;
}
int left() const { TORRENT_ASSERT(end >= begin); return end - begin; }
int left() const
{
TORRENT_ASSERT(end >= begin);
TORRENT_ASSERT(end - begin < INT_MAX);
return int(end - begin);
}
char const* begin;
char const* end;

View File

@ -106,7 +106,7 @@ namespace libtorrent
#endif
// append the following bytes to what is being hashed
hasher& update(std::string const& data) { update(data.c_str(), data.size()); return *this; }
hasher& update(std::string const& data) { update(data.c_str(), int(data.size())); return *this; }
hasher& update(const char* data, int len);
// returns the SHA-1 digest of the buffers previously passed to

View File

@ -316,7 +316,8 @@ namespace libtorrent
void set_end(char const* end)
{
TORRENT_ASSERT(end > m_begin);
m_len = end - m_begin;
TORRENT_ASSERT(end - m_begin < INT_MAX);
m_len = int(end - m_begin);
}
// internal

View File

@ -158,7 +158,7 @@ namespace libtorrent
void check_invariant() const;
#endif
int num_peers() const { return m_peers.size(); }
int num_peers() const { return int(m_peers.size()); }
#ifdef TORRENT_OPTIMIZE_MEMORY_USAGE
typedef std::vector<torrent_peer*> peers_t;