Skip to content

Commit fa56c79

Browse files
author
MarcoFalke
committed
Make CDataStream work properly on 64-bit systems
1 parent fab02f7 commit fa56c79

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/streams.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class CDataStream
187187
protected:
188188
using vector_type = SerializeData;
189189
vector_type vch;
190-
unsigned int nReadPos{0};
190+
vector_type::size_type nReadPos{0};
191191

192192
int nType;
193193
int nVersion;
@@ -282,7 +282,7 @@ class CDataStream
282282
if (dst.size() == 0) return;
283283

284284
// Read from the beginning of the buffer
285-
auto next_read_pos{CheckedAdd<uint32_t>(nReadPos, dst.size())};
285+
auto next_read_pos{CheckedAdd(nReadPos, dst.size())};
286286
if (!next_read_pos.has_value() || next_read_pos.value() > vch.size()) {
287287
throw std::ios_base::failure("CDataStream::read(): end of data");
288288
}
@@ -298,7 +298,7 @@ class CDataStream
298298
void ignore(size_t num_ignore)
299299
{
300300
// Ignore from the beginning of the buffer
301-
auto next_read_pos{CheckedAdd<uint32_t>(nReadPos, num_ignore)};
301+
auto next_read_pos{CheckedAdd(nReadPos, num_ignore)};
302302
if (!next_read_pos.has_value() || next_read_pos.value() > vch.size()) {
303303
throw std::ios_base::failure("CDataStream::ignore(): end of data");
304304
}

0 commit comments

Comments
 (0)