From 5001c19987c959d01178658416795ba9f8b7363f Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Thu, 16 Oct 2014 17:03:21 +0200 Subject: [PATCH] retab --- eth/main.cpp | 6 +++--- libdevcore/CommonJS.cpp | 36 ++++++++++++++++++------------------ libdevcore/CommonJS.h | 26 +++++++++++++------------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/eth/main.cpp b/eth/main.cpp index 67f8d5439..1b484f923 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -186,7 +186,7 @@ int main(int argc, char** argv) unsigned peers = 5; bool interactive = false; #if ETH_JSONRPC - int jsonrpc = -1; + int jsonrpc = -1; #endif string publicIP; bool bootstrap = false; @@ -340,7 +340,7 @@ int main(int argc, char** argv) auto_ptr jsonrpcServer; if (jsonrpc > -1) { - jsonrpcServer = auto_ptr(new EthStubServer(new jsonrpc::CorsHttpServer(jsonrpc), web3)); + jsonrpcServer = auto_ptr(new EthStubServer(new jsonrpc::CorsHttpServer(jsonrpc), web3)); jsonrpcServer->setKeys({us}); jsonrpcServer->StartListening(); } @@ -428,7 +428,7 @@ int main(int argc, char** argv) { if (jsonrpc < 0) jsonrpc = 8080; - jsonrpcServer = auto_ptr(new EthStubServer(new jsonrpc::CorsHttpServer(jsonrpc), web3)); + jsonrpcServer = auto_ptr(new EthStubServer(new jsonrpc::CorsHttpServer(jsonrpc), web3)); jsonrpcServer->setKeys({us}); jsonrpcServer->StartListening(); } diff --git a/libdevcore/CommonJS.cpp b/libdevcore/CommonJS.cpp index 0c6c4842b..49062197a 100644 --- a/libdevcore/CommonJS.cpp +++ b/libdevcore/CommonJS.cpp @@ -5,42 +5,42 @@ namespace eth { bytes dev::eth::jsToBytes(std::string const& _s) { - if (_s.substr(0, 2) == "0x") - // Hex - return fromHex(_s.substr(2)); + if (_s.substr(0, 2) == "0x") + // Hex + return fromHex(_s.substr(2)); else if (_s.find_first_not_of("0123456789") == std::string::npos) // Decimal - return toCompactBigEndian(bigint(_s)); + return toCompactBigEndian(bigint(_s)); else // Binary - return asBytes(_s); + return asBytes(_s); } std::string dev::eth::jsPadded(std::string const& _s, unsigned _l, unsigned _r) { - bytes b = jsToBytes(_s); - while (b.size() < _l) - b.insert(b.begin(), 0); - while (b.size() < _r) - b.push_back(0); - return asString(b).substr(b.size() - std::max(_l, _r)); + bytes b = jsToBytes(_s); + while (b.size() < _l) + b.insert(b.begin(), 0); + while (b.size() < _r) + b.push_back(0); + return asString(b).substr(b.size() - std::max(_l, _r)); } std::string dev::eth::jsPadded(std::string const& _s, unsigned _l) { - if (_s.substr(0, 2) == "0x" || _s.find_first_not_of("0123456789") == std::string::npos) + if (_s.substr(0, 2) == "0x" || _s.find_first_not_of("0123456789") == std::string::npos) // Numeric: pad to right - return jsPadded(_s, _l, _l); - else + return jsPadded(_s, _l, _l); + else // Text: pad to the left - return jsPadded(_s, 0, _l); + return jsPadded(_s, 0, _l); } std::string dev::eth::jsUnpadded(std::string _s) { - auto p = _s.find_last_not_of((char)0); - _s.resize(p == std::string::npos ? 0 : (p + 1)); - return _s; + auto p = _s.find_last_not_of((char)0); + _s.resize(p == std::string::npos ? 0 : (p + 1)); + return _s; } diff --git a/libdevcore/CommonJS.h b/libdevcore/CommonJS.h index a67a308d5..564d5de74 100644 --- a/libdevcore/CommonJS.h +++ b/libdevcore/CommonJS.h @@ -1,4 +1,4 @@ - #pragma once +#pragma once #include #include @@ -12,14 +12,14 @@ namespace eth { template std::string toJS(FixedHash const& _h) { - return "0x" + toHex(_h.ref()); + return "0x" + toHex(_h.ref()); } template std::string toJS(boost::multiprecision::number> const& _n) { - return "0x" + toHex(toCompactBigEndian(_n)); + return "0x" + toHex(toCompactBigEndian(_n)); } inline std::string toJS(dev::bytes const& _n) { - return "0x" + dev::toHex(_n); + return "0x" + dev::toHex(_n); } bytes jsToBytes(std::string const& _s); @@ -29,15 +29,15 @@ std::string jsUnpadded(std::string _s); template FixedHash jsToFixed(std::string const& _s) { - if (_s.substr(0, 2) == "0x") - // Hex - return FixedHash(_s.substr(2)); - else if (_s.find_first_not_of("0123456789") == std::string::npos) - // Decimal - return (typename FixedHash::Arith)(_s); - else - // Binary - return FixedHash(asBytes(jsPadded(_s, N))); + if (_s.substr(0, 2) == "0x") + // Hex + return FixedHash(_s.substr(2)); + else if (_s.find_first_not_of("0123456789") == std::string::npos) + // Decimal + return (typename FixedHash::Arith)(_s); + else + // Binary + return FixedHash(asBytes(jsPadded(_s, N))); } inline std::string jsToFixed(double _s)