Swith all port-related to uint16_t 307/head
authorsvost <ya.nowa@yandex.ru>
Sun, 10 Apr 2016 16:06:50 +0000 (19:06 +0300)
committersvost <ya.nowa@yandex.ru>
Sun, 10 Apr 2016 16:06:50 +0000 (19:06 +0300)
src/bitcoinrpc.cpp
src/irc.cpp
src/ministun.h
src/net.cpp
src/net.h
src/netbase.cpp
src/netbase.h
src/protocol.h

index 171e6ff..da691fa 100644 (file)
@@ -41,7 +41,7 @@ const Object emptyobj;
 
 void ThreadRPCServer3(void* parg);
 
-static inline unsigned short GetDefaultRPCPort()
+static inline uint16_t GetDefaultRPCPort()
 {
     return GetBoolArg("-testnet", false) ? 18344 : 8344;
 }
index a29874e..de789bd 100644 (file)
@@ -20,7 +20,7 @@ void ThreadIRCSeed2(void* parg);
 struct ircaddr
 {
     struct in_addr ip;
-    unsigned short port;
+    uint16_t port;
 };
 #pragma pack(pop)
 
index d2ad738..0581615 100644 (file)
@@ -41,7 +41,7 @@
     struct stun_addr {
         unsigned char unused;
         unsigned char family;
-        unsigned short port;
+        uint16_t port;
         unsigned int addr;
     } __attribute__((packed));
 #else
@@ -69,7 +69,7 @@
     struct stun_addr {
         unsigned char unused;
         unsigned char family;
-        unsigned short port;
+        uint16_t port;
         unsigned int addr;
     };
 #pragma pack(pop)
index 56a7e0e..db7b692 100644 (file)
@@ -85,9 +85,9 @@ void AddOneShot(string strDest)
     vOneShots.push_back(strDest);
 }
 
-unsigned short GetListenPort()
+uint16_t GetListenPort()
 {
-    return (unsigned short)(GetArg("-port", GetDefaultPort()));
+    return static_cast<uint16_t>(GetArg("-port", GetDefaultPort()));
 }
 
 void CNode::PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd)
index cc6b20d..2539112 100644 (file)
--- a/src/net.h
+++ b/src/net.h
@@ -44,7 +44,7 @@ CNode* FindNode(const CService& ip);
 CNode* ConnectNode(CAddress addrConnect, const char *strDest = NULL, int64_t nTimeout=0);
 bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOutbound = NULL, const char *strDest = NULL, bool fOneShot = false);
 void MapPort();
-unsigned short GetListenPort();
+uint16_t GetListenPort();
 bool BindListenPort(const CService &bindAddr, string& strError=REF(string()));
 void StartNode(void* parg);
 bool StopNode();
index 36a71ac..a00fea7 100644 (file)
@@ -1097,7 +1097,7 @@ CService::CService(const std::string &strIpPort, uint16_t portDefault, bool fAll
         *this = ip;
 }
 
-unsigned short CService::GetPort() const
+uint16_t CService::GetPort() const
 {
     return port;
 }
@@ -1177,7 +1177,7 @@ std::string CService::ToString() const
     return ToStringIPPort();
 }
 
-void CService::SetPort(unsigned short portIn)
+void CService::SetPort(uint16_t portIn)
 {
     port = portIn;
 }
index 77c7fa2..9508b41 100644 (file)
@@ -91,7 +91,7 @@ class CNetAddr
 class CService : public CNetAddr
 {
     protected:
-        unsigned short port; // host order
+        uint16_t port; // host order
 
     public:
         CService();
@@ -104,7 +104,7 @@ class CService : public CNetAddr
         explicit CService(const std::string& strIpPort, bool fAllowLookup = false);
         void Init();
         void SetPort(uint16_t portIn);
-        unsigned short GetPort() const;
+        uint16_t GetPort() const;
         bool GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const;
         bool SetSockAddr(const struct sockaddr* paddr);
         friend bool operator==(const CService& a, const CService& b);
@@ -124,7 +124,7 @@ class CService : public CNetAddr
             (
              CService* pthis = const_cast<CService*>(this);
              READWRITE(FLATDATA(ip));
-             unsigned short portN = htons(port);
+             uint16_t portN = htons(port);
              READWRITE(portN);
              if (fRead)
                  pthis->port = ntohs(portN);
index 1fc86fc..88f4e4b 100644 (file)
@@ -18,9 +18,9 @@
 #include "uint256.h"
 
 extern bool fTestNet;
-inline unsigned short GetDefaultPort()
+inline uint16_t GetDefaultPort()
 {
-    return static_cast<unsigned short>(fTestNet ? 17777 : 7777);
+    return static_cast<uint16_t>(fTestNet ? 17777 : 7777);
 }
 
 extern uint8_t pchMessageStart[4];