Make keystore.h bit compact
[novacoin.git] / src / bitcoinrpc.cpp
index d9c6c72..0c7e278 100644 (file)
@@ -16,6 +16,7 @@
 #include <boost/asio/ip/v6_only.hpp>
 #include <boost/bind.hpp>
 #include <boost/filesystem.hpp>
+
 #include <boost/iostreams/concepts.hpp>
 #include <boost/iostreams/stream.hpp>
 #include <boost/algorithm/string.hpp>
@@ -40,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;
 }
@@ -109,17 +110,16 @@ Value ValueFromAmount(int64_t amount)
     return (double)amount / (double)COIN;
 }
 
-std::string HexBits(unsigned int nBits)
+string HexBits(uint32_t nBits)
 {
     union {
-        int32_t nBits;
+        uint32_t nBits;
         char cBits[4];
     } uBits;
-    uBits.nBits = htonl((int32_t)nBits);
+    uBits.nBits = htonl(nBits);
     return HexStr(BEGIN(uBits.cBits), END(uBits.cBits));
 }
 
-
 //
 // Utilities: convert hex-encoded Values
 // (throws error if not hex).
@@ -452,7 +452,7 @@ int ReadHTTPHeader(std::basic_istream<char>& stream, map<string, string>& mapHea
         {
             auto strHeader = str.substr(0, nColon);
             boost::trim(strHeader);
-            boost::to_lower(strHeader);
+            transform(strHeader.begin(), strHeader.end(), strHeader.begin(), ::tolower);
             auto strValue = str.substr(nColon+1);
             boost::trim(strValue);
             mapHeadersRet[strHeader] = strValue;
@@ -1126,7 +1126,7 @@ Object CallRPC(const string& strMethod, const Array& params)
     asio::ssl::stream<asio::ip::tcp::socket> sslStream(io_service, context);
     SSLIOStreamDevice<asio::ip::tcp> d(sslStream, fUseSSL);
     iostreams::stream< SSLIOStreamDevice<asio::ip::tcp> > stream(d);
-    if (!d.connect(GetArg("-rpcconnect", "127.0.0.1"), GetArg("-rpcport", itostr(GetDefaultRPCPort()))))
+    if (!d.connect(GetArg("-rpcconnect", "127.0.0.1"), GetArg("-rpcport", to_string(GetDefaultRPCPort()))))
         throw runtime_error("couldn't connect to server");
 
     // HTTP basic authentication