aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-08-21 08:51:05 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-08-21 08:51:19 +0200
commit56953925db9261ad358ec53dff877fe3ebba3f2a (patch)
tree50e23ddfd652a3e408303c02c007242dcd6504ce /src
parent2fb886bffb5ec42f7e77905ac9367e63e95470f6 (diff)
parent8695a39350cd9fd403c1bb1ca725535b591f82f9 (diff)
downloadbitcoin-56953925db9261ad358ec53dff877fe3ebba3f2a.tar.xz
Merge pull request #4706
8695a39 replace int with size_t in stream methods (Kamil Domanski)
Diffstat (limited to 'src')
-rw-r--r--src/serialize.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/serialize.h b/src/serialize.h
index 2eb69b3ec0..3e5eff469d 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -68,7 +68,7 @@ inline const T* end_ptr(const std::vector<T,TAl>& v)
/////////////////////////////////////////////////////////////////
//
// Templates for serializing to anything that looks like a stream,
-// i.e. anything that supports .read(char*, int) and .write(char*, int)
+// i.e. anything that supports .read(char*, size_t) and .write(char*, size_t)
//
enum
@@ -876,7 +876,7 @@ public:
CSizeComputer(int nTypeIn, int nVersionIn) : nSize(0), nType(nTypeIn), nVersion(nVersionIn) {}
- CSizeComputer& write(const char *psz, int nSize)
+ CSizeComputer& write(const char *psz, size_t nSize)
{
this->nSize += nSize;
return *this;
@@ -1105,10 +1105,9 @@ public:
void ReadVersion() { *this >> nVersion; }
void WriteVersion() { *this << nVersion; }
- CDataStream& read(char* pch, int nSize)
+ CDataStream& read(char* pch, size_t nSize)
{
// Read from the beginning of the buffer
- assert(nSize >= 0);
unsigned int nReadPosNext = nReadPos + nSize;
if (nReadPosNext >= vch.size())
{
@@ -1145,10 +1144,9 @@ public:
return (*this);
}
- CDataStream& write(const char* pch, int nSize)
+ CDataStream& write(const char* pch, size_t nSize)
{
// Write to the end of the buffer
- assert(nSize >= 0);
vch.insert(vch.end(), pch, pch + nSize);
return (*this);
}