From afc2bcf340f842111978138a9e04e0b14e5de9fe Mon Sep 17 00:00:00 2001 From: svost Date: Sat, 16 May 2015 14:17:45 +0300 Subject: [PATCH] Fix some msvc C4244 warnings, also useless cast (ptime) --- src/key.cpp | 4 ++-- src/netbase.cpp | 4 ++-- src/netbase.h | 2 +- src/stun.cpp | 2 +- src/util.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/key.cpp b/src/key.cpp index 540d44f..6239ba5 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -411,8 +411,8 @@ bool CKey::SignCompact(uint256 hash, std::vector& vchSig) int nBitsS = BN_num_bits(sig->s); if (nBitsR <= 256 && nBitsS <= 256) { - int nRecId = -1; - for (int i=0; i<4; i++) + int8_t nRecId = -1; + for (int8_t i=0; i<4; i++) { CKey keyRec; keyRec.fSet = true; diff --git a/src/netbase.cpp b/src/netbase.cpp index 744a5b0..320db3e 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -623,7 +623,7 @@ CNetAddr::CNetAddr(const std::string &strIp, bool fAllowLookup) *this = vIP[0]; } -unsigned int CNetAddr::GetByte(int n) const +uint8_t CNetAddr::GetByte(int n) const { return ip[15-n]; } @@ -851,7 +851,7 @@ bool CNetAddr::GetIn6Addr(struct in6_addr* pipv6Addr) const std::vector CNetAddr::GetGroup() const { std::vector vchRet; - int nClass = NET_IPV6; + uint8_t nClass = NET_IPV6; int nStartByte = 0; int nBits = 16; diff --git a/src/netbase.h b/src/netbase.h index 01d8898..765609c 100644 --- a/src/netbase.h +++ b/src/netbase.h @@ -66,7 +66,7 @@ class CNetAddr enum Network GetNetwork() const; std::string ToString() const; std::string ToStringIP() const; - unsigned int GetByte(int n) const; + uint8_t GetByte(int n) const; uint64_t GetHash() const; bool GetInAddr(struct in_addr* pipv4Addr) const; std::vector GetGroup() const; diff --git a/src/stun.cpp b/src/stun.cpp index 30da395..62e302f 100644 --- a/src/stun.cpp +++ b/src/stun.cpp @@ -456,7 +456,7 @@ static int StunRequest2(int sock, struct sockaddr_in *server, struct sockaddr_in req = (struct stun_header *)reqdata; stun_req_id(req); - int reqlen = 0; + unsigned short reqlen = 0; req->msgtype = 0; req->msglen = 0; req->msglen = htons(reqlen); diff --git a/src/util.cpp b/src/util.cpp index f4d229e..f47d1de 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1155,7 +1155,7 @@ string randomStrGen(int length) { void createConf() { - srand(time(NULL)); + srand(static_cast(time(NULL))); ofstream pConf; #if BOOST_FILESYSTEM_VERSION >= 3 -- 1.7.1