diff --git a/src/net.h b/src/net.h --- a/src/net.h +++ b/src/net.h @@ -532,11 +532,11 @@ CDataStream hdrbuf; // Complete header. CMessageHeader hdr; - unsigned int nHdrPos; + uint32_t nHdrPos; // Received message data. CDataStream vRecv; - unsigned int nDataPos; + uint32_t nDataPos; // Time (in microseconds) of message receipt. int64_t nTime; @@ -567,8 +567,8 @@ vRecv.SetVersion(nVersionIn); } - int readHeader(const Config &config, const char *pch, unsigned int nBytes); - int readData(const char *pch, unsigned int nBytes); + int readHeader(const Config &config, const char *pch, uint32_t nBytes); + int readData(const char *pch, uint32_t nBytes); }; /** Information about a peer */ @@ -739,8 +739,8 @@ return nRefCount; } - bool ReceiveMsgBytes(const Config &config, const char *pch, - unsigned int nBytes, bool &complete); + bool ReceiveMsgBytes(const Config &config, const char *pch, uint32_t nBytes, + bool &complete); void SetRecvVersion(int nVersionIn) { nRecvVersion = nVersionIn; } int GetRecvVersion() { return nRecvVersion; } diff --git a/src/net.cpp b/src/net.cpp --- a/src/net.cpp +++ b/src/net.cpp @@ -708,7 +708,7 @@ } bool CNode::ReceiveMsgBytes(const Config &config, const char *pch, - unsigned int nBytes, bool &complete) { + uint32_t nBytes, bool &complete) { complete = false; int64_t nTimeMicros = GetTimeMicros(); LOCK(cs_vRecv); @@ -792,10 +792,10 @@ } int CNetMessage::readHeader(const Config &config, const char *pch, - unsigned int nBytes) { + uint32_t nBytes) { // copy data to temporary parsing buffer - unsigned int nRemaining = 24 - nHdrPos; - unsigned int nCopy = std::min(nRemaining, nBytes); + uint32_t nRemaining = 24 - nHdrPos; + uint32_t nCopy = std::min(nRemaining, nBytes); memcpy(&hdrbuf[nHdrPos], pch, nCopy); nHdrPos += nCopy; @@ -824,7 +824,7 @@ return nCopy; } -int CNetMessage::readData(const char *pch, unsigned int nBytes) { +int CNetMessage::readData(const char *pch, uint32_t nBytes) { unsigned int nRemaining = hdr.nMessageSize - nDataPos; unsigned int nCopy = std::min(nRemaining, nBytes); @@ -1407,7 +1407,7 @@ if (recvSet || errorSet) { // typical socket buffer is 8K-64K char pchBuf[0x10000]; - int nBytes = 0; + int32_t nBytes = 0; { LOCK(pnode->cs_hSocket); if (pnode->hSocket == INVALID_SOCKET) {