changeset 3525:3387fbc046f8 draft

Merge pull request #1793 from Diapolo/fix_signed_unsigned_strprintf fix signed/unsigned in strprintf and CNetAddr::GetByte()
author Wladimir J. van der Laan <laanwj@gmail.com>
date Fri, 21 Sep 2012 06:04:27 -0700
parents 2c4cb54ce45e (current diff) dbf288b632e2 (diff)
children ba853f68e2c6 aae197423e3f 0f9db639c882 539954e753e1
files src/bitcoinrpc.cpp src/main.h src/netbase.cpp
diffstat 5 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -816,7 +816,7 @@
     }
     catch(boost::system::system_error &e)
     {
-        strerr = strprintf(_("An error occurred while setting up the RPC port %i for listening on IPv4: %s"), endpoint.port(), e.what());
+        strerr = strprintf(_("An error occurred while setting up the RPC port %u for listening on IPv4: %s"), endpoint.port(), e.what());
     }
 
     if (!fListening) {
--- a/src/main.h
+++ b/src/main.h
@@ -158,7 +158,7 @@
         if (IsNull())
             return "null";
         else
-            return strprintf("(nFile=%d, nBlockPos=%d, nTxPos=%d)", nFile, nBlockPos, nTxPos);
+            return strprintf("(nFile=%u, nBlockPos=%u, nTxPos=%u)", nFile, nBlockPos, nTxPos);
     }
 
     void print() const
@@ -214,7 +214,7 @@
 
     std::string ToString() const
     {
-        return strprintf("COutPoint(%s, %d)", hash.ToString().substr(0,10).c_str(), n);
+        return strprintf("COutPoint(%s, %u)", hash.ToString().substr(0,10).c_str(), n);
     }
 
     void print() const
@@ -586,7 +586,7 @@
     std::string ToString() const
     {
         std::string str;
-        str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%d, vout.size=%d, nLockTime=%d)\n",
+        str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%u, vout.size=%u, nLockTime=%u)\n",
             GetHash().ToString().substr(0,10).c_str(),
             nVersion,
             vin.size(),
@@ -1128,7 +1128,7 @@
 
     std::string ToString() const
     {
-        return strprintf("CBlockIndex(pprev=%08x, pnext=%08x, nFile=%d, nBlockPos=%-6d nHeight=%d, merkle=%s, hashBlock=%s)",
+        return strprintf("CBlockIndex(pprev=%08x, pnext=%08x, nFile=%u, nBlockPos=%-6u nHeight=%d, merkle=%s, hashBlock=%s)",
             pprev, pnext, nFile, nBlockPos, nHeight,
             hashMerkleRoot.ToString().substr(0,10).c_str(),
             GetBlockHash().ToString().substr(0,20).c_str());
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1025,7 +1025,7 @@
 {
     printf("ThreadMapPort started\n");
 
-    std::string port = strprintf("%d", GetListenPort());
+    std::string port = strprintf("%u", GetListenPort());
     const char * multicastif = 0;
     const char * minissdpdpath = 0;
     struct UPNPDev * devlist = 0;
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -599,7 +599,7 @@
         *this = vIP[0];
 }
 
-int CNetAddr::GetByte(int n) const
+unsigned int CNetAddr::GetByte(int n) const
 {
     return ip[15-n];
 }
@@ -1135,7 +1135,7 @@
 
 std::string CService::ToStringPort() const
 {
-    return strprintf("%i", port);
+    return strprintf("%u", port);
 }
 
 std::string CService::ToStringIPPort() const
--- a/src/netbase.h
+++ b/src/netbase.h
@@ -66,7 +66,7 @@
         enum Network GetNetwork() const;
         std::string ToString() const;
         std::string ToStringIP() const;
-        int GetByte(int n) const;
+        unsigned int GetByte(int n) const;
         uint64 GetHash() const;
         bool GetInAddr(struct in_addr* pipv4Addr) const;
         std::vector<unsigned char> GetGroup() const;