mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-03 19:51:32 +02:00
Make CDataStream work properly on 64-bit systems
This commit is contained in:
parent
fab02f7991
commit
fa56c79df9
@ -187,7 +187,7 @@ class CDataStream
|
|||||||
protected:
|
protected:
|
||||||
using vector_type = SerializeData;
|
using vector_type = SerializeData;
|
||||||
vector_type vch;
|
vector_type vch;
|
||||||
unsigned int nReadPos{0};
|
vector_type::size_type nReadPos{0};
|
||||||
|
|
||||||
int nType;
|
int nType;
|
||||||
int nVersion;
|
int nVersion;
|
||||||
@ -282,7 +282,7 @@ public:
|
|||||||
if (dst.size() == 0) return;
|
if (dst.size() == 0) return;
|
||||||
|
|
||||||
// Read from the beginning of the buffer
|
// Read from the beginning of the buffer
|
||||||
auto next_read_pos{CheckedAdd<uint32_t>(nReadPos, dst.size())};
|
auto next_read_pos{CheckedAdd(nReadPos, dst.size())};
|
||||||
if (!next_read_pos.has_value() || next_read_pos.value() > vch.size()) {
|
if (!next_read_pos.has_value() || next_read_pos.value() > vch.size()) {
|
||||||
throw std::ios_base::failure("CDataStream::read(): end of data");
|
throw std::ios_base::failure("CDataStream::read(): end of data");
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@ public:
|
|||||||
void ignore(size_t num_ignore)
|
void ignore(size_t num_ignore)
|
||||||
{
|
{
|
||||||
// Ignore from the beginning of the buffer
|
// Ignore from the beginning of the buffer
|
||||||
auto next_read_pos{CheckedAdd<uint32_t>(nReadPos, num_ignore)};
|
auto next_read_pos{CheckedAdd(nReadPos, num_ignore)};
|
||||||
if (!next_read_pos.has_value() || next_read_pos.value() > vch.size()) {
|
if (!next_read_pos.has_value() || next_read_pos.value() > vch.size()) {
|
||||||
throw std::ios_base::failure("CDataStream::ignore(): end of data");
|
throw std::ios_base::failure("CDataStream::ignore(): end of data");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user