addrman.h, main.h: fix msvc warnings
authorCryptoManiac <balthazar@yandex.ru>
Mon, 29 Dec 2014 07:01:42 +0000 (10:01 +0300)
committerCryptoManiac <balthazar@yandex.ru>
Mon, 29 Dec 2014 07:01:42 +0000 (10:01 +0300)
src/addrman.h
src/main.h
src/net.cpp
src/net.h

index 5f5bf79..beb543a 100644 (file)
@@ -569,7 +569,7 @@ public:
     // Return the number of (unique) addresses in all tables.
     int size()
     {
-        return vRandom.size();
+        return (int) vRandom.size();
     }
 
     // Consistency check
index 0c54e7e..2cb3ea7 100644 (file)
@@ -471,7 +471,7 @@ public:
     void SetNull()
     {
         nVersion = CTransaction::CURRENT_VERSION;
-        nTime = GetAdjustedTime();
+        nTime = (uint32_t) GetAdjustedTime();
         vin.clear();
         vout.clear();
         nLockTime = 0;
@@ -619,6 +619,7 @@ public:
             filein >> *this;
         }
         catch (std::exception &e) {
+            (void)e;
             return error("%s() : deserialize or I/O error", BOOST_CURRENT_FUNCTION);
         }
 
@@ -975,7 +976,7 @@ public:
         hashSig >>= 159; // take the first bit of the hash
         if (fDebug && GetBoolArg("-printstakemodifier"))
             printf(" entropybit=%" PRId64 "\n", hashSig.Get64());
-        return hashSig.Get64();
+        return (unsigned int)hashSig.Get64();
     }
 
     // ppcoin: two types of block: proof-of-work or proof-of-stake
@@ -1009,7 +1010,7 @@ public:
         BOOST_FOREACH(const CTransaction& tx, vtx)
             vMerkleTree.push_back(tx.GetHash());
         int j = 0;
-        for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
+        for (int nSize = (int)vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
         {
             for (int i = 0; i < nSize; i += 2)
             {
@@ -1028,7 +1029,7 @@ public:
             BuildMerkleTree();
         std::vector<uint256> vMerkleBranch;
         int j = 0;
-        for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
+        for (int nSize = (int)vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
         {
             int i = std::min(nIndex^1, nSize-1);
             vMerkleBranch.push_back(vMerkleTree[j+i]);
@@ -1096,6 +1097,7 @@ public:
             filein >> *this;
         }
         catch (std::exception &e) {
+            (void)e;
             return error("%s() : deserialize or I/O error", BOOST_CURRENT_FUNCTION);
         }
 
@@ -1354,7 +1356,7 @@ public:
 
     bool GeneratedStakeModifier() const
     {
-        return (nFlags & BLOCK_STAKE_MODIFIER);
+        return (nFlags & BLOCK_STAKE_MODIFIER) != 0;
     }
 
     void SetStakeModifier(uint64_t nModifier, bool fGeneratedStakeModifier)
@@ -1634,7 +1636,7 @@ public:
     void clear();
     void queryHashes(std::vector<uint256>& vtxid);
 
-    unsigned long size()
+    size_t size()
     {
         LOCK(cs);
         return mapTx.size();
index 941bcd8..55d761e 100644 (file)
@@ -804,7 +804,7 @@ void ThreadSocketHandler2(void* parg)
                 if (lockRecv)
                 {
                     CDataStream& vRecv = pnode->vRecv;
-                    unsigned int nPos = vRecv.size();
+                    uint64_t nPos = vRecv.size();
 
                     if (nPos > ReceiveBufferSize()) {
                         if (!pnode->fDisconnect)
index 60c5274..2d635fa 100644 (file)
--- a/src/net.h
+++ b/src/net.h
@@ -29,8 +29,8 @@ extern int nBestHeight;
 
 
 
-inline unsigned int ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
-inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
+inline uint64_t ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
+inline uint64_t SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
 
 void AddOneShot(std::string strDest);
 bool RecvLine(SOCKET hSocket, std::string& strLine);
@@ -251,7 +251,7 @@ public:
         fGetAddr = false;
         nMisbehavior = 0;
         hashCheckpointKnown = 0;
-        setInventoryKnown.max_size(SendBufferSize() / 1000);
+        setInventoryKnown.max_size((size_t)SendBufferSize() / 1000);
 
         // Be shy and don't send version until we hear
         if (hSocket != INVALID_SOCKET && !fInbound)
@@ -359,9 +359,9 @@ public:
         ENTER_CRITICAL_SECTION(cs_vSend);
         if (nHeaderStart != -1)
             AbortMessage();
-        nHeaderStart = vSend.size();
+        nHeaderStart = (int32_t)vSend.size();
         vSend << CMessageHeader(pszCommand, 0);
-        nMessageStart = vSend.size();
+        nMessageStart = (uint32_t)vSend.size();
         if (fDebug)
             printf("sending: %s ", pszCommand);
     }
@@ -392,7 +392,7 @@ public:
             return;
 
         // Set the size
-        uint32_t nSize = vSend.size() - nMessageStart;
+        uint32_t nSize = (uint32_t) vSend.size() - nMessageStart;
         memcpy((char*)&vSend[nHeaderStart] + CMessageHeader::MESSAGE_SIZE_OFFSET, &nSize, sizeof(nSize));
 
         // Set the checksum
@@ -415,7 +415,7 @@ public:
     {
         if (nHeaderStart < 0)
             return;
-        int nSize = vSend.size() - nMessageStart;
+        int nSize = (int) vSend.size() - nMessageStart;
         if (nSize > 0)
             EndMessage();
         else