rename bitfield::bytes() -> bitfiele::data()

This commit is contained in:
Arvid Norberg 2015-05-09 19:07:33 +00:00
parent ca581f2258
commit 095b709adb
2 changed files with 1975 additions and 728 deletions

File diff suppressed because one or more lines are too long

View File

@ -69,7 +69,7 @@ namespace libtorrent
bitfield(char const* b, int bits): m_buf(NULL) bitfield(char const* b, int bits): m_buf(NULL)
{ assign(b, bits); } { assign(b, bits); }
bitfield(bitfield const& rhs): m_buf(NULL) bitfield(bitfield const& rhs): m_buf(NULL)
{ assign(rhs.bytes(), rhs.size()); } { assign(rhs.data(), rhs.size()); }
#if __cplusplus > 199711L #if __cplusplus > 199711L
bitfield(bitfield&& rhs): m_buf(rhs.m_buf) bitfield(bitfield&& rhs): m_buf(rhs.m_buf)
{ rhs.m_buf = NULL; } { rhs.m_buf = NULL; }
@ -157,13 +157,12 @@ namespace libtorrent
bool empty() const { return m_buf == NULL ? true : m_buf[-1] == 0; } bool empty() const { return m_buf == NULL ? true : m_buf[-1] == 0; }
// returns a pointer to the internal buffer of the bitfield. // returns a pointer to the internal buffer of the bitfield.
// TODO: rename to data() ? char const* data() const { return reinterpret_cast<char const*>(m_buf); }
char const* bytes() const { return reinterpret_cast<char const*>(m_buf); }
// copy operator // copy operator
bitfield& operator=(bitfield const& rhs) bitfield& operator=(bitfield const& rhs)
{ {
assign(rhs.bytes(), rhs.size()); assign(rhs.data(), rhs.size());
return *this; return *this;
} }