From 92948780909cc9e3349409d6102dbe5adf1d5a10 Mon Sep 17 00:00:00 2001 From: svost Date: Fri, 10 Apr 2015 22:53:14 +0300 Subject: [PATCH] Remove msvc C4245 warning, better readability. --- src/main.cpp | 2 +- src/net.cpp | 2 +- src/net.h | 6 +++--- src/protocol.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 28bdb47..21eef1e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2387,7 +2387,7 @@ bool CBlock::AcceptBlock() // Write block to history file if (!CheckDiskSpace(::GetSerializeSize(*this, SER_DISK, CLIENT_VERSION))) return error("AcceptBlock() : out of disk space"); - unsigned int nFile = -1; + unsigned int nFile = UINT_MAX; unsigned int nBlockPos = 0; if (!WriteToDisk(nFile, nBlockPos)) return error("AcceptBlock() : WriteToDisk failed"); diff --git a/src/net.cpp b/src/net.cpp index 0b80e0d..90824d0 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -308,7 +308,7 @@ extern int GetExternalIPbySTUN(uint64_t rnd, struct sockaddr_in *mapped, const c bool GetMyExternalIP(CNetAddr& ipRet) { struct sockaddr_in mapped; - uint64_t rnd = GetRand(~0LL); + uint64_t rnd = ULLONG_MAX; const char *srv; int rc = GetExternalIPbySTUN(rnd, &mapped, &srv); if(rc >= 0) { diff --git a/src/net.h b/src/net.h index a946210..7306d13 100644 --- a/src/net.h +++ b/src/net.h @@ -233,7 +233,7 @@ public: nLastSendEmpty = GetTime(); nTimeConnected = GetTime(); nHeaderStart = -1; - nMessageStart = -1; + nMessageStart = UINT_MAX; addr = addrIn; addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; nVersion = 0; @@ -375,7 +375,7 @@ public: return; vSend.resize(nHeaderStart); nHeaderStart = -1; - nMessageStart = -1; + nMessageStart = UINT_MAX; LEAVE_CRITICAL_SECTION(cs_vSend); if (fDebug) @@ -410,7 +410,7 @@ public: } nHeaderStart = -1; - nMessageStart = -1; + nMessageStart = UINT_MAX; LEAVE_CRITICAL_SECTION(cs_vSend); } diff --git a/src/protocol.cpp b/src/protocol.cpp index 1bb578c..fc112a5 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -23,7 +23,7 @@ CMessageHeader::CMessageHeader() memcpy(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart)); memset(pchCommand, 0, sizeof(pchCommand)); pchCommand[1] = 1; - nMessageSize = -1; + nMessageSize = UINT_MAX; nChecksum = 0; } -- 1.7.1