From ec85da431a924779495c3c3b10978e5999778a46 Mon Sep 17 00:00:00 2001 From: winsvega Date: Fri, 23 Jan 2015 23:03:29 +0300 Subject: style changes --- TestHelper.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'TestHelper.cpp') diff --git a/TestHelper.cpp b/TestHelper.cpp index 8c7345df..5a579702 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -228,25 +228,19 @@ byte toByte(json_spirit::mValue const& _v) return 0; } -bytes importByteArray(const std::string& str) +bytes importByteArray(std::string const& _str) { - bytes data; - if (str.find_first_of("0x") == 0) - data = fromHex(str.substr(2)); - else - data = fromHex(str); - return data; + return fromHex(_str.substr(0, 2) == "0x" ? _str.substr(2) : _str); } bytes importData(json_spirit::mObject& _o) { bytes data; if (_o["data"].type() == json_spirit::str_type) - data = importByteArray(_o["data"].get_str()); + data = importByteArray(_o["data"].get_str()); else for (auto const& j: _o["data"].get_array()) data.push_back(toByte(j)); - return data; } -- cgit v1.2.3